@wix/auto-patterns 1.44.0 → 1.45.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.uni.driver.js +3 -0
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.uni.driver.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +3 -3
- package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js +26 -14
- package/dist/cjs/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js +38 -29
- package/dist/cjs/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/index.js +0 -6
- package/dist/cjs/components/AutoPatternsEntityPage/index.js.map +1 -1
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js +67 -12
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js +8 -7
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/cjs/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.js +165 -0
- package/dist/cjs/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.js.map +1 -0
- package/dist/cjs/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.uni.driver.js +15 -0
- package/dist/cjs/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.uni.driver.js.map +1 -0
- package/dist/cjs/components/AutoPatternsSettingsPage/index.js +10 -0
- package/dist/cjs/components/AutoPatternsSettingsPage/index.js.map +1 -0
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +2 -3
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/Checkbox.js +1 -1
- package/dist/cjs/components/fields/Checkbox.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/DateInput.js +9 -8
- package/dist/cjs/components/fields/DateInput.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/DateTime.js +13 -12
- package/dist/cjs/components/fields/DateTime.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/ImageInput.js +11 -10
- package/dist/cjs/components/fields/ImageInput.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/LongText.js +9 -8
- package/dist/cjs/components/fields/LongText.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/Number.js +9 -8
- package/dist/cjs/components/fields/Number.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/ShortText.js +9 -8
- package/dist/cjs/components/fields/ShortText.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/Url.js +11 -10
- package/dist/cjs/components/fields/Url.js.map +1 -0
- package/dist/cjs/components/fields/index.js +38 -0
- package/dist/cjs/components/fields/index.js.map +1 -0
- package/dist/cjs/components/fields/types.js.map +1 -0
- package/dist/cjs/components/fields/utils/dates.js.map +1 -0
- package/dist/cjs/components/{AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js → layouts/ContentCard.js} +26 -15
- package/dist/cjs/components/layouts/ContentCard.js.map +1 -0
- package/dist/cjs/components/layouts/ContentCardLayout.js +157 -0
- package/dist/cjs/components/layouts/ContentCardLayout.js.map +1 -0
- package/dist/cjs/components/layouts/ContentSkeleton.js +98 -0
- package/dist/cjs/components/layouts/ContentSkeleton.js.map +1 -0
- package/dist/cjs/components/layouts/FormField.js +52 -0
- package/dist/cjs/components/layouts/FormField.js.map +1 -0
- package/dist/cjs/components/layouts/ViewField.js +68 -0
- package/dist/cjs/components/layouts/ViewField.js.map +1 -0
- package/dist/cjs/components/layouts/types.js +4 -0
- package/dist/cjs/components/layouts/types.js.map +1 -0
- package/dist/cjs/hooks/useBaseTableFeatures.js +2 -1
- package/dist/cjs/hooks/useBaseTableFeatures.js.map +1 -1
- package/dist/cjs/hooks/usePagePath.js +4 -1
- package/dist/cjs/hooks/usePagePath.js.map +1 -1
- package/dist/cjs/hooks/useSettingsPageMoreActions.js +36 -0
- package/dist/cjs/hooks/useSettingsPageMoreActions.js.map +1 -0
- package/dist/cjs/providers/AutoPatternsOverridesContext.js +1 -1
- package/dist/cjs/providers/AutoPatternsOverridesContext.js.map +1 -1
- package/dist/cjs/types/SettingsPageConfig.js +4 -0
- package/dist/cjs/types/SettingsPageConfig.js.map +1 -0
- package/dist/cjs/types/actions/base.js.map +1 -1
- package/dist/cjs/types/actions/entityPageActions.js.map +1 -1
- package/dist/cjs/types/actions/formPageActions.js +4 -0
- package/dist/cjs/types/actions/formPageActions.js.map +1 -0
- package/dist/cjs/types/actions/index.js +6 -0
- package/dist/cjs/types/actions/index.js.map +1 -1
- package/dist/cjs/types/index.js +6 -0
- package/dist/cjs/types/index.js.map +1 -1
- package/dist/cjs/types/types.js.map +1 -1
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.uni.driver.js +4 -1
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.uni.driver.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +3 -3
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js +21 -8
- package/dist/esm/components/AutoPatternsEntityPage/EditModeEntityPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js +21 -12
- package/dist/esm/components/AutoPatternsEntityPage/ViewModeEntityPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/index.js +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/index.js.map +1 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js +31 -6
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js +2 -1
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsRoutes.js.map +1 -1
- package/dist/esm/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.js +108 -0
- package/dist/esm/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.js.map +1 -0
- package/dist/esm/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.uni.driver.js +10 -0
- package/dist/esm/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.uni.driver.js.map +1 -0
- package/dist/esm/components/AutoPatternsSettingsPage/index.js +2 -0
- package/dist/esm/components/AutoPatternsSettingsPage/index.js.map +1 -0
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +0 -1
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
- package/dist/esm/components/fields/Checkbox.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/DateInput.js +7 -6
- package/dist/esm/components/fields/DateInput.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/DateTime.js +7 -6
- package/dist/esm/components/fields/DateTime.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/ImageInput.js +9 -8
- package/dist/esm/components/fields/ImageInput.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/LongText.js +7 -6
- package/dist/esm/components/fields/LongText.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/Number.js +7 -6
- package/dist/esm/components/fields/Number.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/ShortText.js +7 -6
- package/dist/esm/components/fields/ShortText.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/Url.js +7 -6
- package/dist/esm/components/fields/Url.js.map +1 -0
- package/dist/esm/components/fields/index.js +10 -0
- package/dist/esm/components/fields/index.js.map +1 -0
- package/dist/esm/components/fields/types.js.map +1 -0
- package/dist/esm/components/fields/utils/dates.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js → layouts/ContentCard.js} +19 -8
- package/dist/esm/components/layouts/ContentCard.js.map +1 -0
- package/dist/esm/components/{AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js → layouts/ContentCardLayout.js} +38 -19
- package/dist/esm/components/layouts/ContentCardLayout.js.map +1 -0
- package/dist/esm/components/layouts/ContentSkeleton.js +47 -0
- package/dist/esm/components/layouts/ContentSkeleton.js.map +1 -0
- package/dist/esm/components/layouts/FormField.js +40 -0
- package/dist/esm/components/layouts/FormField.js.map +1 -0
- package/dist/esm/components/layouts/ViewField.js +43 -0
- package/dist/esm/components/layouts/ViewField.js.map +1 -0
- package/dist/esm/components/layouts/types.js +2 -0
- package/dist/esm/components/layouts/types.js.map +1 -0
- package/dist/esm/hooks/useBaseTableFeatures.js +1 -0
- package/dist/esm/hooks/useBaseTableFeatures.js.map +1 -1
- package/dist/esm/hooks/usePagePath.js +4 -1
- package/dist/esm/hooks/usePagePath.js.map +1 -1
- package/dist/esm/hooks/useSettingsPageMoreActions.js +32 -0
- package/dist/esm/hooks/useSettingsPageMoreActions.js.map +1 -0
- package/dist/esm/providers/AutoPatternsOverridesContext.js.map +1 -1
- package/dist/esm/types/SettingsPageConfig.js +2 -0
- package/dist/esm/types/SettingsPageConfig.js.map +1 -0
- package/dist/esm/types/actions/base.js.map +1 -1
- package/dist/esm/types/actions/entityPageActions.js.map +1 -1
- package/dist/esm/types/actions/formPageActions.js +2 -0
- package/dist/esm/types/actions/formPageActions.js.map +1 -0
- package/dist/esm/types/actions/index.js +1 -0
- package/dist/esm/types/actions/index.js.map +1 -1
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/types.js.map +1 -1
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.uni.driver.d.ts +4 -1
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.uni.driver.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/AutoPatternsEntityPage/index.d.ts +0 -1
- package/dist/types/components/AutoPatternsEntityPage/index.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsRoute/AutoPatternsPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsRoute/AutoPatternsRoutes.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.d.ts +6 -0
- package/dist/types/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.uni.driver.d.ts +145 -0
- package/dist/types/components/AutoPatternsSettingsPage/AutoPatternsSettingsPage.uni.driver.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsSettingsPage/index.d.ts +2 -0
- package/dist/types/components/AutoPatternsSettingsPage/index.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -1
- package/dist/types/components/fields/Checkbox.d.ts.map +1 -0
- package/dist/types/components/fields/DateInput.d.ts.map +1 -0
- package/dist/types/components/fields/DateTime.d.ts.map +1 -0
- package/dist/types/components/fields/ImageInput.d.ts.map +1 -0
- package/dist/types/components/fields/LongText.d.ts.map +1 -0
- package/dist/types/components/fields/Number.d.ts.map +1 -0
- package/dist/types/components/fields/ShortText.d.ts.map +1 -0
- package/dist/types/components/fields/Url.d.ts.map +1 -0
- package/dist/types/components/fields/index.d.ts +10 -0
- package/dist/types/components/fields/index.d.ts.map +1 -0
- package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/types.d.ts +4 -1
- package/dist/types/components/fields/types.d.ts.map +1 -0
- package/dist/types/components/fields/utils/dates.d.ts.map +1 -0
- package/dist/types/components/layouts/ContentCard.d.ts +17 -0
- package/dist/types/components/layouts/ContentCard.d.ts.map +1 -0
- package/dist/types/components/layouts/ContentCardLayout.d.ts +18 -0
- package/dist/types/components/layouts/ContentCardLayout.d.ts.map +1 -0
- package/dist/types/components/layouts/ContentSkeleton.d.ts +9 -0
- package/dist/types/components/layouts/ContentSkeleton.d.ts.map +1 -0
- package/dist/types/components/layouts/FormField.d.ts +13 -0
- package/dist/types/components/layouts/FormField.d.ts.map +1 -0
- package/dist/types/components/layouts/ViewField.d.ts +8 -0
- package/dist/types/components/layouts/ViewField.d.ts.map +1 -0
- package/dist/types/components/layouts/types.d.ts +3 -0
- package/dist/types/components/layouts/types.d.ts.map +1 -0
- package/dist/types/hooks/useBaseTableFeatures.d.ts +2 -0
- package/dist/types/hooks/useBaseTableFeatures.d.ts.map +1 -1
- package/dist/types/hooks/usePagePath.d.ts.map +1 -1
- package/dist/types/hooks/useSettingsPageMoreActions.d.ts +5 -0
- package/dist/types/hooks/useSettingsPageMoreActions.d.ts.map +1 -0
- package/dist/types/providers/AutoPatternsOverridesContext.d.ts +2 -2
- package/dist/types/providers/AutoPatternsOverridesContext.d.ts.map +1 -1
- package/dist/types/testkit/enzyme.d.ts +1 -0
- package/dist/types/testkit/enzyme.d.ts.map +1 -1
- package/dist/types/testkit/jsdom.d.ts +1 -0
- package/dist/types/testkit/jsdom.d.ts.map +1 -1
- package/dist/types/testkit/playwright.d.ts +1 -0
- package/dist/types/testkit/playwright.d.ts.map +1 -1
- package/dist/types/testkit/puppeteer.d.ts +1 -0
- package/dist/types/testkit/puppeteer.d.ts.map +1 -1
- package/dist/types/types/SettingsPageConfig.d.ts +140 -0
- package/dist/types/types/SettingsPageConfig.d.ts.map +1 -0
- package/dist/types/types/actions/base.d.ts +1 -0
- package/dist/types/types/actions/base.d.ts.map +1 -1
- package/dist/types/types/actions/entityPageActions.d.ts +2 -7
- package/dist/types/types/actions/entityPageActions.d.ts.map +1 -1
- package/dist/types/types/actions/formPageActions.d.ts +8 -0
- package/dist/types/types/actions/formPageActions.d.ts.map +1 -0
- package/dist/types/types/actions/index.d.ts +1 -0
- package/dist/types/types/actions/index.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/types.d.ts +20 -1
- package/dist/types/types/types.d.ts.map +1 -1
- package/docs/GETTING_STARTED.md +73 -18
- package/mcp-docs/app_config_structure.md +66 -3
- package/mcp-docs/auto-patterns-guide.md +86 -6
- package/mcp-docs/index.md +4 -0
- package/mcp-docs/pages_configuration.md +20 -3
- package/mcp-docs/settings_page.md +599 -0
- package/package.json +3 -3
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Checkbox.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateInput.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateTime.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +0 -59
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/LongText.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Number.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/ShortText.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Url.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/types.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/utils/dates.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js +0 -119
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +0 -79
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js +0 -16
- package/dist/cjs/components/AutoPatternsEntityPage/RenderLayout/index.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/SkeletonEntity.js +0 -198
- package/dist/cjs/components/AutoPatternsEntityPage/SkeletonEntity.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +0 -77
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +0 -1
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +0 -109
- package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Checkbox.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +0 -46
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ImageInput.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/types.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/Fields/utils/dates.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js +0 -48
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js +0 -3
- package/dist/esm/components/AutoPatternsEntityPage/RenderLayout/index.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js +0 -91
- package/dist/esm/components/AutoPatternsEntityPage/SkeletonEntity.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js +0 -31
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map +0 -1
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js +0 -66
- package/dist/esm/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/Checkbox.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/DateInput.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/DateTime.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/FormFieldInput.d.ts +0 -10
- package/dist/types/components/AutoPatternsEntityPage/Fields/FormFieldInput.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/ImageInput.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/LongText.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/Number.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/ShortText.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/Url.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/types.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/Fields/utils/dates.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts +0 -11
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutCard.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts +0 -13
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderLayoutContent.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts +0 -8
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/RenderViewField.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts +0 -3
- package/dist/types/components/AutoPatternsEntityPage/RenderLayout/index.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/SkeletonEntity.d.ts +0 -7
- package/dist/types/components/AutoPatternsEntityPage/SkeletonEntity.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts +0 -8
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.d.ts.map +0 -1
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts +0 -8
- package/dist/types/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.d.ts.map +0 -1
- /package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/types.js +0 -0
- /package/dist/cjs/components/{AutoPatternsEntityPage/Fields → fields}/utils/dates.js +0 -0
- /package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/Checkbox.js +0 -0
- /package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/types.js +0 -0
- /package/dist/esm/components/{AutoPatternsEntityPage/Fields → fields}/utils/dates.js +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/Checkbox.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/DateInput.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/DateTime.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/ImageInput.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/LongText.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/Number.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/ShortText.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/Url.d.ts +0 -0
- /package/dist/types/components/{AutoPatternsEntityPage/Fields → fields}/utils/dates.d.ts +0 -0
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.SkeletonEntity = void 0;
|
|
6
|
-
var _patterns = require("@wix/patterns");
|
|
7
|
-
var _form = require("../../exports/form");
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _designSystem = require("@wix/design-system");
|
|
10
|
-
var _jsxFileName = "/home/builduser/work/8f3ab5a55e62623a/packages/auto-patterns/dist/cjs/components/AutoPatternsEntityPage/SkeletonEntity.tsx";
|
|
11
|
-
const RenderLayoutContent = ({
|
|
12
|
-
content,
|
|
13
|
-
level,
|
|
14
|
-
sectionId,
|
|
15
|
-
cardIndex,
|
|
16
|
-
contentIndex
|
|
17
|
-
}) => {
|
|
18
|
-
var _content$container$ch;
|
|
19
|
-
switch (content.type) {
|
|
20
|
-
case 'container':
|
|
21
|
-
if (!((_content$container$ch = content.container.children) != null && _content$container$ch.length)) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
return /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
|
|
25
|
-
span: content.container.span,
|
|
26
|
-
__self: void 0,
|
|
27
|
-
__source: {
|
|
28
|
-
fileName: _jsxFileName,
|
|
29
|
-
lineNumber: 25,
|
|
30
|
-
columnNumber: 9
|
|
31
|
-
}
|
|
32
|
-
}, /*#__PURE__*/_react.default.createElement(_designSystem.Layout, {
|
|
33
|
-
__self: void 0,
|
|
34
|
-
__source: {
|
|
35
|
-
fileName: _jsxFileName,
|
|
36
|
-
lineNumber: 26,
|
|
37
|
-
columnNumber: 11
|
|
38
|
-
}
|
|
39
|
-
}, content.container.children.map((child, index) => /*#__PURE__*/_react.default.createElement(RenderLayoutContent, {
|
|
40
|
-
key: `${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`,
|
|
41
|
-
content: child,
|
|
42
|
-
level: level + 1,
|
|
43
|
-
sectionId: sectionId,
|
|
44
|
-
cardIndex: cardIndex,
|
|
45
|
-
contentIndex: index,
|
|
46
|
-
__self: void 0,
|
|
47
|
-
__source: {
|
|
48
|
-
fileName: _jsxFileName,
|
|
49
|
-
lineNumber: 28,
|
|
50
|
-
columnNumber: 15
|
|
51
|
-
}
|
|
52
|
-
}))));
|
|
53
|
-
default:
|
|
54
|
-
return null;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const RenderLayoutCard = ({
|
|
58
|
-
layout,
|
|
59
|
-
sectionId,
|
|
60
|
-
cardIndex
|
|
61
|
-
}) => {
|
|
62
|
-
var _layout$card$subtitle;
|
|
63
|
-
switch (layout.type) {
|
|
64
|
-
case 'card':
|
|
65
|
-
return /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.Card, {
|
|
66
|
-
minHeight: "50px",
|
|
67
|
-
__self: void 0,
|
|
68
|
-
__source: {
|
|
69
|
-
fileName: _jsxFileName,
|
|
70
|
-
lineNumber: 54,
|
|
71
|
-
columnNumber: 9
|
|
72
|
-
}
|
|
73
|
-
}, /*#__PURE__*/_react.default.createElement(_designSystem.Card.Header, {
|
|
74
|
-
title: layout.card.title.text,
|
|
75
|
-
subtitle: (_layout$card$subtitle = layout.card.subtitle) == null ? void 0 : _layout$card$subtitle.text,
|
|
76
|
-
__self: void 0,
|
|
77
|
-
__source: {
|
|
78
|
-
fileName: _jsxFileName,
|
|
79
|
-
lineNumber: 55,
|
|
80
|
-
columnNumber: 11
|
|
81
|
-
}
|
|
82
|
-
}), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Divider, {
|
|
83
|
-
__self: void 0,
|
|
84
|
-
__source: {
|
|
85
|
-
fileName: _jsxFileName,
|
|
86
|
-
lineNumber: 59,
|
|
87
|
-
columnNumber: 11
|
|
88
|
-
}
|
|
89
|
-
}), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Content, {
|
|
90
|
-
__self: void 0,
|
|
91
|
-
__source: {
|
|
92
|
-
fileName: _jsxFileName,
|
|
93
|
-
lineNumber: 60,
|
|
94
|
-
columnNumber: 11
|
|
95
|
-
}
|
|
96
|
-
}, /*#__PURE__*/_react.default.createElement(_designSystem.Layout, {
|
|
97
|
-
__self: void 0,
|
|
98
|
-
__source: {
|
|
99
|
-
fileName: _jsxFileName,
|
|
100
|
-
lineNumber: 61,
|
|
101
|
-
columnNumber: 13
|
|
102
|
-
}
|
|
103
|
-
}, layout.card.children.map((child, index) => /*#__PURE__*/_react.default.createElement(RenderLayoutContent, {
|
|
104
|
-
key: `${sectionId}-card-${cardIndex}-content-${index}`,
|
|
105
|
-
content: child,
|
|
106
|
-
level: 0,
|
|
107
|
-
sectionId: sectionId,
|
|
108
|
-
cardIndex: cardIndex,
|
|
109
|
-
contentIndex: index,
|
|
110
|
-
__self: void 0,
|
|
111
|
-
__source: {
|
|
112
|
-
fileName: _jsxFileName,
|
|
113
|
-
lineNumber: 63,
|
|
114
|
-
columnNumber: 17
|
|
115
|
-
}
|
|
116
|
-
})))));
|
|
117
|
-
default:
|
|
118
|
-
return null;
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const SkeletonEntity = ({
|
|
122
|
-
entityPage
|
|
123
|
-
}) => {
|
|
124
|
-
var _entityPage$layout, _entityPage$layout2, _entityPage$layout$si;
|
|
125
|
-
const form = (0, _form.useForm)();
|
|
126
|
-
const state = (0, _patterns.useEntityPage)({
|
|
127
|
-
parentPath: '',
|
|
128
|
-
form,
|
|
129
|
-
onSave: async () => ({
|
|
130
|
-
updatedEntity: {}
|
|
131
|
-
}),
|
|
132
|
-
fetch: async () => new Promise(() => {})
|
|
133
|
-
});
|
|
134
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_patterns.EntityPage, {
|
|
135
|
-
state: state,
|
|
136
|
-
__self: void 0,
|
|
137
|
-
__source: {
|
|
138
|
-
fileName: _jsxFileName,
|
|
139
|
-
lineNumber: 93,
|
|
140
|
-
columnNumber: 7
|
|
141
|
-
}
|
|
142
|
-
}, /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.Header, {
|
|
143
|
-
title: {
|
|
144
|
-
text: ''
|
|
145
|
-
},
|
|
146
|
-
__self: void 0,
|
|
147
|
-
__source: {
|
|
148
|
-
fileName: _jsxFileName,
|
|
149
|
-
lineNumber: 94,
|
|
150
|
-
columnNumber: 9
|
|
151
|
-
}
|
|
152
|
-
}), /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.Content, {
|
|
153
|
-
__self: void 0,
|
|
154
|
-
__source: {
|
|
155
|
-
fileName: _jsxFileName,
|
|
156
|
-
lineNumber: 95,
|
|
157
|
-
columnNumber: 9
|
|
158
|
-
}
|
|
159
|
-
}, /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.MainContent, {
|
|
160
|
-
__self: void 0,
|
|
161
|
-
__source: {
|
|
162
|
-
fileName: _jsxFileName,
|
|
163
|
-
lineNumber: 96,
|
|
164
|
-
columnNumber: 11
|
|
165
|
-
}
|
|
166
|
-
}, (_entityPage$layout = entityPage.layout) == null || (_entityPage$layout = _entityPage$layout.main) == null ? void 0 : _entityPage$layout.map((layout, layoutIndex) => /*#__PURE__*/_react.default.createElement(RenderLayoutCard, {
|
|
167
|
-
key: `main-section-card-${layoutIndex}`,
|
|
168
|
-
layout: layout,
|
|
169
|
-
sectionId: "main",
|
|
170
|
-
cardIndex: layoutIndex,
|
|
171
|
-
__self: void 0,
|
|
172
|
-
__source: {
|
|
173
|
-
fileName: _jsxFileName,
|
|
174
|
-
lineNumber: 98,
|
|
175
|
-
columnNumber: 15
|
|
176
|
-
}
|
|
177
|
-
}))), (_entityPage$layout2 = entityPage.layout) != null && _entityPage$layout2.sidebar ? /*#__PURE__*/_react.default.createElement(_patterns.EntityPage.AdditionalContent, {
|
|
178
|
-
__self: void 0,
|
|
179
|
-
__source: {
|
|
180
|
-
fileName: _jsxFileName,
|
|
181
|
-
lineNumber: 107,
|
|
182
|
-
columnNumber: 13
|
|
183
|
-
}
|
|
184
|
-
}, (_entityPage$layout$si = entityPage.layout.sidebar) == null ? void 0 : _entityPage$layout$si.map((layout, layoutIndex) => /*#__PURE__*/_react.default.createElement(RenderLayoutCard, {
|
|
185
|
-
key: `sidebar-section-card-${layoutIndex}`,
|
|
186
|
-
layout: layout,
|
|
187
|
-
sectionId: "sidebar",
|
|
188
|
-
cardIndex: layoutIndex,
|
|
189
|
-
__self: void 0,
|
|
190
|
-
__source: {
|
|
191
|
-
fileName: _jsxFileName,
|
|
192
|
-
lineNumber: 109,
|
|
193
|
-
columnNumber: 17
|
|
194
|
-
}
|
|
195
|
-
}))) : null)));
|
|
196
|
-
};
|
|
197
|
-
exports.SkeletonEntity = SkeletonEntity;
|
|
198
|
-
//# sourceMappingURL=SkeletonEntity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_patterns","require","_form","_react","_interopRequireDefault","_designSystem","_jsxFileName","RenderLayoutContent","content","level","sectionId","cardIndex","contentIndex","_content$container$ch","type","container","children","length","default","createElement","Cell","span","__self","__source","fileName","lineNumber","columnNumber","Layout","map","child","index","key","RenderLayoutCard","layout","_layout$card$subtitle","EntityPage","Card","minHeight","Header","title","card","text","subtitle","Divider","Content","SkeletonEntity","entityPage","_entityPage$layout","_entityPage$layout2","_entityPage$layout$si","form","useForm","state","useEntityPage","parentPath","onSave","updatedEntity","fetch","Promise","Fragment","MainContent","main","layoutIndex","sidebar","AdditionalContent","exports"],"sources":["../../../../src/components/AutoPatternsEntityPage/SkeletonEntity.tsx"],"sourcesContent":["import { EntityPage, EntityPageState, useEntityPage } from '@wix/patterns';\nimport { useForm } from '../../exports/form';\nimport React from 'react';\nimport { EntityPageConfig, CardLayout, LayoutContent } from '../../types';\n\nexport interface SkeletonEntityProps {\n entityPage: EntityPageConfig;\n}\nimport { Card, Cell, Layout } from '@wix/design-system';\n\nconst RenderLayoutContent: React.FC<{\n content: LayoutContent;\n level: number;\n sectionId: string;\n cardIndex: number;\n contentIndex: number;\n}> = ({ content, level, sectionId, cardIndex, contentIndex }) => {\n switch (content.type) {\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n default:\n return null;\n }\n};\n\nconst RenderLayoutCard: React.FC<{\n layout: CardLayout;\n sectionId: string;\n cardIndex: number;\n}> = ({ layout, sectionId, cardIndex }) => {\n switch (layout.type) {\n case 'card':\n return (\n <EntityPage.Card minHeight=\"50px\">\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Card.Content>\n </EntityPage.Card>\n );\n default:\n return null;\n }\n};\n\nexport const SkeletonEntity = ({ entityPage }: SkeletonEntityProps) => {\n const form = useForm();\n\n const state: EntityPageState<any> = useEntityPage<any, any>({\n parentPath: '',\n form,\n onSave: async () => ({ updatedEntity: {} }),\n fetch: async () => new Promise(() => {}),\n });\n\n return (\n <>\n <EntityPage state={state}>\n <EntityPage.Header title={{ text: '' }} />\n <EntityPage.Content>\n <EntityPage.MainContent>\n {entityPage.layout?.main?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`main-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"main\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.MainContent>\n {entityPage.layout?.sidebar ? (\n <EntityPage.AdditionalContent>\n {entityPage.layout.sidebar?.map((layout, layoutIndex) => (\n <RenderLayoutCard\n key={`sidebar-section-card-${layoutIndex}`}\n layout={layout}\n sectionId=\"sidebar\"\n cardIndex={layoutIndex}\n />\n ))}\n </EntityPage.AdditionalContent>\n ) : null}\n </EntityPage.Content>\n </EntityPage>\n </>\n );\n};\n"],"mappings":";;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAC,sBAAA,CAAAH,OAAA;AAMA,IAAAI,aAAA,GAAAJ,OAAA;AAAwD,IAAAK,YAAA;AAExD,MAAMC,mBAMJ,GAAGA,CAAC;EAAEC,OAAO;EAAEC,KAAK;EAAEC,SAAS;EAAEC,SAAS;EAAEC;AAAa,CAAC,KAAK;EAAA,IAAAC,qBAAA;EAC/D,QAAQL,OAAO,CAACM,IAAI;IAClB,KAAK,WAAW;MACd,IAAI,GAAAD,qBAAA,GAACL,OAAO,CAACO,SAAS,CAACC,QAAQ,aAA1BH,qBAAA,CAA4BI,MAAM,GAAE;QACvC,OAAO,IAAI;MACb;MAEA,oBACEd,MAAA,CAAAe,OAAA,CAAAC,aAAA,CAAC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,QAAA;MAAAC,QAAA,EAAAlB,YAAA;MAAAmB,UAAA;MAAAC,YAAA;IAAA;EAAA,CACxB,CACF,CAC2B,CAAC,GAC7B,IACc,CACV,CACZ,CAAC;AAEP,CAAC;AAACuC,OAAA,CAAApB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.RenderViewLayoutCard = void 0;
|
|
6
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
var _designSystem = require("@wix/design-system");
|
|
8
|
-
var _RenderViewLayoutContent = require("./RenderViewLayoutContent");
|
|
9
|
-
var _jsxFileName = "/home/builduser/work/8f3ab5a55e62623a/packages/auto-patterns/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.tsx";
|
|
10
|
-
// TODO: remove this component and use RenderLayoutCard instead
|
|
11
|
-
const RenderViewLayoutCard = ({
|
|
12
|
-
entity,
|
|
13
|
-
layout,
|
|
14
|
-
sectionId,
|
|
15
|
-
cardIndex
|
|
16
|
-
}) => {
|
|
17
|
-
var _layout$card$subtitle;
|
|
18
|
-
switch (layout.type) {
|
|
19
|
-
case 'card':
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement(_designSystem.Card, {
|
|
21
|
-
__self: void 0,
|
|
22
|
-
__source: {
|
|
23
|
-
fileName: _jsxFileName,
|
|
24
|
-
lineNumber: 21,
|
|
25
|
-
columnNumber: 9
|
|
26
|
-
}
|
|
27
|
-
}, /*#__PURE__*/_react.default.createElement(_designSystem.Card.Header, {
|
|
28
|
-
title: layout.card.title.text,
|
|
29
|
-
subtitle: (_layout$card$subtitle = layout.card.subtitle) == null ? void 0 : _layout$card$subtitle.text,
|
|
30
|
-
__self: void 0,
|
|
31
|
-
__source: {
|
|
32
|
-
fileName: _jsxFileName,
|
|
33
|
-
lineNumber: 22,
|
|
34
|
-
columnNumber: 11
|
|
35
|
-
}
|
|
36
|
-
}), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Divider, {
|
|
37
|
-
__self: void 0,
|
|
38
|
-
__source: {
|
|
39
|
-
fileName: _jsxFileName,
|
|
40
|
-
lineNumber: 26,
|
|
41
|
-
columnNumber: 11
|
|
42
|
-
}
|
|
43
|
-
}), /*#__PURE__*/_react.default.createElement(_designSystem.Card.Content, {
|
|
44
|
-
__self: void 0,
|
|
45
|
-
__source: {
|
|
46
|
-
fileName: _jsxFileName,
|
|
47
|
-
lineNumber: 27,
|
|
48
|
-
columnNumber: 11
|
|
49
|
-
}
|
|
50
|
-
}, /*#__PURE__*/_react.default.createElement(_designSystem.Layout, {
|
|
51
|
-
__self: void 0,
|
|
52
|
-
__source: {
|
|
53
|
-
fileName: _jsxFileName,
|
|
54
|
-
lineNumber: 28,
|
|
55
|
-
columnNumber: 13
|
|
56
|
-
}
|
|
57
|
-
}, layout.card.children.map((child, index) => /*#__PURE__*/_react.default.createElement(_RenderViewLayoutContent.RenderViewLayoutContent, {
|
|
58
|
-
key: `${sectionId}-card-${cardIndex}-content-${index}`,
|
|
59
|
-
entity: entity,
|
|
60
|
-
content: child,
|
|
61
|
-
level: 0,
|
|
62
|
-
sectionId: sectionId,
|
|
63
|
-
cardIndex: cardIndex,
|
|
64
|
-
contentIndex: index,
|
|
65
|
-
__self: void 0,
|
|
66
|
-
__source: {
|
|
67
|
-
fileName: _jsxFileName,
|
|
68
|
-
lineNumber: 30,
|
|
69
|
-
columnNumber: 17
|
|
70
|
-
}
|
|
71
|
-
})))));
|
|
72
|
-
default:
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
exports.RenderViewLayoutCard = RenderViewLayoutCard;
|
|
77
|
-
//# sourceMappingURL=RenderViewLayoutCard.js.map
|
package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_designSystem","_RenderViewLayoutContent","_jsxFileName","RenderViewLayoutCard","entity","layout","sectionId","cardIndex","_layout$card$subtitle","type","default","createElement","Card","__self","__source","fileName","lineNumber","columnNumber","Header","title","card","text","subtitle","Divider","Content","Layout","children","map","child","index","RenderViewLayoutContent","key","content","level","contentIndex","exports"],"sources":["../../../../../src/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutCard.tsx"],"sourcesContent":["import React from 'react';\nimport { Card, Layout } from '@wix/design-system';\nimport { RenderViewLayoutContent } from './RenderViewLayoutContent';\nimport { RenderLayoutCardProps } from '../RenderLayout';\n\ninterface RenderViewLayoutCardProps\n extends Omit<RenderLayoutCardProps, 'setInputRef'> {\n entity: Record<string, any>;\n}\n\n// TODO: remove this component and use RenderLayoutCard instead\nexport const RenderViewLayoutCard: React.FC<RenderViewLayoutCardProps> = ({\n entity,\n layout,\n sectionId,\n cardIndex,\n}) => {\n switch (layout.type) {\n case 'card':\n return (\n <Card>\n <Card.Header\n title={layout.card.title.text}\n subtitle={layout.card.subtitle?.text}\n />\n <Card.Divider />\n <Card.Content>\n <Layout>\n {layout.card.children.map((child, index: number) => (\n <RenderViewLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${index}`}\n entity={entity}\n content={child}\n level={0}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Card.Content>\n </Card>\n );\n default:\n return null;\n }\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,wBAAA,GAAAF,OAAA;AAAoE,IAAAG,YAAA;AAQpE;AACO,MAAMC,oBAAyD,GAAGA,CAAC;EACxEC,MAAM;EACNC,MAAM;EACNC,SAAS;EACTC;AACF,CAAC,KAAK;EAAA,IAAAC,qBAAA;EACJ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E,GAAGzB,SAAS,SAASC,SAAS,YAAYsB,KAAK,EAAG;QACvDzB,MAAM,EAAEA,MAAO;QACf4B,OAAO,EAAEJ,KAAM;QACfK,KAAK,EAAE,CAAE;QACT3B,SAAS,EAAEA,SAAU;QACrBC,SAAS,EAAEA,SAAU;QACrB2B,YAAY,EAAEL,KAAM;QAAAhB,MAAA;QAAAC,QAAA;UAAAC,QAAA,EAAAb,YAAA;UAAAc,UAAA;UAAAC,YAAA;QAAA;MAAA,CACrB,CACF,CACK,CACI,CACV,CAAC;IAEX;MACE,OAAO,IAAI;EACf;AACF,CAAC;AAACkB,OAAA,CAAAhC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
exports.__esModule = true;
|
|
5
|
-
exports.RenderViewLayoutContent = void 0;
|
|
6
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
-
var _designSystem = require("@wix/design-system");
|
|
8
|
-
var _SchemaContext = require("../../../providers/SchemaContext");
|
|
9
|
-
var _providers = require("../../../providers");
|
|
10
|
-
var _RenderViewField = require("../RenderLayout/RenderViewField");
|
|
11
|
-
var _jsxFileName = "/home/builduser/work/8f3ab5a55e62623a/packages/auto-patterns/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.tsx";
|
|
12
|
-
// TODO: remove this component and use RenderLayoutContent instead
|
|
13
|
-
const RenderViewLayoutContent = ({
|
|
14
|
-
entity,
|
|
15
|
-
content,
|
|
16
|
-
level,
|
|
17
|
-
sectionId,
|
|
18
|
-
cardIndex,
|
|
19
|
-
contentIndex
|
|
20
|
-
}) => {
|
|
21
|
-
var _content$container$ch, _overrides$components;
|
|
22
|
-
const schema = (0, _SchemaContext.useSchema)();
|
|
23
|
-
const overrides = (0, _providers.useAutoPatternsOverridesContext)();
|
|
24
|
-
switch (content.type) {
|
|
25
|
-
case 'field':
|
|
26
|
-
if (!content.field.fieldId) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const field = schema.fields[content.field.fieldId];
|
|
30
|
-
if (!field) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return /*#__PURE__*/_react.default.createElement(_RenderViewField.RenderViewField, {
|
|
34
|
-
field: field,
|
|
35
|
-
fieldId: content.field.fieldId,
|
|
36
|
-
entity: entity,
|
|
37
|
-
span: content.field.span,
|
|
38
|
-
__self: void 0,
|
|
39
|
-
__source: {
|
|
40
|
-
fileName: _jsxFileName,
|
|
41
|
-
lineNumber: 32,
|
|
42
|
-
columnNumber: 9
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
case 'container':
|
|
46
|
-
if (!((_content$container$ch = content.container.children) != null && _content$container$ch.length)) {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
|
|
50
|
-
span: content.container.span,
|
|
51
|
-
__self: void 0,
|
|
52
|
-
__source: {
|
|
53
|
-
fileName: _jsxFileName,
|
|
54
|
-
lineNumber: 46,
|
|
55
|
-
columnNumber: 9
|
|
56
|
-
}
|
|
57
|
-
}, /*#__PURE__*/_react.default.createElement(_designSystem.Layout, {
|
|
58
|
-
__self: void 0,
|
|
59
|
-
__source: {
|
|
60
|
-
fileName: _jsxFileName,
|
|
61
|
-
lineNumber: 47,
|
|
62
|
-
columnNumber: 11
|
|
63
|
-
}
|
|
64
|
-
}, content.container.children.map((child, index) => /*#__PURE__*/_react.default.createElement(RenderViewLayoutContent, {
|
|
65
|
-
key: `${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`,
|
|
66
|
-
entity: entity,
|
|
67
|
-
content: child,
|
|
68
|
-
level: level + 1,
|
|
69
|
-
sectionId: sectionId,
|
|
70
|
-
cardIndex: cardIndex,
|
|
71
|
-
contentIndex: index,
|
|
72
|
-
__self: void 0,
|
|
73
|
-
__source: {
|
|
74
|
-
fileName: _jsxFileName,
|
|
75
|
-
lineNumber: 49,
|
|
76
|
-
columnNumber: 15
|
|
77
|
-
}
|
|
78
|
-
}))));
|
|
79
|
-
case 'component':
|
|
80
|
-
if (!content.component.componentId) {
|
|
81
|
-
return null;
|
|
82
|
-
}
|
|
83
|
-
const Component = overrides == null || (_overrides$components = overrides.components) == null ? void 0 : _overrides$components[content.component.componentId];
|
|
84
|
-
if (!Component) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
return /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
|
|
88
|
-
span: content.component.span,
|
|
89
|
-
__self: void 0,
|
|
90
|
-
__source: {
|
|
91
|
-
fileName: _jsxFileName,
|
|
92
|
-
lineNumber: 74,
|
|
93
|
-
columnNumber: 9
|
|
94
|
-
}
|
|
95
|
-
}, /*#__PURE__*/_react.default.createElement(Component, {
|
|
96
|
-
entity: entity,
|
|
97
|
-
__self: void 0,
|
|
98
|
-
__source: {
|
|
99
|
-
fileName: _jsxFileName,
|
|
100
|
-
lineNumber: 75,
|
|
101
|
-
columnNumber: 11
|
|
102
|
-
}
|
|
103
|
-
}));
|
|
104
|
-
default:
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
exports.RenderViewLayoutContent = RenderViewLayoutContent;
|
|
109
|
-
//# sourceMappingURL=RenderViewLayoutContent.js.map
|
package/dist/cjs/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_designSystem","_SchemaContext","_providers","_RenderViewField","_jsxFileName","RenderViewLayoutContent","entity","content","level","sectionId","cardIndex","contentIndex","_content$container$ch","_overrides$components","schema","useSchema","overrides","useAutoPatternsOverridesContext","type","field","fieldId","fields","default","createElement","RenderViewField","span","__self","__source","fileName","lineNumber","columnNumber","container","children","length","Cell","Layout","map","child","index","key","component","componentId","Component","components","exports"],"sources":["../../../../../src/components/AutoPatternsEntityPage/ViewEntityPage/RenderViewLayoutContent.tsx"],"sourcesContent":["import React from 'react';\nimport { Cell, Layout } from '@wix/design-system';\nimport { useSchema } from '../../../providers/SchemaContext';\nimport { useAutoPatternsOverridesContext } from '../../../providers';\nimport { RenderViewField } from '../RenderLayout/RenderViewField';\nimport { RenderLayoutContentProps } from '../RenderLayout';\n\ninterface RenderViewLayoutContentProps\n extends Omit<RenderLayoutContentProps, 'setInputRef'> {\n entity: Record<string, any>;\n}\n\n// TODO: remove this component and use RenderLayoutContent instead\nexport const RenderViewLayoutContent: React.FC<\n RenderViewLayoutContentProps\n> = ({ entity, content, level, sectionId, cardIndex, contentIndex }) => {\n const schema = useSchema();\n const overrides = useAutoPatternsOverridesContext();\n\n switch (content.type) {\n case 'field':\n if (!content.field.fieldId) {\n return null;\n }\n\n const field = schema.fields[content.field.fieldId];\n if (!field) {\n return null;\n }\n\n return (\n <RenderViewField\n field={field}\n fieldId={content.field.fieldId}\n entity={entity}\n span={content.field.span}\n />\n );\n\n case 'container':\n if (!content.container.children?.length) {\n return null;\n }\n\n return (\n <Cell span={content.container.span}>\n <Layout>\n {content.container.children.map((child, index) => (\n <RenderViewLayoutContent\n key={`${sectionId}-card-${cardIndex}-content-${contentIndex}-level-${level}-child-${index}`}\n entity={entity}\n content={child}\n level={level + 1}\n sectionId={sectionId}\n cardIndex={cardIndex}\n contentIndex={index}\n />\n ))}\n </Layout>\n </Cell>\n );\n\n case 'component':\n if (!content.component.componentId) {\n return null;\n }\n\n const Component = overrides?.components?.[content.component.componentId];\n if (!Component) {\n return null;\n }\n\n return (\n <Cell span={content.component.span}>\n <Component entity={entity} />\n </Cell>\n );\n\n default:\n return null;\n }\n};\n"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,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AAI,EAAElB,OAAO,CAACiC,SAAS,CAACf,IAAK;QAAAC,MAAA;QAAAC,QAAA;UAAAC,QAAA,EAAAxB,YAAA;UAAAyB,UAAA;UAAAC,YAAA;QAAA;MAAA,gBACjCjC,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACmB,SAAS;QAACpC,MAAM,EAAEA,MAAO;QAAAoB,MAAA;QAAAC,QAAA;UAAAC,QAAA,EAAAxB,YAAA;UAAAyB,UAAA;UAAAC,YAAA;QAAA;MAAA,CAAE,CACxB,CAAC;IAGX;MACE,OAAO,IAAI;EACf;AACF,CAAC;AAACc,OAAA,CAAAvC,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Checkbox","CheckboxWSR","props","field","onChange","value","createElement","checked","e","target","dataHook","id","displayName"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Checkbox as CheckboxWSR } from '@wix/design-system';\nimport { BaseInputProps } from './types';\n\nexport interface CheckboxProps extends BaseInputProps<boolean> {}\n\nexport const Checkbox = (props: CheckboxProps) => {\n const { field, onChange, value } = props;\n\n return (\n <CheckboxWSR\n checked={value}\n onChange={(e) => {\n onChange(e.target.checked);\n }}\n dataHook={`checkbox-${field.id}`}\n >\n {field.displayName}\n </CheckboxWSR>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,IAAIC,WAAW,QAAQ,oBAAoB;AAK5D,OAAO,MAAMD,QAAQ,GAAIE,KAAoB,IAAK;EAChD,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAGH,KAAK;EAExC,oBACEH,KAAA,CAAAO,aAAA,CAACL,WAAW;IACVM,OAAO,EAAEF,KAAM;IACfD,QAAQ,EAAGI,CAAC,IAAK;MACfJ,QAAQ,CAACI,CAAC,CAACC,MAAM,CAACF,OAAO,CAAC;IAC5B,CAAE;IACFG,QAAQ,EAAE,YAAYP,KAAK,CAACQ,EAAE;EAAG,GAEhCR,KAAK,CAACS,WACI,CAAC;AAElB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","useRef","FormField","DatePicker","getDateWithoutTimezone","getISODateStringWithFixedTimezone","useSelector","useWixPatternsContainer","useEntityPageContext","useController","validateDateField","value","validation","t","format","validationType","required","undefined","dateFormat","DateInput","props","_pageState$entity","_field$validation","field","dataHook","inputRef","translate","container","initTask","status","pageState","controller","name","id","control","form","defaultValue","entity","rules","validate","error","date","setDate","ref","errorMessage","setErrorMessage","createElement","label","displayName","internalRef","current","focus","_internalRef$state","state","width","onChange","newValue","formattedDate","split","onValidate","_ref","invalid","statusMessage"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/DateInput.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\nimport { FormField, DatePicker } from '@wix/design-system';\nimport {\n getDateWithoutTimezone,\n getISODateStringWithFixedTimezone,\n} from './utils/dates';\nimport { BaseInputProps, BaseInputRef } from './types';\nimport {\n useSelector,\n useWixPatternsContainer,\n useEntityPageContext,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\nimport { Translate } from '@wix/patterns/core';\n\nexport interface DateProps extends BaseInputProps<string | null> {}\n\nfunction validateDateField(\n value: string | null | undefined,\n validation: DateProps['field']['validation'],\n t: Translate,\n format?: string,\n validationType?: 'outOfBoundsError' | 'formatError' | 'valid',\n) {\n if (\n validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n } else if (validationType === 'formatError' && format) {\n return t('cairo.customFields.fieldType.date.invalid.value', {\n dateFormat: format,\n });\n }\n\n return '';\n}\n\nexport const DateInput = (props: DateProps) => {\n const { field, dataHook, inputRef } = props;\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n const pageState = useEntityPageContext();\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n const error = validateDateField(value, field.validation, t);\n return error || true;\n },\n },\n });\n\n const [date, setDate] = useState<Date | undefined>(() => {\n if (controller.field.value) {\n return getDateWithoutTimezone(\n getISODateStringWithFixedTimezone(controller.field.value),\n );\n }\n return undefined;\n });\n\n const ref = useRef<BaseInputRef>({});\n const [errorMessage, setErrorMessage] = useState<string>('');\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n dataHook={dataHook}\n >\n <DatePicker\n ref={(internalRef) => {\n inputRef?.(ref.current);\n // @ts-expect-error: WSR internal API hack for focusing\n ref.current.focus = () => internalRef?.state?.inputRef?.focus?.();\n }}\n dataHook={`date-${field.id}`}\n width=\"100%\"\n value={date}\n onChange={(newValue: Date) => {\n setDate(newValue);\n if (newValue) {\n const formattedDate = getISODateStringWithFixedTimezone(newValue);\n controller.field.onChange(formattedDate.split('T')[0]);\n } else {\n controller.field.onChange(null);\n }\n }}\n onValidate={({ validationType, value: newValue, format }) => {\n const error = validateDateField(\n newValue,\n field.validation,\n t,\n format,\n validationType,\n );\n setErrorMessage(error);\n ref.current.invalid = !!error;\n\n if (validationType === 'formatError' && newValue === '') {\n setDate(undefined);\n controller.field.onChange(null);\n }\n }}\n status={errorMessage ? 'error' : undefined}\n statusMessage={errorMessage}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,MAAM,QAAQ,OAAO;AAC/C,SAASC,SAAS,EAAEC,UAAU,QAAQ,oBAAoB;AAC1D,SACEC,sBAAsB,EACtBC,iCAAiC,QAC5B,eAAe;AAEtB,SACEC,WAAW,EACXC,uBAAuB,EACvBC,oBAAoB,QACf,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAKlD,SAASC,iBAAiBA,CACxBC,KAAgC,EAChCC,UAA4C,EAC5CC,CAAY,EAC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MC,aAAa,GAAGpD,iCAAiC,CAACmD,QAAQ,CAAC;QACjEzB,UAAU,CAACR,KAAK,CAACgC,QAAQ,CAACE,aAAa,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;MACxD,CAAC,MAAM;QACL3B,UAAU,CAACR,KAAK,CAACgC,QAAQ,CAAC,IAAI,CAAC;MACjC;IACF,CAAE;IACFI,UAAU,EAAEC,IAAA,IAAiD;MAAA,IAAhD;QAAE7C,cAAc;QAAEJ,KAAK,EAAE6C,QAAQ;QAAE1C;MAAO,CAAC,GAAA8C,IAAA;MACtD,MAAMpB,KAAK,GAAG9B,iBAAiB,CAC7B8C,QAAQ,EACRjC,KAAK,CAACX,UAAU,EAChBC,CAAC,EACDC,MAAM,EACNC,cACF,CAAC;MACD8B,eAAe,CAACL,KAAK,CAAC;MACtBG,GAAG,CAACO,OAAO,CAACW,OAAO,GAAG,CAAC,CAACrB,KAAK;MAE7B,IAAIzB,cAAc,KAAK,aAAa,IAAIyC,QAAQ,KAAK,EAAE,EAAE;QACvDd,OAAO,CAACzB,SAAS,CAAC;QAClBc,UAAU,CAACR,KAAK,CAACgC,QAAQ,CAAC,IAAI,CAAC;MACjC;IACF,CAAE;IACF1B,MAAM,EAAEe,YAAY,GAAG,OAAO,GAAG3B,SAAU;IAC3C6C,aAAa,EAAElB;EAAa,CAC7B,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useRef","useMemo","useState","useEffect","Cell","DatePicker","FormField","Layout","TimeInput","useWixPatternsContainer","useSelector","useEntityPageContext","useController","DateTime","props","_pageState$entity","_field$validation2","field","dataHook","inputRef","translate","t","container","initTask","status","pageState","controller","name","id","control","form","defaultValue","entity","rules","validate","v","_field$validation","validation","required","undefined","date","value","d","Date","isNaN","getTime","dateStatusMessage","setDateStatusMessage","timeStatusMessage","setTimeStatusMessage","ref","dateRef","timeRef","dateValue","setDateValue","getDate","timeValue","setTimeValue","current","focus","invalid","createElement","label","displayName","span","internalRef","_internalRef$state","state","width","onChange","onValidate","_ref","validationType","newValue","format","dateWithNewDate","_value","setFullYear","getFullYear","setMonth","getMonth","setDate","toISOString","_field$validation3","dateFormat","fieldState","error","statusMessage","onInvalid","_ref2","dateWithNewTime","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","setMilliseconds","getMilliseconds","_field$validation4"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/DateTime.tsx"],"sourcesContent":["import React, { useRef, useMemo, useState, useEffect } from 'react';\nimport {\n Cell,\n DatePicker,\n FormField,\n Layout,\n TimeInput,\n} from '@wix/design-system';\nimport { BaseInputProps, BaseInputRef } from './types';\nimport {\n useWixPatternsContainer,\n useSelector,\n useEntityPageContext,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface DateTimeProps extends BaseInputProps<string | null> {}\n\nexport const DateTime = (props: DateTimeProps) => {\n const { field, dataHook, inputRef } = props;\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n const pageState = useEntityPageContext();\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (v) => {\n if (\n field?.validation?.required &&\n (v === null || v === undefined || v === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n return true;\n },\n },\n });\n\n const date = useMemo(() => {\n if (!controller.field.value) {\n return undefined;\n }\n const d = new Date(controller.field.value);\n return isNaN(d.getTime()) ? undefined : d;\n }, [controller.field.value]);\n\n const [dateStatusMessage, setDateStatusMessage] = useState('');\n const [timeStatusMessage, setTimeStatusMessage] = useState('');\n\n const ref = useRef<BaseInputRef>({});\n const dateRef = useRef<BaseInputRef>({});\n const timeRef = useRef<BaseInputRef>({});\n const [dateValue, setDateValue] = useState<number | string | undefined>(\n date?.getDate(),\n );\n const [timeValue, setTimeValue] = useState<number | string | undefined>(\n date?.getTime(),\n );\n\n useEffect(() => {\n ref.current.focus = () => {\n if (dateRef.current.invalid) {\n return dateRef.current.focus?.();\n }\n\n return timeRef.current.focus?.();\n };\n\n inputRef?.(ref.current);\n }, [inputRef]);\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n dataHook={dataHook}\n >\n <Layout>\n <Cell span={6}>\n <DatePicker\n ref={(internalRef) => {\n dateRef.current.focus = () =>\n // TODO: PR to WSR needed to expose as public API\n // @ts-expect-error\n internalRef?.state?.inputRef?.focus?.();\n }}\n width=\"100%\"\n value={date}\n // onChange is triggered only when you have valid, non-empty value. and onValidate is triggered on every change so we use onValidate\n onChange={() => {}}\n onValidate={({ validationType, value: newValue, format }) => {\n if (validationType === 'valid') {\n const dateWithNewDate = date\n ? new Date(date)\n : new Date(newValue);\n const _value = new Date(newValue);\n dateWithNewDate.setFullYear(_value.getFullYear());\n dateWithNewDate.setMonth(_value.getMonth());\n dateWithNewDate.setDate(_value.getDate());\n controller.field.onChange(dateWithNewDate.toISOString());\n setDateValue(new Date(newValue).getDate());\n setDateStatusMessage('');\n dateRef.current.invalid = false;\n } else if (validationType === 'formatError' && newValue === '') {\n if (field.validation?.required) {\n setDateStatusMessage(\n t('cairo.fieldValidation.requiredField'),\n );\n dateRef.current.invalid = true;\n } else {\n setDateStatusMessage('');\n dateRef.current.invalid = false;\n }\n setDateValue(newValue);\n if (!timeValue) {\n controller.field.onChange(null);\n }\n } else {\n setDateStatusMessage(\n t('cairo.customFields.fieldType.date.invalid.value', {\n dateFormat: format ?? '',\n }),\n );\n dateRef.current.invalid = true;\n }\n\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n }}\n status={\n controller.fieldState.error || dateStatusMessage\n ? 'error'\n : undefined\n }\n statusMessage={controller.fieldState.error || dateStatusMessage}\n dataHook={`datetime-date-${field.id}`}\n />\n </Cell>\n <Cell span={6}>\n <TimeInput\n ref={(internalRef) => {\n timeRef.current.focus = () => internalRef?.focus();\n }}\n dataHook={`datetime-time-${field.id}`}\n value={date ?? null}\n status={\n controller.fieldState.error || timeStatusMessage\n ? 'error'\n : undefined\n }\n statusMessage={controller.fieldState.error || timeStatusMessage}\n onInvalid={() => {\n timeRef.current.invalid = true;\n setTimeStatusMessage(\n t('cairo.customFields.fieldType.dateAndTime.invalid.value'),\n );\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n }}\n onChange={({ date: newValue }) => {\n timeRef.current.invalid = false;\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n\n if (newValue) {\n const dateWithNewTime = date ? new Date(date) : newValue;\n dateWithNewTime.setHours(newValue.getHours());\n dateWithNewTime.setMinutes(newValue.getMinutes());\n dateWithNewTime.setSeconds(newValue.getSeconds());\n dateWithNewTime.setMilliseconds(newValue.getMilliseconds());\n controller.field.onChange(dateWithNewTime.toISOString());\n setTimeStatusMessage('');\n setDateStatusMessage('');\n } else {\n if (!newValue) {\n setTimeValue('');\n if (field.validation?.required) {\n setTimeStatusMessage(\n t('cairo.fieldValidation.requiredField'),\n );\n timeRef.current.invalid = true;\n } else {\n setTimeStatusMessage('');\n timeRef.current.invalid = false;\n }\n if (!ref.current.invalid) {\n if (!dateValue) {\n controller.field.onChange(null);\n }\n }\n }\n }\n }}\n />\n </Cell>\n </Layout>\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AACnE,SACEC,IAAI,EACJC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,SAAS,QACJ,oBAAoB;AAE3B,SACEC,uBAAuB,EACvBC,WAAW,EACXC,oBAAoB,QACf,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,QAAQ,GAAIC,KAAoB,IAAK;EAAA,IAAAC,iBAAA,EAAAC,kBAAA;EAChD,MAAM;IAAEC,KAAK;IAAEC,QAAQ;IAAEC;EAAS,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Q,CAACqB,UAAU,CAAC,CAAC,CAAC;QACjDJ,eAAe,CAACK,UAAU,CAACtB,QAAQ,CAACuB,UAAU,CAAC,CAAC,CAAC;QACjDN,eAAe,CAACO,eAAe,CAACxB,QAAQ,CAACyB,eAAe,CAAC,CAAC,CAAC;QAC3DxE,UAAU,CAACT,KAAK,CAACoD,QAAQ,CAACqB,eAAe,CAACR,WAAW,CAAC,CAAC,CAAC;QACxDjC,oBAAoB,CAAC,EAAE,CAAC;QACxBF,oBAAoB,CAAC,EAAE,CAAC;MAC1B,CAAC,MAAM;QACL,IAAI,CAAC0B,QAAQ,EAAE;UAAA,IAAA0B,kBAAA;UACb1C,YAAY,CAAC,EAAE,CAAC;UAChB,KAAA0C,kBAAA,GAAIlF,KAAK,CAACoB,UAAU,aAAhB8D,kBAAA,CAAkB7D,QAAQ,EAAE;YAC9BW,oBAAoB,CAClB5B,CAAC,CAAC,qCAAqC,CACzC,CAAC;YACD+B,OAAO,CAACM,OAAO,CAACE,OAAO,GAAG,IAAI;UAChC,CAAC,MAAM;YACLX,oBAAoB,CAAC,EAAE,CAAC;YACxBG,OAAO,CAACM,OAAO,CAACE,OAAO,GAAG,KAAK;UACjC;UACA,IAAI,CAACV,GAAG,CAACQ,OAAO,CAACE,OAAO,EAAE;YACxB,IAAI,CAACP,SAAS,EAAE;cACd3B,UAAU,CAACT,KAAK,CAACoD,QAAQ,CAAC,IAAI,CAAC;YACjC;UACF;QACF;MACF;IACF;EAAE,CACH,CACG,CACA,CACC,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { ShortText } from './ShortText';
|
|
3
|
-
import { useEntityPageContext } from '@wix/patterns';
|
|
4
|
-
import { useController } from '@wix/patterns/form';
|
|
5
|
-
import { Checkbox } from './Checkbox';
|
|
6
|
-
import { DateInput } from './DateInput';
|
|
7
|
-
import { DateTime } from './DateTime';
|
|
8
|
-
import { Number } from './Number';
|
|
9
|
-
import { LongText } from './LongText';
|
|
10
|
-
import { Url } from './Url';
|
|
11
|
-
import { ImageInput } from './ImageInput';
|
|
12
|
-
export const EDITABLE_INPUT_ELEMENTS = {
|
|
13
|
-
SHORT_TEXT: ShortText,
|
|
14
|
-
LONG_TEXT: LongText,
|
|
15
|
-
BOOLEAN: Checkbox,
|
|
16
|
-
DATE: DateInput,
|
|
17
|
-
DATETIME: DateTime,
|
|
18
|
-
NUMBER: Number,
|
|
19
|
-
URL: Url,
|
|
20
|
-
IMAGE: ImageInput
|
|
21
|
-
};
|
|
22
|
-
export const FormFieldInput = props => {
|
|
23
|
-
var _pageState$entity;
|
|
24
|
-
const {
|
|
25
|
-
field,
|
|
26
|
-
inputRef
|
|
27
|
-
} = props;
|
|
28
|
-
const pageState = useEntityPageContext();
|
|
29
|
-
const controller = useController({
|
|
30
|
-
name: (field == null ? void 0 : field.id) ?? '',
|
|
31
|
-
control: pageState.form.control,
|
|
32
|
-
defaultValue: (_pageState$entity = pageState.entity) == null ? void 0 : _pageState$entity[(field == null ? void 0 : field.id) ?? '']
|
|
33
|
-
});
|
|
34
|
-
if (!EDITABLE_INPUT_ELEMENTS.hasOwnProperty(field.type) || !pageState) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const FieldInput = EDITABLE_INPUT_ELEMENTS[field.type];
|
|
38
|
-
return /*#__PURE__*/React.createElement(FieldInput, {
|
|
39
|
-
field: field,
|
|
40
|
-
value: controller.field.value,
|
|
41
|
-
onChange: controller.field.onChange,
|
|
42
|
-
dataHook: `form-field-${field.id}`,
|
|
43
|
-
inputRef: inputRef
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=FormFieldInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","ShortText","useEntityPageContext","useController","Checkbox","DateInput","DateTime","Number","LongText","Url","ImageInput","EDITABLE_INPUT_ELEMENTS","SHORT_TEXT","LONG_TEXT","BOOLEAN","DATE","DATETIME","NUMBER","URL","IMAGE","FormFieldInput","props","_pageState$entity","field","inputRef","pageState","controller","name","id","control","form","defaultValue","entity","hasOwnProperty","type","FieldInput","createElement","value","onChange","dataHook"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/FormFieldInput.tsx"],"sourcesContent":["import React from 'react';\nimport { ShortText } from './ShortText';\nimport { useEntityPageContext } from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\nimport { Field, PatternsFieldType } from '../../../types';\nimport { Checkbox } from './Checkbox';\nimport { DateInput } from './DateInput';\nimport { DateTime } from './DateTime';\nimport { Number } from './Number';\nimport { LongText } from './LongText';\nimport { Url } from './Url';\nimport { BaseInputProps } from './types';\nimport { ImageInput } from './ImageInput';\n\nexport const EDITABLE_INPUT_ELEMENTS: Partial<\n Record<PatternsFieldType, React.ComponentType<any>>\n> = {\n SHORT_TEXT: ShortText,\n LONG_TEXT: LongText,\n BOOLEAN: Checkbox,\n DATE: DateInput,\n DATETIME: DateTime,\n NUMBER: Number,\n URL: Url,\n IMAGE: ImageInput,\n};\n\nexport interface FormFieldInputProps {\n field: Field;\n inputRef?: BaseInputProps<any>['inputRef'];\n}\n\nexport const FormFieldInput = (props: FormFieldInputProps) => {\n const { field, inputRef } = props;\n\n const pageState = useEntityPageContext();\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n });\n\n if (!EDITABLE_INPUT_ELEMENTS.hasOwnProperty(field.type) || !pageState) {\n return null;\n }\n\n const FieldInput = EDITABLE_INPUT_ELEMENTS[field.type]!;\n\n return (\n <FieldInput\n field={field}\n value={controller.field.value}\n onChange={controller.field.onChange}\n dataHook={`form-field-${field.id}`}\n inputRef={inputRef}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,aAAa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KAAM;IACbc,KAAK,EAAEX,UAAU,CAACH,KAAK,CAACc,KAAM;IAC9BC,QAAQ,EAAEZ,UAAU,CAACH,KAAK,CAACe,QAAS;IACpCC,QAAQ,EAAE,cAAchB,KAAK,CAACK,EAAE,EAAG;IACnCJ,QAAQ,EAAEA;EAAS,CACpB,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","FormField","ImageViewer","useEntityPageContext","useIsMobile","useSelector","useWixPatternsContainer","useController","getImageUrl","dashboard","ImageInput","props","_pageState$entity","_field$validation2","_controller$fieldStat","field","dataHook","translate","t","container","initTask","status","isMobile","pageState","openMedia","_chosenMediaItems$ite","chosenMediaItems","openMediaManager","multiSelect","category","newImage","items","media","image","controller","onChange","error","console","name","id","control","form","defaultValue","entity","rules","validate","value","_field$validation","validation","required","undefined","imageUrl","createElement","label","displayName","fieldState","statusMessage","message","onAddImage","onUpdateImage","updateImageInfo","removeImageInfo","addImageInfo","height","width","fit","onRemoveImage"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/ImageInput.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, ImageViewer } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useIsMobile,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\nimport { getImageUrl } from '../../../utils/media/getImageUrl';\nimport { dashboard } from '@wix/dashboard';\n\nexport interface ImageInputProps extends BaseInputProps<string> {}\n\nexport const ImageInput = (props: ImageInputProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n const isMobile = useIsMobile();\n const pageState = useEntityPageContext();\n\n async function openMedia() {\n try {\n const chosenMediaItems = await dashboard.openMediaManager({\n multiSelect: false,\n category: 'IMAGE',\n });\n\n const newImage = chosenMediaItems?.items[0]?.media?.image?.image;\n\n controller.field.onChange(newImage);\n } catch (error) {\n console.error('Error opening Media Manager or no files selected:', error);\n }\n }\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n return true;\n },\n },\n });\n\n const imageUrl =\n controller.field.value && getImageUrl(controller.field.value);\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <ImageViewer\n imageUrl={imageUrl}\n dataHook={`image-${field.id}`}\n onAddImage={isMobile ? undefined : () => openMedia()}\n onUpdateImage={isMobile ? undefined : () => openMedia()}\n updateImageInfo={t('cairo.replace-image.tooltip')}\n removeImageInfo={t('cairo.remove-image.tooltip')}\n addImageInfo={t('cairo.add-image.tooltip')}\n height=\"120px\"\n width=\"25%\"\n fit=\"cover\"\n onRemoveImage={() => controller.field.onChange(null)}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AAE3D,SACEC,oBAAoB,EACpBC,WAAW,EACXC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,WAAW,QAAQ,kCAAkC;AAC9D,SAASC,SAAS,QAAQ,gBAAgB;AAI1C,OAAO,MAAMC,UAAU,GAAIC,KAAsB,IAAK;EAAA,IAAAC,iBAAA,EAAAC,kBAAA,EAAAC,qBAAA;EACpD,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGL,KAAK;EAEjC,MAAM;IAAEM,SAAS,EAAEC,CAAC;IAAE,GAAGC;EAAU,CAAC,GAAGb,uBAAuB,CAAC,CAAC;EAChED,WAAW,CAAC,MAAMc,SAAS,C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ACtD,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","FormField","InputArea","useEntityPageContext","useSelector","useWixPatternsContainer","useController","LongText","props","_pageState$entity","_field$validation2","_controller$fieldStat","field","dataHook","translate","t","container","initTask","status","pageState","controller","name","id","control","form","defaultValue","entity","rules","validate","value","_field$validation","validation","required","undefined","createElement","label","displayName","fieldState","error","statusMessage","message","onChange","e","target","onBlur","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/LongText.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, InputArea } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface LongTextProps extends BaseInputProps<string> {}\n\nexport const LongText = (props: LongTextProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n\n const pageState = useEntityPageContext();\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n return true;\n },\n },\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <InputArea\n value={controller.field.value}\n onChange={(e) => controller.field.onChange?.(e.target.value)}\n onBlur={controller.field.onBlur}\n ref={controller.field.ref}\n dataHook={`long-text-${field.id}`}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,SAAS,QAAQ,oBAAoB;AAEzD,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBA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Cd,MAAM,EAAEE,UAAU,CAACiB,UAAU,CAACC,KAAK,GAAG,OAAO,GAAGL,SAAU;IAC1DM,aAAa,GAAA5B,qBAAA,GAAES,UAAU,CAACiB,UAAU,CAACC,KAAK,qBAA3B3B,qBAAA,CAA6B6B,OAAQ;IACpD3B,QAAQ,EAAEA;EAAS,gBAEnBb,KAAA,CAAAkC,aAAA,CAAChC,SAAS;IACR2B,KAAK,EAAET,UAAU,CAACR,KAAK,CAACiB,KAAM;IAC9BY,QAAQ,EAAGC,CAAC,IAAKtB,UAAU,CAACR,KAAK,CAAC6B,QAAQ,oBAAzBrB,UAAU,CAACR,KAAK,CAAC6B,QAAQ,CAAGC,CAAC,CAACC,MAAM,CAACd,KAAK,CAAE;IAC7De,MAAM,EAAExB,UAAU,CAACR,KAAK,CAACgC,MAAO;IAChCC,GAAG,EAAEzB,UAAU,CAACR,KAAK,CAACiC,GAAI;IAC1BhC,QAAQ,EAAE,aAAaD,KAAK,CAACU,EAAE;EAAG,CACnC,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","FormField","NumberInput","useEntityPageContext","useSelector","useWixPatternsContainer","useController","Number","props","_field$validation","_pageState$entity","_field$validation3","_controller$fieldStat","field","dataHook","translate","t","container","initTask","status","pageState","numberRange","validation","min","max","controller","name","id","control","form","defaultValue","entity","rules","validate","value","_field$validation2","required","undefined","minAmount","maxAmount","createElement","label","displayName","fieldState","error","statusMessage","message","onChange","e","onBlur","inputRef","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/Number.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, NumberInput } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface NumberProps extends BaseInputProps<number | null> {}\n\nexport const Number = (props: NumberProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n\n const pageState = useEntityPageContext();\n\n const numberRange = field.validation?.numberRange;\n const min = numberRange?.min;\n const max = numberRange?.max;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n if (value !== null && value !== undefined) {\n if (min !== undefined && value < min) {\n return t('cairo.fieldValidation.minNumber', {\n minAmount: min,\n });\n }\n if (max !== undefined && value > max) {\n return t('cairo.fieldValidation.maxNumber', {\n maxAmount: max,\n });\n }\n }\n\n return true;\n },\n },\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <NumberInput\n value={controller.field.value ?? undefined}\n onChange={(e) => controller.field.onChange(e)}\n onBlur={controller.field.onBlur}\n inputRef={controller.field.ref}\n dataHook={`number-${field.id}`}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,WAAW,QAAQ,oBAAoB;AAE3D,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,MAAM,GAAIC,KAAkB,IAAK;EAAA,IAAAC,iBAAA,EAAAC,iBAAA,EAAAC,kBAAA,EAAAC,qBAAA;EAC5C,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAC,GAAGN,KAAK;EAEjC,MAAM;IAAEO,SAAS,EAAEC,CAAC;IAAE,GAAGC;EAAU,CAAC,GAAGZ,uBAAuB,CAAC,CAAC;EAChED,WAAW,CAAC,MAAMa,SAAS,CAACC,QAAQ,CAACC,M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;QAEA,OAAO,IAAI;MACb;IACF;EACF,CAAC,CAAC;EAEF,oBACExB,KAAA,CAAAwC,aAAA,CAACvC,SAAS;IACRwC,KAAK,EAAE5B,KAAK,CAAC6B,WAAY;IACzBN,QAAQ,GAAAzB,kBAAA,GAAEE,KAAK,CAACS,UAAU,qBAAhBX,kBAAA,CAAkByB,QAAS;IACrCjB,MAAM,EAAEM,UAAU,CAACkB,UAAU,CAACC,KAAK,GAAG,OAAO,GAAGP,SAAU;IAC1DQ,aAAa,GAAAjC,qBAAA,GAAEa,UAAU,CAACkB,UAAU,CAACC,KAAK,qBAA3BhC,qBAAA,CAA6BkC,OAAQ;IACpDhC,QAAQ,EAAEA;EAAS,gBAEnBd,KAAA,CAAAwC,aAAA,CAACtC,WAAW;IACVgC,KAAK,EAAET,UAAU,CAACZ,KAAK,CAACqB,KAAK,IAAIG,SAAU;IAC3CU,QAAQ,EAAGC,CAAC,IAAKvB,UAAU,CAACZ,KAAK,CAACkC,QAAQ,CAACC,CAAC,CAAE;IAC9CC,MAAM,EAAExB,UAAU,CAACZ,KAAK,CAACoC,MAAO;IAChCC,QAAQ,EAAEzB,UAAU,CAACZ,KAAK,CAACsC,GAAI;IAC/BrC,QAAQ,EAAE,UAAUD,KAAK,CAACc,EAAE;EAAG,CAChC,CACQ,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","FormField","Input","useEntityPageContext","useSelector","useWixPatternsContainer","useController","ShortText","props","_field$validation","_pageState$entity","_controller$field$val","_field$validation3","_controller$fieldStat","field","dataHook","translate","t","container","initTask","status","pageState","stringLengthRange","validation","minLength","maxLength","controller","name","id","control","form","defaultValue","entity","rules","validate","value","_field$validation2","required","undefined","length","charMin","charMax","charCount","createElement","label","displayName","fieldState","error","statusMessage","message","onChange","e","target","onBlur","ref"],"sources":["../../../../../src/components/AutoPatternsEntityPage/Fields/ShortText.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField, Input } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport {\n useEntityPageContext,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { useController } from '@wix/patterns/form';\n\nexport interface ShortTextProps extends BaseInputProps<string> {}\n\nexport const ShortText = (props: ShortTextProps) => {\n const { field, dataHook } = props;\n\n const { translate: t, ...container } = useWixPatternsContainer();\n useSelector(() => container.initTask.status);\n\n const pageState = useEntityPageContext();\n\n const stringLengthRange = field.validation?.stringLengthRange;\n const minLength = stringLengthRange?.minLength;\n const maxLength = stringLengthRange?.maxLength;\n\n const controller = useController({\n name: field?.id ?? '',\n control: pageState.form.control,\n defaultValue: (pageState.entity as any)?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n if (\n field.validation?.required &&\n (value === null || value === undefined || value === '')\n ) {\n return t('cairo.fieldValidation.requiredField');\n }\n\n if (minLength && value && value.length < minLength) {\n return t('cairo.fieldValidation.minCharacter', {\n charMin: minLength,\n });\n } else if (maxLength && value && value.length > maxLength) {\n return t('cairo.fieldValidation.maxCharacter', {\n charMax: maxLength,\n });\n }\n\n return true;\n },\n },\n });\n\n const charCount = maxLength\n ? maxLength - controller.field.value?.length\n : undefined;\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n charCount={charCount}\n status={controller.fieldState.error ? 'error' : undefined}\n statusMessage={controller.fieldState.error?.message}\n dataHook={dataHook}\n >\n <Input\n value={controller.field.value}\n onChange={(e) => controller.field.onChange?.(e.target.value)}\n onBlur={controller.field.onBlur}\n dataHook={`short-text-${field.id}`}\n ref={controller.field.ref}\n />\n </FormField>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS,EAAEC,KAAK,QAAQ,oBAAoB;AAErD,SACEC,oBAAoB,EACpBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AACtB,SAASC,aAAa,QAAQ,oBAAoB;AAIlD,OAAO,MAAMC,SAAS,GAAIC,KAAqB,IAAK;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