@designcrowd/library.brand-page 5.16.47-kp-dropdown-2 → 5.16.47
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/lib/src/{CreatedOnBrandCrowd-de-de-BTCT28oZ.js → CreatedOnBrandCrowd-de-de-DebKPLDX.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-en-us-CCXQIdn4.js → CreatedOnBrandCrowd-en-us-BpPgKLto.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-es-es-Dv1ZXxtD.js → CreatedOnBrandCrowd-es-es-cPAZBjUO.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-fr-H4ze6Vhb.js → CreatedOnBrandCrowd-fr-ca-BYaPug2f.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-fr-ca-H4ze6Vhb.js → CreatedOnBrandCrowd-fr-fr-BYaPug2f.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-pt-Dnl8_sRO.js → CreatedOnBrandCrowd-pt-br-BMJ1UJ-b.js} +1 -1
- package/lib/src/{CreatedOnBrandCrowd-pt-br-Dnl8_sRO.js → CreatedOnBrandCrowd-pt-pt-BMJ1UJ-b.js} +1 -1
- package/lib/src/{CreatedOnDcom-de-de-Cjfk8fTg.js → CreatedOnDcom-de-de-B280zfGM.js} +1 -1
- package/lib/src/{CreatedOnDcom-en-us-D_Ks8X6k.js → CreatedOnDcom-en-us-CcH8WRUU.js} +1 -1
- package/lib/src/{CreatedOnDcom-es-es-CVgGS_TQ.js → CreatedOnDcom-es-es-BjVBQo_F.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-ca-DXU17SGm.js → CreatedOnDcom-fr-ca-T6WZ2I2E.js} +1 -1
- package/lib/src/{CreatedOnDcom-fr-fr-CZprWhYG.js → CreatedOnDcom-fr-fr-Bdwxqa13.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-br-DgzkkWa6.js → CreatedOnDcom-pt-br-DwM59Qaw.js} +1 -1
- package/lib/src/{CreatedOnDcom-pt-pt-CTXWh20G.js → CreatedOnDcom-pt-pt-Cg34AcLr.js} +1 -1
- package/lib/src/brand-page/__fixtures__/brand-page-sample-data.js +0 -6
- package/lib/src/brand-page/components/button/Button.mixin.js +9 -3
- package/lib/src/brand-page/components/image-gallery/ImageGallery.stories.js +0 -3
- package/lib/src/brand-page/components/images-section/ImagesSection.stories.js +0 -3
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.d.ts +12 -14
- package/lib/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.js +23 -19
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.d.ts +9 -13
- package/lib/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.js +9 -15
- package/lib/src/brand-page/components/page-header/PageHeader.mixin.d.ts +1 -9
- package/lib/src/brand-page/components/page-header/PageHeader.mixin.js +0 -4
- package/lib/src/brand-page/components/payment/__fixtures__/request-payment.d.ts +0 -1
- package/lib/src/brand-page/components/payment/__fixtures__/support-me.d.ts +0 -1
- package/lib/src/brand-page/components/profile/Profile.stories.js +0 -1
- package/lib/src/brand-page/models/brand-page-context.model.d.ts +1 -2
- package/lib/src/brand-page/models/index.d.ts +3 -3
- package/lib/src/brand-page/utils/migration/migration-06.js +2 -2
- package/lib/src/brand-page/utils/migration.util.js +0 -6
- package/lib/src/brand-page/utils/model.util.d.ts +1 -2
- package/lib/src/brand-page/utils/model.util.js +0 -3
- package/lib/src/brand-page/utils/view-model.util.js +12 -73
- package/lib/src/brand-page/view-models.d.ts +0 -3
- package/lib/src/brand-page-maker/components/brand-page-maker/BrandPageMaker.mixin.d.ts +1 -2
- package/lib/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.js +1 -1
- package/lib/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.mixin.d.ts +1 -2
- package/lib/src/brand-page-maker/components/preview/Preview.mixin.js +0 -1
- package/lib/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.js +0 -1
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.d.ts +0 -3
- package/lib/src/brand-page-maker/composables/rich-text-editor/hyperlink.js +0 -15
- package/lib/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.js +1 -3
- package/lib/src/brand-page-maker/constants/config-settings-constant.js +2 -2
- package/lib/src/brand-page-maker/models/content-settings.js +2 -2
- package/lib/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.js +7 -5
- package/lib/src/brand-page-maker/utils/content.util.d.ts +4 -0
- package/lib/src/brand-page-maker/utils/content.util.js +34 -0
- package/lib/src/brand-page-maker/utils/rich-text-editor.util.js +1 -4
- package/lib/src/brand-page-maker/validators/section-button.validator.js +1 -2
- package/lib/src/{bundled-translations-C4k-Kbm4.js → bundled-translations-BGBFf8J6.js} +30 -32
- package/lib/src/{bundled-translations.de-DE-MavJbdYH.js → bundled-translations.de-DE-CMMRRwga.js} +30 -32
- package/lib/src/{bundled-translations.es-ES-Dqi9nQzQ.js → bundled-translations.es-ES-XRLPG1g-.js} +30 -32
- package/lib/src/{bundled-translations.fr-CA-BBJdMWhW.js → bundled-translations.fr-CA-JVxHjJw5.js} +30 -32
- package/lib/src/{bundled-translations.fr-FR-yYENZ0WX.js → bundled-translations.fr-FR-B9v33v0w.js} +32 -34
- package/lib/src/{bundled-translations.pt-BR-B5ztDVhs.js → bundled-translations.pt-BR-B_hexxsq.js} +24 -26
- package/lib/src/{bundled-translations.pt-PT-BZcbziI9.js → bundled-translations.pt-PT-B9aY7rS8.js} +24 -26
- package/lib/src/bundles/bundled-translations.de-DE.json +1 -5
- package/lib/src/bundles/bundled-translations.es-ES.json +1 -5
- package/lib/src/bundles/bundled-translations.fr-CA.json +1 -5
- package/lib/src/bundles/bundled-translations.fr-FR.json +1 -5
- package/lib/src/bundles/bundled-translations.json +2 -6
- package/lib/src/bundles/bundled-translations.pt-BR.json +1 -5
- package/lib/src/bundles/bundled-translations.pt-PT.json +1 -5
- package/lib/src/composables/useTranslate.d.ts +1 -2
- package/lib/src/composables/useTranslate.js +1 -2
- package/lib/src/css/library.brand-page-brandCrowd.min.css +74 -95
- package/lib/src/css/library.brand-page-brandPage.min.css +74 -96
- package/lib/src/css/library.brand-page-designCom.min.css +74 -95
- package/lib/src/css/library.brand-page-preview.min.css +74 -95
- package/lib/src/index.mjs +1 -1
- package/lib/src/{lib-Bs0yL0Cl.js → lib-BJ3mN_oo.js} +22053 -22653
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.d.ts +2 -9
- package/lib/src/shared/content-settings/components/content-settings/ContentSettings.mixin.js +1 -5
- package/lib/src/shared/content-settings/components/content-settings/ReplaceImageSettingsForContent.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.js +0 -2
- package/lib/src/shared/content-settings/components/content-settings-item/ContentSettingsItemField.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.js +0 -2
- package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.d.ts +149 -0
- package/lib/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.js +103 -0
- package/lib/src/shared/content-settings/components/payment-config-field/PaymentConfigField.mixin.d.ts +1 -2
- package/lib/src/shared/content-settings/components/radio-field/RadioField.mixin.js +0 -2
- package/lib/src/shared/logo-settings/components/LogoSettings.mixin.d.ts +1 -2
- package/lib/src/shared/page-navigation/store/page-navigation-store.d.ts +0 -4
- package/lib/src/shared/page-navigation/store/page-navigation-store.js +0 -4
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.d.ts +1 -7
- package/lib/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.js +1 -8
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.d.ts +2 -8
- package/lib/src/shared/page-settings/components/page-settings/PageSettings.mixin.js +7 -104
- package/lib/src/shared/page-settings/components/page-settings-section-styles/PageSettingsSectionStyles.mixin.d.ts +1 -2
- package/lib/src/shared/page-settings/store/page-settings-store.d.ts +1 -3
- package/lib/src/shared/page-settings/store/page-settings-store.js +6 -10
- package/package.json +5 -5
- package/src/brand-page/__fixtures__/brand-page-sample-data.ts +0 -6
- package/src/brand-page/components/about-section/AboutSection.vue.test.ts +0 -3
- package/src/brand-page/components/button/Button.mixin.ts +17 -4
- package/src/brand-page/components/image/Image.test.ts +0 -3
- package/src/brand-page/components/image-gallery/ImageGallery.stories.ts +0 -3
- package/src/brand-page/components/image-gallery/ImageGallery.test.ts +0 -3
- package/src/brand-page/components/images-section/ImagesSection.stories.ts +0 -3
- package/src/brand-page/components/navigation/Navigation.vue +4 -4
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.mixin.ts +37 -24
- package/src/brand-page/components/navigation/button-carousel/ButtonCarouselNavigation.vue +5 -4
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.mixin.ts +22 -17
- package/src/brand-page/components/navigation/navigation-side-menu/NavigationSideMenu.vue +4 -4
- package/src/brand-page/components/page/Page.vue +3 -9
- package/src/brand-page/components/page-header/PageHeader.mixin.ts +1 -5
- package/src/brand-page/components/page-header/PageHeader.vue +0 -1
- package/src/brand-page/components/profile/Profile.stories.ts +0 -1
- package/src/brand-page/components/social-links/SocialLinks.vue.test.ts +0 -3
- package/src/brand-page/components/text-wrapper/TextWrapper.vue +17 -1
- package/src/brand-page/models/brand-page-context.model.ts +2 -3
- package/src/brand-page/models/index.ts +3 -3
- package/src/brand-page/utils/__snapshots__/migration.util.test.ts.snap +4 -4
- package/src/brand-page/utils/migration/migration-06.ts +7 -3
- package/src/brand-page/utils/migration.util.ts +0 -6
- package/src/brand-page/utils/model.util.ts +0 -7
- package/src/brand-page/utils/view-model.util.ts +35 -119
- package/src/brand-page/view-models.ts +0 -3
- package/src/brand-page-maker/components/brand-page-maker/__fixtures__/brand-page-examples.ts +1 -1
- package/src/brand-page-maker/components/brandpage-maker-page/BrandPageMakerPage.vue +0 -2
- package/src/brand-page-maker/components/preview/Preview.mixin.ts +0 -1
- package/src/brand-page-maker/components/rich-text-editor/RichTextEditor.vue +32 -53
- package/src/brand-page-maker/components/template-preview/TemplatePreview.mixin.ts +0 -1
- package/src/brand-page-maker/composables/rich-text-editor/hyperlink.ts +0 -18
- package/src/brand-page-maker/composables/rich-text-editor/useRichTextEditor.ts +1 -5
- package/src/brand-page-maker/constants/config-settings-constant.ts +2 -2
- package/src/brand-page-maker/models/content-settings.ts +2 -2
- package/src/brand-page-maker/stores/brandpage-maker/brandpage-maker-store.ts +7 -4
- package/src/brand-page-maker/utils/content.util.ts +68 -1
- package/src/brand-page-maker/utils/rich-text-editor.util.ts +1 -5
- package/src/brand-page-maker/validators/section-button.validator.ts +1 -4
- package/src/bundles/bundled-translations.de-DE.json +1 -5
- package/src/bundles/bundled-translations.es-ES.json +1 -5
- package/src/bundles/bundled-translations.fr-CA.json +1 -5
- package/src/bundles/bundled-translations.fr-FR.json +1 -5
- package/src/bundles/bundled-translations.json +2 -6
- package/src/bundles/bundled-translations.pt-BR.json +1 -5
- package/src/bundles/bundled-translations.pt-PT.json +1 -5
- package/src/composables/useTranslate.ts +0 -3
- package/src/shared/content-settings/components/content-settings/ContentSettings.mixin.ts +1 -13
- package/src/shared/content-settings/components/content-settings/ContentSettings.vue +27 -27
- package/src/shared/content-settings/components/content-settings-item/ContentSettingsItem.mixin.ts +0 -2
- package/src/shared/content-settings/components/focused-content-item-settings/FocusedContentItemSettings.mixin.ts +0 -2
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.mixin.ts +115 -0
- package/src/shared/content-settings/components/page-dropdown-field/PageDropdownField.vue +40 -103
- package/src/shared/content-settings/components/radio-field/RadioField.mixin.ts +0 -2
- package/src/shared/page-navigation/store/page-navigation-store.ts +0 -5
- package/src/shared/page-settings/components/new-page-modal/NewPageModal.mixin.ts +1 -12
- package/src/shared/page-settings/components/new-page-modal/NewPageModal.vue +3 -12
- package/src/shared/page-settings/components/new-page-modal/i18n/new-page-modal.json +1 -1
- package/src/shared/page-settings/components/page-settings/PageElement.vue +4 -17
- package/src/shared/page-settings/components/page-settings/PageSettingMenu.vue +3 -31
- package/src/shared/page-settings/components/page-settings/PageSettings.mixin.ts +14 -161
- package/src/shared/page-settings/components/page-settings/PageSettings.vue +41 -22
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.de-DE.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.es-ES.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-CA.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.fr-FR.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.json +1 -2
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-BR.json +15 -17
- package/src/shared/page-settings/components/page-settings/i18n/page-settings.pt-PT.json +15 -17
- package/src/shared/page-settings/store/page-settings-store.ts +6 -11
- package/lib/src/brand-page/utils/migration/migration-13.d.ts +0 -2
- package/lib/src/brand-page/utils/migration/migration-13.js +0 -74
- package/src/brand-page/utils/migration/migration-13.test.ts +0 -735
- package/src/brand-page/utils/migration/migration-13.ts +0 -125
- package/src/shared/page-navigation/PageSelectorDropdown.vue +0 -174
- package/src/shared/page-navigation/i18n/page-selector-dropdown.de-DE.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.es-ES.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.fr-CA.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.fr-FR.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.pt-BR.json +0 -5
- package/src/shared/page-navigation/i18n/page-selector-dropdown.pt-PT.json +0 -5
- package/src/shared/page-settings/components/page-settings/NestedDraggable.vue +0 -276
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import type { MigrationData } from '../migration.util';
|
|
2
|
-
import {
|
|
3
|
-
type BannerSectionContent,
|
|
4
|
-
type BookingSectionContent,
|
|
5
|
-
type BrandPageModel,
|
|
6
|
-
type GeneralLinkContent,
|
|
7
|
-
type ImagesSectionContent,
|
|
8
|
-
} from '../../models';
|
|
9
|
-
import {
|
|
10
|
-
isBannerContent,
|
|
11
|
-
isBookingContent,
|
|
12
|
-
isButtonContent,
|
|
13
|
-
isImagesContent,
|
|
14
|
-
} from '../../utils';
|
|
15
|
-
import { hasRTEContent } from '../../../brand-page-maker/utils';
|
|
16
|
-
|
|
17
|
-
export const migration13 = async (
|
|
18
|
-
migrationResult: MigrationData,
|
|
19
|
-
): Promise<MigrationData> => {
|
|
20
|
-
const { brandPageModel } = migrationResult;
|
|
21
|
-
|
|
22
|
-
for (const page of brandPageModel.pages) {
|
|
23
|
-
for (const content of page.contents) {
|
|
24
|
-
// Handle RTE hyperlinks in dynamic content
|
|
25
|
-
handleDynamicContentRTEHyperlinks(brandPageModel, content);
|
|
26
|
-
|
|
27
|
-
// Handle button page type links
|
|
28
|
-
if (isBannerContent(content)) {
|
|
29
|
-
const bannerContent = content as BannerSectionContent;
|
|
30
|
-
|
|
31
|
-
bannerContent.buttonPageId = getPageIdFromPageSlug(
|
|
32
|
-
brandPageModel,
|
|
33
|
-
bannerContent['pageSlug'],
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
delete bannerContent['pageSlug'];
|
|
37
|
-
} else if (isBookingContent(content)) {
|
|
38
|
-
const bookingContent = content as BookingSectionContent;
|
|
39
|
-
|
|
40
|
-
bookingContent.buttonPageId = getPageIdFromPageSlug(
|
|
41
|
-
brandPageModel,
|
|
42
|
-
bookingContent['pageSlug'],
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
delete bookingContent['pageSlug'];
|
|
46
|
-
} else if (isImagesContent(content)) {
|
|
47
|
-
const imageContent = content as ImagesSectionContent;
|
|
48
|
-
|
|
49
|
-
if (imageContent.items) {
|
|
50
|
-
imageContent.items.forEach((item) => {
|
|
51
|
-
item.buttonPageId = getPageIdFromPageSlug(
|
|
52
|
-
brandPageModel,
|
|
53
|
-
item['pageSlug'],
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
delete item['pageSlug'];
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
} else if (isButtonContent(content)) {
|
|
60
|
-
const generalLinkContent = content as GeneralLinkContent;
|
|
61
|
-
|
|
62
|
-
generalLinkContent.page = getPageIdFromPageSlug(
|
|
63
|
-
brandPageModel,
|
|
64
|
-
generalLinkContent.page,
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return migrationResult;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const handleDynamicContentRTEHyperlinks = (
|
|
74
|
-
brandPageModel: BrandPageModel,
|
|
75
|
-
content: any,
|
|
76
|
-
) => {
|
|
77
|
-
if (!content) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
Object.keys(content).forEach((key) => {
|
|
82
|
-
const value = content[key];
|
|
83
|
-
|
|
84
|
-
if (value === undefined || value === null) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (typeof value === 'object' && key === 'items') {
|
|
89
|
-
if (Array.isArray(value)) {
|
|
90
|
-
value.forEach((item) => {
|
|
91
|
-
handleDynamicContentRTEHyperlinks(brandPageModel, item);
|
|
92
|
-
});
|
|
93
|
-
} else {
|
|
94
|
-
handleDynamicContentRTEHyperlinks(brandPageModel, value);
|
|
95
|
-
}
|
|
96
|
-
} else if (typeof value === 'string' && hasRTEContent(value)) {
|
|
97
|
-
(content as unknown as Record<string, unknown>)[key] = value.replace(
|
|
98
|
-
/<a\s+([^>]*?)href="([^"]*?)"([^>]*?)>/gi,
|
|
99
|
-
(match, existingAttrsStart, href, existingAttrsEnd) => {
|
|
100
|
-
if (href && !href.match(/^(https?:\/\/|\/)/)) {
|
|
101
|
-
const pageId = getPageIdFromPageSlug(brandPageModel, href);
|
|
102
|
-
|
|
103
|
-
// Old page slug translated to pageid link
|
|
104
|
-
return `<a ${existingAttrsStart}href="pageid:${pageId}"${existingAttrsEnd}>`;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
return match;
|
|
108
|
-
},
|
|
109
|
-
);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const getPageIdFromPageSlug = (
|
|
115
|
-
model: BrandPageModel,
|
|
116
|
-
targetPageSlug: string,
|
|
117
|
-
): string => {
|
|
118
|
-
if (!targetPageSlug) {
|
|
119
|
-
return '';
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
return (
|
|
123
|
-
model.nav.routes.find((x) => x.pageSlug === targetPageSlug)?.pageId || ''
|
|
124
|
-
);
|
|
125
|
-
};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="tw-relative">
|
|
3
|
-
<Dropdown
|
|
4
|
-
ref="dropdownRef"
|
|
5
|
-
element-classes="tw-h-12"
|
|
6
|
-
menu-element-classes="tw-overflow-y-auto tw-max-h-72 tw-w-full"
|
|
7
|
-
:title="selectedDisplayName"
|
|
8
|
-
>
|
|
9
|
-
<DropdownItem
|
|
10
|
-
v-for="item of navItems"
|
|
11
|
-
:key="item.routeId"
|
|
12
|
-
class="tw-text-black tw-break-all"
|
|
13
|
-
@click="onSelectPage(item)"
|
|
14
|
-
>
|
|
15
|
-
<div
|
|
16
|
-
class="tw-pl-2 tw-flex tw-items-center tw-w-full"
|
|
17
|
-
:class="dynamicPaddingCssClass(item.depth)"
|
|
18
|
-
>
|
|
19
|
-
<Icon
|
|
20
|
-
v-if="item.isHidden"
|
|
21
|
-
name="eye-crossed"
|
|
22
|
-
class="tw-mr-2 tw-pt-1"
|
|
23
|
-
/>
|
|
24
|
-
<span class="tw-grow tw-truncate tw-mr-2">{{
|
|
25
|
-
item.displayName
|
|
26
|
-
}}</span>
|
|
27
|
-
<Icon
|
|
28
|
-
v-if="item.selected"
|
|
29
|
-
name="check-thin"
|
|
30
|
-
class="tw-pt-1 tw-mr-2"
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
33
|
-
</DropdownItem>
|
|
34
|
-
<DropdownItem
|
|
35
|
-
v-if="hasLastItemSlot"
|
|
36
|
-
class="tw-text-black tw-break-all"
|
|
37
|
-
@click="onLastItemClicked()"
|
|
38
|
-
>
|
|
39
|
-
<slot name="lastitem" />
|
|
40
|
-
</DropdownItem>
|
|
41
|
-
<DropdownItem class="tw-text-black tw-break-all tw-pt-2 tw-px-2">
|
|
42
|
-
<Button
|
|
43
|
-
:label="pageSelectorDropdownTr('managePagesButtonLabel')"
|
|
44
|
-
variant="outline"
|
|
45
|
-
:full-width="true"
|
|
46
|
-
size="small-wide"
|
|
47
|
-
@on-click.stop="onManagedPageClicked()"
|
|
48
|
-
/>
|
|
49
|
-
</DropdownItem>
|
|
50
|
-
</Dropdown>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
|
|
54
|
-
<script setup lang="ts">
|
|
55
|
-
import { computed, ref, useSlots } from 'vue';
|
|
56
|
-
import {
|
|
57
|
-
Dropdown,
|
|
58
|
-
DropdownItem,
|
|
59
|
-
Icon,
|
|
60
|
-
DcomIcon,
|
|
61
|
-
Button,
|
|
62
|
-
} from '@designcrowd/fe-shared-lib';
|
|
63
|
-
import { usePageNavigationStore } from './store/page-navigation-store';
|
|
64
|
-
import type { NavOrder } from '../../brand-page';
|
|
65
|
-
import { pageSelectorDropdownTr } from '../../composables/useTranslate';
|
|
66
|
-
|
|
67
|
-
interface NavItem {
|
|
68
|
-
routeId: string;
|
|
69
|
-
pageId: string;
|
|
70
|
-
displayName: string;
|
|
71
|
-
pageSlug: string;
|
|
72
|
-
isHidden: boolean;
|
|
73
|
-
depth: number;
|
|
74
|
-
selected: boolean;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
interface Props {
|
|
78
|
-
pageId: string | undefined;
|
|
79
|
-
placeholder: string | undefined;
|
|
80
|
-
}
|
|
81
|
-
const dropdownRef = ref<InstanceType<typeof Dropdown> | null>(null);
|
|
82
|
-
const slots = useSlots();
|
|
83
|
-
const props = withDefaults(defineProps<Props>(), {});
|
|
84
|
-
|
|
85
|
-
const hasLastItemSlot = computed(() => !!slots.lastitem);
|
|
86
|
-
|
|
87
|
-
const emit = defineEmits<{
|
|
88
|
-
(
|
|
89
|
-
e: 'on-select',
|
|
90
|
-
data: {
|
|
91
|
-
selectedItem: {
|
|
92
|
-
pageId: string;
|
|
93
|
-
displayName: string;
|
|
94
|
-
};
|
|
95
|
-
},
|
|
96
|
-
): void;
|
|
97
|
-
(e: 'on-managed-page'): void;
|
|
98
|
-
}>();
|
|
99
|
-
|
|
100
|
-
const pageNavigationStore = usePageNavigationStore();
|
|
101
|
-
|
|
102
|
-
const selectedRoute = computed(() => {
|
|
103
|
-
if (!props.pageId) return undefined;
|
|
104
|
-
return pageNavigationStore.routes.find((r) => r.pageId === props.pageId);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
const selectedDisplayName = computed(() => {
|
|
108
|
-
return selectedRoute.value?.displayName ?? props.placeholder;
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
const navItems = computed((): NavItem[] => {
|
|
112
|
-
const items: NavItem[] = [];
|
|
113
|
-
|
|
114
|
-
const flattenOrders = (orders: NavOrder[], depth: number): void => {
|
|
115
|
-
for (const order of orders) {
|
|
116
|
-
const route = pageNavigationStore.routes.find(
|
|
117
|
-
(r) => r.id === order.routeId,
|
|
118
|
-
);
|
|
119
|
-
if (route) {
|
|
120
|
-
items.push({
|
|
121
|
-
routeId: route.id,
|
|
122
|
-
pageId: route.pageId,
|
|
123
|
-
displayName: route.displayName,
|
|
124
|
-
pageSlug: route.pageSlug,
|
|
125
|
-
isHidden: route.isHidden,
|
|
126
|
-
depth: depth,
|
|
127
|
-
selected: route.pageId === props.pageId,
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
if (order.subRoutes && order.subRoutes.length > 0) {
|
|
131
|
-
flattenOrders(order.subRoutes, depth + 1);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
flattenOrders(pageNavigationStore.orders, 0);
|
|
137
|
-
return items;
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
const onSelectPage = (item: NavItem): void => {
|
|
141
|
-
if ((dropdownRef.value as any)?.hideMenu) {
|
|
142
|
-
(dropdownRef.value as any).hideMenu();
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
emit('on-select', {
|
|
146
|
-
selectedItem: {
|
|
147
|
-
pageId: item.pageId,
|
|
148
|
-
displayName: item.displayName,
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
};
|
|
152
|
-
|
|
153
|
-
const onLastItemClicked = (): void => {
|
|
154
|
-
if ((dropdownRef.value as any)?.hideMenu) {
|
|
155
|
-
(dropdownRef.value as any).hideMenu();
|
|
156
|
-
}
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
const onManagedPageClicked = (): void => {
|
|
160
|
-
if ((dropdownRef.value as any)?.hideMenu) {
|
|
161
|
-
(dropdownRef.value as any).hideMenu();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
emit('on-managed-page');
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const dynamicPaddingCssClass = (depth: number) => {
|
|
168
|
-
const css = `tw-ml-${depth * 4}`;
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
[css]: true,
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
</script>
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<Draggable
|
|
3
|
-
:list="orders"
|
|
4
|
-
tag="ul"
|
|
5
|
-
:class="{ dragArea: isDraggingPage && parentRouteId === undefined }"
|
|
6
|
-
:group="groupConfig"
|
|
7
|
-
:animation="300"
|
|
8
|
-
:move="handleMove"
|
|
9
|
-
:data-parent-route-id="parentRouteId || ''"
|
|
10
|
-
handle=".c-drag-handle"
|
|
11
|
-
@start="handleStart"
|
|
12
|
-
@end="handleEnd"
|
|
13
|
-
>
|
|
14
|
-
<template #item="{ element }">
|
|
15
|
-
<li :key="element.routeId" :data-route-id="element.routeId">
|
|
16
|
-
<PageElement
|
|
17
|
-
v-if="pageIndexByRouteId(element.routeId) !== -1"
|
|
18
|
-
:is-hidden="routeIsHidden(element.routeId)"
|
|
19
|
-
:page-title="pageTitleByRouteId(element.routeId)"
|
|
20
|
-
:page-title-error="
|
|
21
|
-
getPageTitleErrorForIndex(pageIndexByRouteId(element.routeId)) ||
|
|
22
|
-
undefined
|
|
23
|
-
"
|
|
24
|
-
:index="pageIndexByRouteId(element.routeId)"
|
|
25
|
-
:is-dragging-page="isDraggingPage"
|
|
26
|
-
:is-design-com="isDesignCom"
|
|
27
|
-
:is-root-page="isRootPageForRoute(element.routeId)"
|
|
28
|
-
:has-sub-pages="
|
|
29
|
-
Boolean(element.subRoutes && element.subRoutes.length)
|
|
30
|
-
"
|
|
31
|
-
:page-title-input="onPageTitleInput"
|
|
32
|
-
:delete-page-selected="onDeletePageSelected"
|
|
33
|
-
:change-page-visibility="onChangePageVisibility"
|
|
34
|
-
:on-add-sub-page-selected="onAddSubPageSelected"
|
|
35
|
-
:total-pages="totalPages"
|
|
36
|
-
:visible-page-count="visiblePageCount"
|
|
37
|
-
/>
|
|
38
|
-
<NestedDraggable
|
|
39
|
-
v-if="!parentRouteId"
|
|
40
|
-
:orders="element.subRoutes"
|
|
41
|
-
:parent-route-id="element.routeId"
|
|
42
|
-
:is-dragging-page="isDraggingPage"
|
|
43
|
-
:is-design-com="isDesignCom"
|
|
44
|
-
:on-page-title-input="onPageTitleInput"
|
|
45
|
-
:on-delete-page-selected="onDeletePageSelected"
|
|
46
|
-
:on-change-page-visibility="onChangePageVisibility"
|
|
47
|
-
:on-add-sub-page-selected="onAddSubPageSelected"
|
|
48
|
-
:move="handleMove"
|
|
49
|
-
@drag-start="handleStart"
|
|
50
|
-
@drag-end="handleEnd"
|
|
51
|
-
/>
|
|
52
|
-
</li>
|
|
53
|
-
</template>
|
|
54
|
-
</Draggable>
|
|
55
|
-
</template>
|
|
56
|
-
|
|
57
|
-
<script setup lang="ts">
|
|
58
|
-
import { computed, ref } from 'vue';
|
|
59
|
-
import Draggable from 'vuedraggable';
|
|
60
|
-
import PageElement from './PageElement.vue';
|
|
61
|
-
import type { NavOrder } from '../../../../brand-page';
|
|
62
|
-
import { useUiPageSettingsStore } from '../../store';
|
|
63
|
-
import { usePageNavigationStore } from '../../../page-navigation/store/page-navigation-store';
|
|
64
|
-
import { getPageTitleError } from '../../utils';
|
|
65
|
-
|
|
66
|
-
defineOptions({ name: 'NestedDraggable' });
|
|
67
|
-
|
|
68
|
-
interface Props {
|
|
69
|
-
orders: NavOrder[];
|
|
70
|
-
parentRouteId?: string;
|
|
71
|
-
isDraggingPage: boolean;
|
|
72
|
-
isDesignCom: boolean;
|
|
73
|
-
onPageTitleInput: (index: number, value: string) => void;
|
|
74
|
-
onDeletePageSelected: (index: number) => void;
|
|
75
|
-
onChangePageVisibility: (index: number) => void;
|
|
76
|
-
onAddSubPageSelected: (index: number) => void;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const props = defineProps<Props>();
|
|
80
|
-
|
|
81
|
-
const emit = defineEmits<{
|
|
82
|
-
(e: 'drag-start'): void;
|
|
83
|
-
(e: 'drag-end', ev: any): void;
|
|
84
|
-
}>();
|
|
85
|
-
|
|
86
|
-
const pageSettingsStore = useUiPageSettingsStore();
|
|
87
|
-
const pageNavigationStore = usePageNavigationStore();
|
|
88
|
-
|
|
89
|
-
const dragPreview = ref<{
|
|
90
|
-
routeId: string;
|
|
91
|
-
parentRouteId: string | null;
|
|
92
|
-
} | null>(null);
|
|
93
|
-
|
|
94
|
-
const dragStartX = ref<number | null>(null);
|
|
95
|
-
const subpageOn = ref(false);
|
|
96
|
-
|
|
97
|
-
const groupConfig = {
|
|
98
|
-
name: 'pages',
|
|
99
|
-
pull: true,
|
|
100
|
-
put: true,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const pageIndexByRouteId = (routeId: string): number => {
|
|
104
|
-
const route = pageNavigationStore.routes.find((r) => r.id === routeId);
|
|
105
|
-
|
|
106
|
-
if (!route) {
|
|
107
|
-
return -1;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
return pageSettingsStore.pages.findIndex((p) => p.id === route.pageId);
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
const routeIsHidden = (routeId: string): boolean => {
|
|
114
|
-
const route = pageNavigationStore.routes.find((r) => r.id === routeId);
|
|
115
|
-
|
|
116
|
-
return Boolean(route?.isHidden);
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const pageTitleByRouteId = (routeId: string): string => {
|
|
120
|
-
const route = pageNavigationStore.routes.find((r) => r.id === routeId);
|
|
121
|
-
|
|
122
|
-
if (!route) {
|
|
123
|
-
return '';
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const page = pageSettingsStore.pages.find((p) => p.id === route.pageId);
|
|
127
|
-
|
|
128
|
-
return page?.title ?? '';
|
|
129
|
-
};
|
|
130
|
-
const totalPages = computed(() => pageSettingsStore.pages.length);
|
|
131
|
-
|
|
132
|
-
const visiblePageCount = computed(
|
|
133
|
-
() =>
|
|
134
|
-
pageSettingsStore.pages.filter((page) =>
|
|
135
|
-
pageNavigationStore.routes.some(
|
|
136
|
-
(route) => route.pageId === page.id && !route.isHidden,
|
|
137
|
-
),
|
|
138
|
-
).length,
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
const getPageTitleErrorForIndex = (index: number): string | null => {
|
|
142
|
-
const page = pageSettingsStore.pages[index];
|
|
143
|
-
|
|
144
|
-
if (!page) {
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
return getPageTitleError(page.title);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const isRootPageForRoute = (routeId: string): boolean => {
|
|
152
|
-
const preview = dragPreview.value;
|
|
153
|
-
|
|
154
|
-
if (preview && preview.routeId === routeId) {
|
|
155
|
-
return preview.parentRouteId === null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
return !props.parentRouteId;
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
const handleStart = (evt: any): void => {
|
|
162
|
-
emit('drag-start');
|
|
163
|
-
const originalEvent = evt?.originalEvent as
|
|
164
|
-
| MouseEvent
|
|
165
|
-
| TouchEvent
|
|
166
|
-
| undefined;
|
|
167
|
-
|
|
168
|
-
let clientX: number | undefined;
|
|
169
|
-
|
|
170
|
-
if (originalEvent instanceof MouseEvent) {
|
|
171
|
-
clientX = originalEvent.clientX;
|
|
172
|
-
} else if (originalEvent instanceof TouchEvent) {
|
|
173
|
-
const touch = originalEvent.touches[0] ?? originalEvent.changedTouches[0];
|
|
174
|
-
clientX = touch?.clientX;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
dragStartX.value = clientX ?? null;
|
|
178
|
-
subpageOn.value = false;
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
const handleEnd = (ev: any): void => {
|
|
182
|
-
emit('drag-end', ev);
|
|
183
|
-
dragPreview.value = null;
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const handleMove = (evt: any): boolean => {
|
|
187
|
-
const toEl = evt?.to as HTMLElement | undefined;
|
|
188
|
-
const fromEl = evt?.from as HTMLElement | undefined;
|
|
189
|
-
const targetParentRouteId = toEl?.dataset?.parentRouteId || null;
|
|
190
|
-
const sourceParentRouteId = fromEl?.dataset?.parentRouteId || null;
|
|
191
|
-
const draggedElement = evt?.draggedContext?.element as
|
|
192
|
-
| (NavOrder & { subRoutes?: NavOrder[] })
|
|
193
|
-
| undefined;
|
|
194
|
-
const draggedRouteId = draggedElement?.routeId as string | undefined;
|
|
195
|
-
|
|
196
|
-
const draggedHasSubPages = Boolean(draggedElement?.subRoutes?.length);
|
|
197
|
-
const draggedContext = evt?.draggedContext as
|
|
198
|
-
| { futureIndex?: number }
|
|
199
|
-
| undefined;
|
|
200
|
-
const futureIndex = draggedContext?.futureIndex;
|
|
201
|
-
|
|
202
|
-
const originalEvent = evt?.originalEvent as
|
|
203
|
-
| MouseEvent
|
|
204
|
-
| TouchEvent
|
|
205
|
-
| undefined;
|
|
206
|
-
|
|
207
|
-
let clientX: number | undefined;
|
|
208
|
-
|
|
209
|
-
if (originalEvent instanceof MouseEvent) {
|
|
210
|
-
clientX = originalEvent.clientX;
|
|
211
|
-
} else if (originalEvent instanceof TouchEvent) {
|
|
212
|
-
const touch = originalEvent.touches[0] ?? originalEvent.changedTouches[0];
|
|
213
|
-
clientX = touch?.clientX;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
if (dragStartX.value != null && clientX != null) {
|
|
217
|
-
const deltaX = clientX - dragStartX.value;
|
|
218
|
-
|
|
219
|
-
// Enable subpage mode when dragged sufficiently to the right
|
|
220
|
-
subpageOn.value = deltaX > 10;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// Do not allow a main page that already has sub-pages
|
|
224
|
-
// to become the home page (first root item).
|
|
225
|
-
if (!targetParentRouteId && futureIndex === 0 && draggedHasSubPages) {
|
|
226
|
-
return false;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
const homeRouteId =
|
|
230
|
-
pageNavigationStore.orders.length > 0
|
|
231
|
-
? pageNavigationStore.orders[0]?.routeId
|
|
232
|
-
: undefined;
|
|
233
|
-
|
|
234
|
-
// Disallow turning a parent (with sub-pages) into a sub-page
|
|
235
|
-
if (targetParentRouteId && draggedHasSubPages) {
|
|
236
|
-
return false;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Do not allow adding sub-pages to the home page via dragging.
|
|
240
|
-
if (targetParentRouteId && targetParentRouteId === homeRouteId) {
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Do not allow the home page itself to become a sub-page of any page.
|
|
245
|
-
if (targetParentRouteId && draggedRouteId && draggedRouteId === homeRouteId) {
|
|
246
|
-
return false;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// When dragging from root into a sub-page list, only allow if
|
|
250
|
-
// the user has explicitly dragged to the right (subpageOn).
|
|
251
|
-
if (!sourceParentRouteId && targetParentRouteId && !subpageOn.value) {
|
|
252
|
-
return false;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// Prevent nesting further than 1 depth
|
|
256
|
-
// TODO(jyao): We will want to change this in the future to allow deeper nesting
|
|
257
|
-
if (targetParentRouteId && props.parentRouteId) {
|
|
258
|
-
return false;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (draggedRouteId) {
|
|
262
|
-
dragPreview.value = {
|
|
263
|
-
routeId: draggedRouteId,
|
|
264
|
-
parentRouteId: targetParentRouteId,
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return true;
|
|
269
|
-
};
|
|
270
|
-
</script>
|
|
271
|
-
|
|
272
|
-
<style scoped>
|
|
273
|
-
.dragArea {
|
|
274
|
-
min-height: 1rem;
|
|
275
|
-
}
|
|
276
|
-
</style>
|