@websolutespa/payload-plugin-bowl 1.0.1 → 1.0.4
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 +82 -63
- package/dist/index.d.ts +27 -13
- package/dist/index.js +242 -122
- package/package.json +2 -2
- package/scss/styles.scss +48 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,63 +1,82 @@
|
|
|
1
|
-
# @websolutespa/payload-plugin-bowl
|
|
2
|
-
|
|
3
|
-
## 1.0.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
-
|
|
21
|
-
|
|
22
|
-
## 0.
|
|
23
|
-
|
|
24
|
-
###
|
|
25
|
-
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
## 0.
|
|
54
|
-
|
|
55
|
-
### Minor Changes
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
## 0.0
|
|
60
|
-
|
|
61
|
-
###
|
|
62
|
-
|
|
63
|
-
- Added:
|
|
1
|
+
# @websolutespa/payload-plugin-bowl
|
|
2
|
+
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixing: storeGet endpoint locale.
|
|
8
|
+
|
|
9
|
+
## 1.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Modified: withPage preview, getApiUrl.
|
|
14
|
+
|
|
15
|
+
## 1.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Added: duration to withStaticCollection.
|
|
20
|
+
- Fixing: eachField.
|
|
21
|
+
|
|
22
|
+
## 1.0.1
|
|
23
|
+
|
|
24
|
+
### Minor Changes
|
|
25
|
+
|
|
26
|
+
- Added: CategoryTree.
|
|
27
|
+
- Fixing: sass.
|
|
28
|
+
|
|
29
|
+
## 0.5.0
|
|
30
|
+
|
|
31
|
+
### Minor Changes
|
|
32
|
+
|
|
33
|
+
- Modified routes, added redirects.
|
|
34
|
+
|
|
35
|
+
## 0.4.0
|
|
36
|
+
|
|
37
|
+
### Minor Changes
|
|
38
|
+
|
|
39
|
+
- Removed: external dependency @websolutespa/payload-plugin-localization.
|
|
40
|
+
|
|
41
|
+
## 0.3.2
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- Fixing: avoid categories circular reference.
|
|
46
|
+
|
|
47
|
+
## 0.3.1
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- Modified: ILocalizable.
|
|
52
|
+
|
|
53
|
+
## 0.3.0
|
|
54
|
+
|
|
55
|
+
### Minor Changes
|
|
56
|
+
|
|
57
|
+
- Added: splat routes.
|
|
58
|
+
|
|
59
|
+
## 0.2.0
|
|
60
|
+
|
|
61
|
+
### Minor Changes
|
|
62
|
+
|
|
63
|
+
- Added: menu, @websolutespa/bom-core.
|
|
64
|
+
|
|
65
|
+
## 0.1.1
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- Modified: route service.
|
|
70
|
+
- Added: white label.
|
|
71
|
+
|
|
72
|
+
## 0.1.0
|
|
73
|
+
|
|
74
|
+
### Minor Changes
|
|
75
|
+
|
|
76
|
+
- mock refactor.
|
|
77
|
+
|
|
78
|
+
## 0.0.1
|
|
79
|
+
|
|
80
|
+
### Patch Changes
|
|
81
|
+
|
|
82
|
+
- Added: first release.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Endpoint, AdminRoute, Config } from 'payload/config';
|
|
2
2
|
import { Resource } from 'i18next';
|
|
3
3
|
import * as payload_dist_fields_config_types from 'payload/dist/fields/config/types';
|
|
4
|
-
import { Field, FieldHookArgs, Tab, JSONField, FieldAffectingData, HookName, FieldHook as FieldHook$1, FieldBase, UIField as UIField$1 } from 'payload/dist/fields/config/types';
|
|
4
|
+
import { Field, FieldHookArgs, Tab, JSONField, Block as Block$1, FieldAffectingData, HookName, FieldHook as FieldHook$1, FieldBase, UIField as UIField$1 } from 'payload/dist/fields/config/types';
|
|
5
5
|
import * as payload_types from 'payload/types';
|
|
6
6
|
import { PayloadRequest, CollectionAfterChangeHook, CollectionAfterDeleteHook, Block, CollectionConfig, 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';
|
|
7
7
|
import { IEntity, ILocale, ILocalizable, IEquatable, IMedia, ICategory, IPageRelation, IMenu, IRoute, IMenuItem, ISchema, ICategorized, IMarket, IMemoryStore } from '@websolutespa/bom-core';
|
|
@@ -23,12 +23,13 @@ type ICache<T = any> = {
|
|
|
23
23
|
data: T;
|
|
24
24
|
};
|
|
25
25
|
type InMemoryCacheOptions = {
|
|
26
|
-
duration?: number;
|
|
26
|
+
duration?: number | false;
|
|
27
27
|
};
|
|
28
28
|
declare class InMemoryCache<T = any> {
|
|
29
|
-
duration: number;
|
|
29
|
+
duration: number | false;
|
|
30
30
|
cache: Map<string, ICache<T>>;
|
|
31
31
|
constructor(options?: InMemoryCacheOptions);
|
|
32
|
+
private isExpired_;
|
|
32
33
|
has(key: string): boolean;
|
|
33
34
|
get(key: string): T;
|
|
34
35
|
set(key: string, data: T): void;
|
|
@@ -338,19 +339,21 @@ type StaticCollectionSrc = string | Option[] | ((config: CollectionConfig) => Op
|
|
|
338
339
|
type StaticCollectionConfig = {
|
|
339
340
|
src: StaticCollectionSrc;
|
|
340
341
|
map?: KeyMapper;
|
|
342
|
+
duration?: number | false;
|
|
341
343
|
};
|
|
342
344
|
declare function whereCollection<T = IEntity>(items: T[], where?: {
|
|
343
345
|
[key: string]: any;
|
|
344
346
|
}): Promise<T[]>;
|
|
345
347
|
declare function populateStaticFields<T = IEntity>(item: T, fields: Field[], locale?: string): Promise<T>;
|
|
346
348
|
declare function localizeCollection<T = IEntity>(items: T[], localizedFields: string[], locale?: string): Promise<T[]>;
|
|
349
|
+
declare function sortCollection<T = IEntity>(items: T[], sort?: string): Promise<T[]>;
|
|
347
350
|
declare function getStaticLoader(slug: string): any;
|
|
348
351
|
declare const StaticCollectionDefault: Partial<CollectionConfig>;
|
|
349
352
|
/**
|
|
350
353
|
* @param {CollectionConfig & StaticCollectionConfig} config
|
|
351
354
|
* @returns {CollectionConfig} Return a `CollectionConfig` from static or remote dataset.
|
|
352
355
|
*/
|
|
353
|
-
declare const withStaticCollection: ({ src, map, ...config }: WithStaticProps) => CollectionConfig;
|
|
356
|
+
declare const withStaticCollection: ({ src, map, duration, ...config }: WithStaticProps) => CollectionConfig;
|
|
354
357
|
|
|
355
358
|
type WithAbstractProps = (Omit<RichTextField, 'type' | 'name'> & {
|
|
356
359
|
name?: string;
|
|
@@ -609,8 +612,9 @@ declare function log(...rest: unknown[]): void;
|
|
|
609
612
|
|
|
610
613
|
declare const defaultSlug: BowlSlug;
|
|
611
614
|
declare const defaultGroup: BowlGroup;
|
|
612
|
-
declare const defaultLocales: string[];
|
|
613
615
|
declare const defaultLocale = "en";
|
|
616
|
+
declare const defaultLocales: string[];
|
|
617
|
+
declare const defaultMarket = "ww";
|
|
614
618
|
declare const options: BowlOptions;
|
|
615
619
|
declare const internalSlugs: string[];
|
|
616
620
|
|
|
@@ -650,13 +654,19 @@ declare function isObject(item: unknown): boolean;
|
|
|
650
654
|
*/
|
|
651
655
|
declare function deepMerge<T, R = T>(target: Partial<T>, source: Partial<R>): T & R;
|
|
652
656
|
|
|
653
|
-
type PresentationField =
|
|
657
|
+
type PresentationField = CollapsibleField | RowField | TabsField | UIField;
|
|
654
658
|
declare const PRESENTATION_FIELDS: string[];
|
|
655
659
|
declare function isPresentationField(field: Field$1): field is PresentationField;
|
|
656
660
|
type DataField = JSONField | TextField | NumberField | EmailField | TextareaField | CheckboxField | DateField | BlockField | RadioField | RelationshipField | ArrayField | RichTextField | SelectField | UploadField | CodeField | PointField;
|
|
657
661
|
declare function isDataField(field: Field$1): field is DataField;
|
|
658
|
-
|
|
659
|
-
|
|
662
|
+
type eachFieldAcc = {
|
|
663
|
+
maxDepth: number;
|
|
664
|
+
depth: number;
|
|
665
|
+
paths: string[];
|
|
666
|
+
parent?: Field$1 | Block$1 | Tab;
|
|
667
|
+
};
|
|
668
|
+
declare function eachField(fields: Field$1[], callback: (field: Field$1, paths: string[], parent?: Field$1 | Block$1 | Tab) => boolean | void, options?: number | eachFieldAcc): boolean | void;
|
|
669
|
+
declare function eachDataField(fields: Field$1[], callback: (field: DataField, paths: string[], parent?: Field$1 | Block$1 | Tab) => boolean | void, maxDepth?: number): boolean | void;
|
|
660
670
|
|
|
661
671
|
declare function textToSlug(value: string): string;
|
|
662
672
|
declare const formatSlug: (fallback: string) => FieldHook;
|
|
@@ -811,22 +821,24 @@ type BowlGroup = {
|
|
|
811
821
|
};
|
|
812
822
|
type BowlOptions = {
|
|
813
823
|
collections: string[];
|
|
814
|
-
|
|
815
|
-
|
|
824
|
+
defaultLocale: string;
|
|
825
|
+
defaultMarket: string;
|
|
816
826
|
group: BowlGroup;
|
|
817
827
|
locales: string[];
|
|
818
828
|
menu: {
|
|
819
829
|
blocks: BowlBlock[];
|
|
820
830
|
};
|
|
821
|
-
|
|
831
|
+
pages: string[];
|
|
832
|
+
slug: BowlSlug;
|
|
822
833
|
translations: Resource;
|
|
823
834
|
};
|
|
824
835
|
type BowlInitOptions = {
|
|
825
|
-
|
|
836
|
+
defaultMarket?: string;
|
|
826
837
|
group?: Partial<BowlGroup>;
|
|
827
838
|
menu?: {
|
|
828
839
|
blocks: BowlBlock[];
|
|
829
840
|
};
|
|
841
|
+
slug?: Partial<BowlSlug>;
|
|
830
842
|
};
|
|
831
843
|
|
|
832
844
|
declare const bowl: (sourceOptions?: BowlInitOptions) => (sourceConfig: BowlConfig) => Config;
|
|
@@ -937,4 +949,6 @@ declare const Icon: React__default.FC;
|
|
|
937
949
|
|
|
938
950
|
declare const Logo: React__default.FC;
|
|
939
951
|
|
|
940
|
-
|
|
952
|
+
declare function webpack(sourceConfig: BowlConfig): (config: any) => any;
|
|
953
|
+
|
|
954
|
+
export { BlockDefaults, BowlArrayField, BowlBlock, BowlBlockField, BowlCollapsibleField, BowlCollection, BowlConfig, BowlField, BowlGlobal, BowlGroup, BowlGroupField, BowlInitOptions, BowlOptions, BowlRowField, BowlSlug, BowlTab, BowlTabsField, CategoryDefaults, CategoryList, CategoryListProps, CategoryTree, CategoryTreeProps, CheckboxDefaults, CollectionDefault, CollectionHelper, CollectionHook, CollectionHookName, CollectionHooks, ColorCell, ColorConfig, ColorField, ComponentsDefaults, DataField, DataTree, DataTreeDragItem, DataTreeItem, DataTreeItemLi, DataTreeItemProps, DataTreeProps, DataTreeProvider, DataTreeRenameItem, DateDefaults, DebugField, DecoratedList, DecoratedListProps, EditModal, EditModalProps, GlobalDefault, GlobalHelper, GlobalHook, GlobalHookName, GlobalHooks, IBulkAction, IBulkRecord, ICache, IImportItem, IPage, IPageFull, IPagination, IUndecoratedMenu, IUndecoratedMenuBase, IUndecoratedMenuCategory, IUndecoratedMenuCustom, IUndecoratedMenuGroup, IUndecoratedMenuItem, IUndecoratedMenuLink, IUndecoratedMenuPage, Icon, ImportExportList, ImportExportListProps, ImportExportRedirectList, ImportLogInvalidTypes, ImportLogType, ImportMode, InMemoryCache, InMemoryCacheOptions, LeaveModal, LeaveWithoutSavingModal, LeaveWithoutSavingModalProps, LocalizedDescription, LocalizedDescriptionProps, Logo, MAX_INT, MarketDefaults, MediaDefaults, MediasDefaults, Option, OrderDefaults, PRESENTATION_FIELDS, PageDefault, PresentationField, Publish, RelatedDefaults, RichTextDefaults, Save, SaveDraft, SelectDefaults, StaticCollectionConfig, StaticCollectionDefault, TemplateDefaults, TextDefaults, TreeItems, UIStaticCell, UIStaticField, WithAbstract, WithAbstractProps, 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, WithSelect, WithSelectProps, WithSlug, WithSlugProps, WithStatic, WithStaticProps, WithTemplate, WithTemplateProps, WithText, WithTextProps, WithTitle, WithTitleProps, afterCategoryChangeHook, afterCategoryDeleteHook, afterPageChangeHook, afterPageDeleteHook, appearanceOptions, beforeValidate, bowl, collectionBulkPatch, collectionExportGet, collectionImportPost, collectionIndexGet, collectionUpdatePatch, debugField, decorateHref, decorateHrefs, decorateMenu, decorateMenuCategory, decorateMenuGroup, decorateMenuItem, decorateMenuLink, decorateMenuPage, decorateMenuRoute, decorateMenus, deepMerge, bowl as default, defaultGroup, defaultLocale, defaultLocales, defaultMarket, defaultSlug, eachDataField, eachField, fetchCollection, fetchCollectionItems, fetchEachMarketLocale, fetchEndpoint, fetchGlobal, fetchGlobalItems, fetchPages, formatSlug, getApiUrl, getCollectionItem, getCollectionItems, getLocale, getLocales, getMarkets, getNumericParam, getObjectParam, getPagination, getRoute, getRouteByCategoryAndLocale, getRouteByItemAndLocale, getRoutes, getSearchUrl, getStaticLoader, getStore, getStringParam, getTranslation, getTranslations, getTreeItemClassName, hasMarket, importExportListWithParser, internalSlugs, isAdmin, isDataField, isObject, isPresentationField, keyWithRequest, localeGet, localizeCollection, log, logMissingTranslations, menuDetailGet, menuIndexGet, modalSlug, options, pageDetailGet, pageIndexGet, parseDepth, populateStaticFields, redirectParser, richTextAfterReadHook, richTextSerialize, routeGet, routePost, routePostHandler, slugToLabel, slugToLabels, sortCollection, storeGet, textToSlug, toBlock, toCollection, toField, toGlobal, toTab, translateBlock, translateBlocks, translateCollection, translateField, translateFields, translateGlobal, translateTab, translateTabs, validateHexColor, webpack, whereCollection, withAbstract, withAbstractRequired, 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, withSelect, withSelectRequired, withSlug, withSlugRequired, withStaticCollection, withTemplate, withTemplateRequired, withText, withTextRequired, withTitle, withTitleRequired, withUIStatic };
|
package/dist/index.js
CHANGED
|
@@ -83,7 +83,7 @@ var init_Save = __esm({
|
|
|
83
83
|
});
|
|
84
84
|
|
|
85
85
|
// src/components/SaveDraft/SaveDraft.tsx
|
|
86
|
-
var import_forms3, import_utilities3, import_Submit3, import_react4, import_react_i18next3, import_jsx_runtime6,
|
|
86
|
+
var import_forms3, import_utilities3, import_Submit3, import_react4, import_react_i18next3, import_jsx_runtime6, SaveDraft;
|
|
87
87
|
var init_SaveDraft = __esm({
|
|
88
88
|
"src/components/SaveDraft/SaveDraft.tsx"() {
|
|
89
89
|
import_forms3 = require("payload/components/forms");
|
|
@@ -92,7 +92,6 @@ var init_SaveDraft = __esm({
|
|
|
92
92
|
import_react4 = require("react");
|
|
93
93
|
import_react_i18next3 = require("react-i18next");
|
|
94
94
|
import_jsx_runtime6 = require("react/jsx-runtime");
|
|
95
|
-
baseClass = "save-draft";
|
|
96
95
|
SaveDraft = /* @__PURE__ */ __name(() => {
|
|
97
96
|
const { serverURL, routes: { api } } = (0, import_utilities3.useConfig)();
|
|
98
97
|
const { submit } = (0, import_forms3.useForm)();
|
|
@@ -122,13 +121,13 @@ var init_SaveDraft = __esm({
|
|
|
122
121
|
}
|
|
123
122
|
});
|
|
124
123
|
}, [submit, collection, global, serverURL, api, locale, id]);
|
|
125
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Submit3.default, { className:
|
|
124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_Submit3.default, { className: "save-draft", type: "button", buttonStyle: "secondary", disabled: !canSaveDraft, onClick: saveDraft, children: t("saveDraft") });
|
|
126
125
|
}, "SaveDraft");
|
|
127
126
|
}
|
|
128
127
|
});
|
|
129
128
|
|
|
130
129
|
// src/components/EditModal/EditModalContent.tsx
|
|
131
|
-
var import_forms4, import_utilities4, import_Loading, import_RenderTitle, import_RenderFields, import_field_types, import_LeaveWithoutSaving, import_OperationProvider, import_Auth, import_SetStepNav, import_Upload, import_getTranslation, import_react5, import_react_i18next4, import_jsx_runtime7,
|
|
130
|
+
var import_forms4, import_utilities4, import_Loading, import_RenderTitle, import_RenderFields, import_field_types, import_LeaveWithoutSaving, import_OperationProvider, import_Auth, import_SetStepNav, import_Upload, import_getTranslation, import_react5, import_react_i18next4, import_jsx_runtime7, baseClass, EditModalContent;
|
|
132
131
|
var init_EditModalContent = __esm({
|
|
133
132
|
"src/components/EditModal/EditModalContent.tsx"() {
|
|
134
133
|
import_forms4 = require("payload/components/forms");
|
|
@@ -149,7 +148,7 @@ var init_EditModalContent = __esm({
|
|
|
149
148
|
init_Save();
|
|
150
149
|
init_SaveDraft();
|
|
151
150
|
import_jsx_runtime7 = require("react/jsx-runtime");
|
|
152
|
-
|
|
151
|
+
baseClass = "collection-edit";
|
|
153
152
|
EditModalContent = /* @__PURE__ */ __name((props) => {
|
|
154
153
|
const { admin: { dateFormat }, routes } = (0, import_utilities4.useConfig)();
|
|
155
154
|
const adminRoute = routes.admin;
|
|
@@ -188,8 +187,8 @@ var init_EditModalContent = __esm({
|
|
|
188
187
|
upload
|
|
189
188
|
} = collection;
|
|
190
189
|
const classes = [
|
|
191
|
-
|
|
192
|
-
isEditing && `${
|
|
190
|
+
baseClass,
|
|
191
|
+
isEditing && `${baseClass}--is-editing`
|
|
193
192
|
].filter(Boolean).join(" ");
|
|
194
193
|
const onSave = (0, import_react5.useCallback)((json) => {
|
|
195
194
|
if (typeof onSaveFromProps === "function") {
|
|
@@ -203,7 +202,7 @@ var init_EditModalContent = __esm({
|
|
|
203
202
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: classes, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_OperationProvider.OperationContext.Provider, { value: operation, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
204
203
|
import_forms4.Form,
|
|
205
204
|
{
|
|
206
|
-
className: `${
|
|
205
|
+
className: `${baseClass}__form`,
|
|
207
206
|
method: id ? "patch" : "post",
|
|
208
207
|
action,
|
|
209
208
|
onSuccess: onSave,
|
|
@@ -229,9 +228,9 @@ var init_EditModalContent = __esm({
|
|
|
229
228
|
id: data?.id
|
|
230
229
|
}
|
|
231
230
|
),
|
|
232
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `${
|
|
231
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `${baseClass}__main`, children: [
|
|
233
232
|
!(collection.versions?.drafts && collection.versions?.drafts?.autosave) && !disableLeaveWithoutSaving && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_LeaveWithoutSaving.default, {}),
|
|
234
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `${
|
|
233
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: `${baseClass}__edit`, children: [
|
|
235
234
|
false,
|
|
236
235
|
auth && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
237
236
|
import_Auth.default,
|
|
@@ -486,6 +485,7 @@ __export(src_exports, {
|
|
|
486
485
|
defaultGroup: () => defaultGroup,
|
|
487
486
|
defaultLocale: () => defaultLocale,
|
|
488
487
|
defaultLocales: () => defaultLocales,
|
|
488
|
+
defaultMarket: () => defaultMarket,
|
|
489
489
|
defaultSlug: () => defaultSlug,
|
|
490
490
|
eachDataField: () => eachDataField,
|
|
491
491
|
eachField: () => eachField,
|
|
@@ -545,6 +545,7 @@ __export(src_exports, {
|
|
|
545
545
|
routePostHandler: () => routePostHandler,
|
|
546
546
|
slugToLabel: () => slugToLabel,
|
|
547
547
|
slugToLabels: () => slugToLabels,
|
|
548
|
+
sortCollection: () => sortCollection,
|
|
548
549
|
storeGet: () => storeGet,
|
|
549
550
|
textToSlug: () => textToSlug,
|
|
550
551
|
toBlock: () => toBlock,
|
|
@@ -561,6 +562,7 @@ __export(src_exports, {
|
|
|
561
562
|
translateTab: () => translateTab,
|
|
562
563
|
translateTabs: () => translateTabs,
|
|
563
564
|
validateHexColor: () => validateHexColor,
|
|
565
|
+
webpack: () => webpack,
|
|
564
566
|
whereCollection: () => whereCollection,
|
|
565
567
|
withAbstract: () => withAbstract,
|
|
566
568
|
withAbstractRequired: () => withAbstractRequired,
|
|
@@ -631,9 +633,9 @@ var CategoryList = /* @__PURE__ */ __name((props) => {
|
|
|
631
633
|
const { collection } = props;
|
|
632
634
|
const slug = collection.slug;
|
|
633
635
|
const { routes } = (0, import_utilities.useConfig)();
|
|
634
|
-
const
|
|
635
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className:
|
|
636
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${
|
|
636
|
+
const baseClass6 = "category-list";
|
|
637
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: baseClass6, children: [
|
|
638
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `${baseClass6}__actions`, children: [
|
|
637
639
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "List" }),
|
|
638
640
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
639
641
|
import_components.Button,
|
|
@@ -1036,11 +1038,13 @@ var defaultGroup = {
|
|
|
1036
1038
|
i18n: "i18n",
|
|
1037
1039
|
admin: "admin"
|
|
1038
1040
|
};
|
|
1039
|
-
var defaultLocales = ["en", "it"];
|
|
1040
1041
|
var defaultLocale = "en";
|
|
1042
|
+
var defaultLocales = ["en", "it"];
|
|
1043
|
+
var defaultMarket = "ww";
|
|
1041
1044
|
var options = {
|
|
1042
1045
|
collections: [],
|
|
1043
1046
|
defaultLocale,
|
|
1047
|
+
defaultMarket,
|
|
1044
1048
|
group: defaultGroup,
|
|
1045
1049
|
locales: defaultLocales,
|
|
1046
1050
|
menu: {
|
|
@@ -1073,11 +1077,14 @@ var InMemoryCache = class {
|
|
|
1073
1077
|
duration = CACHE_DURATION;
|
|
1074
1078
|
cache;
|
|
1075
1079
|
constructor(options2 = {}) {
|
|
1076
|
-
this.duration = options2.duration
|
|
1080
|
+
this.duration = typeof options2.duration !== "undefined" ? options2.duration : this.duration;
|
|
1077
1081
|
this.cache = /* @__PURE__ */ new Map();
|
|
1078
1082
|
}
|
|
1083
|
+
isExpired_(key) {
|
|
1084
|
+
return this.duration === false ? true : this.cache.get(key).timestamp < (/* @__PURE__ */ new Date()).getTime() - this.duration;
|
|
1085
|
+
}
|
|
1079
1086
|
has(key) {
|
|
1080
|
-
return this.cache.has(key) && this.
|
|
1087
|
+
return this.cache.has(key) && !this.isExpired_(key);
|
|
1081
1088
|
}
|
|
1082
1089
|
get(key) {
|
|
1083
1090
|
return this.cache.get(key).data;
|
|
@@ -1097,10 +1104,10 @@ function keyWithRequest(key, req) {
|
|
|
1097
1104
|
__name(keyWithRequest, "keyWithRequest");
|
|
1098
1105
|
|
|
1099
1106
|
// src/core/api/redirect.service.ts
|
|
1100
|
-
var
|
|
1107
|
+
var import_bom_core4 = require("@websolutespa/bom-core");
|
|
1101
1108
|
|
|
1102
1109
|
// src/core/api/route.service.ts
|
|
1103
|
-
var
|
|
1110
|
+
var import_bom_core3 = require("@websolutespa/bom-core");
|
|
1104
1111
|
|
|
1105
1112
|
// src/core/translations/translations.ts
|
|
1106
1113
|
var missingTranslations = [];
|
|
@@ -1263,7 +1270,7 @@ function deepMerge(target, source) {
|
|
|
1263
1270
|
__name(deepMerge, "deepMerge");
|
|
1264
1271
|
|
|
1265
1272
|
// src/core/utils/eachField.ts
|
|
1266
|
-
var PRESENTATION_FIELDS = ["collapsible", "
|
|
1273
|
+
var PRESENTATION_FIELDS = ["collapsible", "row", "tabs", "ui"];
|
|
1267
1274
|
function isPresentationField(field) {
|
|
1268
1275
|
return PRESENTATION_FIELDS.includes(field.type);
|
|
1269
1276
|
}
|
|
@@ -1272,46 +1279,74 @@ function isDataField(field) {
|
|
|
1272
1279
|
return !PRESENTATION_FIELDS.includes(field.type);
|
|
1273
1280
|
}
|
|
1274
1281
|
__name(isDataField, "isDataField");
|
|
1275
|
-
function eachField(fields, callback,
|
|
1282
|
+
function eachField(fields, callback, options2) {
|
|
1283
|
+
const acc = typeof options2 === "number" ? {
|
|
1284
|
+
paths: [],
|
|
1285
|
+
depth: 0,
|
|
1286
|
+
maxDepth: options2
|
|
1287
|
+
} : typeof options2 === "object" ? options2 : {
|
|
1288
|
+
paths: [],
|
|
1289
|
+
depth: 0,
|
|
1290
|
+
maxDepth: -1
|
|
1291
|
+
};
|
|
1276
1292
|
for (const field of fields) {
|
|
1277
|
-
|
|
1293
|
+
let shouldBreak = callback(field, acc.paths, acc.parent);
|
|
1278
1294
|
if (shouldBreak === true) {
|
|
1279
1295
|
return shouldBreak;
|
|
1280
1296
|
}
|
|
1281
|
-
|
|
1297
|
+
let nextAcc = {
|
|
1298
|
+
...acc,
|
|
1299
|
+
paths: [...acc.paths],
|
|
1300
|
+
parent: field
|
|
1301
|
+
};
|
|
1302
|
+
if (isDataField(field)) {
|
|
1303
|
+
nextAcc.paths.push(field.name);
|
|
1304
|
+
}
|
|
1305
|
+
if (acc.maxDepth === -1 || acc.depth < acc.maxDepth || isPresentationField(field)) {
|
|
1282
1306
|
switch (field.type) {
|
|
1283
1307
|
case "array":
|
|
1284
|
-
|
|
1308
|
+
nextAcc.depth++;
|
|
1309
|
+
shouldBreak = eachField(field.fields, callback, nextAcc);
|
|
1310
|
+
break;
|
|
1285
1311
|
case "blocks":
|
|
1312
|
+
nextAcc.depth++;
|
|
1286
1313
|
for (const block of field.blocks) {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1314
|
+
nextAcc = {
|
|
1315
|
+
...nextAcc,
|
|
1316
|
+
parent: block
|
|
1317
|
+
};
|
|
1318
|
+
shouldBreak = eachField(block.fields, callback, nextAcc);
|
|
1319
|
+
if (shouldBreak === true) {
|
|
1320
|
+
return shouldBreak;
|
|
1290
1321
|
}
|
|
1291
1322
|
}
|
|
1292
1323
|
break;
|
|
1293
1324
|
case "collapsible":
|
|
1294
1325
|
case "group":
|
|
1295
1326
|
case "row":
|
|
1296
|
-
|
|
1327
|
+
shouldBreak = eachField(field.fields, callback, nextAcc);
|
|
1328
|
+
break;
|
|
1297
1329
|
case "tabs":
|
|
1298
1330
|
for (const tab of field.tabs) {
|
|
1299
|
-
|
|
1300
|
-
if (
|
|
1301
|
-
return
|
|
1331
|
+
shouldBreak = eachField(tab.fields, callback, nextAcc);
|
|
1332
|
+
if (shouldBreak === true) {
|
|
1333
|
+
return shouldBreak;
|
|
1302
1334
|
}
|
|
1303
1335
|
}
|
|
1304
1336
|
}
|
|
1337
|
+
if (shouldBreak === true) {
|
|
1338
|
+
return shouldBreak;
|
|
1339
|
+
}
|
|
1305
1340
|
}
|
|
1306
1341
|
}
|
|
1307
1342
|
}
|
|
1308
1343
|
__name(eachField, "eachField");
|
|
1309
|
-
function eachDataField(fields, callback, maxDepth = -1
|
|
1310
|
-
return eachField(fields, (field) => {
|
|
1344
|
+
function eachDataField(fields, callback, maxDepth = -1) {
|
|
1345
|
+
return eachField(fields, (field, paths, parent) => {
|
|
1311
1346
|
if (isDataField(field)) {
|
|
1312
|
-
return callback(field);
|
|
1347
|
+
return callback(field, paths, parent);
|
|
1313
1348
|
}
|
|
1314
|
-
});
|
|
1349
|
+
}, maxDepth);
|
|
1315
1350
|
}
|
|
1316
1351
|
__name(eachDataField, "eachDataField");
|
|
1317
1352
|
|
|
@@ -1774,7 +1809,7 @@ __name(getPagination, "getPagination");
|
|
|
1774
1809
|
var staticCollections = [];
|
|
1775
1810
|
var staticCollectionLoaders = {};
|
|
1776
1811
|
var ID = 0;
|
|
1777
|
-
var
|
|
1812
|
+
var CACHE_ = {};
|
|
1778
1813
|
async function getCollection(url) {
|
|
1779
1814
|
const response = await import_axios.default.get(url, {});
|
|
1780
1815
|
const items = response.data.items;
|
|
@@ -1794,25 +1829,31 @@ function mapItems(items, map) {
|
|
|
1794
1829
|
return items;
|
|
1795
1830
|
}
|
|
1796
1831
|
__name(mapItems, "mapItems");
|
|
1797
|
-
function getLoader(config, src, map) {
|
|
1832
|
+
function getLoader(config, src, map, duration) {
|
|
1798
1833
|
return async () => {
|
|
1799
1834
|
const key = typeof src === "string" ? src : `static_${++ID}`;
|
|
1800
|
-
let
|
|
1801
|
-
if (!
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1835
|
+
let memoryCache = CACHE_[key];
|
|
1836
|
+
if (!memoryCache) {
|
|
1837
|
+
memoryCache = new InMemoryCache({ duration });
|
|
1838
|
+
CACHE_[key] = memoryCache;
|
|
1839
|
+
}
|
|
1840
|
+
if (memoryCache.has(key)) {
|
|
1841
|
+
return memoryCache.get(key);
|
|
1842
|
+
}
|
|
1843
|
+
let items;
|
|
1844
|
+
if (typeof src === "string") {
|
|
1845
|
+
items = await getCollection(src);
|
|
1846
|
+
} else if (typeof src === "function") {
|
|
1847
|
+
if (src instanceof Promise) {
|
|
1848
|
+
items = await src(config);
|
|
1810
1849
|
} else {
|
|
1811
|
-
items = src;
|
|
1850
|
+
items = src(config);
|
|
1812
1851
|
}
|
|
1813
|
-
|
|
1814
|
-
|
|
1852
|
+
} else {
|
|
1853
|
+
items = src;
|
|
1815
1854
|
}
|
|
1855
|
+
items = mapItems(items, map);
|
|
1856
|
+
memoryCache.set(key, items);
|
|
1816
1857
|
return items;
|
|
1817
1858
|
};
|
|
1818
1859
|
}
|
|
@@ -1916,7 +1957,7 @@ async function populateStaticFields(item, fields, locale = "en") {
|
|
|
1916
1957
|
__name(populateStaticFields, "populateStaticFields");
|
|
1917
1958
|
function localizeItem(item, localizedFields, locale = "en") {
|
|
1918
1959
|
let localizedItem = item;
|
|
1919
|
-
if (localizedFields.length) {
|
|
1960
|
+
if (localizedFields.length > 0) {
|
|
1920
1961
|
localizedItem = { ...item };
|
|
1921
1962
|
localizedFields.forEach((field) => {
|
|
1922
1963
|
localizedItem[field] = item[field][locale];
|
|
@@ -1925,8 +1966,8 @@ function localizeItem(item, localizedFields, locale = "en") {
|
|
|
1925
1966
|
return localizedItem;
|
|
1926
1967
|
}
|
|
1927
1968
|
__name(localizeItem, "localizeItem");
|
|
1928
|
-
async function localizeCollection(items, localizedFields, locale = "
|
|
1929
|
-
if (localizedFields.length) {
|
|
1969
|
+
async function localizeCollection(items, localizedFields, locale = "*") {
|
|
1970
|
+
if (locale !== "*" && localizedFields.length > 0) {
|
|
1930
1971
|
items = items.map((item) => localizeItem(item, localizedFields, locale));
|
|
1931
1972
|
}
|
|
1932
1973
|
return items;
|
|
@@ -1972,11 +2013,11 @@ var StaticCollectionDefault = {
|
|
|
1972
2013
|
unlock: () => false
|
|
1973
2014
|
}
|
|
1974
2015
|
};
|
|
1975
|
-
var withStaticCollection = /* @__PURE__ */ __name(({ src, map, ...config }) => {
|
|
2016
|
+
var withStaticCollection = /* @__PURE__ */ __name(({ src, map, duration, ...config }) => {
|
|
1976
2017
|
staticCollections.push(config.slug);
|
|
1977
2018
|
const collectionConfig = deepMerge(StaticCollectionDefault, config);
|
|
1978
2019
|
const localizedFields = collectionConfig.fields.filter((x) => x["localized"] === true).map((x) => x.name);
|
|
1979
|
-
const loader = getLoader(collectionConfig, src, map);
|
|
2020
|
+
const loader = getLoader(collectionConfig, src, map, duration);
|
|
1980
2021
|
staticCollectionLoaders[collectionConfig.slug] = loader;
|
|
1981
2022
|
collectionConfig.endpoints = [
|
|
1982
2023
|
{
|
|
@@ -2128,23 +2169,26 @@ var withGlobal = /* @__PURE__ */ __name((config) => {
|
|
|
2128
2169
|
}, "withGlobal");
|
|
2129
2170
|
|
|
2130
2171
|
// src/core/api/store.service.ts
|
|
2172
|
+
var import_bom_core = require("@websolutespa/bom-core");
|
|
2131
2173
|
var import_qs = __toESM(require("qs"));
|
|
2132
|
-
var
|
|
2174
|
+
var CACHE_2 = new InMemoryCache();
|
|
2133
2175
|
async function getStore(req) {
|
|
2176
|
+
const { url, query, params } = req;
|
|
2177
|
+
const { locale, where, sort, pagination, page, limit, depth, draft } = query;
|
|
2134
2178
|
const key = keyWithRequest("store", req);
|
|
2135
|
-
if (
|
|
2136
|
-
return
|
|
2179
|
+
if (CACHE_2.has(key)) {
|
|
2180
|
+
return CACHE_2.get(key);
|
|
2137
2181
|
}
|
|
2138
2182
|
const store = {};
|
|
2139
2183
|
for (const slug of options.collections) {
|
|
2140
2184
|
const collection = await fetchCollection(req, slug);
|
|
2141
2185
|
store[slug] = collection.docs;
|
|
2142
2186
|
}
|
|
2143
|
-
const
|
|
2144
|
-
store.locale =
|
|
2187
|
+
const localeCollection = await fetchCollection(req, "locale");
|
|
2188
|
+
store.locale = localeCollection.docs;
|
|
2145
2189
|
const routes = await getRoutes(req);
|
|
2146
2190
|
store.route = routes;
|
|
2147
|
-
|
|
2191
|
+
CACHE_2.set(key, store);
|
|
2148
2192
|
return store;
|
|
2149
2193
|
}
|
|
2150
2194
|
__name(getStore, "getStore");
|
|
@@ -2153,7 +2197,8 @@ function getApiUrl(req) {
|
|
|
2153
2197
|
const { config } = payload;
|
|
2154
2198
|
const port = process.env.PORT || 4e3;
|
|
2155
2199
|
const origin = `http://localhost:${port}`;
|
|
2156
|
-
|
|
2200
|
+
let url = `${origin}${config.routes.api}/`;
|
|
2201
|
+
url = import_bom_core.isBrowser ? url : url.replace("://localhost", "://127.0.0.1");
|
|
2157
2202
|
return url;
|
|
2158
2203
|
}
|
|
2159
2204
|
__name(getApiUrl, "getApiUrl");
|
|
@@ -2480,7 +2525,7 @@ var withMenu = /* @__PURE__ */ __name((config) => {
|
|
|
2480
2525
|
}, "withMenu");
|
|
2481
2526
|
|
|
2482
2527
|
// src/components/DataTree/DataTree.tsx
|
|
2483
|
-
var
|
|
2528
|
+
var import_bom_core2 = require("@websolutespa/bom-core");
|
|
2484
2529
|
var import_components2 = require("payload/components");
|
|
2485
2530
|
var import_react = require("react");
|
|
2486
2531
|
var import_react_complex_tree = require("react-complex-tree");
|
|
@@ -2567,7 +2612,7 @@ var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
|
2567
2612
|
var canRename = false;
|
|
2568
2613
|
function getTreeItemClassName(props) {
|
|
2569
2614
|
const { context, item, depth, title, arrow, children } = props;
|
|
2570
|
-
return (0,
|
|
2615
|
+
return (0, import_bom_core2.getClassNames)(
|
|
2571
2616
|
"rct-tree-item-title-container",
|
|
2572
2617
|
{
|
|
2573
2618
|
"rct-tree-item-title-container-isFolder": item.isFolder,
|
|
@@ -2665,9 +2710,9 @@ function DataTree(props) {
|
|
|
2665
2710
|
const onCollapseAll = /* @__PURE__ */ __name((event) => {
|
|
2666
2711
|
tree.current?.collapseAll();
|
|
2667
2712
|
}, "onCollapseAll");
|
|
2668
|
-
const
|
|
2713
|
+
const baseClass6 = "category-tree";
|
|
2669
2714
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
|
|
2670
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "list-controls", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "list-controls__wrap", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `${
|
|
2715
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "list-controls", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "list-controls__wrap", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `${baseClass6}__actions`, children: [
|
|
2671
2716
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: onExpandAll, children: "Expand" }),
|
|
2672
2717
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: onCollapseAll, children: "Collapse" })
|
|
2673
2718
|
] }) }) }),
|
|
@@ -2728,7 +2773,7 @@ var INITIAL_DATA = {
|
|
|
2728
2773
|
importMode: "append" /* Append */,
|
|
2729
2774
|
dataParsing: false
|
|
2730
2775
|
};
|
|
2731
|
-
var
|
|
2776
|
+
var baseClass2 = "import-modal";
|
|
2732
2777
|
var ImportModal = /* @__PURE__ */ __name(({
|
|
2733
2778
|
parser,
|
|
2734
2779
|
props
|
|
@@ -2999,31 +3044,31 @@ var ImportModal = /* @__PURE__ */ __name(({
|
|
|
2999
3044
|
setLogs([]);
|
|
3000
3045
|
}, "onClear");
|
|
3001
3046
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_components4.MinimalTemplate, { children: [
|
|
3002
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { className: `${
|
|
3047
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("header", { className: `${baseClass2}__header`, children: [
|
|
3003
3048
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("h3", { children: t("importExport:modalTitle") }),
|
|
3004
3049
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.Button, { buttonStyle: "none", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.X, {}) })
|
|
3005
3050
|
] }),
|
|
3006
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("main", { className: `${
|
|
3051
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("main", { className: `${baseClass2}__main`, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_forms5.Form, { onSubmit, initialData: INITIAL_DATA, children: [
|
|
3007
3052
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Select, { label: t("importExport:importMode"), name: "importMode", path: "importMode", options: importModes, validate: onSelectDidChange }),
|
|
3008
3053
|
typeof parser === "function" && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Checkbox, { label: t("importExport:enableDataParsing"), name: "dataParsing", path: "dataParsing", onChange: onCheckboxkDidChange }),
|
|
3009
3054
|
data ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3010
3055
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { dangerouslySetInnerHTML: { __html: format(t("importExport:records"), items.length, name) } }),
|
|
3011
|
-
logs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: `${
|
|
3056
|
+
logs.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: `${baseClass2}__logs`, children: logs.map((log2, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { className: `${baseClass2}__log ${baseClass2}__log--${log2.type}`, children: [
|
|
3012
3057
|
log2.count,
|
|
3013
3058
|
" ",
|
|
3014
3059
|
log2.message,
|
|
3015
3060
|
" ",
|
|
3016
3061
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("i", { children: log2.invalid })
|
|
3017
3062
|
] }, `log-${i}`)) })
|
|
3018
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${
|
|
3019
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { className: `${
|
|
3063
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${baseClass2}__dropzone`, ...getRootProps(), children: [
|
|
3064
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("input", { className: `${baseClass2}__input`, ...getInputProps() }),
|
|
3020
3065
|
isDragActive ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: t("importExport:dropTitle") }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: t("importExport:dropAbstract") })
|
|
3021
3066
|
] }),
|
|
3022
3067
|
error && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(import_jsx_runtime9.Fragment, { children: [
|
|
3023
3068
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: t("importExport:parseError") }),
|
|
3024
3069
|
error.message && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { children: error.message })
|
|
3025
3070
|
] }),
|
|
3026
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${
|
|
3071
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: `${baseClass2}__foot`, children: [
|
|
3027
3072
|
dirty && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.Button, { type: "button", buttonStyle: "secondary", onClick: onClear, children: t("importExport:clear") }),
|
|
3028
3073
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components4.Button, { type: "submit", disabled: !valid, children: t("importExport:submit") })
|
|
3029
3074
|
] })
|
|
@@ -3042,7 +3087,7 @@ __name(once, "once");
|
|
|
3042
3087
|
|
|
3043
3088
|
// src/components/ImportExport/ImportExportList.tsx
|
|
3044
3089
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
3045
|
-
var
|
|
3090
|
+
var baseClass3 = "import-export-list";
|
|
3046
3091
|
var ImportExportList = /* @__PURE__ */ __name(({
|
|
3047
3092
|
parser,
|
|
3048
3093
|
...props
|
|
@@ -3064,7 +3109,7 @@ var ImportExportList = /* @__PURE__ */ __name(({
|
|
|
3064
3109
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_components5.Button, { className: "pill pill--style-light pill--has-link pill--has-action", onClick: () => openModal(modalKey), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: t("importExport:importCSV") }) }),
|
|
3065
3110
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)("a", { className: "pill pill--style-light pill--has-link pill--has-action", href: exportUrl, download: `${slug}.csv`, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: t("importExport:exportCSV") }) })
|
|
3066
3111
|
] }),
|
|
3067
|
-
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_modal3.Modal, { slug: modalKey, className: `${
|
|
3112
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_modal3.Modal, { slug: modalKey, className: `${baseClass3}__modal`, children: isModalOpened && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ImportModal, { parser, props }) })
|
|
3068
3113
|
] })
|
|
3069
3114
|
}
|
|
3070
3115
|
);
|
|
@@ -3955,9 +4000,15 @@ var PageDefault = {
|
|
|
3955
4000
|
};
|
|
3956
4001
|
var withPage = /* @__PURE__ */ __name((config) => {
|
|
3957
4002
|
const defaultConfig = { ...PageDefault };
|
|
3958
|
-
defaultConfig.admin.preview = (doc, { locale }) => {
|
|
3959
|
-
const
|
|
3960
|
-
|
|
4003
|
+
defaultConfig.admin.preview = (doc, { locale, token }) => {
|
|
4004
|
+
const PREVIEW_URL = process.env.PAYLOAD_PUBLIC_PREVIEW_URL || "https://localhost:3000";
|
|
4005
|
+
const localeId = locale;
|
|
4006
|
+
const markets = doc.markets || [];
|
|
4007
|
+
const market = markets.find((x) => x.defaultLanguage === localeId || x.languages.includes(localeId)) || markets[0];
|
|
4008
|
+
const marketId = market ? market.id : options.defaultMarket;
|
|
4009
|
+
const templateId = doc.template ? doc.template.id : doc.slug;
|
|
4010
|
+
const _status = doc._status;
|
|
4011
|
+
return `${PREVIEW_URL}/${marketId}/${localeId}/${templateId}/${doc.id}?_status=${_status}${token ? `&token=${token}` : ""}`;
|
|
3961
4012
|
};
|
|
3962
4013
|
const pageConfig = deepMerge(PageDefault, config);
|
|
3963
4014
|
pageConfig.fields = [
|
|
@@ -4034,11 +4085,11 @@ var withPage = /* @__PURE__ */ __name((config) => {
|
|
|
4034
4085
|
}, "withPage");
|
|
4035
4086
|
|
|
4036
4087
|
// src/core/api/route.service.ts
|
|
4037
|
-
var
|
|
4088
|
+
var CACHE_3 = new InMemoryCache();
|
|
4038
4089
|
async function getRoutes(req) {
|
|
4039
4090
|
const key = keyWithRequest("route", req);
|
|
4040
|
-
if (
|
|
4041
|
-
return
|
|
4091
|
+
if (CACHE_3.has(key)) {
|
|
4092
|
+
return CACHE_3.get(key);
|
|
4042
4093
|
}
|
|
4043
4094
|
let routes = [];
|
|
4044
4095
|
const subRequest = {
|
|
@@ -4057,9 +4108,9 @@ async function getRoutes(req) {
|
|
|
4057
4108
|
if (locales.length > 0 && markets.length > 0) {
|
|
4058
4109
|
const categories = await fetchCollectionItems(subRequest, options.slug.category, { depth: 1 });
|
|
4059
4110
|
const store = await fetchPages(subRequest);
|
|
4060
|
-
routes = (0,
|
|
4111
|
+
routes = (0, import_bom_core3.collectRoutes)(store, categories, markets, locales);
|
|
4061
4112
|
}
|
|
4062
|
-
|
|
4113
|
+
CACHE_3.set(key, routes);
|
|
4063
4114
|
return routes;
|
|
4064
4115
|
}
|
|
4065
4116
|
__name(getRoutes, "getRoutes");
|
|
@@ -4072,11 +4123,11 @@ __name(getRoute, "getRoute");
|
|
|
4072
4123
|
async function getRouteByItemAndLocale(req, item, localeId, slug) {
|
|
4073
4124
|
const routes = [];
|
|
4074
4125
|
const categories = await fetchCollectionItems(req, options.slug.category, { depth: 1 });
|
|
4075
|
-
const segments = (0,
|
|
4126
|
+
const segments = (0, import_bom_core3.getCategorySegments)(item, categories);
|
|
4076
4127
|
await fetchEachMarketLocale(req, (market, locale, markets, locales) => {
|
|
4077
4128
|
if ((!item.markets || item.markets.includes(market.id)) && locale.id === localeId) {
|
|
4078
|
-
const title = (0,
|
|
4079
|
-
const id = (0,
|
|
4129
|
+
const title = (0, import_bom_core3.localize)(item.title, locale.id);
|
|
4130
|
+
const id = (0, import_bom_core3.getRouteHref)(segments, market, locale, markets, locales);
|
|
4080
4131
|
const route = {
|
|
4081
4132
|
id,
|
|
4082
4133
|
market: market.id,
|
|
@@ -4100,11 +4151,11 @@ __name(getRouteByItemAndLocale, "getRouteByItemAndLocale");
|
|
|
4100
4151
|
async function getRouteByCategoryAndLocale(req, item, localeId, slug) {
|
|
4101
4152
|
const routes = [];
|
|
4102
4153
|
const categories = await fetchCollectionItems(req, options.slug.category, { depth: 1 });
|
|
4103
|
-
const segments = (0,
|
|
4154
|
+
const segments = (0, import_bom_core3.getCategorySegmentsByCategory)(item, categories);
|
|
4104
4155
|
await fetchEachMarketLocale(req, (market, locale, markets, locales) => {
|
|
4105
4156
|
if (locale.id === localeId) {
|
|
4106
|
-
const title = (0,
|
|
4107
|
-
const id = (0,
|
|
4157
|
+
const title = (0, import_bom_core3.localize)(item.title, locale.id);
|
|
4158
|
+
const id = (0, import_bom_core3.getRouteHref)(segments, market, locale, markets, locales);
|
|
4108
4159
|
const route = {
|
|
4109
4160
|
id,
|
|
4110
4161
|
market: market.id,
|
|
@@ -4235,7 +4286,7 @@ async function fetchEachMarketLocale(req, callback) {
|
|
|
4235
4286
|
markets = markets ? markets.filter((x) => x.isActive) : [];
|
|
4236
4287
|
let locales = await fetchGlobalItems(req, options.slug.locale, { depth: 0 });
|
|
4237
4288
|
locales = locales ? locales.filter((x) => x.isActive) : [];
|
|
4238
|
-
return (0,
|
|
4289
|
+
return (0, import_bom_core3.eachMarketLocale)(markets, locales, callback);
|
|
4239
4290
|
}
|
|
4240
4291
|
__name(fetchEachMarketLocale, "fetchEachMarketLocale");
|
|
4241
4292
|
async function fetchPages(req) {
|
|
@@ -4252,7 +4303,7 @@ __name(fetchPages, "fetchPages");
|
|
|
4252
4303
|
// src/core/api/redirect.service.ts
|
|
4253
4304
|
async function collectPageRedirects(req, previousItem, newItem) {
|
|
4254
4305
|
const collectedRedirects = [];
|
|
4255
|
-
if (
|
|
4306
|
+
if (import_bom_core4.isProduction) {
|
|
4256
4307
|
const { query, collection, payload, user } = req;
|
|
4257
4308
|
const { locale } = query;
|
|
4258
4309
|
const slug = collection.config.slug;
|
|
@@ -4276,7 +4327,7 @@ async function collectPageRedirects(req, previousItem, newItem) {
|
|
|
4276
4327
|
const redirect = {
|
|
4277
4328
|
from: `*${previousRoute.id}`,
|
|
4278
4329
|
to: `*${route.id}`,
|
|
4279
|
-
status:
|
|
4330
|
+
status: import_bom_core4.RedirectReason.MovedPermanently,
|
|
4280
4331
|
isActive: true
|
|
4281
4332
|
};
|
|
4282
4333
|
return redirect;
|
|
@@ -4294,7 +4345,7 @@ async function collectPageRedirects(req, previousItem, newItem) {
|
|
|
4294
4345
|
__name(collectPageRedirects, "collectPageRedirects");
|
|
4295
4346
|
async function collectCategoryRedirects(req, previousItem, newItem) {
|
|
4296
4347
|
const collectedRedirects = [];
|
|
4297
|
-
if (
|
|
4348
|
+
if (import_bom_core4.isProduction) {
|
|
4298
4349
|
const { query, collection, payload, user } = req;
|
|
4299
4350
|
const { locale } = query;
|
|
4300
4351
|
const slug = collection.config.slug;
|
|
@@ -4318,7 +4369,7 @@ async function collectCategoryRedirects(req, previousItem, newItem) {
|
|
|
4318
4369
|
const redirect = {
|
|
4319
4370
|
from: `*${previousRoute.id}*`,
|
|
4320
4371
|
to: `*${route.id}*`,
|
|
4321
|
-
status:
|
|
4372
|
+
status: import_bom_core4.RedirectReason.MovedPermanently,
|
|
4322
4373
|
isActive: true
|
|
4323
4374
|
};
|
|
4324
4375
|
return redirect;
|
|
@@ -4378,19 +4429,29 @@ var localeGet = {
|
|
|
4378
4429
|
path: "/locale",
|
|
4379
4430
|
method: "get",
|
|
4380
4431
|
handler: async (req, res, next) => {
|
|
4432
|
+
const { url, query, params } = req;
|
|
4433
|
+
const { locale, where, sort, pagination, page, limit, depth, draft } = query;
|
|
4381
4434
|
const loader = getStaticLoader(options.slug.language);
|
|
4382
4435
|
const languages = await loader();
|
|
4383
4436
|
let items = await getLocale(req);
|
|
4384
|
-
if (typeof req.query.where === "object") {
|
|
4385
|
-
items = await whereCollection(items, req.query.where);
|
|
4386
|
-
}
|
|
4387
4437
|
items = items.map((item) => {
|
|
4388
4438
|
const language = languages.find((x) => x.id === item.id);
|
|
4389
4439
|
item.title = language ? language.name : null;
|
|
4390
4440
|
return item;
|
|
4391
4441
|
});
|
|
4392
|
-
items = await
|
|
4393
|
-
|
|
4442
|
+
items = await whereCollection(items, getObjectParam(where));
|
|
4443
|
+
items = await localizeCollection(items, ["title"], getStringParam(locale));
|
|
4444
|
+
items = await sortCollection(items, getStringParam(sort));
|
|
4445
|
+
if (pagination !== "false") {
|
|
4446
|
+
const result = await getPagination(
|
|
4447
|
+
items,
|
|
4448
|
+
getNumericParam(page),
|
|
4449
|
+
getNumericParam(limit)
|
|
4450
|
+
);
|
|
4451
|
+
res.status(200).send(result);
|
|
4452
|
+
} else {
|
|
4453
|
+
res.status(200).send(items);
|
|
4454
|
+
}
|
|
4394
4455
|
}
|
|
4395
4456
|
};
|
|
4396
4457
|
|
|
@@ -4422,7 +4483,7 @@ var CategoryTree = /* @__PURE__ */ __name((props) => {
|
|
|
4422
4483
|
id,
|
|
4423
4484
|
collectionSlug: collection.slug
|
|
4424
4485
|
});
|
|
4425
|
-
const
|
|
4486
|
+
const baseClass6 = "collection-list";
|
|
4426
4487
|
const modalSlug3 = "category-edit";
|
|
4427
4488
|
(0, import_react8.useEffect)(() => {
|
|
4428
4489
|
const getData = /* @__PURE__ */ __name(async () => {
|
|
@@ -4592,16 +4653,16 @@ var CategoryTree = /* @__PURE__ */ __name((props) => {
|
|
|
4592
4653
|
title: (0, import_getTranslation2.getTranslation)(collection.labels.plural, i18n)
|
|
4593
4654
|
}
|
|
4594
4655
|
),
|
|
4595
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className:
|
|
4656
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: baseClass6, children: [
|
|
4596
4657
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Eyebrow.default, {}),
|
|
4597
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_Gutter.Gutter, { className: `${
|
|
4598
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("header", { className: `${
|
|
4658
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_Gutter.Gutter, { className: `${baseClass6}__wrap`, children: [
|
|
4659
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("header", { className: `${baseClass6}__header`, children: [
|
|
4599
4660
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h1", { children: (0, import_getTranslation2.getTranslation)(pluralLabel, i18n) }),
|
|
4600
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${
|
|
4661
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${baseClass6}__sub-header`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_ViewDescription.default, { description }) })
|
|
4601
4662
|
] }),
|
|
4602
4663
|
items && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
4603
4664
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DataTree, { items, rootItem: ROOT_ITEM, onChange, onEdit }),
|
|
4604
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${
|
|
4665
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: `${baseClass6}__foot`, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_Submit4.default, { type: "button", disabled: !dirty, onClick: onSubmit, children: t("save") }) }),
|
|
4605
4666
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(LeaveWithoutSaving_default, { modified: dirty })
|
|
4606
4667
|
] }),
|
|
4607
4668
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_modal5.Modal, { slug: modalSlug3, className: `${modalSlug3}__modal`, children: isModalOpened && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_DocumentInfo2.DocumentInfoProvider, { collection, id, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
@@ -4644,9 +4705,9 @@ var CategoryTreeRoute = /* @__PURE__ */ __name(({ user, canAccessAdmin }) => {
|
|
|
4644
4705
|
if (!collection) {
|
|
4645
4706
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_router_dom3.Redirect, { to: `${routes.admin}/not-found` });
|
|
4646
4707
|
}
|
|
4647
|
-
const
|
|
4648
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_templates.DefaultTemplate, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className:
|
|
4649
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${
|
|
4708
|
+
const baseClass6 = "category-list";
|
|
4709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_templates.DefaultTemplate, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: baseClass6, children: [
|
|
4710
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: `${baseClass6}__actions`, children: [
|
|
4650
4711
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
4651
4712
|
import_elements.Button,
|
|
4652
4713
|
{
|
|
@@ -5312,8 +5373,8 @@ var Province = /* @__PURE__ */ __name((options2) => ({
|
|
|
5312
5373
|
}), "Province");
|
|
5313
5374
|
|
|
5314
5375
|
// src/collections/Redirect.ts
|
|
5315
|
-
var
|
|
5316
|
-
var RedirectStatusOptions = Object.entries(
|
|
5376
|
+
var import_bom_core5 = require("@websolutespa/bom-core");
|
|
5377
|
+
var RedirectStatusOptions = Object.entries(import_bom_core5.RedirectReason).map(([k, v]) => ({
|
|
5317
5378
|
value: v,
|
|
5318
5379
|
label: `${v} - ${k}`
|
|
5319
5380
|
}));
|
|
@@ -5629,7 +5690,7 @@ var defaultColors = [
|
|
|
5629
5690
|
"#B2FFD6",
|
|
5630
5691
|
"#F3DDF3"
|
|
5631
5692
|
];
|
|
5632
|
-
var
|
|
5693
|
+
var baseClass4 = "custom-color-picker";
|
|
5633
5694
|
var preferenceKey = "color-picker-colors";
|
|
5634
5695
|
var ColorField = /* @__PURE__ */ __name((props) => {
|
|
5635
5696
|
const { path: path3, label, required } = props;
|
|
@@ -5658,14 +5719,14 @@ var ColorField = /* @__PURE__ */ __name((props) => {
|
|
|
5658
5719
|
setColorOptions(newOptions);
|
|
5659
5720
|
setPreference(preferenceKey, newOptions);
|
|
5660
5721
|
}, [colorOptions, setPreference, colorToAdd, setIsAdding, setValue]);
|
|
5661
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className:
|
|
5722
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: baseClass4, children: [
|
|
5662
5723
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_forms7.Label, { htmlFor: path3, label, required }),
|
|
5663
5724
|
isAdding && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
|
|
5664
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { className: `${
|
|
5725
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("input", { className: `${baseClass4}__input`, type: "text", placeholder: "#000000", value: colorToAdd, onChange: (e) => setColorToAdd(e.target.value) }),
|
|
5665
5726
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5666
5727
|
import_components9.Button,
|
|
5667
5728
|
{
|
|
5668
|
-
className: `${
|
|
5729
|
+
className: `${baseClass4}__btn`,
|
|
5669
5730
|
buttonStyle: "primary",
|
|
5670
5731
|
iconPosition: "left",
|
|
5671
5732
|
iconStyle: "with-border",
|
|
@@ -5678,7 +5739,7 @@ var ColorField = /* @__PURE__ */ __name((props) => {
|
|
|
5678
5739
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5679
5740
|
import_components9.Button,
|
|
5680
5741
|
{
|
|
5681
|
-
className: `${
|
|
5742
|
+
className: `${baseClass4}__btn`,
|
|
5682
5743
|
buttonStyle: "secondary",
|
|
5683
5744
|
iconPosition: "left",
|
|
5684
5745
|
iconStyle: "with-border",
|
|
@@ -5689,7 +5750,7 @@ var ColorField = /* @__PURE__ */ __name((props) => {
|
|
|
5689
5750
|
)
|
|
5690
5751
|
] }),
|
|
5691
5752
|
!isAdding && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react10.Fragment, { children: [
|
|
5692
|
-
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: `${
|
|
5753
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { className: `${baseClass4}__colors`, children: colorOptions.map((color, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
5693
5754
|
"button",
|
|
5694
5755
|
{
|
|
5695
5756
|
type: "button",
|
|
@@ -5749,14 +5810,14 @@ var withColorRequired = /* @__PURE__ */ __name((options2 = {}) => {
|
|
|
5749
5810
|
var import_utilities11 = require("payload/components/utilities");
|
|
5750
5811
|
var import_react11 = require("react");
|
|
5751
5812
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
5752
|
-
var
|
|
5813
|
+
var baseClass5 = "custom-text";
|
|
5753
5814
|
var DebugField = /* @__PURE__ */ __name((props) => {
|
|
5754
5815
|
const { path: path3, type, fieldTypes: fieldTypes3 } = props;
|
|
5755
5816
|
const schema = (0, import_react11.useMemo)(() => ({ ...props, admin: { ...props.admin, components: null } }), [path3]);
|
|
5756
5817
|
const locale = (0, import_utilities11.useLocale)();
|
|
5757
5818
|
const FieldComponent = fieldTypes3[type];
|
|
5758
5819
|
const fieldKey = `${locale}-custom-text-${path3}`;
|
|
5759
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `${
|
|
5820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `${baseClass5}`, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(FieldComponent, { ...schema }, fieldKey) });
|
|
5760
5821
|
}, "DebugField");
|
|
5761
5822
|
|
|
5762
5823
|
// src/fields/debug-field/index.ts
|
|
@@ -5977,6 +6038,57 @@ function toTab(item) {
|
|
|
5977
6038
|
}
|
|
5978
6039
|
__name(toTab, "toTab");
|
|
5979
6040
|
|
|
6041
|
+
// src/webpack.ts
|
|
6042
|
+
function webpack(sourceConfig) {
|
|
6043
|
+
return (config) => {
|
|
6044
|
+
if (sourceConfig.admin?.webpack) {
|
|
6045
|
+
config = sourceConfig.admin?.webpack(config);
|
|
6046
|
+
}
|
|
6047
|
+
config.module = {
|
|
6048
|
+
...config.module,
|
|
6049
|
+
rules: [
|
|
6050
|
+
...config.module?.rules || [],
|
|
6051
|
+
{
|
|
6052
|
+
test: /\.module\.(scss|css)$/,
|
|
6053
|
+
sideEffects: true,
|
|
6054
|
+
use: [
|
|
6055
|
+
{
|
|
6056
|
+
loader: "style-loader"
|
|
6057
|
+
},
|
|
6058
|
+
{
|
|
6059
|
+
loader: "css-loader",
|
|
6060
|
+
options: {
|
|
6061
|
+
importLoaders: 2,
|
|
6062
|
+
modules: {
|
|
6063
|
+
// localIdentName: '[path][name]__[local]--[hash:base64:5]',
|
|
6064
|
+
namedExport: true,
|
|
6065
|
+
exportLocalsConvention: "camelCaseOnly"
|
|
6066
|
+
},
|
|
6067
|
+
import: true
|
|
6068
|
+
// this must be false in order to work with CSS Modules
|
|
6069
|
+
// esModule: false,
|
|
6070
|
+
}
|
|
6071
|
+
},
|
|
6072
|
+
{
|
|
6073
|
+
loader: "postcss-loader"
|
|
6074
|
+
},
|
|
6075
|
+
{
|
|
6076
|
+
loader: "sass-loader"
|
|
6077
|
+
}
|
|
6078
|
+
]
|
|
6079
|
+
}
|
|
6080
|
+
]
|
|
6081
|
+
};
|
|
6082
|
+
config.module.rules.forEach((rule) => {
|
|
6083
|
+
if (typeof rule === "object" && String(rule.test) === "/\\.(scss|css)$/") {
|
|
6084
|
+
rule.test = /(?<!\.module)\.(scss|css)$/;
|
|
6085
|
+
}
|
|
6086
|
+
});
|
|
6087
|
+
return config;
|
|
6088
|
+
};
|
|
6089
|
+
}
|
|
6090
|
+
__name(webpack, "webpack");
|
|
6091
|
+
|
|
5980
6092
|
// src/bowl.ts
|
|
5981
6093
|
var DEBUG = false;
|
|
5982
6094
|
var bowl = /* @__PURE__ */ __name((sourceOptions = {}) => (sourceConfig) => {
|
|
@@ -6015,15 +6127,18 @@ var bowl = /* @__PURE__ */ __name((sourceOptions = {}) => (sourceConfig) => {
|
|
|
6015
6127
|
...sourceGlobals.filter((x) => x.type === "withPage").map((x) => x.slug)
|
|
6016
6128
|
];
|
|
6017
6129
|
options.pages = pages;
|
|
6130
|
+
if (sourceOptions.defaultMarket) {
|
|
6131
|
+
options.defaultMarket = sourceOptions.defaultMarket;
|
|
6132
|
+
}
|
|
6018
6133
|
if (sourceOptions.group) {
|
|
6019
6134
|
options.group = Object.assign(options.group, sourceOptions.group);
|
|
6020
6135
|
}
|
|
6021
|
-
if (sourceOptions.slug) {
|
|
6022
|
-
options.slug = Object.assign(options.slug, sourceOptions.slug);
|
|
6023
|
-
}
|
|
6024
6136
|
if (sourceOptions.menu) {
|
|
6025
6137
|
options.menu = Object.assign(options.menu, sourceOptions.menu);
|
|
6026
6138
|
}
|
|
6139
|
+
if (sourceOptions.slug) {
|
|
6140
|
+
options.slug = Object.assign(options.slug, sourceOptions.slug);
|
|
6141
|
+
}
|
|
6027
6142
|
if (sourceConfig.localization && sourceConfig.localization.locales) {
|
|
6028
6143
|
options.locales = sourceConfig.localization.locales;
|
|
6029
6144
|
}
|
|
@@ -6062,14 +6177,15 @@ var bowl = /* @__PURE__ */ __name((sourceOptions = {}) => (sourceConfig) => {
|
|
|
6062
6177
|
...sourceConfig,
|
|
6063
6178
|
admin: {
|
|
6064
6179
|
...sourceConfig.admin,
|
|
6065
|
-
css: sourceConfig.admin?.css || path2.resolve(__dirname, "../scss/styles.scss"),
|
|
6066
6180
|
components: {
|
|
6067
6181
|
...sourceConfig.admin?.components,
|
|
6068
6182
|
routes: [
|
|
6069
6183
|
...adminRoutes,
|
|
6070
6184
|
...sourceConfig.admin?.components?.routes || []
|
|
6071
6185
|
]
|
|
6072
|
-
}
|
|
6186
|
+
},
|
|
6187
|
+
css: sourceConfig.admin?.css || path2.resolve(__dirname, "../scss/styles.scss"),
|
|
6188
|
+
webpack: webpack(sourceConfig)
|
|
6073
6189
|
},
|
|
6074
6190
|
i18n: {
|
|
6075
6191
|
...sourceConfig.i18n,
|
|
@@ -6086,6 +6202,7 @@ var bowl = /* @__PURE__ */ __name((sourceOptions = {}) => (sourceConfig) => {
|
|
|
6086
6202
|
]
|
|
6087
6203
|
};
|
|
6088
6204
|
if (DEBUG) {
|
|
6205
|
+
debugJson("source-config.json", sourceConfig);
|
|
6089
6206
|
debugJson("target-config.json", targetConfig);
|
|
6090
6207
|
}
|
|
6091
6208
|
logMissingTranslations();
|
|
@@ -6202,6 +6319,7 @@ var src_default = bowl;
|
|
|
6202
6319
|
defaultGroup,
|
|
6203
6320
|
defaultLocale,
|
|
6204
6321
|
defaultLocales,
|
|
6322
|
+
defaultMarket,
|
|
6205
6323
|
defaultSlug,
|
|
6206
6324
|
eachDataField,
|
|
6207
6325
|
eachField,
|
|
@@ -6261,6 +6379,7 @@ var src_default = bowl;
|
|
|
6261
6379
|
routePostHandler,
|
|
6262
6380
|
slugToLabel,
|
|
6263
6381
|
slugToLabels,
|
|
6382
|
+
sortCollection,
|
|
6264
6383
|
storeGet,
|
|
6265
6384
|
textToSlug,
|
|
6266
6385
|
toBlock,
|
|
@@ -6277,6 +6396,7 @@ var src_default = bowl;
|
|
|
6277
6396
|
translateTab,
|
|
6278
6397
|
translateTabs,
|
|
6279
6398
|
validateHexColor,
|
|
6399
|
+
webpack,
|
|
6280
6400
|
whereCollection,
|
|
6281
6401
|
withAbstract,
|
|
6282
6402
|
withAbstractRequired,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@websolutespa/payload-plugin-bowl",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Bowl PayloadCms plugin of the BOM Repository",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"payload",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@websolutespa/test": "*",
|
|
45
45
|
"@websolutespa/tsconfig": "*",
|
|
46
46
|
"axios": "0.27.2",
|
|
47
|
-
"esbuild-sass-plugin": "^2.
|
|
47
|
+
"esbuild-sass-plugin": "^2.10.0",
|
|
48
48
|
"eslint": "^8.36.0",
|
|
49
49
|
"eslint-config-websolute": "*",
|
|
50
50
|
"i18next": "^22.4.9",
|
package/scss/styles.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
@use 'sass:math';
|
|
2
|
+
@import "~payload/scss";
|
|
2
3
|
|
|
3
4
|
.nav-group__label {
|
|
4
5
|
text-transform: uppercase;
|
|
@@ -20,3 +21,49 @@
|
|
|
20
21
|
line-height: 1;
|
|
21
22
|
padding: 2px 0 0 0;
|
|
22
23
|
}
|
|
24
|
+
|
|
25
|
+
%scrollbar {
|
|
26
|
+
|
|
27
|
+
$size: 0;
|
|
28
|
+
$radius: 0;
|
|
29
|
+
|
|
30
|
+
&::-webkit-scrollbar {
|
|
31
|
+
width: $size;
|
|
32
|
+
height: $size;
|
|
33
|
+
border-radius: math.div($size, 2);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&::-webkit-scrollbar-button {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&::-webkit-scrollbar-button:hover {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&::-webkit-scrollbar-thumb {
|
|
45
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
46
|
+
box-shadow: none;
|
|
47
|
+
border-radius: $radius;
|
|
48
|
+
|
|
49
|
+
&:hover {
|
|
50
|
+
background-color: rgba(0, 0, 0, 0.4);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&::-webkit-scrollbar-track {
|
|
55
|
+
background-color: transparent;
|
|
56
|
+
border-radius: $radius;
|
|
57
|
+
|
|
58
|
+
&:hover {
|
|
59
|
+
background-color: transparent;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.collection-edit__sidebar {
|
|
66
|
+
overflow-y: auto;
|
|
67
|
+
overflow-x: hidden;
|
|
68
|
+
@extend %scrollbar;
|
|
69
|
+
}
|