Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOUR-13436 Screen Builder Clipboard #1738

Merged
merged 61 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
bf78b74
FOUR-13437: STORY Add clipboard section to control menu
Sep 9, 2024
d6a3a7e
add steps labels
Sep 9, 2024
f17cfec
update popover message
Sep 9, 2024
b42df71
update control openAcordeon index for cypress tests
Sep 10, 2024
bf67ef4
update open acordeon clipboard
Sep 10, 2024
c07a205
update openAllAcordeon cypress comman and add the clipboard acordeon
Sep 10, 2024
fc790d5
fix WatchersDragAndDrop.spec and update acordeon index
Sep 10, 2024
bb94a38
feature/FOUR-13438: STORY Copy icon now adds to clipboard
Sep 10, 2024
3476dfd
add store
Sep 10, 2024
16452bb
add Clipboard mixing
Sep 10, 2024
f7d73cd
remove commented code and debugger
Sep 10, 2024
a56f49e
add tests
Sep 11, 2024
2c920d4
Merge remote-tracking branch 'origin/feature/FOUR-13436' into feature…
Sep 11, 2024
51342e4
Merge pull request #1694 from ProcessMaker/feature/FOUR-13437
caleeli Sep 11, 2024
ccc6d4e
fix hardcoded code
Sep 11, 2024
8bd03bf
fix translation
Sep 11, 2024
4246887
Merge remote-tracking branch 'origin/feature/FOUR-13436' into feature…
Sep 11, 2024
631b12d
update test acordeon index
Sep 11, 2024
ca175a0
improve translations
Sep 11, 2024
0734284
add openAcordeonByLabel cypress command
Sep 11, 2024
4140b4a
Merge pull request #1695 from ProcessMaker/feature/FOUR-13438
caleeli Sep 13, 2024
2c98b6c
FOUR-13439: STORY Adding multiple content to the clipboard
Sep 13, 2024
794184c
fix ciclical error
Sep 13, 2024
3a11849
remove debugger
Sep 13, 2024
aa691fc
promote saveClipboarToLocalStorage to vue-form-renderer
Sep 13, 2024
1caa987
clear console.log
Sep 13, 2024
6637e7e
udpdate App
Sep 13, 2024
c44a255
Merge pull request #1701 from ProcessMaker/feature/FOUR-13439
caleeli Sep 13, 2024
c81d291
Merge pull request #1701 from ProcessMaker/feature/FOUR-13439
caleeli Sep 13, 2024
b0019f1
Complete uuid assignment to complete remove elements from clipboard
caleeli Sep 19, 2024
68e56e4
Add generate UUID helper
caleeli Sep 19, 2024
c923655
Fix drag in test
caleeli Sep 19, 2024
3188f03
Remove unused method
caleeli Sep 19, 2024
39331f0
Merge pull request #1707 from ProcessMaker/FOUR-13440
caleeli Sep 19, 2024
bfafabd
Fix clipboard on multicolumn
caleeli Sep 19, 2024
e32a976
Paste elements from clipboard
caleeli Sep 19, 2024
fb05a62
Test copy and paste
caleeli Sep 19, 2024
0b8a8ed
Test can copy and paste multiple elements
caleeli Sep 20, 2024
cc2529b
Merge pull request #1709 from ProcessMaker/FOUR-13441
caleeli Sep 20, 2024
d5cbe8d
Implement clear clipboard button
caleeli Sep 20, 2024
7c903b0
Merge pull request #1711 from ProcessMaker/FOUR-13442
devmiguelangel Sep 20, 2024
b0e86c1
Implement distributed storage for clipboard
caleeli Sep 26, 2024
37f639c
Remove unused code
caleeli Sep 26, 2024
7d7947e
Test ClipboardManager
caleeli Sep 26, 2024
15c2809
Add property to show the clear clipboard
caleeli Sep 26, 2024
b7fad6a
Fix property assignation
caleeli Sep 26, 2024
e3ff3e6
Refactor TabsBar component to add clipboard tab
caleeli Sep 27, 2024
26346b0
Merge pull request #1714 from ProcessMaker/FOUR-13443
caleeli Sep 30, 2024
c5fdf75
Remove non used event
caleeli Oct 1, 2024
a8690d0
Add function to clear the clipboard
caleeli Oct 1, 2024
dddbd2d
Implemente Clipboard special page
caleeli Oct 1, 2024
e433b1e
Disable toolbar when on clipboard page
caleeli Oct 1, 2024
01d42c6
Fix tab current page and clipboard index
caleeli Oct 1, 2024
fcd2244
Remove commented code
caleeli Oct 2, 2024
78511b8
Merge pull request #1715 from ProcessMaker/FOUR-18059
caleeli Oct 4, 2024
817ae1f
Merge remote-tracking branch 'origin/release-2024-fall' into feature/…
caleeli Oct 9, 2024
53f18e4
Merge branch 'release-2024-fall' into feature/FOUR-13436
caleeli Oct 9, 2024
f204eb3
Merge remote-tracking branch 'origin/release-2024-fall' into feature/…
caleeli Oct 9, 2024
5c3d14e
Add missing close tag
caleeli Oct 9, 2024
d38c1d9
Fix test to use label to open a control acordeon
caleeli Oct 9, 2024
7651e8e
Merge branch 'release-2024-fall' into feature/FOUR-13436
caleeli Oct 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

<b-col v-if="displayBuilder && !displayPreview" class="text-right">
<screen-toolbar
:disabled="$refs.builder?.isCurrentPageClipboard"
@undo="$refs.builder.undo()"
@redo="$refs.builder.redo()"
@open-templates="openTemplatesPanel"
Expand Down Expand Up @@ -522,7 +523,11 @@ export default {
});
}
return warnings;
}
},
// Get clipboard items from Vuex store
clipboardItems() {
return this.$store.getters["clipboardModule/clipboardItems"];
},
},
created() {
this.updateDataInput = debounce(this.updateDataInput, 1000);
Expand Down Expand Up @@ -605,6 +610,7 @@ export default {
const savedWatchers = localStorage.getItem("savedWatchers");
const customCSS = localStorage.getItem("customCSS");
const computed = localStorage.getItem("computed");
const savedClipboard = localStorage.getItem("savedClipboard");

if (savedConfig) {
const config = JSON.parse(savedConfig);
Expand Down
2 changes: 1 addition & 1 deletion src/VariableDataTypeProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function dataTypeFactory(options) {
function dataFormatFactory() {

return {
type: SelectDataTypeMask,
type: 'SelectDataTypeMask',
field: 'dataMask',
config: {
label: 'Data Format',
Expand Down
77 changes: 77 additions & 0 deletions src/components/ClipboardButton.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<template>
<!-- Conditionally render buttons based on clipboardContent -->
<button
v-if="isInClipboard"
class="btn btn-sm btn-outline-secondary mr-2 remove-btn"
:title="removeTitle"
@click="removeFromClipboard"
data-cy="removeFromClipboard"
>
<i class="fas fa-minus"></i>
</button>

<button
v-else
class="btn btn-sm btn-success mr-2 add-btn"
:title="addTitle"
@click="addToClipboard(index)"
data-cy="addToClipboard"
>
<i class="fas fa-plus"></i>
</button>
</template>

<script>
export default {
props: {
index: {
type: Number,
required: true,
},
config: {
type: Object,
required: true,
},
isInClipboard: {
type: Boolean,
required: true,
},
addTitle: {
type: String,
required: false,
default: 'Add to clipboard',
},
removeTitle: {
type: String,
required: false,
default: 'Remove from clipboard',
}
},


methods: {
// Method to handle adding to clipboard
addToClipboard(index) {
this.$emit('addToClipboard');
},
// Method to handle removing from clipboard
removeFromClipboard() {
this.$emit('removeFromClipboard');
},
},
};
</script>

<style scoped>
.remove-btn {
background-color: #FFFFFF;
color: #596372;
}
.remove-btn:hover {
background-color: #f8f9fa;
color: #596372;
}
.add-btn {
background-color: #0CA442;
}
</style>
17 changes: 15 additions & 2 deletions src/components/ScreenToolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<b-button
class="screen-toolbar-button"
variant="link"
:disabled="!canUndo"
:disabled="!canUndo || disabled"
data-cy="toolbar-undo"
@click="$emit('undo')"
>
Expand All @@ -14,7 +14,7 @@
<b-button
class="screen-toolbar-button"
variant="link"
:disabled="!canRedo"
:disabled="!canRedo || disabled"
data-cy="toolbar-redo"
@click="$emit('redo')"
>
Expand All @@ -34,6 +34,7 @@
type="button"
class="screen-toolbar-button"
variant="link"
:disabled="disabled"
:title="$t('Calculated Properties')"
data-cy="topbar-calcs"
@click="$emit('open-calc')"
Expand All @@ -45,6 +46,7 @@
type="button"
class="screen-toolbar-button"
variant="link"
:disabled="disabled"
:title="$t('Custom CSS')"
data-cy="topbar-css"
@click="$emit('open-customCss')"
Expand All @@ -56,6 +58,7 @@
type="button"
class="screen-toolbar-button"
variant="link"
:disabled="disabled"
:title="$t('Watchers')"
data-cy="topbar-watchers"
@click="$emit('open-watchers')"
Expand All @@ -67,6 +70,7 @@
type="button"
class="screen-toolbar-button"
variant="outlined-secondary"
:disabled="disabled"
:popper-opts="{ placement: 'bottom-end' }"
data-cy="topbar-options"
>
Expand All @@ -86,6 +90,15 @@

<script>
export default {
props: {
/**
* Whether the toolbar is disabled or not
*/
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
showToolbar: true
Expand Down
48 changes: 47 additions & 1 deletion src/components/TabsBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,29 @@
</div>
</template>
</b-tab>
<b-tab
v-if="showClipboard"
ref="clipboard"
class="h-100 w-100"
name="clipboard"
>
<template #title>
{{ $t('Clipboard') }}
<span
:data-test="`close-clipboard-tab`"
class="close-tab"
role="link"
@click.stop="closeClipboard"
>
<i class="fas fa-times" />
</span>
</template>
<template #default>
<div class="h-100 w-100" data-test="tab-content">
<slot :current-page="clipboardPageIndex" />
</div>
</template>
</b-tab>
<template #tabs-end>
<div
v-if="tabsListOverflow"
Expand Down Expand Up @@ -115,6 +138,13 @@ export default {
isMultiPage: {
type: Boolean,
default: true
},
/**
* Show clipboard tab
*/
showClipboard: {
type: Boolean,
default: false
}
},
data() {
Expand All @@ -128,6 +158,9 @@ export default {
};
},
computed: {
clipboardPageIndex() {
return this.pages.length;
},
validLocalOpenedPages() {
return this.localOpenedPages.filter((page) => this.pages[page]);
}
Expand Down Expand Up @@ -170,9 +203,22 @@ export default {
this.checkTabsOverflow();
},
methods: {
openClipboard() {
if (this.$refs.clipboard) {
this.$refs.clipboard.activate();
}
},
closeClipboard() {
this.$emit('close-clipboard');
},
tabOpened() {
const pageIndex = this.localOpenedPages[this.activeTab];
this.$emit("tab-opened", pageIndex);
const isInClipboard = (this.activeTab === this.$refs.tabs.tabs.length - 1) && this.showClipboard;
if (isInClipboard) {
this.$emit("tab-opened", this.clipboardPageIndex);
} else {
this.$emit("tab-opened", pageIndex);
}
},
pageNumber(index) {
return index + 1;
Expand Down
23 changes: 22 additions & 1 deletion src/components/editor/loop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
/>
{{ element.config.name || $t("Variable Name") }}
<div class="ml-auto">
<clipboard-button
:index="index"
:config="element.config"
:isInClipboard="isInClipboard(items[index])"
:addTitle="$t('Add to clipboard')"
:removeTitle="$t('Remove from clipboard')"
@addToClipboard="addToClipboard(items[index])"
@removeFromClipboard="removeFromClipboard(items[index])"
/>
<button
v-if="isAiSection(element) && aiPreview(element)"
class="btn btn-sm btn-primary mr-2"
Expand Down Expand Up @@ -83,6 +92,15 @@
/>
{{ element.config.name || $t("Variable Name") }}
<div class="ml-auto">
<clipboard-button
:index="index"
:config="element.config"
:isInClipboard="isInClipboard(items[index])"
:addTitle="$t('Add to clipboard')"
:removeTitle="$t('Remove from clipboard')"
@addToClipboard="addToClipboard(items[index])"
@removeFromClipboard="removeFromClipboard(items[index])"
/>
<button
class="btn btn-sm btn-secondary mr-2"
:title="$t('Copy Control')"
Expand Down Expand Up @@ -136,6 +154,8 @@ import {
FormTextArea
} from "@processmaker/vue-form-elements";
import { HasColorProperty } from "@/mixins";
import { Clipboard } from "@/mixins";
import ClipboardButton from '../ClipboardButton.vue';
import * as renderer from "@/components/renderer";

export default {
Expand All @@ -149,9 +169,10 @@ export default {
FormDatePicker,
FormHtmlEditor,
FormHtmlViewer,
ClipboardButton,
...renderer
},
mixins: [HasColorProperty],
mixins: [HasColorProperty, Clipboard],
props: ["value", "name", "config", "selected", "validationErrors"],
data() {
return {
Expand Down
24 changes: 22 additions & 2 deletions src/components/editor/multi-column.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@
/>
{{ element.config.name || $t("Variable Name") }}
<div class="ml-auto">
<clipboard-button
:index="index"
:config="element.config"
:isInClipboard="isInClipboard(element)"
:addTitle="$t('Add to clipboard')"
:removeTitle="$t('Remove from clipboard')"
@addToClipboard="addToClipboard(element)"
@removeFromClipboard="removeFromClipboard(element)"
/>
<button
v-if="isAiSection(element) && aiPreview(element)"
class="btn btn-sm btn-primary mr-2"
Expand Down Expand Up @@ -100,6 +109,15 @@
/>
{{ element.config.name || $t("Variable Name") }}
<div class="ml-auto">
<clipboard-button
:index="index"
:config="element.config"
:isInClipboard="isInClipboard(element)"
:addTitle="$t('Add to clipboard')"
:removeTitle="$t('Remove from clipboard')"
@addToClipboard="addToClipboard(element)"
@removeFromClipboard="removeFromClipboard(element)"
/>
<button
class="btn btn-sm btn-secondary mr-2"
:title="$t('Copy Control')"
Expand Down Expand Up @@ -156,8 +174,9 @@ import {
FormTextArea
} from "@processmaker/vue-form-elements";
import { HasColorProperty } from "@/mixins";
import { Clipboard } from "@/mixins";
import * as renderer from "@/components/renderer";

import ClipboardButton from '../ClipboardButton.vue';
const defaultColumnWidth = 1;

export default {
Expand All @@ -171,9 +190,10 @@ export default {
FormDatePicker,
FormHtmlEditor,
FormHtmlViewer,
ClipboardButton,
...renderer
},
mixins: [HasColorProperty],
mixins: [HasColorProperty, Clipboard],
props: ["value", "name", "config", "selected", "validationErrors"],
data() {
return {
Expand Down
Loading
Loading