diff --git a/components/lib/dock/BaseDock.vue b/components/lib/dock/BaseDock.vue new file mode 100644 index 000000000..f303c1024 --- /dev/null +++ b/components/lib/dock/BaseDock.vue @@ -0,0 +1,185 @@ + diff --git a/components/lib/dock/Dock.d.ts b/components/lib/dock/Dock.d.ts index 2c11c73bb..c380e3023 100644 --- a/components/lib/dock/Dock.d.ts +++ b/components/lib/dock/Dock.d.ts @@ -171,6 +171,11 @@ export interface DockProps { * @type {DockPassThroughOptions} */ pt?: DockPassThroughOptions; + /** + * When enabled, it removes component related styles in the core. + * @defaultValue false + */ + unstyled?: boolean; } /** diff --git a/components/lib/dock/Dock.vue b/components/lib/dock/Dock.vue index 44e6b2adf..b3e1ffe8b 100644 --- a/components/lib/dock/Dock.vue +++ b/components/lib/dock/Dock.vue @@ -1,161 +1,18 @@ - + - - diff --git a/components/lib/dock/DockSub.vue b/components/lib/dock/DockSub.vue index 98be1c103..c15bae93b 100644 --- a/components/lib/dock/DockSub.vue +++ b/components/lib/dock/DockSub.vue @@ -1,9 +1,9 @@ - + - + - + - + - + - + @@ -146,7 +148,7 @@ export default { }); }, isSameMenuItem(event) { - return event.currentTarget && (event.currentTarget.isSameNode(event.target) || event.currentTarget.isSameNode(event.target.closest('.p-menuitem'))); + return event.currentTarget && (event.currentTarget.isSameNode(event.target) || event.currentTarget.isSameNode(event.target.closest('[data-pc-section="menuitem"]'))); }, isItemActive(id) { return id === this.focusedOptionIndex; @@ -241,56 +243,33 @@ export default { this.changeFocusedOptionIndex(0); }, onEndKey() { - this.changeFocusedOptionIndex(DomHandler.find(this.$refs.list, 'li.p-dock-item:not(.p-disabled)').length - 1); + this.changeFocusedOptionIndex(DomHandler.find(this.$refs.list, 'li[data-pc-section="menuitem"][data-p-disabled="false"]').length - 1); }, onSpaceKey() { const element = DomHandler.findSingle(this.$refs.list, `li[id="${`${this.focusedOptionIndex}`}"]`); - const anchorElement = element && DomHandler.findSingle(element, '.p-dock-link'); + const anchorElement = element && DomHandler.findSingle(element, '[data-pc-section="action"]'); anchorElement ? anchorElement.click() : element && element.click(); }, findNextOptionIndex(index) { - const menuitems = DomHandler.find(this.$refs.list, 'li.p-dock-item:not(.p-disabled)'); + const menuitems = DomHandler.find(this.$refs.list, 'li[data-pc-section="menuitem"][data-p-disabled="false"]'); const matchedOptionIndex = [...menuitems].findIndex((link) => link.id === index); return matchedOptionIndex > -1 ? matchedOptionIndex + 1 : 0; }, findPrevOptionIndex(index) { - const menuitems = DomHandler.find(this.$refs.list, 'li.p-dock-item:not(.p-disabled)'); + const menuitems = DomHandler.find(this.$refs.list, 'li[data-pc-section="menuitem"][data-p-disabled="false"]'); const matchedOptionIndex = [...menuitems].findIndex((link) => link.id === index); return matchedOptionIndex > -1 ? matchedOptionIndex - 1 : 0; }, changeFocusedOptionIndex(index) { - const menuitems = DomHandler.find(this.$refs.list, 'li.p-dock-item:not(.p-disabled)'); + const menuitems = DomHandler.find(this.$refs.list, 'li[data-pc-section="menuitem"][data-p-disabled="false"]'); let order = index >= menuitems.length ? menuitems.length - 1 : index < 0 ? 0 : index; this.focusedOptionIndex = menuitems[order].getAttribute('id'); }, - itemClass(item, index, id) { - return [ - 'p-dock-item', - { - 'p-focus': this.isItemActive(id), - 'p-disabled': this.disabled(item), - 'p-dock-item-second-prev': this.currentIndex - 2 === index, - 'p-dock-item-prev': this.currentIndex - 1 === index, - 'p-dock-item-current': this.currentIndex === index, - 'p-dock-item-next': this.currentIndex + 1 === index, - 'p-dock-item-second-next': this.currentIndex + 2 === index - } - ]; - }, - linkClass(routerProps) { - return [ - 'p-dock-link', - { - 'router-link-active': routerProps && routerProps.isActive, - 'router-link-active-exact': this.exact && routerProps && routerProps.isExactActive - } - ]; - }, disabled(item) { return typeof item.disabled === 'function' ? item.disabled() : item.disabled; }