apostrophe 3.63.2 → 4.0.0
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/.eslintrc +13 -4
- package/CHANGELOG.md +21 -0
- package/defaults.js +1 -0
- package/modules/@apostrophecms/admin-bar/ui/apos/apps/AposAdminBar.js +7 -17
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposAdminBar.vue +14 -16
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposAdminBarLocale.vue +1 -1
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposAdminBarMenu.vue +22 -15
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposAdminBarUser.vue +2 -2
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextBar.vue +13 -8
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextModeAndSettings.vue +18 -10
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextTitle.vue +4 -4
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposContextUndoRedo.vue +14 -8
- package/modules/@apostrophecms/admin-bar/ui/apos/components/TheAposSavingIndicator.vue +2 -1
- package/modules/@apostrophecms/area/ui/apos/apps/AposAreas.js +36 -54
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaContextualMenu.vue +20 -25
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaEditor.vue +5 -12
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaExpandedMenu.vue +11 -3
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaMenu.vue +6 -6
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaMenuItem.vue +3 -2
- package/modules/@apostrophecms/area/ui/apos/components/AposAreaWidget.vue +31 -44
- package/modules/@apostrophecms/area/ui/apos/components/AposWidgetControls.vue +6 -6
- package/modules/@apostrophecms/asset/index.js +25 -12
- package/modules/@apostrophecms/asset/lib/webpack/apos/webpack.config.js +3 -3
- package/modules/@apostrophecms/asset/lib/webpack/apos/webpack.vue.js +7 -1
- package/modules/@apostrophecms/busy/ui/apos/apps/AposBusy.js +8 -7
- package/modules/@apostrophecms/busy/ui/apos/components/TheAposBusy.vue +1 -1
- package/modules/@apostrophecms/command-menu/ui/apos/apps/AposCommandMenu.js +11 -29
- package/modules/@apostrophecms/command-menu/ui/apos/components/AposCommandMenuShortcut.vue +6 -6
- package/modules/@apostrophecms/command-menu/ui/apos/components/TheAposCommandMenu.vue +10 -7
- package/modules/@apostrophecms/doc-type/ui/apos/components/AposDocEditor.vue +20 -15
- package/modules/@apostrophecms/doc-type/ui/apos/logic/AposDocContextMenu.js +1 -1
- package/modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalize.vue +36 -27
- package/modules/@apostrophecms/i18n/ui/apos/components/AposI18nLocalizeErrors.vue +3 -3
- package/modules/@apostrophecms/image/ui/apos/components/AposImageCropper.vue +5 -5
- package/modules/@apostrophecms/image/ui/apos/components/AposImageRelationshipEditor.vue +6 -6
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaManager.vue +23 -16
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaManagerDisplay.vue +11 -11
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaManagerEditor.vue +28 -21
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaManagerSelections.vue +1 -1
- package/modules/@apostrophecms/image/ui/apos/components/AposMediaUploader.vue +5 -4
- package/modules/@apostrophecms/login/ui/apos/apps/AposLogin.js +6 -7
- package/modules/@apostrophecms/login/ui/apos/components/AposForgotPasswordForm.vue +3 -3
- package/modules/@apostrophecms/login/ui/apos/components/AposLoginForm.vue +10 -10
- package/modules/@apostrophecms/login/ui/apos/components/AposResetPasswordForm.vue +1 -1
- package/modules/@apostrophecms/login/ui/apos/components/TheAposLogin.vue +2 -2
- package/modules/@apostrophecms/modal/ui/apos/apps/AposModals.js +60 -87
- package/modules/@apostrophecms/modal/ui/apos/components/AposDocsManagerToolbar.vue +15 -11
- package/modules/@apostrophecms/modal/ui/apos/components/AposModal.vue +8 -2
- package/modules/@apostrophecms/modal/ui/apos/components/AposModalBreadcrumbs.vue +7 -4
- package/modules/@apostrophecms/modal/ui/apos/components/AposModalConfirm.vue +5 -5
- package/modules/@apostrophecms/modal/ui/apos/components/AposModalShareDraft.vue +8 -8
- package/modules/@apostrophecms/modal/ui/apos/components/AposModalToolbar.vue +7 -7
- package/modules/@apostrophecms/modal/ui/apos/components/TheAposModals.vue +22 -4
- package/modules/@apostrophecms/modal/ui/apos/composables/AposFocus.js +95 -0
- package/modules/@apostrophecms/modal/ui/apos/mixins/AposDocsManagerMixin.js +2 -3
- package/modules/@apostrophecms/modal/ui/apos/mixins/AposEditorMixin.js +6 -0
- package/modules/@apostrophecms/multisite-i18n/i18n/aposMultisite/en.json +48 -0
- package/modules/@apostrophecms/multisite-i18n/index.js +7 -0
- package/modules/@apostrophecms/notification/index.js +4 -4
- package/modules/@apostrophecms/notification/ui/apos/apps/AposNotification.js +6 -9
- package/modules/@apostrophecms/notification/ui/apos/components/AposNotification.vue +12 -8
- package/modules/@apostrophecms/oembed-field/ui/apos/components/AposInputOembed.vue +4 -4
- package/modules/@apostrophecms/page/ui/apos/components/AposPagesManager.vue +15 -11
- package/modules/@apostrophecms/page/ui/apos/logic/AposPagesManager.js +1 -1
- package/modules/@apostrophecms/permission/ui/apos/components/AposInputRole.vue +3 -3
- package/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManager.vue +25 -17
- package/modules/@apostrophecms/piece-type/ui/apos/components/AposDocsManagerDisplay.vue +24 -20
- package/modules/@apostrophecms/piece-type/ui/apos/components/AposRelationshipEditor.vue +15 -11
- package/modules/@apostrophecms/rich-text-widget/index.js +1 -0
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposImageControlDialog.vue +7 -6
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposRichTextWidgetEditor.vue +31 -30
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposTiptapAnchor.vue +12 -10
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposTiptapLink.vue +9 -8
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposTiptapStyles.vue +3 -3
- package/modules/@apostrophecms/rich-text-widget/ui/apos/components/AposTiptapTable.vue +3 -3
- package/modules/@apostrophecms/schema/ui/apos/components/AposArrayEditor.vue +10 -8
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputArea.vue +5 -3
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputArray.vue +81 -277
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputAttachment.vue +4 -2
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputBoolean.vue +24 -14
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputCheckboxes.vue +7 -6
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputColor.vue +10 -7
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputObject.vue +3 -3
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputRadio.vue +5 -4
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputRelationship.vue +15 -12
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputSelect.vue +1 -1
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputSlug.vue +16 -12
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputString.vue +19 -11
- package/modules/@apostrophecms/schema/ui/apos/components/AposInputWrapper.vue +1 -1
- package/modules/@apostrophecms/schema/ui/apos/components/AposSchema.vue +65 -21
- package/modules/@apostrophecms/schema/ui/apos/components/AposSubform.vue +2 -2
- package/modules/@apostrophecms/schema/ui/apos/logic/AposArrayEditor.js +0 -4
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputArea.js +3 -3
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputArray.js +15 -4
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputAttachment.js +3 -3
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputCheckboxes.js +7 -7
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputColor.js +5 -8
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputDateAndTime.js +1 -1
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputObject.js +1 -1
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputRadio.js +1 -1
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputRelationship.js +12 -9
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputSelect.js +2 -2
- package/modules/@apostrophecms/schema/ui/apos/logic/AposInputString.js +6 -8
- package/modules/@apostrophecms/schema/ui/apos/logic/AposSchema.js +39 -13
- package/modules/@apostrophecms/schema/ui/apos/logic/AposSubform.js +1 -1
- package/modules/@apostrophecms/schema/ui/apos/mixins/AposInputMixin.js +9 -9
- package/modules/@apostrophecms/schema/ui/apos/scss/AposInputArray.scss +205 -0
- package/modules/@apostrophecms/settings/ui/apos/components/AposSettingsManager.vue +4 -4
- package/modules/@apostrophecms/settings/ui/apos/logic/AposSettingsManager.js +4 -4
- package/modules/@apostrophecms/submitted-draft/ui/apos/components/AposSubmittedDraftIcon.vue +5 -4
- package/modules/@apostrophecms/ui/ui/apos/components/AposButton.vue +4 -4
- package/modules/@apostrophecms/ui/ui/apos/components/AposButtonGroup.vue +6 -6
- package/modules/@apostrophecms/ui/ui/apos/components/AposButtonSplit.vue +120 -113
- package/modules/@apostrophecms/ui/ui/apos/components/AposCheckbox.vue +19 -19
- package/modules/@apostrophecms/ui/ui/apos/components/AposCombo.vue +15 -15
- package/modules/@apostrophecms/ui/ui/apos/components/AposContextMenu.vue +216 -191
- package/modules/@apostrophecms/ui/ui/apos/components/AposContextMenuDialog.vue +77 -65
- package/modules/@apostrophecms/ui/ui/apos/components/AposContextMenuItem.vue +1 -1
- package/modules/@apostrophecms/ui/ui/apos/components/AposContextMenuTip.vue +28 -50
- package/modules/@apostrophecms/ui/ui/apos/components/AposFile.vue +5 -5
- package/modules/@apostrophecms/ui/ui/apos/components/AposFilterMenu.vue +4 -4
- package/modules/@apostrophecms/ui/ui/apos/components/AposMinMaxCount.vue +5 -5
- package/modules/@apostrophecms/ui/ui/apos/components/AposPager.vue +14 -8
- package/modules/@apostrophecms/ui/ui/apos/components/AposSlat.vue +2 -2
- package/modules/@apostrophecms/ui/ui/apos/components/AposSlatList.vue +53 -59
- package/modules/@apostrophecms/ui/ui/apos/components/AposSubformPreview.vue +2 -2
- package/modules/@apostrophecms/ui/ui/apos/components/AposTagApply.vue +40 -35
- package/modules/@apostrophecms/ui/ui/apos/components/AposToggle.vue +2 -2
- package/modules/@apostrophecms/ui/ui/apos/components/AposTree.vue +9 -11
- package/modules/@apostrophecms/ui/ui/apos/components/AposTreeHeader.vue +5 -3
- package/modules/@apostrophecms/ui/ui/apos/components/AposTreeRows.vue +129 -129
- package/modules/@apostrophecms/ui/ui/apos/composables/AposTheme.js +11 -0
- package/modules/@apostrophecms/ui/ui/apos/lib/click-outside-element.js +4 -4
- package/modules/@apostrophecms/ui/ui/apos/lib/i18next.js +56 -50
- package/modules/@apostrophecms/ui/ui/apos/lib/tooltip.js +191 -0
- package/modules/@apostrophecms/ui/ui/apos/lib/vue.js +19 -10
- package/modules/@apostrophecms/ui/ui/apos/mixins/AposAdvisoryLockMixin.js +1 -1
- package/modules/@apostrophecms/ui/ui/apos/scss/global/_tables.scss +1 -1
- package/modules/@apostrophecms/ui/ui/apos/scss/global/_tooltips.scss +6 -22
- package/modules/@apostrophecms/ui/ui/apos/scss/shared/_table-rows.scss +1 -1
- package/modules/@apostrophecms/widget-type/index.js +8 -2
- package/modules/@apostrophecms/widget-type/ui/apos/components/AposWidgetEditor.vue +26 -22
- package/modules/@apostrophecms/widget-type/ui/apos/mixins/AposWidgetMixin.js +4 -4
- package/package.json +31 -44
- package/modules/@apostrophecms/ui/ui/apos/lib/localized-v-tooltip.js +0 -63
- package/modules/@apostrophecms/ui/ui/apos/lib/tooltip-options.js +0 -13
|
@@ -6,32 +6,34 @@
|
|
|
6
6
|
:label="label"
|
|
7
7
|
:disabled="disabled"
|
|
8
8
|
:tooltip="tooltip"
|
|
9
|
-
@click="
|
|
9
|
+
@click="emit('click', action)"
|
|
10
10
|
/>
|
|
11
11
|
<AposContextMenu
|
|
12
|
+
ref="contextMenu"
|
|
12
13
|
class="apos-button-split__menu"
|
|
13
14
|
:menu="menu"
|
|
14
15
|
:button="contextMenuButton"
|
|
15
16
|
:disabled="disabled"
|
|
16
17
|
menu-offset="1, 10"
|
|
17
18
|
menu-placement="bottom-end"
|
|
18
|
-
ref="contextMenu"
|
|
19
19
|
@open="menuOpen"
|
|
20
20
|
@close="menuClose"
|
|
21
21
|
>
|
|
22
22
|
<dl
|
|
23
|
-
class="apos-button-split__menu__dialog"
|
|
23
|
+
class="apos-button-split__menu__dialog"
|
|
24
|
+
role="menu"
|
|
24
25
|
:aria-label="menuLabel"
|
|
25
26
|
>
|
|
26
27
|
<button
|
|
27
|
-
v-for="item in menu"
|
|
28
|
+
v-for="item in menu"
|
|
29
|
+
:key="item.action"
|
|
30
|
+
ref="choices"
|
|
28
31
|
class="apos-button-split__menu__dialog-item"
|
|
29
32
|
:class="{ 'apos-is-selected': item.action === action }"
|
|
30
|
-
@click="selectionHandler(item.action)"
|
|
31
33
|
:aria-checked="item.action === action ? 'true' : 'false'"
|
|
32
34
|
role="menuitemradio"
|
|
33
35
|
:value="item.action"
|
|
34
|
-
|
|
36
|
+
@click="selectionHandler(item.action)"
|
|
35
37
|
@keydown="cycleElementsToFocus"
|
|
36
38
|
>
|
|
37
39
|
<AposIndicator
|
|
@@ -53,111 +55,117 @@
|
|
|
53
55
|
</div>
|
|
54
56
|
</template>
|
|
55
57
|
|
|
56
|
-
<script>
|
|
57
|
-
import
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
type: {
|
|
74
|
-
type: String,
|
|
75
|
-
default: 'primary'
|
|
76
|
-
},
|
|
77
|
-
disabled: {
|
|
78
|
-
type: Boolean,
|
|
79
|
-
default: false
|
|
80
|
-
},
|
|
81
|
-
tooltip: {
|
|
82
|
-
type: [ String, Object ],
|
|
83
|
-
default: null
|
|
84
|
-
},
|
|
85
|
-
selected: {
|
|
86
|
-
// corresponds to a menu item action
|
|
87
|
-
type: String,
|
|
88
|
-
default: null
|
|
89
|
-
}
|
|
58
|
+
<script setup>
|
|
59
|
+
import {
|
|
60
|
+
ref, computed, watch, nextTick
|
|
61
|
+
} from 'vue';
|
|
62
|
+
import { useAposFocus } from 'Modules/@apostrophecms/modal/composables/AposFocus';
|
|
63
|
+
|
|
64
|
+
const {
|
|
65
|
+
elementsToFocus,
|
|
66
|
+
cycleElementsToFocus,
|
|
67
|
+
focusElement,
|
|
68
|
+
focuslastmodalfocusedelement
|
|
69
|
+
} = useAposFocus();
|
|
70
|
+
|
|
71
|
+
const props = defineProps({
|
|
72
|
+
menu: {
|
|
73
|
+
type: Array,
|
|
74
|
+
required: true
|
|
90
75
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
label: null,
|
|
95
|
-
action: null,
|
|
96
|
-
button: {
|
|
97
|
-
type: this.type,
|
|
98
|
-
modifiers: [ 'no-motion' ]
|
|
99
|
-
},
|
|
100
|
-
contextMenuButton: {
|
|
101
|
-
iconOnly: true,
|
|
102
|
-
icon: 'chevron-down-icon',
|
|
103
|
-
modifiers: [ 'no-motion' ],
|
|
104
|
-
type: this.type
|
|
105
|
-
}
|
|
106
|
-
};
|
|
76
|
+
menuLabel: {
|
|
77
|
+
type: String,
|
|
78
|
+
required: true
|
|
107
79
|
},
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
classes.push(`apos-button-split--type-${this.button.type}`);
|
|
112
|
-
return classes;
|
|
113
|
-
}
|
|
80
|
+
type: {
|
|
81
|
+
type: String,
|
|
82
|
+
default: 'primary'
|
|
114
83
|
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
84
|
+
disabled: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
default: false
|
|
119
87
|
},
|
|
120
|
-
|
|
121
|
-
|
|
88
|
+
tooltip: {
|
|
89
|
+
type: [ String, Object ],
|
|
90
|
+
default: null
|
|
122
91
|
},
|
|
123
|
-
|
|
124
|
-
//
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.label = this.menu.find(i => i.action === action).label;
|
|
128
|
-
},
|
|
129
|
-
selectionHandler(action) {
|
|
130
|
-
this.setButton(action);
|
|
131
|
-
this.$refs.contextMenu.hide();
|
|
132
|
-
},
|
|
133
|
-
initialize() {
|
|
134
|
-
let initial = this.menu[0].action || null;
|
|
135
|
-
if (this.selected && this.menu.find(i => i.action === this.selected)) {
|
|
136
|
-
initial = this.selected;
|
|
137
|
-
} else if (this.menu.find(i => i.def)) {
|
|
138
|
-
initial = this.menu.find(i => i.def).action;
|
|
139
|
-
}
|
|
140
|
-
this.setButton(initial);
|
|
141
|
-
},
|
|
142
|
-
trapFocus() {
|
|
143
|
-
const selectedElementIndex = this.menu.findIndex(i => i.action === this.action) || 0;
|
|
144
|
-
|
|
145
|
-
// use map to keep items order:
|
|
146
|
-
this.elementsToFocus = this.menu.map(
|
|
147
|
-
i => this.$refs.choices.find(choice => choice.value === i.action)
|
|
148
|
-
);
|
|
149
|
-
|
|
150
|
-
this.focusElement(this.elementsToFocus[selectedElementIndex]);
|
|
151
|
-
},
|
|
152
|
-
menuOpen() {
|
|
153
|
-
// TODO: find another way to wait for elements to be visible
|
|
154
|
-
setTimeout(this.trapFocus, 200);
|
|
155
|
-
},
|
|
156
|
-
menuClose() {
|
|
157
|
-
this.focusLastModalFocusedElement();
|
|
158
|
-
}
|
|
92
|
+
selected: {
|
|
93
|
+
// corresponds to a menu item action
|
|
94
|
+
type: String,
|
|
95
|
+
default: null
|
|
159
96
|
}
|
|
160
|
-
};
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
const emit = defineEmits([ 'click' ]);
|
|
100
|
+
|
|
101
|
+
const label = ref(null);
|
|
102
|
+
const action = ref(null);
|
|
103
|
+
const button = ref({
|
|
104
|
+
type: props.type,
|
|
105
|
+
modifiers: [ 'no-motion' ]
|
|
106
|
+
});
|
|
107
|
+
const contextMenu = ref();
|
|
108
|
+
const choices = ref([]);
|
|
109
|
+
const contextMenuButton = ref({
|
|
110
|
+
iconOnly: true,
|
|
111
|
+
icon: 'chevron-down-icon',
|
|
112
|
+
modifiers: [ 'no-motion' ],
|
|
113
|
+
type: props.type
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const modifiers = computed(() => {
|
|
117
|
+
const classes = [];
|
|
118
|
+
classes.push(`apos-button-split--type-${button.value.type}`);
|
|
119
|
+
return classes;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
watch(() => props.menu, () => {
|
|
123
|
+
initialize();
|
|
124
|
+
}, { immediate: true });
|
|
125
|
+
|
|
126
|
+
// sets the label and emitted action of the button
|
|
127
|
+
function setButton(btnAction) {
|
|
128
|
+
action.value = btnAction;
|
|
129
|
+
label.value = props.menu.find(i => i.action === btnAction).label;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function selectionHandler(btnAction) {
|
|
133
|
+
setButton(btnAction);
|
|
134
|
+
contextMenu.value.hide();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function initialize() {
|
|
138
|
+
let initial = props.menu[0].action || null;
|
|
139
|
+
if (props.selected && props.menu.find(i => i.action === props.selected)) {
|
|
140
|
+
initial = props.selected;
|
|
141
|
+
} else if (props.menu.find(i => i.def)) {
|
|
142
|
+
initial = props.menu.find(i => i.def).action;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
setButton(initial);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function trapFocus() {
|
|
149
|
+
const selectedElementIndex = props.menu.findIndex(i => i.action === action.value) || 0;
|
|
150
|
+
|
|
151
|
+
// use map to keep items order:
|
|
152
|
+
elementsToFocus.value = props.menu.map(
|
|
153
|
+
({ action }) => choices.value.find(choice => {
|
|
154
|
+
return choice.value === action;
|
|
155
|
+
})
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
focusElement(elementsToFocus.value[selectedElementIndex]);
|
|
159
|
+
}
|
|
160
|
+
function menuOpen() {
|
|
161
|
+
nextTick(() => {
|
|
162
|
+
trapFocus();
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function menuClose() {
|
|
167
|
+
focuslastmodalfocusedelement();
|
|
168
|
+
}
|
|
161
169
|
</script>
|
|
162
170
|
<style lang="scss" scoped>
|
|
163
171
|
.apos-button-split {
|
|
@@ -208,7 +216,7 @@ export default {
|
|
|
208
216
|
font-size: var(--a-type-base);
|
|
209
217
|
}
|
|
210
218
|
|
|
211
|
-
.apos-button-split__button
|
|
219
|
+
.apos-button-split__button :deep(.apos-button) {
|
|
212
220
|
padding-right: $spacing-quadruple + $spacing-base;
|
|
213
221
|
margin-top: 0;
|
|
214
222
|
margin-bottom: 0;
|
|
@@ -219,14 +227,13 @@ export default {
|
|
|
219
227
|
top: 0;
|
|
220
228
|
right: 0;
|
|
221
229
|
height: 100%;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
}
|
|
230
|
+
|
|
231
|
+
:deep(.apos-popover__btn),
|
|
232
|
+
:deep(.trigger),
|
|
233
|
+
:deep(.apos-button__wrapper) {
|
|
234
|
+
height: 100%;
|
|
228
235
|
}
|
|
229
|
-
|
|
236
|
+
:deep(.apos-button) {
|
|
230
237
|
display: flex;
|
|
231
238
|
box-sizing: border-box;
|
|
232
239
|
height: 100%;
|
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<label
|
|
3
|
-
class="apos-choice-label"
|
|
3
|
+
class="apos-choice-label"
|
|
4
|
+
:for="id"
|
|
4
5
|
:class="{'apos-choice-label--disabled': field.readOnly}"
|
|
5
6
|
:tabindex="{'-1' : field.hideLabel}"
|
|
6
7
|
>
|
|
7
8
|
<input
|
|
9
|
+
:id="id"
|
|
8
10
|
v-model="checkProxy"
|
|
9
|
-
type="checkbox"
|
|
11
|
+
type="checkbox"
|
|
12
|
+
class="apos-sr-only apos-input--choice apos-input--checkbox"
|
|
10
13
|
:value="choice.value"
|
|
11
14
|
:name="field.name"
|
|
12
|
-
:
|
|
13
|
-
:tabindex="tabindex"
|
|
15
|
+
:aria-label="choice.label || field.label"
|
|
16
|
+
:tabindex="tabindex"
|
|
17
|
+
:disabled="field.readOnly || choice.readOnly"
|
|
14
18
|
:is-indeterminate="choice.indeterminate === true ? 'true' : 'false'"
|
|
15
19
|
@change="update"
|
|
16
20
|
>
|
|
17
21
|
<span class="apos-input-indicator" aria-hidden="true">
|
|
18
22
|
<component
|
|
19
|
-
v-if="isChecked(checked)"
|
|
20
23
|
:is="`${
|
|
21
24
|
choice.indeterminate ? 'minus-icon' : 'check-bold-icon'
|
|
22
25
|
}`"
|
|
26
|
+
v-if="isChecked(modelValue)"
|
|
23
27
|
:size="10"
|
|
24
28
|
/>
|
|
25
29
|
</span>
|
|
26
30
|
<span
|
|
27
|
-
|
|
31
|
+
v-if="choice.label"
|
|
32
|
+
:class="{'apos-sr-only': field.hideLabel }"
|
|
28
33
|
class="apos-choice-label-text"
|
|
29
34
|
>
|
|
30
35
|
{{ $t(choice.label) }}
|
|
@@ -35,13 +40,8 @@
|
|
|
35
40
|
<script>
|
|
36
41
|
|
|
37
42
|
export default {
|
|
38
|
-
// Custom model to handle the v-model connection on the parent.
|
|
39
|
-
model: {
|
|
40
|
-
prop: 'checked',
|
|
41
|
-
event: 'change'
|
|
42
|
-
},
|
|
43
43
|
props: {
|
|
44
|
-
|
|
44
|
+
modelValue: {
|
|
45
45
|
type: [ Array, Boolean ],
|
|
46
46
|
default: false
|
|
47
47
|
},
|
|
@@ -64,7 +64,7 @@ export default {
|
|
|
64
64
|
default: null
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
emits: [ '
|
|
67
|
+
emits: [ 'update:modelValue', 'updated' ],
|
|
68
68
|
data() {
|
|
69
69
|
return {
|
|
70
70
|
tabindex: this.field.disableFocus ? '-1' : '0'
|
|
@@ -74,21 +74,21 @@ export default {
|
|
|
74
74
|
// Handle the local check state within this component.
|
|
75
75
|
checkProxy: {
|
|
76
76
|
get() {
|
|
77
|
-
return this.
|
|
77
|
+
return this.modelValue;
|
|
78
78
|
},
|
|
79
79
|
set(val) {
|
|
80
80
|
if (!this.choice.indeterminate || this.choice.triggerIndeterminateEvent) {
|
|
81
81
|
// Only update the model if the box was *not* indeterminate.
|
|
82
|
-
this.$emit('
|
|
82
|
+
this.$emit('update:modelValue', val);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
},
|
|
87
87
|
methods: {
|
|
88
|
-
isChecked(
|
|
89
|
-
return Array.isArray(
|
|
90
|
-
?
|
|
91
|
-
:
|
|
88
|
+
isChecked(value) {
|
|
89
|
+
return Array.isArray(value)
|
|
90
|
+
? value.includes(this.choice.value)
|
|
91
|
+
: value;
|
|
92
92
|
},
|
|
93
93
|
// This event is only necessary if the parent needs to do *more* than simply
|
|
94
94
|
// keep track of an array of checkbox values. For example, AposTagApply
|
|
@@ -6,21 +6,21 @@
|
|
|
6
6
|
>
|
|
7
7
|
<ul
|
|
8
8
|
ref="select"
|
|
9
|
+
v-click-outside-element="closeList"
|
|
9
10
|
role="button"
|
|
10
11
|
:aria-expanded="showedList.toString()"
|
|
11
12
|
:aria-controls="`${field._id}-combo`"
|
|
12
|
-
v-click-outside-element="closeList"
|
|
13
13
|
class="apos-input-wrapper apos-combo__select"
|
|
14
|
-
@click="toggleList"
|
|
15
14
|
:tabindex="field.readOnly ? null : 0"
|
|
15
|
+
@click="toggleList"
|
|
16
16
|
@keydown.prevent.space="toggleList"
|
|
17
17
|
@keydown.prevent.up="toggleList"
|
|
18
18
|
@keydown.prevent.down="toggleList"
|
|
19
19
|
>
|
|
20
20
|
<li
|
|
21
|
-
class="apos-combo__selected"
|
|
22
21
|
v-for="checked in selectedItems"
|
|
23
22
|
:key="objectValues ? checked.value : checked"
|
|
23
|
+
class="apos-combo__selected"
|
|
24
24
|
@click.stop="selectOption(getSelectedOption(checked))"
|
|
25
25
|
>
|
|
26
26
|
{{ getSelectedOption(checked)?.label }}
|
|
@@ -49,16 +49,16 @@
|
|
|
49
49
|
>
|
|
50
50
|
<li
|
|
51
51
|
v-if="typehead"
|
|
52
|
-
class="apos-combo__list-typehead"
|
|
53
52
|
key="__typehead"
|
|
53
|
+
class="apos-combo__list-typehead"
|
|
54
54
|
@click.stop="$refs.input.focus()"
|
|
55
55
|
>
|
|
56
56
|
<input
|
|
57
|
+
ref="input"
|
|
57
58
|
class="apos-combo__typehead"
|
|
58
59
|
type="text"
|
|
59
60
|
:placeholder="$t('apostrophe:search')"
|
|
60
61
|
:value="thInput"
|
|
61
|
-
ref="input"
|
|
62
62
|
@input="onTypeheadInput"
|
|
63
63
|
@keydown="onTypeheadKey"
|
|
64
64
|
>
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
/>
|
|
70
70
|
</li>
|
|
71
71
|
<li
|
|
72
|
+
v-for="(choice, i) in options"
|
|
72
73
|
:key="choice.value"
|
|
73
74
|
class="apos-combo__list-item"
|
|
74
75
|
role="menuitemcheckbox"
|
|
75
76
|
:class="{focused: focusedItemIndex === i}"
|
|
76
|
-
v-for="(choice, i) in options"
|
|
77
77
|
@click.stop="selectOption(choice)"
|
|
78
78
|
@mouseover="focusedItemIndex = i"
|
|
79
79
|
>
|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
101
101
|
type: Object,
|
|
102
102
|
required: true
|
|
103
103
|
},
|
|
104
|
-
|
|
104
|
+
modelValue: {
|
|
105
105
|
type: Object,
|
|
106
106
|
required: true
|
|
107
107
|
},
|
|
@@ -121,7 +121,7 @@ export default {
|
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
|
|
124
|
-
emits: [ 'select-items', 'toggle', '
|
|
124
|
+
emits: [ 'select-items', 'toggle', 'update:modelValue' ],
|
|
125
125
|
data () {
|
|
126
126
|
|
|
127
127
|
return {
|
|
@@ -142,7 +142,7 @@ export default {
|
|
|
142
142
|
},
|
|
143
143
|
selectedItems() {
|
|
144
144
|
if (!this.showSelectAll || !this.allItemsSelected()) {
|
|
145
|
-
return this.
|
|
145
|
+
return this.modelValue.data;
|
|
146
146
|
}
|
|
147
147
|
if (this.objectValues) {
|
|
148
148
|
const { listLabel } = this.getSelectAllLabel();
|
|
@@ -157,13 +157,13 @@ export default {
|
|
|
157
157
|
mounted() {
|
|
158
158
|
this.boxResizeObserver.observe(this.$refs.select);
|
|
159
159
|
},
|
|
160
|
-
|
|
160
|
+
beforeUnmount() {
|
|
161
161
|
this.boxResizeObserver.unobserve(this.$refs.select);
|
|
162
162
|
},
|
|
163
163
|
methods: {
|
|
164
164
|
onTypeheadInput(e) {
|
|
165
165
|
this.thInput = e.target.value;
|
|
166
|
-
this.$emit('
|
|
166
|
+
this.$emit('update:modelValue', this.thInput);
|
|
167
167
|
},
|
|
168
168
|
onTypeheadKey(e) {
|
|
169
169
|
const stop = () => {
|
|
@@ -276,7 +276,7 @@ export default {
|
|
|
276
276
|
this.focusedItemIndex = null;
|
|
277
277
|
this.$refs.list.scrollTo({ top: 0 });
|
|
278
278
|
this.thInput = '';
|
|
279
|
-
this.$emit('
|
|
279
|
+
this.$emit('update:modelValue', this.thInput);
|
|
280
280
|
},
|
|
281
281
|
getBoxResizeObserver() {
|
|
282
282
|
return new ResizeObserver(([ { target } ]) => {
|
|
@@ -307,10 +307,10 @@ export default {
|
|
|
307
307
|
: entry === choice.value
|
|
308
308
|
);
|
|
309
309
|
|
|
310
|
-
return this.
|
|
310
|
+
return this.modelValue.data.some(condition);
|
|
311
311
|
},
|
|
312
312
|
allItemsSelected () {
|
|
313
|
-
return this.choices.length && this.
|
|
313
|
+
return this.choices.length && this.modelValue.data.length === this.choices.length;
|
|
314
314
|
},
|
|
315
315
|
getSelectedOption(checked) {
|
|
316
316
|
if (this.objectValues) {
|
|
@@ -475,7 +475,7 @@ export default {
|
|
|
475
475
|
cursor: not-allowed;
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
:deep(.apos-indicator) {
|
|
479
479
|
width: 10px;
|
|
480
480
|
height: 10px;
|
|
481
481
|
}
|