@wix/auto-patterns 1.4.0 → 1.6.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/collectionData/CollectionData.js +4 -0
- package/dist/cjs/collectionData/CollectionData.js.map +1 -0
- package/dist/cjs/collectionData/CollectionDataFactory.js +12 -0
- package/dist/cjs/collectionData/CollectionDataFactory.js.map +1 -0
- package/dist/cjs/collectionData/SchemaFactory.js +12 -0
- package/dist/cjs/collectionData/SchemaFactory.js.map +1 -0
- package/dist/cjs/{config/cms/CmsCompositeConfig.js → collectionData/cms/CmsCollectionData.js} +37 -16
- package/dist/cjs/collectionData/cms/CmsCollectionData.js.map +1 -0
- package/dist/cjs/{config → collectionData}/cms/filterUtils.js +26 -11
- package/dist/cjs/collectionData/cms/filterUtils.js.map +1 -0
- package/dist/cjs/collectionData/cms/sortUtils.js.map +1 -0
- package/dist/cjs/collectionData/constants.js +13 -0
- package/dist/cjs/collectionData/constants.js.map +1 -0
- package/dist/cjs/collectionData/index.js +10 -0
- package/dist/cjs/collectionData/index.js.map +1 -0
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js +47 -0
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -0
- package/dist/cjs/components/AutoPatternsApp/index.js +10 -0
- package/dist/cjs/components/AutoPatternsApp/index.js.map +1 -0
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +22 -33
- package/dist/cjs/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +33 -142
- package/dist/cjs/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +162 -0
- package/dist/cjs/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Checkbox.js +30 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Checkbox.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateInput.js +65 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateTime.js +140 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +54 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/LongText.js +36 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Number.js +36 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/ShortText.js +36 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Url.js +75 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/types.js +4 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/types.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/utils/dates.js +16 -0
- package/dist/cjs/components/AutoPatternsEntityPage/Fields/utils/dates.js.map +1 -0
- package/dist/cjs/components/AutoPatternsEntityPage/index.js +10 -0
- package/dist/cjs/components/AutoPatternsEntityPage/index.js.map +1 -0
- package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js +35 -0
- package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -0
- package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGridContent.js +44 -0
- package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGridContent.js.map +1 -0
- package/dist/cjs/components/AutoPatternsGrid/index.js +10 -0
- package/dist/cjs/components/AutoPatternsGrid/index.js.map +1 -0
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js +61 -0
- package/dist/cjs/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -0
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +35 -0
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -0
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTableContent.js +55 -0
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTableContent.js.map +1 -0
- package/dist/cjs/components/AutoPatternsTable/index.js +10 -0
- package/dist/cjs/components/AutoPatternsTable/index.js.map +1 -0
- package/dist/cjs/exports/react.js +7 -0
- package/dist/cjs/exports/react.js.map +1 -1
- package/dist/cjs/hooks/index.js +16 -4
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/useColumns.js +2 -5
- package/dist/cjs/hooks/useColumns.js.map +1 -1
- package/dist/cjs/hooks/useCommonCollectionFeatures.js +109 -0
- package/dist/cjs/hooks/useCommonCollectionFeatures.js.map +1 -0
- package/dist/cjs/hooks/useEmptyStates.js +2 -7
- package/dist/cjs/hooks/useEmptyStates.js.map +1 -1
- package/dist/cjs/hooks/useFetchData.js +7 -8
- package/dist/cjs/hooks/useFetchData.js.map +1 -1
- package/dist/cjs/hooks/useFilters.js +72 -76
- package/dist/cjs/hooks/useFilters.js.map +1 -1
- package/dist/cjs/hooks/useGridFeatures.js +77 -0
- package/dist/cjs/hooks/useGridFeatures.js.map +1 -0
- package/dist/cjs/hooks/useTableFeatures.js +69 -0
- package/dist/cjs/hooks/useTableFeatures.js.map +1 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/providers/CollectionDataContext.js +44 -0
- package/dist/cjs/providers/CollectionDataContext.js.map +1 -0
- package/dist/cjs/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/cjs/providers/{ConfigContext.js → SchemaContext.js} +21 -20
- package/dist/cjs/providers/SchemaContext.js.map +1 -0
- package/dist/cjs/providers/index.js +4 -4
- package/dist/cjs/providers/index.js.map +1 -1
- package/dist/cjs/react.js +4 -4
- package/dist/cjs/react.js.map +1 -1
- package/dist/cjs/{types.js → types/CollectionPageConfig.js} +3 -9
- package/dist/cjs/types/CollectionPageConfig.js.map +1 -0
- package/dist/cjs/types/EntityPageConfig.js +4 -0
- package/dist/cjs/types/EntityPageConfig.js.map +1 -0
- package/dist/cjs/types/index.js +22 -0
- package/dist/cjs/types/index.js.map +1 -0
- package/dist/cjs/types/types.js +4 -0
- package/dist/cjs/types/types.js.map +1 -0
- package/dist/cjs/utils/filters.js +53 -0
- package/dist/cjs/utils/filters.js.map +1 -0
- package/dist/esm/collectionData/CollectionData.js +2 -0
- package/dist/esm/collectionData/CollectionData.js.map +1 -0
- package/dist/esm/collectionData/CollectionDataFactory.js +8 -0
- package/dist/esm/collectionData/CollectionDataFactory.js.map +1 -0
- package/dist/esm/collectionData/SchemaFactory.js +8 -0
- package/dist/esm/collectionData/SchemaFactory.js.map +1 -0
- package/dist/esm/{config/cms/CmsCompositeConfig.js → collectionData/cms/CmsCollectionData.js} +35 -14
- package/dist/esm/collectionData/cms/CmsCollectionData.js.map +1 -0
- package/dist/esm/{config → collectionData}/cms/filterUtils.js +27 -12
- package/dist/esm/collectionData/cms/filterUtils.js.map +1 -0
- package/dist/esm/collectionData/cms/sortUtils.js.map +1 -0
- package/dist/esm/collectionData/constants.js +9 -0
- package/dist/esm/collectionData/constants.js.map +1 -0
- package/dist/esm/collectionData/index.js +2 -0
- package/dist/esm/collectionData/index.js.map +1 -0
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js +22 -0
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -0
- package/dist/esm/components/AutoPatternsApp/index.js +2 -0
- package/dist/esm/components/AutoPatternsApp/index.js.map +1 -0
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js +11 -13
- package/dist/esm/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.js.map +1 -1
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js +31 -109
- package/dist/esm/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.js.map +1 -1
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js +80 -0
- package/dist/esm/components/AutoPatternsEntityPage/AutoPatternsEntityPage.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Checkbox.js +17 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Checkbox.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js +46 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateInput.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js +97 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/DateTime.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js +41 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/FormFieldInput.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js +17 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/LongText.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js +17 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Number.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js +17 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/ShortText.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js +39 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/Url.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/types.js +2 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/types.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/utils/dates.js +10 -0
- package/dist/esm/components/AutoPatternsEntityPage/Fields/utils/dates.js.map +1 -0
- package/dist/esm/components/AutoPatternsEntityPage/index.js +2 -0
- package/dist/esm/components/AutoPatternsEntityPage/index.js.map +1 -0
- package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js +16 -0
- package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -0
- package/dist/esm/components/AutoPatternsGrid/AutoPatternsGridContent.js +32 -0
- package/dist/esm/components/AutoPatternsGrid/AutoPatternsGridContent.js.map +1 -0
- package/dist/esm/components/AutoPatternsGrid/index.js +2 -0
- package/dist/esm/components/AutoPatternsGrid/index.js.map +1 -0
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js +37 -0
- package/dist/esm/components/AutoPatternsRoute/AutoPatternsPage.js.map +1 -0
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +16 -0
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -0
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTableContent.js +43 -0
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTableContent.js.map +1 -0
- package/dist/esm/components/AutoPatternsTable/index.js +2 -0
- package/dist/esm/components/AutoPatternsTable/index.js.map +1 -0
- package/dist/esm/exports/react.js +1 -0
- package/dist/esm/exports/react.js.map +1 -1
- package/dist/esm/hooks/index.js +3 -1
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/useColumns.js +3 -6
- package/dist/esm/hooks/useColumns.js.map +1 -1
- package/dist/esm/hooks/useCommonCollectionFeatures.js +72 -0
- package/dist/esm/hooks/useCommonCollectionFeatures.js.map +1 -0
- package/dist/esm/hooks/useEmptyStates.js +2 -7
- package/dist/esm/hooks/useEmptyStates.js.map +1 -1
- package/dist/esm/hooks/useFetchData.js +8 -9
- package/dist/esm/hooks/useFetchData.js.map +1 -1
- package/dist/esm/hooks/useFilters.js +63 -75
- package/dist/esm/hooks/useFilters.js.map +1 -1
- package/dist/esm/hooks/useGridFeatures.js +75 -0
- package/dist/esm/hooks/useGridFeatures.js.map +1 -0
- package/dist/esm/hooks/useTableFeatures.js +58 -0
- package/dist/esm/hooks/useTableFeatures.js.map +1 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/providers/CollectionDataContext.js +30 -0
- package/dist/esm/providers/CollectionDataContext.js.map +1 -0
- package/dist/esm/providers/PatternsWizardOverridesContext.js +1 -1
- package/dist/esm/providers/PatternsWizardOverridesContext.js.map +1 -1
- package/dist/esm/providers/SchemaContext.js +30 -0
- package/dist/esm/providers/SchemaContext.js.map +1 -0
- package/dist/esm/providers/index.js +1 -1
- package/dist/esm/providers/index.js.map +1 -1
- package/dist/esm/react.js +1 -1
- package/dist/esm/react.js.map +1 -1
- package/dist/esm/{types.js → types/CollectionPageConfig.js} +1 -9
- package/dist/esm/types/CollectionPageConfig.js.map +1 -0
- package/dist/esm/types/EntityPageConfig.js +2 -0
- package/dist/esm/types/EntityPageConfig.js.map +1 -0
- package/dist/esm/types/index.js +4 -0
- package/dist/esm/types/index.js.map +1 -0
- package/dist/esm/types/types.js +2 -0
- package/dist/esm/types/types.js.map +1 -0
- package/dist/esm/utils/filters.js +49 -0
- package/dist/esm/utils/filters.js.map +1 -0
- package/dist/types/collectionData/CollectionData.d.ts +9 -0
- package/dist/types/collectionData/CollectionData.d.ts.map +1 -0
- package/dist/types/collectionData/CollectionDataFactory.d.ts +4 -0
- package/dist/types/collectionData/CollectionDataFactory.d.ts.map +1 -0
- package/dist/types/collectionData/SchemaFactory.d.ts +3 -0
- package/dist/types/collectionData/SchemaFactory.d.ts.map +1 -0
- package/dist/types/collectionData/cms/CmsCollectionData.d.ts +8 -0
- package/dist/types/collectionData/cms/CmsCollectionData.d.ts.map +1 -0
- package/dist/types/{config → collectionData}/cms/filterUtils.d.ts +3 -3
- package/dist/types/collectionData/cms/filterUtils.d.ts.map +1 -0
- package/dist/types/collectionData/cms/sortUtils.d.ts.map +1 -0
- package/dist/types/{config → collectionData}/constants.d.ts +4 -0
- package/dist/types/collectionData/constants.d.ts.map +1 -0
- package/dist/types/collectionData/index.d.ts +2 -0
- package/dist/types/collectionData/index.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts +7 -0
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsApp/index.d.ts +2 -0
- package/dist/types/components/AutoPatternsApp/index.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts +2 -2
- package/dist/types/components/AutoPatternsCollectionPage/AutoPatternsCollectionPage.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.d.ts +5 -1
- package/dist/types/components/AutoPatternsCollectionPageContent/AutoPatternsCollectionPageContent.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts +7 -0
- package/dist/types/components/AutoPatternsEntityPage/AutoPatternsEntityPage.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/Checkbox.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/Checkbox.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/DateInput.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/DateInput.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/DateTime.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/DateTime.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/FormFieldInput.d.ts +8 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/FormFieldInput.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/LongText.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/LongText.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/Number.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/Number.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/ShortText.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/ShortText.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/Url.d.ts +6 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/Url.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/types.d.ts +11 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/types.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/utils/dates.d.ts +3 -0
- package/dist/types/components/AutoPatternsEntityPage/Fields/utils/dates.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsEntityPage/index.d.ts +2 -0
- package/dist/types/components/AutoPatternsEntityPage/index.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsGrid/AutoPatternsGrid.d.ts +7 -0
- package/dist/types/components/AutoPatternsGrid/AutoPatternsGrid.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsGrid/AutoPatternsGridContent.d.ts +7 -0
- package/dist/types/components/AutoPatternsGrid/AutoPatternsGridContent.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsGrid/index.d.ts +2 -0
- package/dist/types/components/AutoPatternsGrid/index.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsRoute/AutoPatternsPage.d.ts +7 -0
- package/dist/types/components/AutoPatternsRoute/AutoPatternsPage.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts +7 -0
- package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsTable/AutoPatternsTableContent.d.ts +7 -0
- package/dist/types/components/AutoPatternsTable/AutoPatternsTableContent.d.ts.map +1 -0
- package/dist/types/components/AutoPatternsTable/index.d.ts +2 -0
- package/dist/types/components/AutoPatternsTable/index.d.ts.map +1 -0
- package/dist/types/exports/react.d.ts +1 -0
- package/dist/types/exports/react.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +3 -1
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/useColumns.d.ts +2 -1
- package/dist/types/hooks/useColumns.d.ts.map +1 -1
- package/dist/types/hooks/useCommonCollectionFeatures.d.ts +15 -0
- package/dist/types/hooks/useCommonCollectionFeatures.d.ts.map +1 -0
- package/dist/types/hooks/useEmptyStates.d.ts +2 -1
- package/dist/types/hooks/useEmptyStates.d.ts.map +1 -1
- package/dist/types/hooks/useFetchData.d.ts +2 -1
- package/dist/types/hooks/useFetchData.d.ts.map +1 -1
- package/dist/types/hooks/useFilters.d.ts +7 -2
- package/dist/types/hooks/useFilters.d.ts.map +1 -1
- package/dist/types/hooks/useGridFeatures.d.ts +25 -0
- package/dist/types/hooks/useGridFeatures.d.ts.map +1 -0
- package/dist/types/hooks/useTableFeatures.d.ts +19 -0
- package/dist/types/hooks/useTableFeatures.d.ts.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/providers/CollectionDataContext.d.ts +12 -0
- package/dist/types/providers/CollectionDataContext.d.ts.map +1 -0
- package/dist/types/providers/PatternsWizardOverridesContext.d.ts +2 -2
- package/dist/types/providers/SchemaContext.d.ts +11 -0
- package/dist/types/providers/SchemaContext.d.ts.map +1 -0
- package/dist/types/providers/index.d.ts +1 -1
- package/dist/types/providers/index.d.ts.map +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/react.d.ts.map +1 -1
- package/dist/types/types/CollectionPageConfig.d.ts +166 -0
- package/dist/types/types/CollectionPageConfig.d.ts.map +1 -0
- package/dist/types/types/EntityPageConfig.d.ts +17 -0
- package/dist/types/types/EntityPageConfig.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +4 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/types.d.ts +47 -0
- package/dist/types/types/types.d.ts.map +1 -0
- package/dist/types/utils/filters.d.ts +7 -0
- package/dist/types/utils/filters.d.ts.map +1 -0
- package/package.json +24 -23
- package/dist/cjs/config/CompositeConfig.js +0 -4
- package/dist/cjs/config/CompositeConfig.js.map +0 -1
- package/dist/cjs/config/ConfigFactory.js +0 -12
- package/dist/cjs/config/ConfigFactory.js.map +0 -1
- package/dist/cjs/config/cms/CmsCompositeConfig.js.map +0 -1
- package/dist/cjs/config/cms/filterUtils.js.map +0 -1
- package/dist/cjs/config/cms/sortUtils.js.map +0 -1
- package/dist/cjs/config/constants.js +0 -9
- package/dist/cjs/config/constants.js.map +0 -1
- package/dist/cjs/config/index.js +0 -10
- package/dist/cjs/config/index.js.map +0 -1
- package/dist/cjs/hooks/useFeatures.js +0 -50
- package/dist/cjs/hooks/useFeatures.js.map +0 -1
- package/dist/cjs/hooks/useTableProps.js +0 -34
- package/dist/cjs/hooks/useTableProps.js.map +0 -1
- package/dist/cjs/providers/ConfigContext.js.map +0 -1
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/config/CompositeConfig.js +0 -2
- package/dist/esm/config/CompositeConfig.js.map +0 -1
- package/dist/esm/config/ConfigFactory.js +0 -8
- package/dist/esm/config/ConfigFactory.js.map +0 -1
- package/dist/esm/config/cms/CmsCompositeConfig.js.map +0 -1
- package/dist/esm/config/cms/filterUtils.js.map +0 -1
- package/dist/esm/config/cms/sortUtils.js.map +0 -1
- package/dist/esm/config/constants.js +0 -5
- package/dist/esm/config/constants.js.map +0 -1
- package/dist/esm/config/index.js +0 -2
- package/dist/esm/config/index.js.map +0 -1
- package/dist/esm/hooks/useFeatures.js +0 -22
- package/dist/esm/hooks/useFeatures.js.map +0 -1
- package/dist/esm/hooks/useTableProps.js +0 -29
- package/dist/esm/hooks/useTableProps.js.map +0 -1
- package/dist/esm/providers/ConfigContext.js +0 -29
- package/dist/esm/providers/ConfigContext.js.map +0 -1
- package/dist/esm/types.js.map +0 -1
- package/dist/types/config/CompositeConfig.d.ts +0 -8
- package/dist/types/config/CompositeConfig.d.ts.map +0 -1
- package/dist/types/config/ConfigFactory.d.ts +0 -4
- package/dist/types/config/ConfigFactory.d.ts.map +0 -1
- package/dist/types/config/cms/CmsCompositeConfig.d.ts +0 -7
- package/dist/types/config/cms/CmsCompositeConfig.d.ts.map +0 -1
- package/dist/types/config/cms/filterUtils.d.ts.map +0 -1
- package/dist/types/config/cms/sortUtils.d.ts.map +0 -1
- package/dist/types/config/constants.d.ts.map +0 -1
- package/dist/types/config/index.d.ts +0 -2
- package/dist/types/config/index.d.ts.map +0 -1
- package/dist/types/hooks/useFeatures.d.ts +0 -8
- package/dist/types/hooks/useFeatures.d.ts.map +0 -1
- package/dist/types/hooks/useTableProps.d.ts +0 -13
- package/dist/types/hooks/useTableProps.d.ts.map +0 -1
- package/dist/types/providers/ConfigContext.d.ts +0 -11
- package/dist/types/providers/ConfigContext.d.ts.map +0 -1
- package/dist/types/types.d.ts +0 -211
- package/dist/types/types.d.ts.map +0 -1
- /package/dist/cjs/{config → collectionData}/cms/sortUtils.js +0 -0
- /package/dist/esm/{config → collectionData}/cms/sortUtils.js +0 -0
- /package/dist/types/{config → collectionData}/cms/sortUtils.d.ts +0 -0
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { DateRangeFilter, dateRangeFilter, NumberRangeFilter, numberRangeFilter, useStaticListFilterCollection } from '@wix/patterns';
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { CollectionToolbarFilters, DateRangeFilter, dateRangeFilter, idNameArrayFilter, NumberRangeFilter, numberRangeFilter, RadioGroupFilter, useStaticListFilterCollection } from '@wix/patterns';
|
|
4
|
+
import { useCollectionData } from '../providers';
|
|
5
|
+
import { createEnumFilter } from '../utils/filters';
|
|
6
|
+
export const useFilters = configuration => {
|
|
6
7
|
const {
|
|
7
8
|
schema
|
|
8
|
-
} =
|
|
9
|
+
} = useCollectionData();
|
|
9
10
|
const filters = React.useMemo(() => {
|
|
10
|
-
var _config$filters;
|
|
11
11
|
const currFilters = [];
|
|
12
|
-
|
|
13
|
-
var _filter$dateConfig, _filter$dateConfig2, _filter$dateConfig3, _filter$numberConfig, _filter$numberConfig2, _filter$numberConfig3;
|
|
12
|
+
configuration == null || configuration.items.forEach(filter => {
|
|
13
|
+
var _filter$dateConfig, _filter$dateConfig2, _filter$dateConfig3, _filter$booleanConfig, _filter$booleanConfig2, _filter$numberConfig, _filter$numberConfig2, _filter$numberConfig3;
|
|
14
14
|
const {
|
|
15
15
|
fieldId: key
|
|
16
16
|
} = filter;
|
|
@@ -52,53 +52,23 @@ export const useFilters = config => {
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
break;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
// currFilters.push({
|
|
73
|
-
// key,
|
|
74
|
-
// filter: idNameArrayFilter(),
|
|
75
|
-
// component: SingleSelectFilter,
|
|
76
|
-
// collectionData:
|
|
77
|
-
// filter.static?.values.map((value) => {
|
|
78
|
-
// return { id: value.id, name: value.value };
|
|
79
|
-
// }) ?? [],
|
|
80
|
-
// props: {
|
|
81
|
-
// placeholder: `Select ${filter.displayName}`,
|
|
82
|
-
// accordionItemProps: { label: filter.displayName },
|
|
83
|
-
// },
|
|
84
|
-
// });
|
|
85
|
-
|
|
86
|
-
// break;
|
|
87
|
-
// case 'radio-group':
|
|
88
|
-
// currFilters.push({
|
|
89
|
-
// key,
|
|
90
|
-
// filter: idNameArrayFilter(),
|
|
91
|
-
// component: RadioGroupFilter,
|
|
92
|
-
// props: {
|
|
93
|
-
// accordionItemProps: { label: filter.displayName },
|
|
94
|
-
// data:
|
|
95
|
-
// filter.static?.values.map((value) => {
|
|
96
|
-
// return { id: value.id, name: value.value };
|
|
97
|
-
// }) ?? [],
|
|
98
|
-
// },
|
|
99
|
-
// });
|
|
100
|
-
|
|
101
|
-
// break;
|
|
55
|
+
case 'BOOLEAN':
|
|
56
|
+
currFilters.push({
|
|
57
|
+
key,
|
|
58
|
+
filter: idNameArrayFilter(),
|
|
59
|
+
component: RadioGroupFilter,
|
|
60
|
+
props: {
|
|
61
|
+
...commonFilterProps,
|
|
62
|
+
data: [{
|
|
63
|
+
id: 'checked',
|
|
64
|
+
name: (filter == null || (_filter$booleanConfig = filter.booleanConfig) == null ? void 0 : _filter$booleanConfig.checkedLabel) || 'Yes'
|
|
65
|
+
}, {
|
|
66
|
+
id: 'unchecked',
|
|
67
|
+
name: (filter == null || (_filter$booleanConfig2 = filter.booleanConfig) == null ? void 0 : _filter$booleanConfig2.uncheckedLabel) || 'No'
|
|
68
|
+
}]
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
break;
|
|
102
72
|
case 'NUMBER':
|
|
103
73
|
currFilters.push({
|
|
104
74
|
key,
|
|
@@ -112,36 +82,50 @@ export const useFilters = config => {
|
|
|
112
82
|
}
|
|
113
83
|
});
|
|
114
84
|
break;
|
|
85
|
+
default:
|
|
86
|
+
if (filter != null && filter.enumConfig) {
|
|
87
|
+
currFilters.push(createEnumFilter({
|
|
88
|
+
filter,
|
|
89
|
+
commonFilterProps
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
115
93
|
}
|
|
116
94
|
});
|
|
117
95
|
return currFilters;
|
|
118
|
-
}, [
|
|
96
|
+
}, [configuration == null ? void 0 : configuration.items, schema.fields]);
|
|
119
97
|
const FilterCollectionComponent = _ref => {
|
|
120
98
|
let {
|
|
121
|
-
filter
|
|
99
|
+
filter,
|
|
100
|
+
collectionData,
|
|
101
|
+
key,
|
|
102
|
+
component,
|
|
103
|
+
...filterProps
|
|
122
104
|
} = _ref;
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
105
|
+
const FilterComponent = component;
|
|
106
|
+
const collection = useStaticListFilterCollection(filter, collectionData ?? []);
|
|
107
|
+
if (!configuration) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return /*#__PURE__*/React.createElement(FilterComponent, _extends({
|
|
111
|
+
key: key,
|
|
112
|
+
filter: filter
|
|
113
|
+
}, collectionData ? {
|
|
128
114
|
collection
|
|
129
|
-
} : {},
|
|
130
|
-
collection: collection
|
|
131
|
-
}, filter.props));
|
|
115
|
+
} : {}, filterProps));
|
|
132
116
|
};
|
|
133
|
-
const collectionToolbarFiltersProps = React.useMemo(() => {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
};
|
|
139
|
-
}, [config.filters]);
|
|
140
|
-
return filters.reduce((acc, filter) => {
|
|
117
|
+
const collectionToolbarFiltersProps = React.useMemo(() => ({
|
|
118
|
+
inline: (configuration == null ? void 0 : configuration.maxToolbarFilters) || 0,
|
|
119
|
+
panelTitle: configuration == null ? void 0 : configuration.panelTitle
|
|
120
|
+
}), [configuration]);
|
|
121
|
+
const filtersData = filters.reduce((acc, filter) => {
|
|
141
122
|
acc.filters[filter.key] = filter.filter;
|
|
142
|
-
acc.components.push(filter.collectionData ? /*#__PURE__*/React.createElement(FilterCollectionComponent, {
|
|
143
|
-
filter: filter
|
|
144
|
-
|
|
123
|
+
acc.components.push(filter.collectionData ? /*#__PURE__*/React.createElement(FilterCollectionComponent, _extends({
|
|
124
|
+
filter: filter.filter,
|
|
125
|
+
key: filter.key,
|
|
126
|
+
component: filter.component,
|
|
127
|
+
collectionData: filter.collectionData
|
|
128
|
+
}, filter.props)) : /*#__PURE__*/React.createElement(filter.component, _extends({
|
|
145
129
|
key: filter.key,
|
|
146
130
|
filter: filter.filter
|
|
147
131
|
}, filter.props)));
|
|
@@ -151,5 +135,9 @@ export const useFilters = config => {
|
|
|
151
135
|
components: [],
|
|
152
136
|
collectionToolbarFiltersProps
|
|
153
137
|
});
|
|
138
|
+
return {
|
|
139
|
+
filtersObject: filtersData.filters,
|
|
140
|
+
filterComponent: filtersData.components.length > 0 ? /*#__PURE__*/React.createElement(CollectionToolbarFilters, collectionToolbarFiltersProps, filtersData.components) : undefined
|
|
141
|
+
};
|
|
154
142
|
};
|
|
155
143
|
//# sourceMappingURL=useFilters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","DateRangeFilter","dateRangeFilter","NumberRangeFilter","numberRangeFilter","useStaticListFilterCollection","useConfig","useFilters","config","schema","filters","useMemo","_config$filters","currFilters","items","forEach","filter","_filter$dateConfig","_filter$dateConfig2","_filter$dateConfig3","_filter$numberConfig","_filter$numberConfig2","_filter$numberConfig3","fieldId","key","fieldDefinition","fields","label","displayName","initiallyOpen","sectionTitle","accordionItemProps","toolbarTagProps","commonFilterProps","toolbarItemProps","type","push","component","props","mode","dateConfig","dateRangeOptions","filterByTime","min","numberConfig","max","decimal","FilterCollectionComponent","_ref","collection","collectionData","createElement","_extends","collectionToolbarFiltersProps","_config$filters2","_config$filters3","inline","maxToolbarFilters","panelTitle","reduce","acc","components"],"sources":["../../../src/hooks/useFilters.tsx"],"sourcesContent":["import React from 'react';\nimport { PageConfig } from '../types';\nimport {\n CollectionToolbarFiltersProps,\n DateRangeFilter,\n dateRangeFilter,\n Filter,\n NumberRangeFilter,\n numberRangeFilter,\n useStaticListFilterCollection,\n} from '@wix/patterns';\nimport { useConfig } from '../providers';\n\nexport interface FilterOptions {\n key: string;\n filter: Filter<any>;\n component: React.ElementType;\n collectionData?: { id: string; name: string }[];\n props: Record<string, any>;\n}\n\nexport interface ReturnValue {\n filters: { [key: string]: Filter<any> };\n components: React.JSX.Element[];\n collectionToolbarFiltersProps: Pick<\n CollectionToolbarFiltersProps,\n 'inline' | 'panelTitle' | 'useNewFilters'\n >;\n}\n\nexport const useFilters = (config: PageConfig) => {\n const { schema } = useConfig();\n const filters = React.useMemo(() => {\n const currFilters: FilterOptions[] = [];\n config.filters?.items.forEach((filter) => {\n const { fieldId: key } = filter;\n const fieldDefinition = schema.fields[key];\n if (!fieldDefinition) {\n return;\n }\n\n const label = filter.displayName || fieldDefinition.displayName;\n const { initiallyOpen, sectionTitle } = filter.accordionItemProps || {};\n const { toolbarTagProps } = filter;\n\n const commonFilterProps = {\n accordionItemProps: {\n label,\n initiallyOpen,\n sectionTitle,\n },\n toolbarItemProps: {\n label,\n },\n toolbarTagProps,\n };\n\n switch (fieldDefinition.type) {\n case 'DATE':\n case 'DATETIME':\n currFilters.push({\n key,\n filter: dateRangeFilter(),\n component: DateRangeFilter,\n props: {\n ...commonFilterProps,\n mode: filter.dateConfig?.mode,\n dateRangeOptions: filter.dateConfig?.dateRangeOptions,\n filterByTime: filter.dateConfig?.filterByTime,\n },\n });\n\n break;\n // case 'multi-select':\n // currFilters.push({\n // key,\n // filter: idNameArrayFilter(),\n // component: MultiSelectCheckboxFilter,\n // collectionData:\n // filter.static?.values.map((value) => {\n // return { id: value.id, name: value.value };\n // }) ?? [],\n // props: {\n // accordionItemProps: { label: filter.displayName },\n // popoverProps: { appendTo: 'window' },\n // },\n // });\n\n // break;\n // case 'single':\n // currFilters.push({\n // key,\n // filter: idNameArrayFilter(),\n // component: SingleSelectFilter,\n // collectionData:\n // filter.static?.values.map((value) => {\n // return { id: value.id, name: value.value };\n // }) ?? [],\n // props: {\n // placeholder: `Select ${filter.displayName}`,\n // accordionItemProps: { label: filter.displayName },\n // },\n // });\n\n // break;\n // case 'radio-group':\n // currFilters.push({\n // key,\n // filter: idNameArrayFilter(),\n // component: RadioGroupFilter,\n // props: {\n // accordionItemProps: { label: filter.displayName },\n // data:\n // filter.static?.values.map((value) => {\n // return { id: value.id, name: value.value };\n // }) ?? [],\n // },\n // });\n\n // break;\n case 'NUMBER':\n currFilters.push({\n key,\n filter: numberRangeFilter(),\n component: NumberRangeFilter,\n props: {\n ...commonFilterProps,\n min: filter.numberConfig?.min,\n max: filter.numberConfig?.max,\n decimal: filter.numberConfig?.decimal,\n },\n });\n\n break;\n }\n });\n return currFilters;\n }, [config.filters, schema.fields]);\n\n const FilterCollectionComponent: React.FC<{\n filter: FilterOptions;\n }> = ({ filter }) => {\n const collection = useStaticListFilterCollection(\n filter.filter,\n filter.collectionData ?? [],\n );\n\n return (\n <filter.component\n key={filter.key}\n filter={filter.filter}\n {...(filter.collectionData ? { collection } : {})}\n collection={collection}\n {...filter.props}\n />\n );\n };\n\n const collectionToolbarFiltersProps = React.useMemo<\n Pick<CollectionToolbarFiltersProps, 'inline' | 'panelTitle'>\n >(\n () => ({\n inline: config.filters?.maxToolbarFilters || 0,\n panelTitle: config.filters?.panelTitle,\n }),\n [config.filters],\n );\n\n return filters.reduce<ReturnValue>(\n (acc, filter) => {\n acc.filters[filter.key] = filter.filter;\n acc.components.push(\n filter.collectionData ? (\n <FilterCollectionComponent filter={filter} />\n ) : (\n <filter.component\n key={filter.key}\n filter={filter.filter}\n {...filter.props}\n />\n ),\n );\n\n return acc;\n },\n { filters: {}, components: [], collectionToolbarFiltersProps },\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAEEC,eAAe,EACfC,eAAe,EAEfC,iBAAiB,EACjBC,iBAAiB,EACjBC,6BAA6B,QACxB,eAAe;AACtB,SAASC,SAAS,QAAQ,cAAc;AAmBxC,OAAO,MAAMC,UAAU,GAAIC,MAAkB,IAAK;EAChD,MAAM;IAAEC;EAAO,CAAC,GAAGH,SAAS,CAAC,CAAC;EAC9B,MAAMI,OAAO,GAAGV,KAAK,CAACW,OAAO,CAAC,MAAM;IAAA,IAAAC,eAAA;IAClC,MAAMC,WAA4B,GAAG,EAAE;IACvC,CAAAD,eAAA,GAAAJ,MAAM,CAACE,OAAO,aAAdE,eAAA,CAAgBE,KAAK,CAACC,OAA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,MAAMe,6BAA6B,GAAGrD,KAAK,CAACW,OAAO,CAGjD;IAAA,IAAA2C,gBAAA,EAAAC,gBAAA;IAAA,OAAO;MACLC,MAAM,EAAE,EAAAF,gBAAA,GAAA9C,MAAM,CAACE,OAAO,qBAAd4C,gBAAA,CAAgBG,iBAAiB,KAAI,CAAC;MAC9CC,UAAU,GAAAH,gBAAA,GAAE/C,MAAM,CAACE,OAAO,qBAAd6C,gBAAA,CAAgBG;IAC9B,CAAC;EAAA,CAAC,EACF,CAAClD,MAAM,CAACE,OAAO,CACjB,CAAC;EAED,OAAOA,OAAO,CAACiD,MAAM,CACnB,CAACC,GAAG,EAAE5C,MAAM,KAAK;IACf4C,GAAG,CAAClD,OAAO,CAACM,MAAM,CAACQ,GAAG,CAAC,GAAGR,MAAM,CAACA,MAAM;IACvC4C,GAAG,CAACC,UAAU,CAACzB,IAAI,CACjBpB,MAAM,CAACkC,cAAc,gBACnBlD,KAAA,CAAAmD,aAAA,CAACJ,yBAAyB;MAAC/B,MAAM,EAAEA;IAAO,CAAE,CAAC,gBAE7ChB,KAAA,CAAAmD,aAAA,CAACnC,MAAM,CAACqB,SAAS,EAAAe,QAAA;MACf5B,GAAG,EAAER,MAAM,CAACQ,GAAI;MAChBR,MAAM,EAAEA,MAAM,CAACA;IAAO,GAClBA,MAAM,CAACsB,KAAK,CACjB,CAEL,CAAC;IAED,OAAOsB,GAAG;EACZ,CAAC,EACD;IAAElD,OAAO,EAAE,CAAC,CAAC;IAAEmD,UAAU,EAAE,EAAE;IAAER;EAA8B,CAC/D,CAAC;AACH,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","CollectionToolbarFilters","DateRangeFilter","dateRangeFilter","idNameArrayFilter","NumberRangeFilter","numberRangeFilter","RadioGroupFilter","useStaticListFilterCollection","useCollectionData","createEnumFilter","useFilters","configuration","schema","filters","useMemo","currFilters","items","forEach","filter","_filter$dateConfig","_filter$dateConfig2","_filter$dateConfig3","_filter$booleanConfig","_filter$booleanConfig2","_filter$numberConfig","_filter$numberConfig2","_filter$numberConfig3","fieldId","key","fieldDefinition","fields","label","displayName","initiallyOpen","sectionTitle","accordionItemProps","toolbarTagProps","commonFilterProps","toolbarItemProps","type","push","component","props","mode","dateConfig","dateRangeOptions","filterByTime","data","id","name","booleanConfig","checkedLabel","uncheckedLabel","min","numberConfig","max","decimal","enumConfig","FilterCollectionComponent","_ref","collectionData","filterProps","FilterComponent","collection","createElement","_extends","collectionToolbarFiltersProps","inline","maxToolbarFilters","panelTitle","filtersData","reduce","acc","components","filtersObject","filterComponent","length","undefined"],"sources":["../../../src/hooks/useFilters.tsx"],"sourcesContent":["import React from 'react';\nimport {\n CollectionToolbarFilters,\n CollectionToolbarFiltersProps,\n DateRangeFilter,\n dateRangeFilter,\n Filter,\n idNameArrayFilter,\n NumberRangeFilter,\n numberRangeFilter,\n RadioGroupFilter,\n useStaticListFilterCollection,\n} from '@wix/patterns';\nimport { FiltersConfig } from '../types';\nimport { useCollectionData } from '../providers';\nimport { createEnumFilter } from '../utils/filters';\n\nexport interface FilterOptions {\n key: string;\n filter: Filter<any>;\n component: React.ElementType;\n collectionData?: { id: string; name: string }[];\n props: Record<string, any>;\n}\n\nexport interface ReturnValue {\n filters: { [key: string]: Filter<any> };\n components: React.JSX.Element[];\n collectionToolbarFiltersProps: Pick<\n CollectionToolbarFiltersProps,\n 'inline' | 'panelTitle' | 'useNewFilters'\n >;\n}\n\nexport const useFilters = (configuration?: FiltersConfig) => {\n const { schema } = useCollectionData();\n const filters = React.useMemo(() => {\n const currFilters: FilterOptions[] = [];\n configuration?.items.forEach((filter) => {\n const { fieldId: key } = filter;\n const fieldDefinition = schema.fields[key];\n if (!fieldDefinition) {\n return;\n }\n\n const label = filter.displayName || fieldDefinition.displayName;\n const { initiallyOpen, sectionTitle } = filter.accordionItemProps || {};\n const { toolbarTagProps } = filter;\n\n const commonFilterProps = {\n accordionItemProps: {\n label,\n initiallyOpen,\n sectionTitle,\n },\n toolbarItemProps: {\n label,\n },\n toolbarTagProps,\n };\n\n switch (fieldDefinition.type) {\n case 'DATE':\n case 'DATETIME':\n currFilters.push({\n key,\n filter: dateRangeFilter(),\n component: DateRangeFilter,\n props: {\n ...commonFilterProps,\n mode: filter.dateConfig?.mode,\n dateRangeOptions: filter.dateConfig?.dateRangeOptions,\n filterByTime: filter.dateConfig?.filterByTime,\n },\n });\n\n break;\n case 'BOOLEAN':\n currFilters.push({\n key,\n filter: idNameArrayFilter(),\n component: RadioGroupFilter,\n props: {\n ...commonFilterProps,\n data: [\n {\n id: 'checked',\n name: filter?.booleanConfig?.checkedLabel || 'Yes',\n },\n {\n id: 'unchecked',\n name: filter?.booleanConfig?.uncheckedLabel || 'No',\n },\n ],\n },\n });\n break;\n case 'NUMBER':\n currFilters.push({\n key,\n filter: numberRangeFilter(),\n component: NumberRangeFilter,\n props: {\n ...commonFilterProps,\n min: filter.numberConfig?.min,\n max: filter.numberConfig?.max,\n decimal: filter.numberConfig?.decimal,\n },\n });\n\n break;\n\n default:\n if (filter?.enumConfig) {\n currFilters.push(createEnumFilter({ filter, commonFilterProps }));\n }\n break;\n }\n });\n return currFilters;\n }, [configuration?.items, schema.fields]);\n\n const FilterCollectionComponent: React.FC<{\n filter: Filter<any>;\n collectionData?: { id: string; name: string }[];\n key: string;\n component: React.ElementType;\n }> = ({ filter, collectionData, key, component, ...filterProps }) => {\n const FilterComponent = component;\n\n const collection = useStaticListFilterCollection(\n filter,\n collectionData ?? [],\n );\n\n if (!configuration) {\n return null;\n }\n\n return (\n <FilterComponent\n key={key}\n filter={filter}\n {...(collectionData ? { collection } : {})}\n {...filterProps}\n />\n );\n };\n\n const collectionToolbarFiltersProps = React.useMemo<\n Pick<CollectionToolbarFiltersProps, 'inline' | 'panelTitle'>\n >(\n () => ({\n inline: configuration?.maxToolbarFilters || 0,\n panelTitle: configuration?.panelTitle,\n }),\n [configuration],\n );\n\n const filtersData = filters.reduce<ReturnValue>(\n (acc, filter) => {\n acc.filters[filter.key] = filter.filter;\n acc.components.push(\n filter.collectionData ? (\n <FilterCollectionComponent\n filter={filter.filter}\n key={filter.key}\n component={filter.component}\n collectionData={filter.collectionData}\n {...filter.props}\n />\n ) : (\n <filter.component\n key={filter.key}\n filter={filter.filter}\n {...filter.props}\n />\n ),\n );\n\n return acc;\n },\n { filters: {}, components: [], collectionToolbarFiltersProps },\n );\n\n return {\n filtersObject: filtersData.filters,\n filterComponent:\n filtersData.components.length > 0 ? (\n <CollectionToolbarFilters {...collectionToolbarFiltersProps}>\n {filtersData.components}\n </CollectionToolbarFilters>\n ) : undefined,\n };\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,wBAAwB,EAExBC,eAAe,EACfC,eAAe,EAEfC,iBAAiB,EACjBC,iBAAiB,EACjBC,iBAAiB,EACjBC,gBAAgB,EAChBC,6BAA6B,QACxB,eAAe;AAEtB,SAASC,iBAAiB,QAAQ,cAAc;AAChD,SAASC,gBAAgB,QAAQ,kBAAkB;AAmBnD,OAAO,MAAMC,UAAU,GAAIC,aAA6B,IAAK;EAC3D,MAAM;IAAEC;EAAO,CAAC,GAAGJ,iBAAiB,CAAC,CAAC;EACtC,MAAMK,OAAO,GAAGd,KAAK,CAACe,OAAO,CAAC,MAAM;IAClC,MAAMC,WAA4B,GAAG,EAAE;IACvCJ,aAAa,YAAbA,aAAa,CAAEK,KAAK,CAACC,OAAO,CAAEC,MAAM,IAAK;MAAA,IAAAC,kBAAA,EAAAC,mBAAA,EAAAC,mBAAA,EAAAC,qBAAA,EAAAC,sBAAA,EAAAC,oBAAA,EAAAC,qBAAA,EAAAC,qBAAA;MACvC,MAAM;QAAEC,OAAO,EAAEC;MAAI,CAAC,GAAGV,MAAM;MAC/B,MAAMW,eAAe,GAAGjB,MAAM,CAACkB,MAAM,CAACF,GAAG,CAAC;MAC1C,IAAI,CAACC,eAAe,EAAE;QACpB;MACF;MAEA,MAAME,KAAK,GAAGb,MAAM,CAACc,WAAW,IAAIH,eAA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EP;EAA8B,CAC/D,CAAC;EAED,OAAO;IACLQ,aAAa,EAAEJ,WAAW,CAACzD,OAAO;IAClC8D,eAAe,EACbL,WAAW,CAACG,UAAU,CAACG,MAAM,GAAG,CAAC,gBAC/B7E,KAAA,CAAAiE,aAAA,CAAChE,wBAAwB,EAAKkE,6BAA6B,EACxDI,WAAW,CAACG,UACW,CAAC,GACzBI;EACR,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useFetchData } from './useFetchData';
|
|
2
|
+
import { useGridCollection } from '@wix/patterns';
|
|
3
|
+
import { useCommonCollectionFeatures } from './useCommonCollectionFeatures';
|
|
4
|
+
import { useFilters } from './useFilters';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
import { useCollectionData } from '../providers';
|
|
7
|
+
export const useGridFeatures = configuration => {
|
|
8
|
+
const {
|
|
9
|
+
item,
|
|
10
|
+
collection
|
|
11
|
+
} = configuration;
|
|
12
|
+
const {
|
|
13
|
+
collectionId,
|
|
14
|
+
limit,
|
|
15
|
+
persistQueryToUrl,
|
|
16
|
+
disableAutoSelectAllCount,
|
|
17
|
+
selectionConsistencyMode
|
|
18
|
+
} = collection;
|
|
19
|
+
const {
|
|
20
|
+
title,
|
|
21
|
+
subtitle,
|
|
22
|
+
image,
|
|
23
|
+
imagePlacement,
|
|
24
|
+
preset
|
|
25
|
+
} = item;
|
|
26
|
+
const commonFeatures = useCommonCollectionFeatures(configuration);
|
|
27
|
+
const {
|
|
28
|
+
filterComponent,
|
|
29
|
+
filtersObject
|
|
30
|
+
} = useFilters(configuration.filters);
|
|
31
|
+
const {
|
|
32
|
+
fetchData
|
|
33
|
+
} = useFetchData(configuration.collection);
|
|
34
|
+
const {
|
|
35
|
+
entityIdKey,
|
|
36
|
+
entityNameKey
|
|
37
|
+
} = useCollectionData();
|
|
38
|
+
const state = useGridCollection({
|
|
39
|
+
queryName: `${collectionId}`,
|
|
40
|
+
itemKey: gridItem => gridItem[entityIdKey],
|
|
41
|
+
itemName: gridItem => gridItem[entityNameKey],
|
|
42
|
+
filters: filtersObject,
|
|
43
|
+
toExtendedFields: gridItem => gridItem.extendedFields,
|
|
44
|
+
fetchErrorMessage: _ref => {
|
|
45
|
+
let {
|
|
46
|
+
err
|
|
47
|
+
} = _ref;
|
|
48
|
+
return String(err);
|
|
49
|
+
},
|
|
50
|
+
fetchData,
|
|
51
|
+
limit,
|
|
52
|
+
persistQueryToUrl,
|
|
53
|
+
disableAutoSelectAllCount,
|
|
54
|
+
selectionConsistencyMode
|
|
55
|
+
});
|
|
56
|
+
const renderItem = useMemo(() => gridItem => ({
|
|
57
|
+
id: gridItem[entityIdKey],
|
|
58
|
+
title: `${gridItem[title]}`,
|
|
59
|
+
...(subtitle ? {
|
|
60
|
+
subtitle: `${gridItem[subtitle] ?? ''}`
|
|
61
|
+
} : {}),
|
|
62
|
+
...(image ? {
|
|
63
|
+
backgroundImageUrl: `${gridItem[image]}`
|
|
64
|
+
} : {})
|
|
65
|
+
}), [title, subtitle, image, entityIdKey]);
|
|
66
|
+
return {
|
|
67
|
+
...commonFeatures,
|
|
68
|
+
state,
|
|
69
|
+
imagePlacement,
|
|
70
|
+
preset,
|
|
71
|
+
renderItem,
|
|
72
|
+
filters: filterComponent
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=useGridFeatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useFetchData","useGridCollection","useCommonCollectionFeatures","useFilters","useMemo","useCollectionData","useGridFeatures","configuration","item","collection","collectionId","limit","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","title","subtitle","image","imagePlacement","preset","commonFeatures","filterComponent","filtersObject","filters","fetchData","entityIdKey","entityNameKey","state","queryName","itemKey","gridItem","itemName","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","renderItem","id","backgroundImageUrl"],"sources":["../../../src/hooks/useGridFeatures.tsx"],"sourcesContent":["import { GridConfig } from '../types';\nimport { useFetchData } from './useFetchData';\nimport { useGridCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useMemo } from 'react';\nimport { useCollectionData } from '../providers';\n\nexport const useGridFeatures = (configuration: GridConfig) => {\n const { item, collection } = configuration;\n\n const {\n collectionId,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n } = collection;\n\n const { title, subtitle, image, imagePlacement, preset } = item;\n\n const commonFeatures = useCommonCollectionFeatures(configuration);\n\n const { filterComponent, filtersObject } = useFilters(configuration.filters);\n const { fetchData } = useFetchData(configuration.collection);\n\n const { entityIdKey, entityNameKey } = useCollectionData();\n\n const state = useGridCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (gridItem) => gridItem[entityIdKey],\n itemName: (gridItem) => gridItem[entityNameKey],\n filters: filtersObject,\n toExtendedFields: (gridItem) => gridItem.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n });\n\n const renderItem = useMemo(\n () => (gridItem: any) => ({\n id: gridItem[entityIdKey],\n title: `${gridItem[title]}`,\n ...(subtitle ? { subtitle: `${gridItem[subtitle] ?? ''}` } : {}),\n ...(image ? { backgroundImageUrl: `${gridItem[image]}` } : {}),\n }),\n [title, subtitle, image, entityIdKey],\n );\n\n return {\n ...commonFeatures,\n state,\n imagePlacement,\n preset,\n renderItem,\n filters: filterComponent,\n };\n};\n"],"mappings":"AACA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,iBAAiB,QAAQ,eAAe;AACjD,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,OAAO,QAAQ,OAAO;AAC/B,SAASC,iBAAiB,QAAQ,cAAc;AAEhD,OAAO,MAAMC,eAAe,GAAIC,aAAyB,IAA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AQ,GAAG;MAAEA,QAAQ,EAAE,GAAGc,QAAQ,CAACd,QAAQ,CAAC,IAAI,EAAE;IAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,IAAIC,KAAK,GAAG;MAAEuB,kBAAkB,EAAE,GAAGV,QAAQ,CAACb,KAAK,CAAC;IAAG,CAAC,GAAG,CAAC,CAAC;EAC/D,CAAC,CAAC,EACF,CAACF,KAAK,EAAEC,QAAQ,EAAEC,KAAK,EAAEQ,WAAW,CACtC,CAAC;EAED,OAAO;IACL,GAAGL,cAAc;IACjBO,KAAK;IACLT,cAAc;IACdC,MAAM;IACNmB,UAAU;IACVf,OAAO,EAAEF;EACX,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useColumns } from './useColumns';
|
|
3
|
+
import { useFetchData } from './useFetchData';
|
|
4
|
+
import { CustomColumns, useTableCollection } from '@wix/patterns';
|
|
5
|
+
import { useCommonCollectionFeatures } from './useCommonCollectionFeatures';
|
|
6
|
+
import { useFilters } from './useFilters';
|
|
7
|
+
import { useCollectionData } from '../providers';
|
|
8
|
+
export const useTableFeatures = configuration => {
|
|
9
|
+
var _configuration$custom;
|
|
10
|
+
const {
|
|
11
|
+
collectionId,
|
|
12
|
+
limit,
|
|
13
|
+
persistQueryToUrl,
|
|
14
|
+
disableAutoSelectAllCount,
|
|
15
|
+
selectionConsistencyMode
|
|
16
|
+
} = configuration.collection;
|
|
17
|
+
const commonFeatures = useCommonCollectionFeatures({
|
|
18
|
+
...configuration
|
|
19
|
+
});
|
|
20
|
+
const {
|
|
21
|
+
filterComponent,
|
|
22
|
+
filtersObject
|
|
23
|
+
} = useFilters(configuration.filters);
|
|
24
|
+
const columns = useColumns(configuration.columns);
|
|
25
|
+
const {
|
|
26
|
+
fetchData
|
|
27
|
+
} = useFetchData(configuration.collection);
|
|
28
|
+
const {
|
|
29
|
+
entityIdKey,
|
|
30
|
+
entityNameKey
|
|
31
|
+
} = useCollectionData();
|
|
32
|
+
const state = useTableCollection({
|
|
33
|
+
queryName: `${collectionId}`,
|
|
34
|
+
itemKey: item => item[entityIdKey],
|
|
35
|
+
itemName: item => item[entityNameKey],
|
|
36
|
+
filters: filtersObject,
|
|
37
|
+
toExtendedFields: item => item.extendedFields,
|
|
38
|
+
fetchErrorMessage: _ref => {
|
|
39
|
+
let {
|
|
40
|
+
err
|
|
41
|
+
} = _ref;
|
|
42
|
+
return String(err);
|
|
43
|
+
},
|
|
44
|
+
fetchData,
|
|
45
|
+
limit,
|
|
46
|
+
persistQueryToUrl,
|
|
47
|
+
disableAutoSelectAllCount,
|
|
48
|
+
selectionConsistencyMode
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
...commonFeatures,
|
|
52
|
+
state,
|
|
53
|
+
columns,
|
|
54
|
+
filters: filterComponent,
|
|
55
|
+
customColumns: (_configuration$custom = configuration.customColumns) != null && _configuration$custom.enabled ? /*#__PURE__*/React.createElement(CustomColumns, null) : undefined
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=useTableFeatures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useColumns","useFetchData","CustomColumns","useTableCollection","useCommonCollectionFeatures","useFilters","useCollectionData","useTableFeatures","configuration","_configuration$custom","collectionId","limit","persistQueryToUrl","disableAutoSelectAllCount","selectionConsistencyMode","collection","commonFeatures","filterComponent","filtersObject","filters","columns","fetchData","entityIdKey","entityNameKey","state","queryName","itemKey","item","itemName","toExtendedFields","extendedFields","fetchErrorMessage","_ref","err","String","customColumns","enabled","createElement","undefined"],"sources":["../../../src/hooks/useTableFeatures.tsx"],"sourcesContent":["import React from 'react';\nimport { TableConfig } from '../types';\nimport { useColumns } from './useColumns';\nimport { useFetchData } from './useFetchData';\nimport { CustomColumns, useTableCollection } from '@wix/patterns';\nimport { useCommonCollectionFeatures } from './useCommonCollectionFeatures';\nimport { useFilters } from './useFilters';\nimport { useCollectionData } from '../providers';\n\nexport const useTableFeatures = (configuration: TableConfig) => {\n const {\n collectionId,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n } = configuration.collection;\n\n const commonFeatures = useCommonCollectionFeatures({\n ...configuration,\n });\n\n const { filterComponent, filtersObject } = useFilters(configuration.filters);\n const columns = useColumns(configuration.columns);\n const { fetchData } = useFetchData(configuration.collection);\n\n const { entityIdKey, entityNameKey } = useCollectionData();\n\n const state = useTableCollection<any>({\n queryName: `${collectionId}`,\n itemKey: (item) => item[entityIdKey],\n itemName: (item) => item[entityNameKey],\n filters: filtersObject,\n toExtendedFields: (item) => item.extendedFields,\n fetchErrorMessage: ({ err }) => String(err),\n fetchData,\n limit,\n persistQueryToUrl,\n disableAutoSelectAllCount,\n selectionConsistencyMode,\n });\n\n return {\n ...commonFeatures,\n state,\n columns,\n filters: filterComponent,\n customColumns: configuration.customColumns?.enabled ? (\n <CustomColumns />\n ) : undefined,\n };\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,aAAa,EAAEC,kBAAkB,QAAQ,eAAe;AACjE,SAASC,2BAA2B,QAAQ,+BAA+B;AAC3E,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,iBAAiB,QAAQ,cAAc;AAEhD,OAAO,MAAMC,gBAAgB,GAAIC,aAA0B,IAAK;EAAA,IAAAC,qBAAA;EAC9D,MAAM;IACJC,YAAY;IACZC,KAAK;IACLC,iBAAiB;IACjBC,yBAAyB;IACzBC;EACF,CAAC,GAAGN,aAAa,CAACO,UAAU;EAE5B,MAAMC,cAAc,GAAGZ,2BAA2B,CAAC;IACjD,GAAGI;EACL,CAAC,CAAC;EAEF,MAAM;IAAES,eAAe;IAAEC;EAAc,CAAC,GAAGb,UAAU,CAACG,aAAa,CAACW,OAAO,CAAC;EAC5E,MAAMC,OAAO,GAAGpB,UAAU,CAACQ,aAAa,CAACY,OAAO,CAAC;EACjD,MAAM;IAAEC;EAAU,CAAC,GAAGpB,YAAY,CAACO,aAAa,CAACO,UAAU,CAAC;EAE5D,MAAM;IAAEO,WAAW;IAAEC;EAAc,CAAC,GAAGjB,iBAAiB,CAAC,CAAC;EAE1D,MAAMkB,KAAK,GAAGrB,kBAAkB,CAAM;IACpCsB,SAAS,EAAE,GAAGf,YAAY,EAAE;IAC5BgB,OAAO,EAAGC,IAAI,IAAKA,IAAI,CAACL,WAAW,CAAC;IACpCM,QAAQ,EAAGD,IAAI,IAAKA,IAAI,CAACJ,aAAa,CAAC;IACvCJ,OAAO,EAAED,aAAa;IACtBW,gBAAgB,EAAGF,IAAI,IAAKA,IAAI,CAACG,cAAc;IAC/CC,iBAAiB,EAAEC,IAAA;MAAA,IAAC;QAAEC;MAAI,CAAC,GAAAD,IAAA;MAAA,OAAKE,MAAM,CAACD,GAAG,CAAC;IAAA;IAC3CZ,SAAS;IACTV,KAAK;IACLC,iBAAiB;IACjBC,yBAAyB;IACzBC;EACF,CAAC,CAAC;EAEF,OAAO;IACL,GAAGE,cAAc;IACjBQ,KAAK;IACLJ,OAAO;IACPD,OAAO,EAAEF,eAAe;IACxBkB,aAAa,EAAE,CAAA1B,qBAAA,GAAAD,aAAa,CAAC2B,aAAa,aAA3B1B,qBAAA,CAA6B2B,OAAO,gBACjDrC,KAAA,CAAAsC,aAAA,CAACnC,aAAa,MAAE,CAAC,GACfoC;EACN,CAAC;AACH,CAAC","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from './providers';\nexport * from './hooks';\n"],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from './providers';\nexport * from './hooks';\nexport * from './components/AutoPatternsApp';\nexport * from './types';\n"],"mappings":"AAAA,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,8BAA8B;AAC5C,cAAc,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { getCollectionData } from '../collectionData/CollectionDataFactory';
|
|
3
|
+
const CollectionDataContext = /*#__PURE__*/createContext(null);
|
|
4
|
+
export const CollectionDataProvider = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
collectionConfig,
|
|
7
|
+
visibleFieldIds,
|
|
8
|
+
children
|
|
9
|
+
} = _ref;
|
|
10
|
+
const [collectionData, setCollectionData] = useState(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
getCollectionData(collectionConfig, visibleFieldIds).then(setCollectionData).catch(error => {
|
|
13
|
+
console.error('Error fetching config:', error);
|
|
14
|
+
});
|
|
15
|
+
}, [collectionConfig, visibleFieldIds]);
|
|
16
|
+
if (!collectionConfig || !collectionData) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/React.createElement(CollectionDataContext.Provider, {
|
|
20
|
+
value: collectionData
|
|
21
|
+
}, children);
|
|
22
|
+
};
|
|
23
|
+
export const useCollectionData = () => {
|
|
24
|
+
const context = useContext(CollectionDataContext);
|
|
25
|
+
if (!context) {
|
|
26
|
+
throw new Error('useCollectionData must be used within a CollectionDataProvider');
|
|
27
|
+
}
|
|
28
|
+
return context;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=CollectionDataContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","useEffect","useState","getCollectionData","CollectionDataContext","CollectionDataProvider","_ref","collectionConfig","visibleFieldIds","children","collectionData","setCollectionData","then","catch","error","console","createElement","Provider","value","useCollectionData","context","Error"],"sources":["../../../src/providers/CollectionDataContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useState,\n ReactNode,\n} from 'react';\nimport { getCollectionData } from '../collectionData/CollectionDataFactory';\nimport { CollectionConfig } from '../types/CollectionPageConfig';\nimport { CollectionData } from '../collectionData/CollectionData';\n\nconst CollectionDataContext = createContext<CollectionData | null>(null);\n\ninterface CollectionDataProviderProps {\n collectionConfig: CollectionConfig;\n visibleFieldIds: string[];\n children: ReactNode;\n}\n\nexport const CollectionDataProvider = ({\n collectionConfig,\n visibleFieldIds,\n children,\n}: CollectionDataProviderProps) => {\n const [collectionData, setCollectionData] = useState<CollectionData | null>(\n null,\n );\n\n useEffect(() => {\n getCollectionData(collectionConfig, visibleFieldIds)\n .then(setCollectionData)\n .catch((error) => {\n console.error('Error fetching config:', error);\n });\n }, [collectionConfig, visibleFieldIds]);\n\n if (!collectionConfig || !collectionData) {\n return null;\n }\n\n return (\n <CollectionDataContext.Provider value={collectionData}>\n {children}\n </CollectionDataContext.Provider>\n );\n};\n\nexport const useCollectionData = (): CollectionData => {\n const context = useContext(CollectionDataContext);\n if (!context) {\n throw new Error(\n 'useCollectionData must be used within a CollectionDataProvider',\n );\n }\n return context;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,QAAQ,QAEH,OAAO;AACd,SAASC,iBAAiB,QAAQ,yCAAyC;AAI3E,MAAMC,qBAAqB,gBAAGL,aAAa,CAAwB,IAAI,CAAC;AAQxE,OAAO,MAAMM,sBAAsB,GAAGC,IAAA,IAIH;EAAA,IAJI;IACrCC,gBAAgB;IAChBC,eAAe;IACfC;EAC2B,CAAC,GAAAH,IAAA;EAC5B,MAAM,CAACI,cAAc,EAAEC,iBAAiB,CAAC,GAAGT,QAAQ,CAClD,IACF,CAAC;EAEDD,SAAS,CAAC,MAAM;IACdE,iBAAiB,CAACI,gBAAgB,EAAEC,eAAe,CAAC,CACjDI,IAAI,CAACD,iBAAiB,CAAC,CACvBE,KAAK,CAAEC,KAAK,IAAK;MAChBC,OAAO,CAACD,KAAK,CAAC,wBAAwB,EAAEA,KAAK,CAAC;IAChD,CAAC,CAAC;EACN,CAAC,EAAE,CAACP,gBAAgB,EAAEC,eAAe,CAAC,CAAC;EAEvC,IAAI,CAACD,gBAAgB,IAAI,CAACG,cAAc,EAAE;IACxC,OAAO,IAAI;EACb;EAEA,oBACEZ,KAAA,CAAAkB,aAAA,CAACZ,qBAAqB,CAACa,QAAQ;IAACC,KAAK,EAAER;EAAe,GACnDD,QAC6B,CAAC;AAErC,CAAC;AAED,OAAO,MAAMU,iBAAiB,GAAGA,CAAA,KAAsB;EACrD,MAAMC,OAAO,GAAGpB,UAAU,CAACI,qBAAqB,CAAC;EACjD,IAAI,CAACgB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CACb,gEACF,CAAC;EACH;EACA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","createContext","useContext","PatternsWizardOverridesContext","undefined","PatternsWizardOverridesProvider","_ref","children","value","createElement","Provider","usePatternsWizardOverridesContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","PatternsWizardOverridesContext","undefined","PatternsWizardOverridesProvider","_ref","children","value","createElement","Provider","usePatternsWizardOverridesContext"],"sources":["../../../src/providers/PatternsWizardOverridesContext.tsx"],"sourcesContent":["import React, { createContext, useContext, ReactNode } from 'react';\nimport {\n IColumnValue,\n IMenuItem,\n PagePrimaryActionProps,\n PageSecondaryActionProps,\n} from '../types';\nimport { CollectionConfig } from '@wix/patterns';\n\nexport interface PatternsWizardOverridesContextProps {\n actions?: Record<string, (props: IMenuItem<any>) => void>;\n columns?: Record<string, (props: IColumnValue<any>) => void>;\n HeaderAddon?: React.FC;\n emptyState?: Record<string, () => void>;\n usePagePrimaryAction?: () => PagePrimaryActionProps;\n usePageSecondaryAction?: () => PageSecondaryActionProps;\n fetchData?: Record<string, CollectionConfig<any, any>['fetchData']>;\n}\n\nconst PatternsWizardOverridesContext = createContext<\n PatternsWizardOverridesContextProps | undefined\n>(undefined);\n\nexport const PatternsWizardOverridesProvider: React.FC<{\n children: ReactNode;\n value: PatternsWizardOverridesContextProps;\n}> = ({ children, value }) => {\n return (\n <PatternsWizardOverridesContext.Provider value={value}>\n {children}\n </PatternsWizardOverridesContext.Provider>\n );\n};\n\nexport const usePatternsWizardOverridesContext = ():\n | PatternsWizardOverridesContextProps\n | undefined => {\n return useContext(PatternsWizardOverridesContext);\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,aAAa,EAAEC,UAAU,QAAmB,OAAO;AAmBnE,MAAMC,8BAA8B,gBAAGF,aAAa,CAElDG,SAAS,CAAC;AAEZ,OAAO,MAAMC,+BAGX,GAAGC,IAAA,IAAyB;EAAA,IAAxB;IAAEC,QAAQ;IAAEC;EAAM,CAAC,GAAAF,IAAA;EACvB,oBACEN,KAAA,CAAAS,aAAA,CAACN,8BAA8B,CAACO,QAAQ;IAACF,KAAK,EAAEA;EAAM,GACnDD,QACsC,CAAC;AAE9C,CAAC;AAED,OAAO,MAAMI,iCAAiC,GAAGA,CAAA,KAEhC;EACf,OAAOT,UAAU,CAACC,8BAA8B,CAAC;AACnD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React, { createContext, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { getSchema } from '../collectionData/SchemaFactory';
|
|
3
|
+
const SchemaContext = /*#__PURE__*/createContext(null);
|
|
4
|
+
export const SchemaProvider = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
collectionId,
|
|
7
|
+
entityTypeSource,
|
|
8
|
+
children
|
|
9
|
+
} = _ref;
|
|
10
|
+
const [schema, setSchema] = useState(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
getSchema(collectionId, entityTypeSource).then(setSchema).catch(error => {
|
|
13
|
+
console.error('Error fetching schema config:', error);
|
|
14
|
+
});
|
|
15
|
+
}, [collectionId, entityTypeSource]);
|
|
16
|
+
if (!schema) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return /*#__PURE__*/React.createElement(SchemaContext.Provider, {
|
|
20
|
+
value: schema
|
|
21
|
+
}, children);
|
|
22
|
+
};
|
|
23
|
+
export const useSchema = () => {
|
|
24
|
+
const context = useContext(SchemaContext);
|
|
25
|
+
if (!context) {
|
|
26
|
+
throw new Error('useSchema must be used within a SchemaProvider');
|
|
27
|
+
}
|
|
28
|
+
return context;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=SchemaContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","createContext","useContext","useEffect","useState","getSchema","SchemaContext","SchemaProvider","_ref","collectionId","entityTypeSource","children","schema","setSchema","then","catch","error","console","createElement","Provider","value","useSchema","context","Error"],"sources":["../../../src/providers/SchemaContext.tsx"],"sourcesContent":["import React, {\n createContext,\n useContext,\n useEffect,\n useState,\n ReactNode,\n} from 'react';\nimport { getSchema } from '../collectionData/SchemaFactory';\nimport { SchemaConfig } from '../types';\n\nconst SchemaContext = createContext<SchemaConfig | null>(null);\n\ninterface SchemaProviderProps {\n collectionId: string;\n entityTypeSource: string;\n children: ReactNode;\n}\n\nexport const SchemaProvider = ({\n collectionId,\n entityTypeSource,\n children,\n}: SchemaProviderProps) => {\n const [schema, setSchema] = useState<SchemaConfig | null>(null);\n\n useEffect(() => {\n getSchema(collectionId, entityTypeSource)\n .then(setSchema)\n .catch((error) => {\n console.error('Error fetching schema config:', error);\n });\n }, [collectionId, entityTypeSource]);\n\n if (!schema) {\n return null;\n }\n\n return (\n <SchemaContext.Provider value={schema}>{children}</SchemaContext.Provider>\n );\n};\n\nexport const useSchema = (): SchemaConfig => {\n const context = useContext(SchemaContext);\n if (!context) {\n throw new Error('useSchema must be used within a SchemaProvider');\n }\n return context;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,QAAQ,QAEH,OAAO;AACd,SAASC,SAAS,QAAQ,iCAAiC;AAG3D,MAAMC,aAAa,gBAAGL,aAAa,CAAsB,IAAI,CAAC;AAQ9D,OAAO,MAAMM,cAAc,GAAGC,IAAA,IAIH;EAAA,IAJI;IAC7BC,YAAY;IACZC,gBAAgB;IAChBC;EACmB,CAAC,GAAAH,IAAA;EACpB,MAAM,CAACI,MAAM,EAAEC,SAAS,CAAC,GAAGT,QAAQ,CAAsB,IAAI,CAAC;EAE/DD,SAAS,CAAC,MAAM;IACdE,SAAS,CAACI,YAAY,EAAEC,gBAAgB,CAAC,CACtCI,IAAI,CAACD,SAAS,CAAC,CACfE,KAAK,CAAEC,KAAK,IAAK;MAChBC,OAAO,CAACD,KAAK,CAAC,+BAA+B,EAAEA,KAAK,CAAC;IACvD,CAAC,CAAC;EACN,CAAC,EAAE,CAACP,YAAY,EAAEC,gBAAgB,CAAC,CAAC;EAEpC,IAAI,CAACE,MAAM,EAAE;IACX,OAAO,IAAI;EACb;EAEA,oBACEZ,KAAA,CAAAkB,aAAA,CAACZ,aAAa,CAACa,QAAQ;IAACC,KAAK,EAAER;EAAO,GAAED,QAAiC,CAAC;AAE9E,CAAC;AAED,OAAO,MAAMU,SAAS,GAAGA,CAAA,KAAoB;EAC3C,MAAMC,OAAO,GAAGpB,UAAU,CAACI,aAAa,CAAC;EACzC,IAAI,CAACgB,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,gDAAgD,CAAC;EACnE;EACA,OAAOD,OAAO;AAChB,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../../src/providers/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/providers/index.ts"],"sourcesContent":["export * from './CollectionDataContext';\nexport * from './PatternsWizardOverridesContext';\n"],"mappings":"AAAA,cAAc,yBAAyB;AACvC,cAAc,kCAAkC","ignoreList":[]}
|
package/dist/esm/react.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './components/
|
|
1
|
+
export * from './components/AutoPatternsApp';
|
|
2
2
|
//# sourceMappingURL=react.js.map
|
package/dist/esm/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/react.tsx"],"sourcesContent":["export * from './components/
|
|
1
|
+
{"version":3,"names":[],"sources":["../../src/react.tsx"],"sourcesContent":["export * from './components/AutoPatternsApp';\n"],"mappings":"AAAA,cAAc,8BAA8B","ignoreList":[]}
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
export let CollectionTypeEnum = /*#__PURE__*/function (CollectionTypeEnum) {
|
|
2
|
-
CollectionTypeEnum["TABLE"] = "Table";
|
|
3
|
-
CollectionTypeEnum["GRID"] = "Grid";
|
|
4
|
-
CollectionTypeEnum["TABLE_GRID_SWITCH"] = "TableGridSwitch";
|
|
5
|
-
return CollectionTypeEnum;
|
|
6
|
-
}({});
|
|
7
1
|
export let ComponentTypeEnum = /*#__PURE__*/function (ComponentTypeEnum) {
|
|
8
2
|
ComponentTypeEnum["SINGLE"] = "single";
|
|
9
3
|
ComponentTypeEnum["MULTI_SELECT"] = "multi-select";
|
|
@@ -12,6 +6,4 @@ export let ComponentTypeEnum = /*#__PURE__*/function (ComponentTypeEnum) {
|
|
|
12
6
|
ComponentTypeEnum["DATE_RANGE"] = "date-range";
|
|
13
7
|
return ComponentTypeEnum;
|
|
14
8
|
}({});
|
|
15
|
-
|
|
16
|
-
// TODO: fill this out
|
|
17
|
-
//# sourceMappingURL=types.js.map
|
|
9
|
+
//# sourceMappingURL=CollectionPageConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ComponentTypeEnum"],"sources":["../../../src/types/CollectionPageConfig.ts"],"sourcesContent":["import { CollectionToolbarFiltersProps } from '@wix/patterns';\nimport { DateRangeFilterMode, DateRangeOptions } from '@wix/patterns/core';\n\nexport interface CollectionPageConfig {\n title: { text: string; hideTotal?: boolean };\n subtitle?: {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n components: ComponentConfig[];\n}\n\ninterface ComponentConfig {\n type: 'Table' | 'Grid' | 'TableGridSwitch';\n table?: TableConfig;\n grid?: GridConfig;\n}\n\nexport interface CollectionConfig {\n collectionId: string;\n entityTypeSource: 'cms';\n fetchData?: FetchData;\n limit?: number;\n persistQueryToUrl?: boolean;\n disableAutoSelectAllCount?: boolean;\n selectionConsistencyMode?: 'preserve' | 'clear';\n}\n\nexport interface BaseCollectionComponentConfig {\n collection: CollectionConfig;\n search?: { shown?: boolean };\n toolbarTitle?: ToolbarTitle;\n actions?: Action[];\n emptyState?: EmptyState;\n filters?: FiltersConfig;\n}\n\nexport interface TableConfig extends BaseCollectionComponentConfig {\n columns: Column[];\n customColumns?: {\n enabled: boolean;\n };\n}\n\nexport interface GridConfig extends BaseCollectionComponentConfig {\n item: GridItem;\n}\n\nexport interface ToolbarTitle {\n title: string;\n subtitle?: {\n text: string;\n info?: {\n content: {\n text: string;\n link?: {\n url: string;\n label: string;\n };\n };\n };\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n showTotal?: boolean;\n itemsLimit?: number;\n}\n\nexport interface Column {\n id: string;\n name: string;\n width?: string;\n sortable?: boolean;\n defaultSortOrder?: 'asc' | 'desc';\n sortMode?: 'asc' | 'desc';\n defaultHidden?: boolean;\n hiddenFromCustomColumnsSelection?: boolean;\n hideable?: boolean;\n reorderDisabled?: boolean;\n}\n\nexport interface GridItem {\n title: string;\n subtitle?: string;\n image?: string;\n preset?: 'full' | 'title' | 'empty';\n imagePlacement?: 'top' | 'side';\n}\n\nexport interface EmptyState {\n title?: string;\n subtitle?: string;\n image?: {\n id: string;\n };\n addNewCta?: {\n id?: string;\n text?: string;\n };\n customCta?: {\n id?: string;\n };\n}\n\ninterface FetchData {\n id: string;\n}\n\nexport interface FilterOption {\n value: string;\n label: string;\n}\n\nexport type FilterSelectionMode = 'single' | 'multiple';\nexport type EnumFilterOptionType =\n | 'checkbox'\n | 'inlineCheckbox'\n | 'radio'\n | 'select';\n\nexport enum ComponentTypeEnum {\n SINGLE = 'single',\n MULTI_SELECT = 'multi-select',\n RADIO_GROUP = 'radio-group',\n NUMBER = 'number',\n DATE_RANGE = 'date-range',\n}\n\nexport interface FiltersConfig {\n items: Filter[];\n maxToolbarFilters?: CollectionToolbarFiltersProps['inline'];\n panelTitle?: string;\n}\n\nexport interface DateFilterConfig {\n mode?: DateRangeFilterMode;\n dateRangeOptions?: DateRangeOptions;\n filterByTime?: boolean;\n}\n\nexport interface NumberFilterConfig {\n min?: number;\n max?: number;\n decimal?: boolean;\n}\n\nexport interface BooleanFilterConfig {\n checkedLabel?: string;\n uncheckedLabel?: string;\n}\n\nexport interface EnumFilterConfig {\n options: FilterOption[];\n selectionMode: FilterSelectionMode;\n optionType?: EnumFilterOptionType;\n}\n\nexport interface Filter {\n fieldId: string;\n displayName?: string;\n accordionItemProps?: {\n initiallyOpen?: boolean;\n sectionTitle?: string;\n };\n toolbarTagProps?: {\n label: string;\n };\n componentType?: ComponentTypeEnum;\n numberConfig?: NumberFilterConfig;\n dateConfig?: DateFilterConfig;\n booleanConfig?: BooleanFilterConfig;\n enumConfig?: EnumFilterConfig;\n}\n\ninterface Action {\n id: string;\n text: string;\n icon: string;\n}\n"],"mappings":"AA6HA,WAAYA,iBAAiB,0BAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAjBA,iBAAiB;EAAA,OAAjBA,iBAAiB;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/EntityPageConfig.ts"],"sourcesContent":["export interface EntityPageConfig {\n title?: { text: string };\n subtitle?: {\n text: string;\n learnMore?: {\n url: string;\n label?: string;\n };\n };\n visibleFieldIds: string[];\n collectionId: string;\n entityTypeSource: string;\n collectionPagePath: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/index.ts"],"sourcesContent":["export * from './types';\nexport * from './CollectionPageConfig';\nexport * from './EntityPageConfig';\n"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,wBAAwB;AACtC,cAAc,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["../../../src/types/types.ts"],"sourcesContent":["import { PrimaryActions, SecondaryActions } from '@wix/patterns';\nimport { EntityPageConfig } from './EntityPageConfig';\nimport { CollectionPageConfig } from './CollectionPageConfig';\n\nexport type PatternsFieldType =\n | 'SHORT_TEXT'\n | 'LONG_TEXT'\n | 'NUMBER'\n | 'BOOLEAN'\n | 'DATE'\n | 'DATETIME'\n | 'URL'\n | 'ARRAY';\n\nexport interface AppConfig {\n pages: PageConfig[];\n}\n\nexport interface PageConfig {\n id: string;\n routePath: string;\n type: 'collectionPage' | 'entityPage';\n collectionPage?: CollectionPageConfig;\n entityPage?: EntityPageConfig;\n}\n\nexport type EntityProps = { [key: string]: any };\n\nexport interface IMenuItem<T extends EntityProps = {}> {\n item: T;\n}\nexport interface IColumnValue<T> {\n value: T;\n}\n\nexport type QueryOperator =\n | 'CONTAINS'\n | 'ENDS_WITH'\n | 'EQ'\n | 'EXISTS'\n | 'GT'\n | 'GTE'\n | 'HAS_ALL'\n | 'HAS_SOME'\n | 'LT'\n | 'LTE'\n | 'NE'\n | 'STARTS_WITH'\n | 'URLIZED';\n\nexport interface Field {\n id: string;\n displayName: string;\n type: PatternsFieldType;\n capabilities: {\n supportedQueryOperators: QueryOperator[];\n sortable: boolean;\n };\n}\n\nexport interface SchemaConfig {\n fields: Record<string, Field | undefined>;\n displayField: string;\n actions: {\n get: (entityId: string) => Promise<any>;\n create: (newEntity: Partial<any>) => Promise<any>;\n update: (updatedEntity: any) => Promise<any>;\n delete: (entityId: string) => Promise<any>;\n };\n}\n\nexport type PagePrimaryActionProps = React.ComponentProps<\n typeof PrimaryActions\n>;\n\nexport type PageSecondaryActionProps = React.ComponentProps<\n typeof SecondaryActions\n>;\n"],"mappings":"","ignoreList":[]}
|