@websolutespa/payload-plugin-bowl 1.7.4 → 1.7.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @websolutespa/payload-plugin-bowl
2
2
 
3
+ ## 1.7.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Added: beforeDuplicateCollectionHook
8
+ - Fixing: decorateNav_ link href issue
9
+
10
+ ## 1.7.5
11
+
12
+ ### Patch Changes
13
+
14
+ - Modified: Label collection title -> text
15
+
3
16
  ## 1.7.4
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Resource } from 'i18next';
2
2
  import { Endpoint, AdminView, Locale as Locale$1, Config } from 'payload/config';
3
3
  import { Field, FieldBase, Tab, JSONField, Block as Block$1, FieldAffectingData, HookName, FieldHook as FieldHook$1, UIField as UIField$1 } from 'payload/dist/fields/config/types';
4
4
  import * as payload_types from 'payload/types';
5
- import { PayloadRequest, CollectionAfterChangeHook, CollectionAfterDeleteHook, TypeWithID, CollectionConfig, Block, GlobalConfig, RichTextField, RelationshipField, CheckboxField, BlockField, DateField, TextField, GroupField, Field as Field$1, UploadField, ArrayField, NumberField, FieldHook, SelectField, CollapsibleField, RowField, TabsField, UIField, EmailField, TextareaField, RadioField, CodeField, PointField, SanitizedCollectionConfig } from 'payload/types';
5
+ import { PayloadRequest, CollectionAfterChangeHook, CollectionAfterDeleteHook, TypeWithID, CollectionConfig, BeforeDuplicate, Block, GlobalConfig, RichTextField, RelationshipField, CheckboxField, BlockField, DateField, TextField, GroupField, Field as Field$1, UploadField, ArrayField, NumberField, FieldHook, SelectField, CollapsibleField, RowField, TabsField, UIField, EmailField, TextareaField, RadioField, CodeField, PointField, SanitizedCollectionConfig } from 'payload/types';
6
6
  import { IEntity, ILocale, ICategorized, IRoute, ICategory, IMarket, IMemoryStore, ILocalizable, IEquatable, IMedia, IPageRelation, ISchema, IMenuItem, IMenu } from '@websolutespa/bom-core';
7
7
  import * as payload_dist_admin_components_forms_FieldDescription_types from 'payload/dist/admin/components/forms/FieldDescription/types';
8
8
  import * as React from 'react';
@@ -111,6 +111,10 @@ declare const collectionImportPost: ((slug: string) => Endpoint);
111
111
  * Decorate record for with static collection data.
112
112
  */
113
113
  declare const afterCollectionReadHook: (collectionConfig: CollectionConfig) => CollectionConfig['hooks']['afterRead'][number];
114
+ /**
115
+ * Enforce unique field values during duplication.
116
+ */
117
+ declare const beforeDuplicateCollectionHook: BeforeDuplicate;
114
118
 
115
119
  declare function getLocale(req: PayloadRequest<any>): Promise<ILocale[]>;
116
120
  declare const localeGet: Endpoint;
@@ -273,6 +277,7 @@ type IUndecoratedMenuCustom = Record<string, unknown> & {
273
277
  blockType: string;
274
278
  };
275
279
  type IUndecoratedMenuItem = IUndecoratedMenuCategory | IUndecoratedMenuGroup | IUndecoratedMenuLink | IUndecoratedMenuPage | IUndecoratedMenuCustom;
280
+ type IUndecoratedNavItem = IUndecoratedMenuCategory | IUndecoratedMenuPage;
276
281
  type IUndecoratedMenu = {
277
282
  createdAt: Date;
278
283
  id: string;
@@ -432,12 +437,13 @@ declare function decorateMenuLink_(item: IUndecoratedMenuLink, categories: ICate
432
437
  declare function decorateMenuPage_(item: IUndecoratedMenuPage, categories: ICategory[], routes: IRoute[], market: string): IMenuItem;
433
438
  declare function decorateMenuRoute_(item: IRoute): IMenuItem;
434
439
  declare function decorateMenuItem_(item: IUndecoratedMenuItem, categories: ICategory[], routes: IRoute[], market: string, depth?: number): IMenuItem;
440
+ declare function decorateNavItem_(item: IUndecoratedNavItem, categories: ICategory[], routes: IRoute[], market: string, depth?: number): IMenuItem | IMenuItem[];
435
441
  declare function hasMarket(item: IUndecoratedMenuItem, market: string): boolean;
436
442
  declare function decorateMenu_(item: IUndecoratedMenu, context: MixerContext): Promise<IMenu>;
437
443
 
438
444
  declare function decorateNav_<T extends ISchema = ISchema>(item: T, slug: string, context: MixerContext): Promise<T>;
439
445
  declare function decorateNavs_<T extends ISchema = ISchema>(items: T[], slug: string, context: MixerContext): Promise<T[]>;
440
- declare function isUndecoratedMenuItem(item: unknown): item is IUndecoratedMenuItem;
446
+ declare function isUndecoratedNavItem(item: unknown): item is IUndecoratedNavItem;
441
447
  declare function isRelation(item: unknown): item is IRelation;
442
448
  type IRelation = {
443
449
  relationTo: string;
@@ -1122,4 +1128,4 @@ declare const Logo: React__default.FC;
1122
1128
 
1123
1129
  declare function webpack(sourceConfig: BowlConfig): (config: any) => any;
1124
1130
 
1125
- export { ActionDefault, BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlConfig, BowlField, BowlGlobal, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlPlugin, BowlRole, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryMenu, CategoryMenuProps, CategoryTree, CategoryTreeProps, CheckboxDefaults, CollectionDefault, CollectionHelper, CollectionHook, CollectionHookName, CollectionHooks, ColorCell, ColorConfig, ColorField, ComponentsDefaults, CustomEditModal, CustomEditModalProps, DataField, DataTree, DataTreeDragItem, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, GlobalDefault, GlobalHelper, GlobalHook, GlobalHookName, GlobalHooks, GroupKey, IBulkAction, IBulkRecord, ICache, IImportItem, IPage, IPageFull, IPagination, IRelation, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, KeyMapper, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, MenuItem, MixerContext, Option, OrderDefaults, PRESENTATION_FIELDS, PageDefault, PresentationField, PublicURL, Publish, RelatedDefaults, RichTextDefaults, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TextDefaults, TreeItems, UIStaticCell, UIStaticField, UserRolesDefaults, WithAbstract, WithAbstractProps, WithAction, WithActionProps, WithBlock, WithBlockProps, WithCategory, WithCategoryProps, WithCheckbox, WithCheckboxProps, WithCollection, WithCollectionProps, WithColor, WithColorProps, WithComponents, WithComponentsProps, WithDate, WithDateProps, WithDescription, WithDescriptionProps, WithGlobal, WithGlobalProps, WithId, WithIdProps, WithIsActive, WithIsActiveProps, WithIsDefault, WithIsDefaultProps, WithLink, WithLinkOptions, WithLinkProps, WithMarkets, WithMarketsProps, WithMedia, WithMediaProps, WithMedias, WithMediasProps, WithMenu, WithMenuProps, WithName, WithNameProps, WithOrder, WithOrderProps, WithPage, WithPageProps, WithRelated, WithRelatedProps, WithRichText, WithRichTextProps, WithRoles, WithRolesProps, WithSelect, WithSelectProps, WithSlug, WithSlugProps, WithStatic, WithStaticProps, WithTemplate, WithTemplateProps, WithText, WithTextProps, WithTitle, WithTitleProps, afterCategoryChangeHook, afterCategoryDeleteHook, afterCollectionReadHook, afterMenuReadHook, afterPageChangeHook, afterPageDeleteHook, afterPageReadHook, appearanceOptions, beforeValidate, bowl, collectionBulkPatch, collectionExportGet, collectionImportPost, collectionIndexGet, collectionUpdatePatch, debugField, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateMenuCategory_, decorateMenuGroup_, decorateMenuItem_, decorateMenuLink_, decorateMenuPage_, decorateMenuRoute_, decorateMenu_, decorateNav_, decorateNavs_, decorateSchema_, decorateSchemas_, deepMerge, bowl as default, defaultGroup, defaultLocale, defaultLocales, defaultMarket, defaultSlug, eachDataField, eachField, encryptData, fetchCollection, fetchCollectionItems, fetchEndpoint, fetchGlobal, fetchGlobalItems, formatSlug, getApiUrl, getCollectionItem, getCollectionItems, getEachMarketLocale, getGlobalItems, getLivePreviewURL, getLocale, getNumericParam, getObjectParam, getPages, getPagination, getPreviewURL, getPublicURL, getRoute, getRouteByCategoryAndLocale, getRouteByItemAndLocale, getRoutes, getSearchUrl, getStaticLoader, getStore, getStringParam, getSubRequest, getTranslation, getTranslations, getTreeItemClassName, hasMarket, hasRole, importExportListWithParser, internalSlugs, isAdmin, isDataField, isObject, isPresentationField, isRelation, isRole, isUndecoratedMenuItem, keyWithRequest, localeGet, localizeCollection, localizeItem, log, logMissingTranslations, menuDetailGet, menuIndexGet, modalSlug, optinPost, options, pageDetailGet, pageIndexGet, parseDepth, populateStaticFields, redirectParser, richTextAfterReadHook, richTextSerialize, roles, routeGet, routePost, routePostHandler, setMixerContext, slugToLabel, slugToLabels, sortByGroup, sortCollection, staticCollectionLoaders, staticCollections, staticDetailGet, staticIndexGet, storeGet, textToSlug, toBlock, toCollection, toField, toGlobal, toTab, translateBlock, translateBlocks, translateCollection, translateField, translateFields, translateGlobal, translateTab, translateTabs, webpack, whereCollection, withAbstract, withAbstractRequired, withAction, withBlock, withCategory, withCategoryRequired, withCheckbox, withCheckboxRequired, withCollection, withCollectionHook, withColor, withColorRequired, withComponents, withDate, withDateRequired, withDescription, withDescriptionRequired, withFieldHook, withGlobal, withGlobalHook, withId, withIdRequired, withIsActive, withIsActiveRequired, withIsDefault, withIsDefaultRequired, withLink, withLocalizedDescription, withMarkets, withMarketsRequired, withMedia, withMediaRequired, withMedias, withMediasRequired, withMenu, withName, withNameRequired, withOrder, withOrderRequired, withPage, withRelated, withRichText, withRichTextRequired, withRoles, withSelect, withSelectRequired, withSlug, withSlugRequired, withStaticCollection, withTemplate, withTemplateRequired, withText, withTextRequired, withTitle, withTitleRequired, withUIStatic };
1131
+ export { ActionDefault, BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlConfig, BowlField, BowlGlobal, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlPlugin, BowlRole, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryMenu, CategoryMenuProps, CategoryTree, CategoryTreeProps, CheckboxDefaults, CollectionDefault, CollectionHelper, CollectionHook, CollectionHookName, CollectionHooks, ColorCell, ColorConfig, ColorField, ComponentsDefaults, CustomEditModal, CustomEditModalProps, DataField, DataTree, DataTreeDragItem, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, GlobalDefault, GlobalHelper, GlobalHook, GlobalHookName, GlobalHooks, GroupKey, IBulkAction, IBulkRecord, ICache, IImportItem, IPage, IPageFull, IPagination, IRelation, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, IUndecoratedNavItem, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, KeyMapper, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, MenuItem, MixerContext, Option, OrderDefaults, PRESENTATION_FIELDS, PageDefault, PresentationField, PublicURL, Publish, RelatedDefaults, RichTextDefaults, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TextDefaults, TreeItems, UIStaticCell, UIStaticField, UserRolesDefaults, WithAbstract, WithAbstractProps, WithAction, WithActionProps, WithBlock, WithBlockProps, WithCategory, WithCategoryProps, WithCheckbox, WithCheckboxProps, WithCollection, WithCollectionProps, WithColor, WithColorProps, WithComponents, WithComponentsProps, WithDate, WithDateProps, WithDescription, WithDescriptionProps, WithGlobal, WithGlobalProps, WithId, WithIdProps, WithIsActive, WithIsActiveProps, WithIsDefault, WithIsDefaultProps, WithLink, WithLinkOptions, WithLinkProps, WithMarkets, WithMarketsProps, WithMedia, WithMediaProps, WithMedias, WithMediasProps, WithMenu, WithMenuProps, WithName, WithNameProps, WithOrder, WithOrderProps, WithPage, WithPageProps, WithRelated, WithRelatedProps, WithRichText, WithRichTextProps, WithRoles, WithRolesProps, WithSelect, WithSelectProps, WithSlug, WithSlugProps, WithStatic, WithStaticProps, WithTemplate, WithTemplateProps, WithText, WithTextProps, WithTitle, WithTitleProps, afterCategoryChangeHook, afterCategoryDeleteHook, afterCollectionReadHook, afterMenuReadHook, afterPageChangeHook, afterPageDeleteHook, afterPageReadHook, appearanceOptions, beforeDuplicateCollectionHook, beforeValidate, bowl, collectionBulkPatch, collectionExportGet, collectionImportPost, collectionIndexGet, collectionUpdatePatch, debugField, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateMenuCategory_, decorateMenuGroup_, decorateMenuItem_, decorateMenuLink_, decorateMenuPage_, decorateMenuRoute_, decorateMenu_, decorateNavItem_, decorateNav_, decorateNavs_, decorateSchema_, decorateSchemas_, deepMerge, bowl as default, defaultGroup, defaultLocale, defaultLocales, defaultMarket, defaultSlug, eachDataField, eachField, encryptData, fetchCollection, fetchCollectionItems, fetchEndpoint, fetchGlobal, fetchGlobalItems, formatSlug, getApiUrl, getCollectionItem, getCollectionItems, getEachMarketLocale, getGlobalItems, getLivePreviewURL, getLocale, getNumericParam, getObjectParam, getPages, getPagination, getPreviewURL, getPublicURL, getRoute, getRouteByCategoryAndLocale, getRouteByItemAndLocale, getRoutes, getSearchUrl, getStaticLoader, getStore, getStringParam, getSubRequest, getTranslation, getTranslations, getTreeItemClassName, hasMarket, hasRole, importExportListWithParser, internalSlugs, isAdmin, isDataField, isObject, isPresentationField, isRelation, isRole, isUndecoratedNavItem, keyWithRequest, localeGet, localizeCollection, localizeItem, log, logMissingTranslations, menuDetailGet, menuIndexGet, modalSlug, optinPost, options, pageDetailGet, pageIndexGet, parseDepth, populateStaticFields, redirectParser, richTextAfterReadHook, richTextSerialize, roles, routeGet, routePost, routePostHandler, setMixerContext, slugToLabel, slugToLabels, sortByGroup, sortCollection, staticCollectionLoaders, staticCollections, staticDetailGet, staticIndexGet, storeGet, textToSlug, toBlock, toCollection, toField, toGlobal, toTab, translateBlock, translateBlocks, translateCollection, translateField, translateFields, translateGlobal, translateTab, translateTabs, webpack, whereCollection, withAbstract, withAbstractRequired, withAction, withBlock, withCategory, withCategoryRequired, withCheckbox, withCheckboxRequired, withCollection, withCollectionHook, withColor, withColorRequired, withComponents, withDate, withDateRequired, withDescription, withDescriptionRequired, withFieldHook, withGlobal, withGlobalHook, withId, withIdRequired, withIsActive, withIsActiveRequired, withIsDefault, withIsDefaultRequired, withLink, withLocalizedDescription, withMarkets, withMarketsRequired, withMedia, withMediaRequired, withMedias, withMediasRequired, withMenu, withName, withNameRequired, withOrder, withOrderRequired, withPage, withRelated, withRichText, withRichTextRequired, withRoles, withSelect, withSelectRequired, withSlug, withSlugRequired, withStaticCollection, withTemplate, withTemplateRequired, withText, withTextRequired, withTitle, withTitleRequired, withUIStatic };
package/dist/index.js CHANGED
@@ -247,6 +247,7 @@ __export(src_exports, {
247
247
  afterPageDeleteHook: () => afterPageDeleteHook,
248
248
  afterPageReadHook: () => afterPageReadHook,
249
249
  appearanceOptions: () => appearanceOptions,
250
+ beforeDuplicateCollectionHook: () => beforeDuplicateCollectionHook,
250
251
  beforeValidate: () => beforeValidate,
251
252
  bowl: () => bowl,
252
253
  collectionBulkPatch: () => collectionBulkPatch,
@@ -266,6 +267,7 @@ __export(src_exports, {
266
267
  decorateMenuPage_: () => decorateMenuPage_,
267
268
  decorateMenuRoute_: () => decorateMenuRoute_,
268
269
  decorateMenu_: () => decorateMenu_,
270
+ decorateNavItem_: () => decorateNavItem_,
269
271
  decorateNav_: () => decorateNav_,
270
272
  decorateNavs_: () => decorateNavs_,
271
273
  decorateSchema_: () => decorateSchema_,
@@ -321,7 +323,7 @@ __export(src_exports, {
321
323
  isPresentationField: () => isPresentationField,
322
324
  isRelation: () => isRelation,
323
325
  isRole: () => isRole,
324
- isUndecoratedMenuItem: () => isUndecoratedMenuItem,
326
+ isUndecoratedNavItem: () => isUndecoratedNavItem,
325
327
  keyWithRequest: () => keyWithRequest,
326
328
  localeGet: () => localeGet,
327
329
  localizeCollection: () => localizeCollection,
@@ -672,6 +674,7 @@ var import_react_toastify2 = require("react-toastify");
672
674
 
673
675
  // src/core/api/collection.service.ts
674
676
  var Papa = __toESM(require("papaparse"));
677
+ var import_uuid = require("uuid");
675
678
 
676
679
  // src/translations.ts
677
680
  var translations = {
@@ -2122,6 +2125,20 @@ var afterCollectionReadHook = /* @__PURE__ */ __name((collectionConfig) => async
2122
2125
  }
2123
2126
  return doc;
2124
2127
  }, "afterCollectionReadHook");
2128
+ var beforeDuplicateCollectionHook = /* @__PURE__ */ __name(async ({
2129
+ data,
2130
+ collection
2131
+ }) => {
2132
+ data = {
2133
+ ...data
2134
+ };
2135
+ collection.fields.forEach((field) => {
2136
+ if (isDataField(field) && field.unique) {
2137
+ data[field.name] = `${data[field.name]}-${(0, import_uuid.v4)()}`;
2138
+ }
2139
+ });
2140
+ return data;
2141
+ }, "beforeDuplicateCollectionHook");
2125
2142
 
2126
2143
  // src/components/DataTree/DataTree.tsx
2127
2144
  var import_bom_core3 = require("@websolutespa/bom-core");
@@ -3724,13 +3741,10 @@ function decorateMenuLink_(item, categories, routes, market) {
3724
3741
  }
3725
3742
  __name(decorateMenuLink_, "decorateMenuLink_");
3726
3743
  function decorateMenuPage_(item, categories, routes, market) {
3727
- let href = item.href;
3728
- if (!href) {
3729
- const route = routes.find(
3730
- (x) => x.schema === item.page.relationTo && x.page === item.page.value.id
3731
- );
3732
- href = route?.id;
3733
- }
3744
+ const route = routes.find(
3745
+ (x) => x.schema === item.page.relationTo && x.page === item.page.value.id
3746
+ );
3747
+ const href = route?.id;
3734
3748
  const schema = item.schema || item.page.relationTo;
3735
3749
  const page = item.page.value;
3736
3750
  const decoratedItem = {
@@ -3781,6 +3795,26 @@ function decorateMenuItem_(item, categories, routes, market, depth = 0) {
3781
3795
  }
3782
3796
  }
3783
3797
  __name(decorateMenuItem_, "decorateMenuItem_");
3798
+ function decorateNavItem_(item, categories, routes, market, depth = 0) {
3799
+ switch (item.type) {
3800
+ case "category":
3801
+ return decorateMenuCategory_(item, categories, routes, market, depth);
3802
+ case "page":
3803
+ if (Array.isArray(item.page.value)) {
3804
+ return item.page.value.map((x) => {
3805
+ return decorateMenuPage_({
3806
+ ...item,
3807
+ page: {
3808
+ ...item.page,
3809
+ value: x
3810
+ }
3811
+ }, categories, routes, market);
3812
+ });
3813
+ }
3814
+ return decorateMenuPage_(item, categories, routes, market);
3815
+ }
3816
+ }
3817
+ __name(decorateNavItem_, "decorateNavItem_");
3784
3818
  function hasMarket(item, market) {
3785
3819
  return Array.isArray(item.markets) ? item.markets.includes(market) : true;
3786
3820
  }
@@ -3820,16 +3854,16 @@ function parseNavs_(item, context) {
3820
3854
  const { market, locale, routes, categories } = context;
3821
3855
  if ((0, import_bom_core6.isArray)(item)) {
3822
3856
  item.forEach((v, k) => {
3823
- if (isUndecoratedMenuItem(v)) {
3824
- item[k] = decorateMenuItem_(v, categories, routes, market);
3857
+ if (isUndecoratedNavItem(v)) {
3858
+ item[k] = decorateNavItem_(v, categories, routes, market);
3825
3859
  } else {
3826
3860
  parseNavs_(v, context);
3827
3861
  }
3828
3862
  });
3829
3863
  } else if ((0, import_bom_core6.isObject)(item)) {
3830
3864
  Object.entries(item).forEach(([k, v]) => {
3831
- if (isUndecoratedMenuItem(v)) {
3832
- item[k] = decorateMenuItem_(v, categories, routes, market);
3865
+ if (isUndecoratedNavItem(v)) {
3866
+ item[k] = decorateNavItem_(v, categories, routes, market);
3833
3867
  } else {
3834
3868
  parseNavs_(v, context);
3835
3869
  }
@@ -3837,10 +3871,10 @@ function parseNavs_(item, context) {
3837
3871
  }
3838
3872
  }
3839
3873
  __name(parseNavs_, "parseNavs_");
3840
- function isUndecoratedMenuItem(item) {
3874
+ function isUndecoratedNavItem(item) {
3841
3875
  return (0, import_bom_core6.isObject)(item) && (item.type === "category" && ((0, import_bom_core6.isEquatable)(item.category) || (0, import_bom_core6.isObject)(item.category)) || item.type === "page" && isRelation(item.page));
3842
3876
  }
3843
- __name(isUndecoratedMenuItem, "isUndecoratedMenuItem");
3877
+ __name(isUndecoratedNavItem, "isUndecoratedNavItem");
3844
3878
  function isRelation(item) {
3845
3879
  return (0, import_bom_core6.isObject)(item) && (0, import_bom_core6.isNotNullString)(item.relationTo) && ((0, import_bom_core6.isObject)(item.value) || (0, import_bom_core6.isArray)(item.value));
3846
3880
  }
@@ -4407,12 +4441,12 @@ var Label = /* @__PURE__ */ __name((options2) => ({
4407
4441
  admin: {
4408
4442
  group: options2.group.config,
4409
4443
  useAsTitle: "id",
4410
- defaultColumns: ["id", "title"]
4444
+ defaultColumns: ["id", "text"]
4411
4445
  },
4412
4446
  fields: [
4413
4447
  // inherited fields: id, createdAt, updatedAt
4414
4448
  { type: "withId", required: true },
4415
- { type: "withTitle", required: true }
4449
+ { type: "withText", required: true, localized: true }
4416
4450
  ]
4417
4451
  }), "Label");
4418
4452
 
@@ -5314,6 +5348,9 @@ var withAction = /* @__PURE__ */ __name((config) => {
5314
5348
  return data;
5315
5349
  });
5316
5350
  withCollectionHook(actionConfig, "afterRead", afterCollectionReadHook(actionConfig));
5351
+ actionConfig.admin.hooks = {
5352
+ beforeDuplicate: beforeDuplicateCollectionHook
5353
+ };
5317
5354
  translateCollection(actionConfig);
5318
5355
  encryptData(actionConfig);
5319
5356
  return actionConfig;
@@ -5353,6 +5390,9 @@ var withCollection = /* @__PURE__ */ __name((config) => {
5353
5390
  ];
5354
5391
  }
5355
5392
  withCollectionHook(collectionConfig, "afterRead", afterCollectionReadHook(collectionConfig));
5393
+ collectionConfig.admin.hooks = {
5394
+ beforeDuplicate: beforeDuplicateCollectionHook
5395
+ };
5356
5396
  translateCollection(collectionConfig);
5357
5397
  return collectionConfig;
5358
5398
  }, "withCollection");
@@ -6152,6 +6192,9 @@ var withPage = /* @__PURE__ */ __name((config) => {
6152
6192
  withCollectionHook(pageConfig, "afterChange", afterPageChangeHook);
6153
6193
  withCollectionHook(pageConfig, "afterDelete", afterPageDeleteHook);
6154
6194
  withCollectionHook(pageConfig, "afterRead", afterPageReadHook(config.slug));
6195
+ pageConfig.admin.hooks = {
6196
+ beforeDuplicate: beforeDuplicateCollectionHook
6197
+ };
6155
6198
  translateCollection(pageConfig);
6156
6199
  return pageConfig;
6157
6200
  }, "withPage");
@@ -6972,6 +7015,7 @@ var src_default = bowl;
6972
7015
  afterPageDeleteHook,
6973
7016
  afterPageReadHook,
6974
7017
  appearanceOptions,
7018
+ beforeDuplicateCollectionHook,
6975
7019
  beforeValidate,
6976
7020
  bowl,
6977
7021
  collectionBulkPatch,
@@ -6991,6 +7035,7 @@ var src_default = bowl;
6991
7035
  decorateMenuPage_,
6992
7036
  decorateMenuRoute_,
6993
7037
  decorateMenu_,
7038
+ decorateNavItem_,
6994
7039
  decorateNav_,
6995
7040
  decorateNavs_,
6996
7041
  decorateSchema_,
@@ -7045,7 +7090,7 @@ var src_default = bowl;
7045
7090
  isPresentationField,
7046
7091
  isRelation,
7047
7092
  isRole,
7048
- isUndecoratedMenuItem,
7093
+ isUndecoratedNavItem,
7049
7094
  keyWithRequest,
7050
7095
  localeGet,
7051
7096
  localizeCollection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/payload-plugin-bowl",
3
- "version": "1.7.4",
3
+ "version": "1.7.6",
4
4
  "description": "Bowl PayloadCms plugin of the BOM Repository",
5
5
  "keywords": [
6
6
  "payload",