|
134 | 134 | /> |
135 | 135 | </template> |
136 | 136 |
|
137 | | - <template #branch-options="{ branch, removeBranch, depth }"> |
138 | | - <template v-if="depth < structureMaxDepth"> |
139 | | - <DropdownLabel :text="__('Create Child Entry')" v-if="blueprints.length > 1" /> |
140 | | - <DropdownItem |
141 | | - v-for="blueprint in blueprints" |
142 | | - @click="createEntry(blueprint.handle, branch.id)" |
143 | | - :icon="blueprint.icon || 'add-entry'" |
144 | | - :key="blueprint.handle" |
145 | | - :text="blueprints.length > 1 ? __(blueprint.title) : __('Create Child Entry')" |
146 | | - /> |
147 | | - </template> |
148 | | - <DropdownSeparator v-if="depth < structureMaxDepth && branch.can_delete" /> |
149 | | - <DropdownItem |
150 | | - v-if="branch.can_delete" |
151 | | - :text="__('Delete')" |
152 | | - icon="trash" |
153 | | - variant="destructive" |
154 | | - @click="deleteTreeBranch(branch, removeBranch)" |
155 | | - /> |
| 137 | + <template #branch-options-dropdown="{ branch, removeBranch, depth, isRoot }"> |
156 | 138 | <ItemActions |
157 | 139 | v-if="branch.entry" |
158 | 140 | :url="entriesActionUrl" |
159 | 141 | :context="{ view: 'tree' }" |
160 | 142 | :item="branch.entry" |
161 | | - auto-load |
162 | | - v-slot="{ actions, shouldShowSkeleton }" |
| 143 | + v-slot="{ actions, loadActions, shouldShowSkeleton }" |
163 | 144 | > |
164 | | - <template v-if="shouldShowSkeleton"> |
165 | | - <DropdownSeparator /> |
166 | | - <div v-for="index in 3" :key="index" class="contents"> |
167 | | - <Skeleton class="m-1 size-5" /> |
168 | | - <Skeleton |
169 | | - class="mx-2 my-1.5 h-5" |
170 | | - :class="index === 1 ? 'w-28' : index === 2 ? 'w-36' : 'w-24'" |
| 145 | + <Dropdown |
| 146 | + @mouseover="loadActions" |
| 147 | + @focus="loadActions" |
| 148 | + @click="loadActions" |
| 149 | + placement="left-start" |
| 150 | + :modal="false" |
| 151 | + :class="{ invisible: isRoot }" |
| 152 | + > |
| 153 | + <DropdownMenu> |
| 154 | + <template v-if="depth < structureMaxDepth"> |
| 155 | + <DropdownLabel :text="__('Create Child Entry')" v-if="blueprints.length > 1" /> |
| 156 | + <DropdownItem |
| 157 | + v-for="blueprint in blueprints" |
| 158 | + @click="createEntry(blueprint.handle, branch.id)" |
| 159 | + :icon="blueprint.icon || 'add-entry'" |
| 160 | + :key="blueprint.handle" |
| 161 | + :text="blueprints.length > 1 ? __(blueprint.title) : __('Create Child Entry')" |
| 162 | + /> |
| 163 | + </template> |
| 164 | + |
| 165 | + <DropdownSeparator v-if="depth < structureMaxDepth && branch.can_delete" /> |
| 166 | + |
| 167 | + <DropdownItem |
| 168 | + v-if="branch.can_delete" |
| 169 | + :text="__('Delete')" |
| 170 | + icon="trash" |
| 171 | + variant="destructive" |
| 172 | + @click="deleteTreeBranch(branch, removeBranch)" |
| 173 | + /> |
| 174 | + |
| 175 | + <DropdownSeparator v-if="shouldShowSkeleton || branchTreeActions(actions).length" /> |
| 176 | + |
| 177 | + <template v-if="shouldShowSkeleton"> |
| 178 | + <div v-for="index in 3" :key="index" class="contents"> |
| 179 | + <Skeleton class="m-1 size-5" /> |
| 180 | + <Skeleton |
| 181 | + class="mx-2 my-1.5 h-5" |
| 182 | + :class="index === 1 ? 'w-28' : index === 2 ? 'w-36' : 'w-24'" |
| 183 | + /> |
| 184 | + </div> |
| 185 | + </template> |
| 186 | + <template v-else> |
| 187 | + <DropdownItem |
| 188 | + v-for="action in branchTreeActions(actions)" |
| 189 | + :key="action.handle" |
| 190 | + :text="__(action.title)" |
| 191 | + :icon="action.icon" |
| 192 | + :variant="action.dangerous ? 'destructive' : 'default'" |
| 193 | + @click="action.run" |
| 194 | + /> |
| 195 | + </template> |
| 196 | + </DropdownMenu> |
| 197 | + </Dropdown> |
| 198 | + </ItemActions> |
| 199 | + |
| 200 | + <Dropdown v-else placement="left-start" :modal="false" :class="{ invisible: isRoot }"> |
| 201 | + <DropdownMenu> |
| 202 | + <template v-if="depth < structureMaxDepth"> |
| 203 | + <DropdownLabel :text="__('Create Child Entry')" v-if="blueprints.length > 1" /> |
| 204 | + <DropdownItem |
| 205 | + v-for="blueprint in blueprints" |
| 206 | + @click="createEntry(blueprint.handle, branch.id)" |
| 207 | + :icon="blueprint.icon || 'add-entry'" |
| 208 | + :key="blueprint.handle" |
| 209 | + :text="blueprints.length > 1 ? __(blueprint.title) : __('Create Child Entry')" |
171 | 210 | /> |
172 | | - </div> |
173 | | - </template> |
174 | | - <template v-else-if="branchTreeActions(actions).length"> |
175 | | - <DropdownSeparator /> |
| 211 | + </template> |
| 212 | + |
| 213 | + <DropdownSeparator v-if="depth < structureMaxDepth && branch.can_delete" /> |
| 214 | + |
176 | 215 | <DropdownItem |
177 | | - v-for="action in branchTreeActions(actions)" |
178 | | - :key="action.handle" |
179 | | - :text="__(action.title)" |
180 | | - :icon="action.icon" |
181 | | - :variant="action.dangerous ? 'destructive' : 'default'" |
182 | | - @select.prevent |
183 | | - @click="action.run()" |
| 216 | + v-if="branch.can_delete" |
| 217 | + :text="__('Delete')" |
| 218 | + icon="trash" |
| 219 | + variant="destructive" |
| 220 | + @click="deleteTreeBranch(branch, removeBranch)" |
184 | 221 | /> |
185 | | - </template> |
186 | | - </ItemActions> |
| 222 | + </DropdownMenu> |
| 223 | + </Dropdown> |
187 | 224 | </template> |
188 | 225 | </page-tree> |
189 | 226 |
|
|
0 commit comments