@wix/auto-patterns 1.25.0 → 1.27.0
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/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js +16 -7
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +2 -2
- package/dist/cjs/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +58 -4
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js +10 -9
- package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js +88 -36
- package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +19 -5
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/cjs/hooks/index.js +19 -0
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/useEntityPageHeaderTexts.js +48 -9
- package/dist/cjs/hooks/useEntityPageHeaderTexts.js.map +1 -1
- package/dist/cjs/hooks/useGridFeatures.js +3 -0
- package/dist/cjs/hooks/useGridFeatures.js.map +1 -1
- package/dist/cjs/hooks/useNavigationUtils.js +21 -6
- package/dist/cjs/hooks/useNavigationUtils.js.map +1 -1
- package/dist/cjs/hooks/useTableFeatures.js +3 -0
- package/dist/cjs/hooks/useTableFeatures.js.map +1 -1
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js +3 -0
- package/dist/cjs/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/cjs/hooks/useUpdateAppContextItems.js +18 -0
- package/dist/cjs/hooks/useUpdateAppContextItems.js.map +1 -0
- package/dist/cjs/providers/AppContext.js +58 -0
- package/dist/cjs/providers/AppContext.js.map +1 -0
- package/dist/cjs/providers/ItemsContext.js +37 -0
- package/dist/cjs/providers/ItemsContext.js.map +1 -0
- package/dist/cjs/providers/PatternsWizardOverridesContext.js +1 -1
- package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/cjs/providers/index.js +12 -0
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/types/EntityPageConfig.js.map +1 -1
- package/dist/cjs/types/types.js.map +1 -1
- package/dist/docs/app_config_structure.md +6 -2
- package/dist/docs/auto-patterns-guide.md +466 -38
- package/dist/docs/bulk_actions.md +2 -5
- package/dist/docs/collection_page.md +1 -1
- package/dist/docs/collection_page_actions.md +4 -13
- package/dist/docs/custom_overrides.md +18 -6
- package/dist/docs/entity_page.md +294 -2
- package/dist/docs/entity_page_actions.md +3 -3
- package/dist/docs/entity_page_view_actions.md +2 -2
- package/dist/docs/index.md +12 -0
- package/dist/docs/installation.md +25 -2
- package/dist/docs/pages_configuration.md +2 -2
- package/dist/docs/resolved_action.md +106 -0
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js +5 -3
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js +2 -2
- package/dist/esm/components/AutoPatternsCollectionComponent/AutoPatternsCollectionComponent.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +24 -0
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js +2 -1
- package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js +45 -18
- package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +8 -0
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useEntityPageHeaderTexts.js +48 -9
- package/dist/esm/hooks/useEntityPageHeaderTexts.js.map +1 -1
- package/dist/esm/hooks/useGridFeatures.js +4 -1
- package/dist/esm/hooks/useGridFeatures.js.map +1 -1
- package/dist/esm/hooks/useNavigationUtils.js +21 -6
- package/dist/esm/hooks/useNavigationUtils.js.map +1 -1
- package/dist/esm/hooks/useTableFeatures.js +4 -1
- package/dist/esm/hooks/useTableFeatures.js.map +1 -1
- package/dist/esm/hooks/useTableGridSwitchFeatures.js +4 -1
- package/dist/esm/hooks/useTableGridSwitchFeatures.js.map +1 -1
- package/dist/esm/hooks/useUpdateAppContextItems.js +13 -0
- package/dist/esm/hooks/useUpdateAppContextItems.js.map +1 -0
- package/dist/esm/providers/AppContext.js +31 -0
- package/dist/esm/providers/AppContext.js.map +1 -0
- package/dist/esm/providers/ItemsContext.js +23 -0
- package/dist/esm/providers/ItemsContext.js.map +1 -0
- package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/esm/providers/index.js +1 -0
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/types/EntityPageConfig.js.map +1 -1
- package/dist/esm/types/types.js.map +1 -1
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts +1 -0
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsEntityPage/EditModeEntityPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsEntityPage/ViewModeEntityPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +2 -0
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useEntityPageHeaderTexts.d.ts +10 -1
- package/dist/types/hooks/useEntityPageHeaderTexts.d.ts.map +1 -1
- package/dist/types/hooks/useGridFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useNavigationUtils.d.ts +5 -1
- package/dist/types/hooks/useNavigationUtils.d.ts.map +1 -1
- package/dist/types/hooks/useTableFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useTableGridSwitchFeatures.d.ts.map +1 -1
- package/dist/types/hooks/useUpdateAppContextItems.d.ts +2 -0
- package/dist/types/hooks/useUpdateAppContextItems.d.ts.map +1 -0
- package/dist/types/providers/AppContext.d.ts +11 -0
- package/dist/types/providers/AppContext.d.ts.map +1 -0
- package/dist/types/providers/ItemsContext.d.ts +11 -0
- package/dist/types/providers/ItemsContext.d.ts.map +1 -0
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts +10 -0
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts.map +1 -1
- package/dist/types/providers/index.d.ts +1 -0
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/types/EntityPageConfig.d.ts +5 -1
- package/dist/types/types/EntityPageConfig.d.ts.map +1 -1
- package/dist/types/types/types.d.ts +1 -0
- package/dist/types/types/types.d.ts.map +1 -1
- package/package.json +18 -18
|
@@ -78,7 +78,7 @@ It is configured using a TypeScript file conforming to the `AppConfig` interface
|
|
|
78
78
|
|
|
79
79
|
# AppConfig Structure
|
|
80
80
|
|
|
81
|
-
##
|
|
81
|
+
## Configuration Rules
|
|
82
82
|
|
|
83
83
|
- **Configuration must come only from a TypeScript file** - never inline or from other sources
|
|
84
84
|
- **Always use proper TypeScript typing**: `export const config: AppConfig = { ... }`
|
|
@@ -86,7 +86,7 @@ It is configured using a TypeScript file conforming to the `AppConfig` interface
|
|
|
86
86
|
- **After each configuration change, verify that the configuration strictly aligns with the structure described below** - any configuration entries not defined in this structure must be removed
|
|
87
87
|
- **When generating config for the first time, select up to 3 columns from the schema that best represent the entity**
|
|
88
88
|
|
|
89
|
-
##
|
|
89
|
+
## Common Configuration Mistakes to Avoid
|
|
90
90
|
|
|
91
91
|
- Adding more than two pages
|
|
92
92
|
- Mixing page types in a single configuration
|
|
@@ -392,9 +392,13 @@ export interface AppConfig {
|
|
|
392
392
|
};
|
|
393
393
|
title?: {
|
|
394
394
|
text: string; // Entity page title
|
|
395
|
+
badges?: {
|
|
396
|
+
id?: string; // Optional ID that maps to a dynamic badges override function
|
|
397
|
+
};
|
|
395
398
|
};
|
|
396
399
|
subtitle?: {
|
|
397
400
|
text: string; // Entity page subtitle
|
|
401
|
+
id?: string; // Optional ID that maps to a dynamic subtitle override function
|
|
398
402
|
};
|
|
399
403
|
actions?: { // Action configuration varies by mode
|
|
400
404
|
// Edit mode: only moreActions supported
|
|
@@ -556,7 +560,7 @@ Notice how the `label` is derived from the `value` by capitalizing the first let
|
|
|
556
560
|
|
|
557
561
|
# Pages Configuration
|
|
558
562
|
|
|
559
|
-
##
|
|
563
|
+
## Critical Page Rules
|
|
560
564
|
|
|
561
565
|
- **Pages array must contain exactly two pages** - one collectionPage and one entityPage
|
|
562
566
|
- **Exactly one page must have `appMainPage: true`** to designate it as the main page
|
|
@@ -637,7 +641,7 @@ A two-way connection must be established between collection pages and entity pag
|
|
|
637
641
|
* **Route Structure**: Entity pages must use `/[segment]/:entityId` format (e.g., `/product/:entityId` or `/pets/:entityId`), never just `/:entityId`
|
|
638
642
|
* **Route Parameters Configuration**: All entity pages must have both a dynamic parameter in `route.path` and a matching configuration in `route.params`
|
|
639
643
|
|
|
640
|
-
##
|
|
644
|
+
## Common Route and Configuration Mistakes to Avoid
|
|
641
645
|
|
|
642
646
|
- Missing route.params for entity pages
|
|
643
647
|
- Using `/:entityId` instead of `/segment/:entityId` for entity page routes (causes routing conflicts)
|
|
@@ -678,7 +682,7 @@ Sticky columns allow you to keep specific columns visible while users scroll hor
|
|
|
678
682
|
|
|
679
683
|
# Collection Page Configuration
|
|
680
684
|
|
|
681
|
-
##
|
|
685
|
+
## Collection Page Rules
|
|
682
686
|
|
|
683
687
|
- **Components array inside collectionPage must contain exactly one component with a layout array**
|
|
684
688
|
- **All collection pages with tables/grids must reference their corresponding entity page via `entityPageId`** in the collection configuration
|
|
@@ -735,7 +739,7 @@ The `layout` array contains the rendering components for the collection. Each la
|
|
|
735
739
|
|
|
736
740
|
# Collection Page Actions
|
|
737
741
|
|
|
738
|
-
##
|
|
742
|
+
## Required Actions
|
|
739
743
|
|
|
740
744
|
- **Every collection page must include a create action that navigates to the entity page for adding new entities** - this is essential for user workflow
|
|
741
745
|
|
|
@@ -799,7 +803,7 @@ Custom collection page actions execute JavaScript code that you define for colle
|
|
|
799
803
|
```typescript
|
|
800
804
|
import { CustomActionCollectionPageActionResolver } from '@wix/auto-patterns';
|
|
801
805
|
import React from 'react';
|
|
802
|
-
import { Download } from '@wix/ui-icons-common';
|
|
806
|
+
import { Download } from '@wix/wix-ui-icons-common';
|
|
803
807
|
|
|
804
808
|
// IMPORTANT: Function name MUST match the action id in your configuration
|
|
805
809
|
export const exportCollection: CustomActionCollectionPageActionResolver = (params) => {
|
|
@@ -919,16 +923,7 @@ Row click actions are configured at the table level using the `onRowClick` prope
|
|
|
919
923
|
|
|
920
924
|
⚠️ **CRITICAL**: When you configure `onRowClick` in your TypeScript configuration, you MUST provide a complete working implementation. The Auto Patterns framework cannot function without it.
|
|
921
925
|
|
|
922
|
-
Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction
|
|
923
|
-
|
|
924
|
-
#### Required Return Object Structure:
|
|
925
|
-
```typescript
|
|
926
|
-
return {
|
|
927
|
-
label: string, // REQUIRED: Action label
|
|
928
|
-
icon: ReactElement, // REQUIRED: Icon component
|
|
929
|
-
onClick: () => void // REQUIRED: Click handler function
|
|
930
|
-
};
|
|
931
|
-
```
|
|
926
|
+
Custom row click actions use the `CustomActionCollectionPageActionOnRowClickResolver` type and MUST return a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
|
|
932
927
|
|
|
933
928
|
#### Complete Implementation Example:
|
|
934
929
|
|
|
@@ -1088,7 +1083,7 @@ export const quickToggle: CustomActionCollectionPageActionOnRowClickResolver = (
|
|
|
1088
1083
|
- **MANDATORY IMPLEMENTATION**: If you configure `onRowClick` in TypeScript configuration, you MUST provide a complete working implementation - the framework cannot function without it
|
|
1089
1084
|
- The action `id` in the configuration MUST exactly match the function name exported from your actions folder
|
|
1090
1085
|
- The implementation must use the `CustomActionCollectionPageActionOnRowClickResolver` type
|
|
1091
|
-
- **Required Return Object**: Must return
|
|
1086
|
+
- **Required Return Object**: Must return a `ResolvedAction` object - see [ResolvedAction Reference](./resolved_action.md)
|
|
1092
1087
|
- Access the clicked item's data through `actionParams.item`
|
|
1093
1088
|
- The implementation must be exported as a named export and registered in your `PatternsWizardOverridesProvider`
|
|
1094
1089
|
- When `onRowClick` is configured, the default navigation to entity page is completely disabled
|
|
@@ -1839,11 +1834,8 @@ Custom bulk actions execute JavaScript code that you define for bulk operations.
|
|
|
1839
1834
|
- Be registered in the `actions` property of your `PatternsWizardOverridesProvider`
|
|
1840
1835
|
- Follow JavaScript identifier naming rules (camelCase recommended)
|
|
1841
1836
|
|
|
1842
|
-
2. The implementation must return
|
|
1843
|
-
|
|
1844
|
-
- `icon`: An Icon component from "@wix/wix-ui-icons-common"
|
|
1845
|
-
- `onClick`: Handler function for the bulk action
|
|
1846
|
-
- `hidden` (optional): Boolean to hide the action when true
|
|
1837
|
+
2. The implementation must return a `ResolvedAction`:
|
|
1838
|
+
For complete field documentation, see [ResolvedAction Reference](./resolved_action.md).
|
|
1847
1839
|
|
|
1848
1840
|
3. The implementation must:
|
|
1849
1841
|
- Use the correct type: `CustomBulkActionsActionResolver`
|
|
@@ -1949,7 +1941,7 @@ AI agents should verify these requirements before generating Bulk Action Toolbar
|
|
|
1949
1941
|
|
|
1950
1942
|
# Entity Page Configuration
|
|
1951
1943
|
|
|
1952
|
-
##
|
|
1944
|
+
## Entity Page Requirements
|
|
1953
1945
|
|
|
1954
1946
|
All entity pages must have:
|
|
1955
1947
|
- **A route path with descriptive segment and dynamic parameter** (e.g., `/product/:entityId`, `/pet/:entityId`) - **never just `/:entityId`** as this conflicts with collection page routing
|
|
@@ -1961,6 +1953,20 @@ All entity pages must have:
|
|
|
1961
1953
|
* Displays details for a **single entity**.
|
|
1962
1954
|
* Always tied to a single Wix collection.
|
|
1963
1955
|
* Supports **two distinct modes**: **view mode** and **edit mode** with separate page configurations.
|
|
1956
|
+
* Supports **dynamic subtitle** that adapt based on entity data (see [Entity Page Dynamic Subtitle](#entity-page-dynamic-subtitle)).
|
|
1957
|
+
* Supports **dynamic badges** in the page title that adapt based on entity data (see [Entity Page Dynamic Badges](#entity-page-dynamic-badges)).
|
|
1958
|
+
|
|
1959
|
+
## 🏷️ **Understanding Badges Requests**
|
|
1960
|
+
|
|
1961
|
+
When a user asks to "add badges to the entity page", understand that they want:
|
|
1962
|
+
|
|
1963
|
+
1. **Custom component overrides** - NOT direct configuration in JSON
|
|
1964
|
+
2. **Function that returns badge objects** - NOT JSX components
|
|
1965
|
+
3. **Badge properties** like `text`, `skin`, `prefixIcon`, etc.
|
|
1966
|
+
4. **Registration in PatternsWizardOverridesProvider** under `entityPageHeaderBadges`
|
|
1967
|
+
|
|
1968
|
+
**Example Request**: "Add 2 badges with random skins and text 'wow'"
|
|
1969
|
+
**Correct Implementation**: Create a function that returns `[{text: 'wow', skin: 'success'}, {text: 'wow', skin: 'premium'}]`
|
|
1964
1970
|
|
|
1965
1971
|
## Entity Page Modes
|
|
1966
1972
|
|
|
@@ -1989,6 +1995,284 @@ This pattern allows:
|
|
|
1989
1995
|
- Clear distinction between view and edit URLs
|
|
1990
1996
|
- Natural navigation flow between modes
|
|
1991
1997
|
|
|
1998
|
+
## Entity Page Dynamic Subtitle
|
|
1999
|
+
|
|
2000
|
+
Entity pages support dynamic subtitles that adapt based on entity data, providing contextual information below the main title.
|
|
2001
|
+
|
|
2002
|
+
### Configuration
|
|
2003
|
+
|
|
2004
|
+
Add an `id` property to the entity page subtitle configuration:
|
|
2005
|
+
|
|
2006
|
+
```json
|
|
2007
|
+
{
|
|
2008
|
+
"subtitle": {
|
|
2009
|
+
"text": "Default subtitle text",
|
|
2010
|
+
"id": "mySubtitleOverride"
|
|
2011
|
+
}
|
|
2012
|
+
}
|
|
2013
|
+
```
|
|
2014
|
+
|
|
2015
|
+
### Subtitle Override Implementation
|
|
2016
|
+
|
|
2017
|
+
Create a subtitle override function that returns an object with a `text` property:
|
|
2018
|
+
|
|
2019
|
+
```typescript
|
|
2020
|
+
const mySubtitleOverride = (entity: Record<string, any>): { text: string } => {
|
|
2021
|
+
return { text: `Pet: ${entity.name || 'Unknown'}` };
|
|
2022
|
+
};
|
|
2023
|
+
```
|
|
2024
|
+
|
|
2025
|
+
### Complete Implementation Guide
|
|
2026
|
+
|
|
2027
|
+
#### Step 1: Create the Subtitle Function
|
|
2028
|
+
|
|
2029
|
+
**File**: `src/dashboard/components/entityPageHeaderSubtitle/entityPageHeaderSubtitle.ts`
|
|
2030
|
+
|
|
2031
|
+
```typescript
|
|
2032
|
+
export const entityPageHeaderSubtitle = (entity: Record<string, any>): { text: string } => {
|
|
2033
|
+
return { text: `Pet: ${entity.name || 'Unknown'}` };
|
|
2034
|
+
};
|
|
2035
|
+
```
|
|
2036
|
+
|
|
2037
|
+
#### Step 2: Create/Update Index File
|
|
2038
|
+
|
|
2039
|
+
**File**: `src/dashboard/components/entityPageHeaderSubtitle/index.ts`
|
|
2040
|
+
|
|
2041
|
+
```typescript
|
|
2042
|
+
import { entityPageHeaderSubtitle } from './entityPageHeaderSubtitle';
|
|
2043
|
+
|
|
2044
|
+
export const useEntityPageHeaderSubtitle = () => {
|
|
2045
|
+
return entityPageHeaderSubtitle;
|
|
2046
|
+
};
|
|
2047
|
+
```
|
|
2048
|
+
|
|
2049
|
+
#### Step 3: Update Main Page Overrides
|
|
2050
|
+
|
|
2051
|
+
**File**: `src/dashboard/pages/page.tsx`
|
|
2052
|
+
|
|
2053
|
+
```typescript
|
|
2054
|
+
import { useEntityPageHeaderSubtitle } from '../components/entityPageHeaderSubtitle';
|
|
2055
|
+
|
|
2056
|
+
const Index: FC = () => {
|
|
2057
|
+
const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
|
|
2058
|
+
|
|
2059
|
+
return (
|
|
2060
|
+
<PatternsWizardOverridesProvider
|
|
2061
|
+
value={{
|
|
2062
|
+
// ... other overrides
|
|
2063
|
+
entityPageHeaderSubtitle: {
|
|
2064
|
+
entityPageHeaderSubtitle,
|
|
2065
|
+
},
|
|
2066
|
+
}}
|
|
2067
|
+
>
|
|
2068
|
+
<WixPetsPage />
|
|
2069
|
+
</PatternsWizardOverridesProvider>
|
|
2070
|
+
);
|
|
2071
|
+
};
|
|
2072
|
+
```
|
|
2073
|
+
|
|
2074
|
+
#### Step 4: Update Configuration
|
|
2075
|
+
|
|
2076
|
+
**File**: `src/dashboard/pages/wixPetsConfig.patterns.ts`
|
|
2077
|
+
|
|
2078
|
+
```typescript
|
|
2079
|
+
{
|
|
2080
|
+
id: 'wixPets-entity',
|
|
2081
|
+
type: 'entityPage',
|
|
2082
|
+
entityPage: {
|
|
2083
|
+
subtitle: {
|
|
2084
|
+
text: 'Default subtitle text',
|
|
2085
|
+
id: 'entityPageHeaderSubtitle', // ⚠️ CRITICAL: This must match the override key
|
|
2086
|
+
},
|
|
2087
|
+
// ... rest of config
|
|
2088
|
+
},
|
|
2089
|
+
}
|
|
2090
|
+
```
|
|
2091
|
+
|
|
2092
|
+
### Required File Structure
|
|
2093
|
+
|
|
2094
|
+
```
|
|
2095
|
+
src/dashboard/
|
|
2096
|
+
├── components/
|
|
2097
|
+
│ └── entityPageHeaderSubtitle/
|
|
2098
|
+
│ ├── index.ts # ✅ MUST EXIST (hook exports)
|
|
2099
|
+
│ └── entityPageHeaderSubtitle.ts # ✅ MUST EXIST (subtitle function)
|
|
2100
|
+
├── pages/
|
|
2101
|
+
│ ├── page.tsx # ✅ MUST REGISTER OVERRIDES
|
|
2102
|
+
│ └── wixPetsConfig.patterns.ts # ✅ MUST HAVE SUBTITLE CONFIG
|
|
2103
|
+
```
|
|
2104
|
+
|
|
2105
|
+
|
|
2106
|
+
**Example**:
|
|
2107
|
+
```typescript
|
|
2108
|
+
// Config
|
|
2109
|
+
subtitle: { id: 'mySubtitleOverride' }
|
|
2110
|
+
|
|
2111
|
+
// Overrides
|
|
2112
|
+
entityPageHeaderSubtitle: { mySubtitleOverride: myFunction }
|
|
2113
|
+
|
|
2114
|
+
// Function
|
|
2115
|
+
export const myFunction = (entity) => { ... }
|
|
2116
|
+
```
|
|
2117
|
+
|
|
2118
|
+
### Integration
|
|
2119
|
+
|
|
2120
|
+
Register your subtitle override in the `PatternsWizardOverridesProvider`:
|
|
2121
|
+
|
|
2122
|
+
```typescript
|
|
2123
|
+
<PatternsWizardOverridesProvider value={{
|
|
2124
|
+
entityPageHeaderSubtitle: {
|
|
2125
|
+
mySubtitleOverride,
|
|
2126
|
+
},
|
|
2127
|
+
}}>
|
|
2128
|
+
<AutoPatternsApp configuration={config} />
|
|
2129
|
+
</PatternsWizardOverridesProvider>
|
|
2130
|
+
```
|
|
2131
|
+
|
|
2132
|
+
## Entity Page Dynamic Badges
|
|
2133
|
+
|
|
2134
|
+
Entity pages support dynamic badges in the page title that display contextual information about the entity.
|
|
2135
|
+
|
|
2136
|
+
|
|
2137
|
+
### Badge Skin Options
|
|
2138
|
+
|
|
2139
|
+
The `skin` property accepts values from the `BadgeSkin` type of `@wix/design-system`:
|
|
2140
|
+
|
|
2141
|
+
### Badge Properties
|
|
2142
|
+
|
|
2143
|
+
Each badge can have the following properties:
|
|
2144
|
+
|
|
2145
|
+
```typescript
|
|
2146
|
+
{
|
|
2147
|
+
text: string; // Required: Text to display
|
|
2148
|
+
skin?: BadgeSkin; // Optional: Visual styling
|
|
2149
|
+
prefixIcon?: React.ReactElement; // Optional: Icon before text (from @wix/wix-ui-icons-common)
|
|
2150
|
+
suffixIcon?: React.ReactElement; // Optional: Icon after text (from @wix/wix-ui-icons-common)
|
|
2151
|
+
}
|
|
2152
|
+
```
|
|
2153
|
+
|
|
2154
|
+
|
|
2155
|
+
## ⚠️ **CRITICAL: Understanding Badges Implementation**
|
|
2156
|
+
|
|
2157
|
+
When implementing badges for entity pages, understand these key points:
|
|
2158
|
+
|
|
2159
|
+
1. **Badges are CUSTOM COMPONENT OVERRIDES** - NOT direct configuration
|
|
2160
|
+
2. **Badge function returns an ARRAY of badge objects** - NOT JSX components
|
|
2161
|
+
3. **Each badge object has properties** like `text`, `skin`, `prefixIcon`, etc.
|
|
2162
|
+
4. **Must be registered in PatternsWizardOverridesProvider** under `entityPageHeaderBadges`
|
|
2163
|
+
|
|
2164
|
+
### Complete Implementation Guide
|
|
2165
|
+
|
|
2166
|
+
#### Step 1: Create the Badge Function
|
|
2167
|
+
|
|
2168
|
+
**File**: `src/dashboard/components/entityPageHeaderBadges/entityPageHeaderBadges.ts`
|
|
2169
|
+
|
|
2170
|
+
```typescript
|
|
2171
|
+
export const entityPageHeaderBadges = (entity: Record<string, any>) => {
|
|
2172
|
+
// Define available badge skins
|
|
2173
|
+
const badgeSkins = ['success', 'warning', 'destructive', 'neutral', 'premium'] as const;
|
|
2174
|
+
|
|
2175
|
+
// Get random skins for the two badges
|
|
2176
|
+
const randomSkin1 = badgeSkins[Math.floor(Math.random() * badgeSkins.length)];
|
|
2177
|
+
const randomSkin2 = badgeSkins[Math.floor(Math.random() * badgeSkins.length)];
|
|
2178
|
+
|
|
2179
|
+
return [
|
|
2180
|
+
{
|
|
2181
|
+
text: 'wow',
|
|
2182
|
+
skin: randomSkin1,
|
|
2183
|
+
},
|
|
2184
|
+
{
|
|
2185
|
+
text: 'wow',
|
|
2186
|
+
skin: randomSkin2,
|
|
2187
|
+
},
|
|
2188
|
+
];
|
|
2189
|
+
};
|
|
2190
|
+
```
|
|
2191
|
+
|
|
2192
|
+
#### Step 2: Create/Update Index File
|
|
2193
|
+
|
|
2194
|
+
**File**: `src/dashboard/components/entityPageHeaderBadges/index.ts`
|
|
2195
|
+
|
|
2196
|
+
```typescript
|
|
2197
|
+
import { entityPageHeaderBadges } from './entityPageHeaderBadges';
|
|
2198
|
+
|
|
2199
|
+
export const useEntityPageHeaderBadges = () => {
|
|
2200
|
+
return entityPageHeaderBadges;
|
|
2201
|
+
};
|
|
2202
|
+
```
|
|
2203
|
+
|
|
2204
|
+
#### Step 3: Update Main Page Overrides
|
|
2205
|
+
|
|
2206
|
+
**File**: `src/dashboard/pages/page.tsx`
|
|
2207
|
+
|
|
2208
|
+
```typescript
|
|
2209
|
+
import { useEntityPageHeaderSubtitle } from '../components/entityPageHeaderSubtitle';
|
|
2210
|
+
import { useEntityPageHeaderBadges } from '../components/entityPageHeaderBadges';
|
|
2211
|
+
|
|
2212
|
+
const Index: FC = () => {
|
|
2213
|
+
const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
|
|
2214
|
+
const entityPageHeaderBadges = useEntityPageHeaderBadges();
|
|
2215
|
+
|
|
2216
|
+
return (
|
|
2217
|
+
<PatternsWizardOverridesProvider
|
|
2218
|
+
value={{
|
|
2219
|
+
// ... other overrides
|
|
2220
|
+
entityPageHeaderSubtitle: {
|
|
2221
|
+
entityPageHeaderSubtitle,
|
|
2222
|
+
},
|
|
2223
|
+
entityPageHeaderBadges: {
|
|
2224
|
+
entityPageHeaderBadges, // ⚠️ CRITICAL: This must match the ID in config
|
|
2225
|
+
},
|
|
2226
|
+
}}
|
|
2227
|
+
>
|
|
2228
|
+
<WixPetsPage />
|
|
2229
|
+
</PatternsWizardOverridesProvider>
|
|
2230
|
+
);
|
|
2231
|
+
};
|
|
2232
|
+
```
|
|
2233
|
+
|
|
2234
|
+
#### Step 4: Update Configuration
|
|
2235
|
+
|
|
2236
|
+
**File**: `src/dashboard/pages/wixPetsConfig.patterns.ts`
|
|
2237
|
+
|
|
2238
|
+
```typescript
|
|
2239
|
+
{
|
|
2240
|
+
id: 'wixPets-entity',
|
|
2241
|
+
type: 'entityPage',
|
|
2242
|
+
entityPage: {
|
|
2243
|
+
title: {
|
|
2244
|
+
text: 'WixPet Details',
|
|
2245
|
+
badges: {
|
|
2246
|
+
id: 'entityPageHeaderBadges', // ⚠️ CRITICAL: This must match the override key
|
|
2247
|
+
},
|
|
2248
|
+
},
|
|
2249
|
+
// ... rest of config
|
|
2250
|
+
},
|
|
2251
|
+
}
|
|
2252
|
+
```
|
|
2253
|
+
|
|
2254
|
+
### Required File Structure
|
|
2255
|
+
|
|
2256
|
+
```
|
|
2257
|
+
src/dashboard/
|
|
2258
|
+
├── components/
|
|
2259
|
+
│ └── entityPageHeaderBadges/
|
|
2260
|
+
│ ├── index.ts # ✅ MUST EXIST (badges hook exports)
|
|
2261
|
+
│ └── entityPageHeaderBadges.ts # ✅ MUST EXIST (badges function)
|
|
2262
|
+
├── pages/
|
|
2263
|
+
│ ├── page.tsx # ✅ MUST REGISTER OVERRIDES
|
|
2264
|
+
│ └── wixPetsConfig.patterns.ts # ✅ MUST HAVE BADGES CONFIG
|
|
2265
|
+
```
|
|
2266
|
+
|
|
2267
|
+
### ⚠️ **Common Badges Mistakes to Avoid**
|
|
2268
|
+
|
|
2269
|
+
1. **❌ DON'T return JSX components** - Return badge objects instead
|
|
2270
|
+
2. **❌ DON'T use direct configuration** - Use custom component overrides
|
|
2271
|
+
3. **❌ DON'T forget to register in PatternsWizardOverridesProvider**
|
|
2272
|
+
5. **❌ DON'T forget to export from index.ts** - Must export the function
|
|
2273
|
+
|
|
2274
|
+
|
|
2275
|
+
|
|
1992
2276
|
## View Mode: Purpose and API
|
|
1993
2277
|
|
|
1994
2278
|
### Purpose of View Mode
|
|
@@ -2104,7 +2388,7 @@ Entity page action configuration depends on the mode:
|
|
|
2104
2388
|
- For image fields, consider providing more space (larger span)
|
|
2105
2389
|
- Images are automatically rendered with proper controls when using the field type
|
|
2106
2390
|
|
|
2107
|
-
##
|
|
2391
|
+
## Common Entity Page Layout Mistakes to Avoid
|
|
2108
2392
|
|
|
2109
2393
|
- Using incorrect span values causing unexpected layout breaks
|
|
2110
2394
|
- Referencing non-existent field IDs in the layout
|
|
@@ -2174,7 +2458,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
2174
2458
|
|
|
2175
2459
|
return {
|
|
2176
2460
|
label: 'My More Action',
|
|
2177
|
-
icon: <MyIcon />, //
|
|
2461
|
+
icon: <MyIcon />, // required
|
|
2178
2462
|
onClick: () => {
|
|
2179
2463
|
// Your custom logic here
|
|
2180
2464
|
},
|
|
@@ -2194,7 +2478,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
2194
2478
|
- The implementation must use the `CustomEntityPageActionResolver` type.
|
|
2195
2479
|
- The implementation must be exported as a named export (not default export).
|
|
2196
2480
|
- The function receives `{ actionParams, sdk }` as parameters.
|
|
2197
|
-
- The returned object must
|
|
2481
|
+
- The returned object must be a `ResolvedAction`. See [ResolvedAction Reference](./resolved_action.md) for complete documentation.
|
|
2198
2482
|
|
|
2199
2483
|
---
|
|
2200
2484
|
|
|
@@ -2205,7 +2489,7 @@ export const myMoreAction: CustomEntityPageActionResolver = (params) => {
|
|
|
2205
2489
|
✓ Custom actions match implementations in overrides
|
|
2206
2490
|
✓ The resolver is exported and registered in the `actions` property of your `PatternsWizardOverridesProvider`
|
|
2207
2491
|
✓ The function signature matches `CustomEntityPageActionResolver`
|
|
2208
|
-
✓ The returned object
|
|
2492
|
+
✓ The returned object is a `ResolvedAction` (see [ResolvedAction Reference](./resolved_action.md))
|
|
2209
2493
|
|
|
2210
2494
|
---
|
|
2211
2495
|
|
|
@@ -2312,7 +2596,7 @@ View mode actions follow the same resolver patterns as collection page actions:
|
|
|
2312
2596
|
These actions are handled automatically by the AutoPatterns framework using the configuration provided.
|
|
2313
2597
|
|
|
2314
2598
|
### For Custom Actions
|
|
2315
|
-
Custom actions require resolver implementations
|
|
2599
|
+
Custom actions require resolver implementations that return a `ResolvedAction` object. See [ResolvedAction Reference](./resolved_action.md) for complete field documentation.
|
|
2316
2600
|
|
|
2317
2601
|
```typescript
|
|
2318
2602
|
import { CustomEntityPageActionResolver } from '@wix/auto-patterns/types';
|
|
@@ -2323,7 +2607,7 @@ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
|
|
|
2323
2607
|
const schema = sdk.getSchema(sdk.collectionId);
|
|
2324
2608
|
return {
|
|
2325
2609
|
label: 'Duplicate Product',
|
|
2326
|
-
icon: <DuplicateIcon />, //
|
|
2610
|
+
icon: <DuplicateIcon />, // required
|
|
2327
2611
|
onClick: async () => {
|
|
2328
2612
|
// Your custom duplication logic here
|
|
2329
2613
|
await schema.actions.create({
|
|
@@ -2354,17 +2638,149 @@ export const duplicateProduct: CustomEntityPageActionResolver = (params) => {
|
|
|
2354
2638
|
|
|
2355
2639
|
---
|
|
2356
2640
|
|
|
2641
|
+
# ResolvedAction: Common Return Type for Custom Actions
|
|
2642
|
+
|
|
2643
|
+
All custom action resolvers in Auto Patterns must return a `ResolvedAction`. This applies to:
|
|
2644
|
+
- Collection page actions (primary, secondary, menus) and `onRowClick`
|
|
2645
|
+
- Entity page actions (view mode: primary/secondary/more; edit mode: moreActions)
|
|
2646
|
+
- Bulk action toolbar actions
|
|
2647
|
+
- Action Cell actions
|
|
2648
|
+
|
|
2649
|
+
## Type Definition
|
|
2650
|
+
|
|
2651
|
+
From `@wix/auto-patterns`:
|
|
2652
|
+
|
|
2653
|
+
```typescript
|
|
2654
|
+
export interface ResolvedAction {
|
|
2655
|
+
label: string;
|
|
2656
|
+
icon: IconElement;
|
|
2657
|
+
onClick: () => void;
|
|
2658
|
+
disabled?: boolean;
|
|
2659
|
+
hidden?: boolean;
|
|
2660
|
+
tooltip?: string;
|
|
2661
|
+
skin?: string;
|
|
2662
|
+
}
|
|
2663
|
+
```
|
|
2664
|
+
|
|
2665
|
+
## Field Reference
|
|
2666
|
+
|
|
2667
|
+
### Required Fields
|
|
2668
|
+
|
|
2669
|
+
- **`label`** (string): Text displayed in the button or menu item.
|
|
2670
|
+
- **`icon`** (IconElement): An icon component, typically from `@wix/wix-ui-icons-common`. Example: `icon: <Delete />`.
|
|
2671
|
+
- **`onClick`** (function): Handler function invoked when the user triggers the action. Can be async.
|
|
2672
|
+
|
|
2673
|
+
### Optional Fields
|
|
2674
|
+
|
|
2675
|
+
- **`disabled`** (boolean): When `true`, renders the action as disabled. Pair with `tooltip` to explain why the action is unavailable.
|
|
2676
|
+
- **`hidden`** (boolean): When `true`, the action is completely omitted from the UI. Useful for permission-based or state-based visibility control.
|
|
2677
|
+
- **`tooltip`** (string): Tooltip text displayed on hover. Especially useful when the action is disabled.
|
|
2678
|
+
- **`skin`** (string): Visual style of the action button. Availability may vary by placement context. Recommended values:
|
|
2679
|
+
- Primary actions: `"standard"`, `"inverted"`, `"premium"`
|
|
2680
|
+
- Secondary/more/menu items: `"dark"`, `"destructive"`, `"premium"`
|
|
2681
|
+
- If unsure, omit `skin` or use `"standard"` for primary actions and `"dark"` for secondary actions.
|
|
2682
|
+
|
|
2683
|
+
## Examples
|
|
2684
|
+
|
|
2685
|
+
### Minimal Example
|
|
2686
|
+
|
|
2687
|
+
```typescript
|
|
2688
|
+
import { Add } from '@wix/wix-ui-icons-common';
|
|
2689
|
+
|
|
2690
|
+
return {
|
|
2691
|
+
label: 'Create',
|
|
2692
|
+
icon: <Add />,
|
|
2693
|
+
onClick: () => {
|
|
2694
|
+
// Your action logic here
|
|
2695
|
+
}
|
|
2696
|
+
};
|
|
2697
|
+
```
|
|
2698
|
+
|
|
2699
|
+
### Complete Example with State Control
|
|
2700
|
+
|
|
2701
|
+
```typescript
|
|
2702
|
+
import { Download } from '@wix/wix-ui-icons-common';
|
|
2703
|
+
|
|
2704
|
+
return {
|
|
2705
|
+
label: 'Export',
|
|
2706
|
+
icon: <Download />,
|
|
2707
|
+
onClick: async () => {
|
|
2708
|
+
try {
|
|
2709
|
+
// Perform export logic using SDK
|
|
2710
|
+
await performExport();
|
|
2711
|
+
} catch (error) {
|
|
2712
|
+
// Handle errors, show toast, etc.
|
|
2713
|
+
}
|
|
2714
|
+
},
|
|
2715
|
+
disabled: total === 0,
|
|
2716
|
+
tooltip: total === 0 ? 'Select at least one item to export' : undefined,
|
|
2717
|
+
hidden: !userHasExportPermission,
|
|
2718
|
+
skin: 'premium'
|
|
2719
|
+
};
|
|
2720
|
+
```
|
|
2721
|
+
|
|
2722
|
+
## Context-Specific Notes
|
|
2723
|
+
|
|
2724
|
+
### Collection Page Actions
|
|
2725
|
+
- **onRowClick**: Access clicked item data via `actionParams.item`
|
|
2726
|
+
- **Collection-level actions**: Access collection context via `actionParams.collectionId`
|
|
2727
|
+
|
|
2728
|
+
### Entity Page Actions
|
|
2729
|
+
- **View/Edit mode**: Access entity data via `actionParams.entity`
|
|
2730
|
+
- **Edit mode only**: Access form instance via `actionParams.form`
|
|
2731
|
+
|
|
2732
|
+
### Bulk Actions
|
|
2733
|
+
- **Selection data**: Use `actionParams.selectedValues` and `actionParams.total`
|
|
2734
|
+
- **State control**: Commonly use `disabled: selectedValues.length === 0`
|
|
2735
|
+
|
|
2736
|
+
### Action Cell Actions
|
|
2737
|
+
- **Row context**: Access item and position via `actionParams.item` and `actionParams.index`
|
|
2738
|
+
|
|
2739
|
+
## See Also
|
|
2740
|
+
|
|
2741
|
+
- [Collection Page Actions](./collection_page_actions.md)
|
|
2742
|
+
- [Entity Page Actions](./entity_page_actions.md) (edit mode)
|
|
2743
|
+
- [Entity Page View Actions](./entity_page_view_actions.md)
|
|
2744
|
+
- [Bulk Actions Toolbar](./bulk_actions.md)
|
|
2745
|
+
- [Action Cell](./action_cell.md)
|
|
2746
|
+
- [App Config Structure](./app_config_structure.md) (action item `skin` property)
|
|
2747
|
+
|
|
2748
|
+
---
|
|
2749
|
+
|
|
2357
2750
|
# Installation & Setup
|
|
2358
2751
|
|
|
2359
2752
|
## 1. Install Packages
|
|
2360
2753
|
|
|
2361
|
-
Install if
|
|
2754
|
+
Install if doesn't exists in package.json:
|
|
2362
2755
|
|
|
2363
2756
|
```bash
|
|
2364
2757
|
npm install @wix/auto-patterns @wix/patterns @wix/design-system
|
|
2365
2758
|
```
|
|
2366
2759
|
|
|
2367
|
-
|
|
2760
|
+
### React Router dependency
|
|
2761
|
+
|
|
2762
|
+
`react-router-dom` is required. Install a version that matches your React version:
|
|
2763
|
+
|
|
2764
|
+
- React 16.x (and 17.x): use `react-router-dom@^6`
|
|
2765
|
+
- React 18+ : use `react-router-dom@^7`
|
|
2766
|
+
|
|
2767
|
+
Check your React version:
|
|
2768
|
+
|
|
2769
|
+
```bash
|
|
2770
|
+
npm ls react --depth=0
|
|
2771
|
+
```
|
|
2772
|
+
|
|
2773
|
+
Then install the matching router version:
|
|
2774
|
+
|
|
2775
|
+
```bash
|
|
2776
|
+
# For React 16.x or 17.x
|
|
2777
|
+
npm install react-router-dom@^6
|
|
2778
|
+
|
|
2779
|
+
# For React 18+
|
|
2780
|
+
npm install react-router-dom@^7
|
|
2781
|
+
```
|
|
2782
|
+
|
|
2783
|
+
## Critical Import Rules
|
|
2368
2784
|
|
|
2369
2785
|
- **Import `AutoPatternsApp` only from `@wix/auto-patterns`** - never from other packages
|
|
2370
2786
|
- **CRITICAL:** Always import `AppConfig` as a type import: `import type { AppConfig } from '@wix/auto-patterns/types'` - never import it as a value import
|
|
@@ -2413,7 +2829,7 @@ export default withDashboard(Index);
|
|
|
2413
2829
|
|
|
2414
2830
|
# Custom Overrides
|
|
2415
2831
|
|
|
2416
|
-
##
|
|
2832
|
+
## Override Rules
|
|
2417
2833
|
|
|
2418
2834
|
- **Custom overrides are restricted to the defined areas only** - attempting to override or modify any other aspect of `AutoPatternsApp` is prohibited and can cause unexpected behavior
|
|
2419
2835
|
- **Always verify override implementation** - when implementing custom overrides, you MUST ensure they are correctly imported and passed to the `PatternsWizardOverridesProvider`
|
|
@@ -2455,9 +2871,15 @@ your-page/
|
|
|
2455
2871
|
├── customDataSources/ // Custom data sources
|
|
2456
2872
|
│ ├── index.tsx // Exports useCustomDataSources hook
|
|
2457
2873
|
│ └── myCustomDataSource.ts
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2874
|
+
├── sections/ // Section renderers
|
|
2875
|
+
│ ├── index.tsx
|
|
2876
|
+
│ └── groupByType.ts
|
|
2877
|
+
├── entityPageHeaderSubtitle/ // Entity page dynamic subtitle functions
|
|
2878
|
+
│ ├── index.tsx // Exports useEntityPageHeaderSubtitle hook
|
|
2879
|
+
│ └── mySubtitle.ts
|
|
2880
|
+
└── entityPageHeaderBadges/ // Entity page dynamic badges functions
|
|
2881
|
+
├── index.tsx // Exports useEntityPageHeaderBadges hook
|
|
2882
|
+
└── myBadges.ts
|
|
2461
2883
|
```
|
|
2462
2884
|
|
|
2463
2885
|
### Using Override Hooks in Your Page
|
|
@@ -2472,6 +2894,8 @@ import { useSections } from '../components/sections';
|
|
|
2472
2894
|
import { useComponents } from '../components/customComponents';
|
|
2473
2895
|
import { useModals } from '../components/modals';
|
|
2474
2896
|
import { useCustomDataSources } from '../components/customDataSources';
|
|
2897
|
+
import { useEntityPageHeaderSubtitle } from '../components/entityPageHeaderSubtitle';
|
|
2898
|
+
import { useEntityPageHeaderBadges } from '../components/entityPageHeaderBadges';
|
|
2475
2899
|
|
|
2476
2900
|
export default function YourPage() {
|
|
2477
2901
|
const actions = useActions();
|
|
@@ -2481,9 +2905,11 @@ export default function YourPage() {
|
|
|
2481
2905
|
const components = useComponents();
|
|
2482
2906
|
const modals = useModals();
|
|
2483
2907
|
const customDataSources = useCustomDataSources();
|
|
2908
|
+
const entityPageHeaderSubtitle = useEntityPageHeaderSubtitle();
|
|
2909
|
+
const entityPageHeaderBadges = useEntityPageHeaderBadges();
|
|
2484
2910
|
|
|
2485
2911
|
return (
|
|
2486
|
-
<PatternsWizardOverridesProvider value={{ actions, columns, slots, sections, components, modals, customDataSources }}>
|
|
2912
|
+
<PatternsWizardOverridesProvider value={{ actions, columns, slots, sections, components, modals, customDataSources, entityPageHeaderSubtitle, entityPageHeaderBadges }}>
|
|
2487
2913
|
<AutoPatternsApp configuration={config} />
|
|
2488
2914
|
</PatternsWizardOverridesProvider>
|
|
2489
2915
|
);
|
|
@@ -2502,10 +2928,12 @@ For example:
|
|
|
2502
2928
|
- Adding a new section renderer → Update `../components/sections/index.tsx` to include the new section in the `useSections` hook
|
|
2503
2929
|
- Adding a new custom component → Update `../components/customComponents/index.tsx` to include the new component in the `useComponents` hook
|
|
2504
2930
|
- Adding a new custom data source → Update `../components/customDataSources/index.tsx` to include the new data source in the `useCustomDataSources` hook
|
|
2931
|
+
- Adding a new subtitle override → Update `../components/entityPageHeaderSubtitle/index.tsx` to include the new subtitle in the `useEntityPageHeaderSubtitle` hook
|
|
2932
|
+
- Adding a new badges override → Update `../components/entityPageHeaderBadges/index.tsx` to include the new badges in the `useEntityPageHeaderBadges` hook
|
|
2505
2933
|
|
|
2506
2934
|
Without updating the hook index files, your implementations won't be available to the `PatternsWizardOverridesProvider`.
|
|
2507
2935
|
|
|
2508
|
-
##
|
|
2936
|
+
## Common Override Mistakes to Avoid
|
|
2509
2937
|
|
|
2510
2938
|
- Attempting to override unsupported areas
|
|
2511
2939
|
- Invalid column rendering functions
|