@wix/auto-patterns 1.52.0 → 1.54.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/cms-fields/components/address/input/address-input.st.css.js +3 -3
- package/dist/cjs/cms-fields/components/address/input/address-input.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/audio/actions/actions-menu/actions-menu.st.css.js +3 -3
- package/dist/cjs/cms-fields/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/audio/audio-field/form-audio-field.st.css.js +4 -4
- package/dist/cjs/cms-fields/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/cjs/cms-fields/components/audio/audio-player/audio-player.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/color-view/color-input.js +168 -0
- package/dist/cjs/cms-fields/components/color-view/color-input.js.map +1 -0
- package/dist/cjs/cms-fields/components/color-view/color-view.js +62 -0
- package/dist/cjs/cms-fields/components/color-view/color-view.js.map +1 -0
- package/dist/cjs/cms-fields/components/color-view/color-view.st.css +14 -0
- package/dist/cjs/cms-fields/components/color-view/color-view.st.css.js +24 -0
- package/dist/cjs/cms-fields/components/color-view/color-view.st.css.js.map +1 -0
- package/dist/cjs/cms-fields/components/color-view/color-view.uni.driver.js +15 -0
- package/dist/cjs/cms-fields/components/color-view/color-view.uni.driver.js.map +1 -0
- package/dist/cjs/cms-fields/components/color-view/form-color-input.js +35 -0
- package/dist/cjs/cms-fields/components/color-view/form-color-input.js.map +1 -0
- package/dist/cjs/cms-fields/components/color-view/index.js +22 -0
- package/dist/cjs/cms-fields/components/color-view/index.js.map +1 -0
- package/dist/cjs/cms-fields/components/delete-dialog/delete-dialog.st.css.js +3 -3
- package/dist/cjs/cms-fields/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/document/form-document-field.st.css.js +7 -7
- package/dist/cjs/cms-fields/components/document/form-document-field.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/exclamation/exclamation.st.css.js +5 -5
- package/dist/cjs/cms-fields/components/exclamation/exclamation.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/highlighted-text/highlighted-text.st.css.js +5 -5
- package/dist/cjs/cms-fields/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/index.js +6 -0
- package/dist/cjs/cms-fields/components/index.js.map +1 -1
- package/dist/cjs/cms-fields/components/media-control/paste-url-button.st.css.js +4 -4
- package/dist/cjs/cms-fields/components/media-control/paste-url-button.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/media-gallery/form-media-gallery-field.st.css.js +10 -10
- package/dist/cjs/cms-fields/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/media-image/media-image.st.css.js +4 -4
- package/dist/cjs/cms-fields/components/media-image/media-image.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/media-loader/media-loader.st.css.js +3 -3
- package/dist/cjs/cms-fields/components/media-loader/media-loader.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
- package/dist/cjs/cms-fields/components/media-tag/web-media-tag/media-tag.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/multi-document/multi-document-input/form-multi-document.st.css.js +5 -5
- package/dist/cjs/cms-fields/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +6 -6
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +5 -5
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +3 -3
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +3 -3
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +9 -9
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +4 -4
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +4 -4
- package/dist/cjs/cms-fields/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +18 -18
- package/dist/cjs/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +4 -4
- package/dist/cjs/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +18 -18
- package/dist/cjs/cms-fields/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
- package/dist/cjs/cms-fields/components/text/text-view.st.css.js +3 -3
- package/dist/cjs/cms-fields/components/text/text-view.st.css.js.map +1 -1
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js +1 -1
- package/dist/cjs/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
- package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js +7 -5
- package/dist/cjs/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -1
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js +7 -5
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.uni.driver.js +5 -0
- package/dist/cjs/components/AutoPatternsTable/AutoPatternsTable.uni.driver.js.map +1 -1
- package/dist/cjs/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js +7 -5
- package/dist/cjs/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js.map +1 -1
- package/dist/cjs/components/fields/Color.js +50 -0
- package/dist/cjs/components/fields/Color.js.map +1 -0
- package/dist/cjs/components/fields/Color.uni.driver.js +19 -0
- package/dist/cjs/components/fields/Color.uni.driver.js.map +1 -0
- package/dist/cjs/components/fields/index.js +4 -1
- package/dist/cjs/components/fields/index.js.map +1 -1
- package/dist/cjs/components/layouts/FormField.js +3 -2
- package/dist/cjs/components/layouts/FormField.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js +20 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/cjs/dataSourceAdapters/cms/cmsBackup.js +48 -0
- package/dist/cjs/dataSourceAdapters/cms/cmsBackup.js.map +1 -0
- package/dist/cjs/hooks/pluginsDynamicImports.js +4 -1
- package/dist/cjs/hooks/pluginsDynamicImports.js.map +1 -1
- package/dist/cjs/hooks/useActionCell.js +3 -0
- package/dist/cjs/hooks/useActionCell.js.map +1 -1
- package/dist/cjs/hooks/useColumns.js +24 -14
- package/dist/cjs/hooks/useColumns.js.map +1 -1
- package/dist/cjs/hooks/useGridFeaturesAsync.js +3 -1
- package/dist/cjs/hooks/useGridFeaturesAsync.js.map +1 -1
- package/dist/cjs/hooks/useImport.js +78 -0
- package/dist/cjs/hooks/useImport.js.map +1 -0
- package/dist/cjs/hooks/useTableFeaturesAsync.js +3 -1
- package/dist/cjs/hooks/useTableFeaturesAsync.js.map +1 -1
- package/dist/cjs/hooks/useTableGridSwitchFeaturesAsync.js +3 -1
- package/dist/cjs/hooks/useTableGridSwitchFeaturesAsync.js.map +1 -1
- package/dist/cjs/styles.global.css +1 -1
- package/dist/cjs/types/CollectionPageConfig.js.map +1 -1
- package/dist/cjs/types/SchemaConfig.js +4 -0
- package/dist/cjs/types/SchemaConfig.js.map +1 -0
- package/dist/cjs/types/types.js +6 -0
- package/dist/cjs/types/types.js.map +1 -1
- package/dist/cjs/utils/backupPolling.js +31 -0
- package/dist/cjs/utils/backupPolling.js.map +1 -0
- package/dist/esm/cms-fields/components/address/input/address-input.st.css.js +3 -3
- package/dist/esm/cms-fields/components/address/input/address-input.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/audio/actions/actions-menu/actions-menu.st.css.js +3 -3
- package/dist/esm/cms-fields/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/audio/audio-field/form-audio-field.st.css.js +4 -4
- package/dist/esm/cms-fields/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/esm/cms-fields/components/audio/audio-player/audio-player.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/color-view/color-input.js +104 -0
- package/dist/esm/cms-fields/components/color-view/color-input.js.map +1 -0
- package/dist/esm/cms-fields/components/color-view/color-view.js +30 -0
- package/dist/esm/cms-fields/components/color-view/color-view.js.map +1 -0
- package/dist/esm/cms-fields/components/color-view/color-view.st.css +14 -0
- package/dist/esm/cms-fields/components/color-view/color-view.st.css.js +20 -0
- package/dist/esm/cms-fields/components/color-view/color-view.st.css.js.map +1 -0
- package/dist/esm/cms-fields/components/color-view/color-view.uni.driver.js +11 -0
- package/dist/esm/cms-fields/components/color-view/color-view.uni.driver.js.map +1 -0
- package/dist/esm/cms-fields/components/color-view/form-color-input.js +24 -0
- package/dist/esm/cms-fields/components/color-view/form-color-input.js.map +1 -0
- package/dist/esm/cms-fields/components/color-view/index.js +4 -0
- package/dist/esm/cms-fields/components/color-view/index.js.map +1 -0
- package/dist/esm/cms-fields/components/delete-dialog/delete-dialog.st.css.js +3 -3
- package/dist/esm/cms-fields/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/document/form-document-field.st.css.js +7 -7
- package/dist/esm/cms-fields/components/document/form-document-field.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/exclamation/exclamation.st.css.js +5 -5
- package/dist/esm/cms-fields/components/exclamation/exclamation.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/highlighted-text/highlighted-text.st.css.js +5 -5
- package/dist/esm/cms-fields/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/index.js +1 -0
- package/dist/esm/cms-fields/components/index.js.map +1 -1
- package/dist/esm/cms-fields/components/media-control/paste-url-button.st.css.js +4 -4
- package/dist/esm/cms-fields/components/media-control/paste-url-button.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/media-gallery/form-media-gallery-field.st.css.js +10 -10
- package/dist/esm/cms-fields/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/media-image/media-image.st.css.js +4 -4
- package/dist/esm/cms-fields/components/media-image/media-image.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/media-loader/media-loader.st.css.js +3 -3
- package/dist/esm/cms-fields/components/media-loader/media-loader.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
- package/dist/esm/cms-fields/components/media-tag/web-media-tag/media-tag.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/multi-document/multi-document-input/form-multi-document.st.css.js +5 -5
- package/dist/esm/cms-fields/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +6 -6
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +5 -5
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +3 -3
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +3 -3
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +9 -9
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +4 -4
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +4 -4
- package/dist/esm/cms-fields/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +18 -18
- package/dist/esm/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +4 -4
- package/dist/esm/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +18 -18
- package/dist/esm/cms-fields/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
- package/dist/esm/cms-fields/components/text/text-view.st.css.js +3 -3
- package/dist/esm/cms-fields/components/text/text-view.st.css.js.map +1 -1
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js +1 -1
- package/dist/esm/components/AutoPatternsApp/AutoPatternsApp.js.map +1 -1
- package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js +4 -2
- package/dist/esm/components/AutoPatternsGrid/AutoPatternsGrid.js.map +1 -1
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js +4 -2
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.js.map +1 -1
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.uni.driver.js +5 -0
- package/dist/esm/components/AutoPatternsTable/AutoPatternsTable.uni.driver.js.map +1 -1
- package/dist/esm/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js +4 -2
- package/dist/esm/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.js.map +1 -1
- package/dist/esm/components/fields/Color.js +31 -0
- package/dist/esm/components/fields/Color.js.map +1 -0
- package/dist/esm/components/fields/Color.uni.driver.js +15 -0
- package/dist/esm/components/fields/Color.uni.driver.js.map +1 -0
- package/dist/esm/components/fields/index.js +1 -0
- package/dist/esm/components/fields/index.js.map +1 -1
- package/dist/esm/components/layouts/FormField.js +3 -2
- package/dist/esm/components/layouts/FormField.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js +20 -1
- package/dist/esm/dataSourceAdapters/cms/cmsAdapter.js.map +1 -1
- package/dist/esm/dataSourceAdapters/cms/cmsBackup.js +44 -0
- package/dist/esm/dataSourceAdapters/cms/cmsBackup.js.map +1 -0
- package/dist/esm/hooks/pluginsDynamicImports.js +2 -0
- package/dist/esm/hooks/pluginsDynamicImports.js.map +1 -1
- package/dist/esm/hooks/useActionCell.js +3 -0
- package/dist/esm/hooks/useActionCell.js.map +1 -1
- package/dist/esm/hooks/useColumns.js +5 -1
- package/dist/esm/hooks/useColumns.js.map +1 -1
- package/dist/esm/hooks/useGridFeaturesAsync.js +4 -2
- package/dist/esm/hooks/useGridFeaturesAsync.js.map +1 -1
- package/dist/esm/hooks/useImport.js +66 -0
- package/dist/esm/hooks/useImport.js.map +1 -0
- package/dist/esm/hooks/useTableFeaturesAsync.js +4 -2
- package/dist/esm/hooks/useTableFeaturesAsync.js.map +1 -1
- package/dist/esm/hooks/useTableGridSwitchFeaturesAsync.js +4 -2
- package/dist/esm/hooks/useTableGridSwitchFeaturesAsync.js.map +1 -1
- package/dist/esm/styles.global.css +1 -1
- package/dist/esm/types/CollectionPageConfig.js.map +1 -1
- package/dist/esm/types/SchemaConfig.js +2 -0
- package/dist/esm/types/SchemaConfig.js.map +1 -0
- package/dist/esm/types/types.js +5 -0
- package/dist/esm/types/types.js.map +1 -1
- package/dist/esm/utils/backupPolling.js +27 -0
- package/dist/esm/utils/backupPolling.js.map +1 -0
- package/dist/types/cms-fields/components/address/input/address-input.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/color-view/color-input.d.ts +8 -0
- package/dist/types/cms-fields/components/color-view/color-input.d.ts.map +1 -0
- package/dist/types/cms-fields/components/color-view/color-view.d.ts +7 -0
- package/dist/types/cms-fields/components/color-view/color-view.d.ts.map +1 -0
- package/dist/types/cms-fields/components/color-view/color-view.st.css.d.ts +15 -0
- package/dist/types/cms-fields/components/color-view/color-view.st.css.d.ts.map +1 -0
- package/dist/types/cms-fields/components/color-view/color-view.uni.driver.d.ts +16 -0
- package/dist/types/cms-fields/components/color-view/color-view.uni.driver.d.ts.map +1 -0
- package/dist/types/cms-fields/components/color-view/form-color-input.d.ts +7 -0
- package/dist/types/cms-fields/components/color-view/form-color-input.d.ts.map +1 -0
- package/dist/types/cms-fields/components/color-view/index.d.ts +4 -0
- package/dist/types/cms-fields/components/color-view/index.d.ts.map +1 -0
- package/dist/types/cms-fields/components/highlighted-text/highlighted-text.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/index.d.ts +1 -0
- package/dist/types/cms-fields/components/index.d.ts.map +1 -1
- package/dist/types/cms-fields/components/multi-document/multi-document-input/form-multi-document.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.d.ts.map +1 -1
- package/dist/types/cms-fields/components/text/text-view.st.css.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.uni.driver.d.ts +200 -2
- package/dist/types/components/AutoPatternsApp/AutoPatternsApp.uni.driver.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsGrid/AutoPatternsGrid.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsTable/AutoPatternsTable.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsTable/AutoPatternsTable.uni.driver.d.ts +200 -2
- package/dist/types/components/AutoPatternsTable/AutoPatternsTable.uni.driver.d.ts.map +1 -1
- package/dist/types/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.d.ts.map +1 -1
- package/dist/types/components/fields/Color.d.ts +6 -0
- package/dist/types/components/fields/Color.d.ts.map +1 -0
- package/dist/types/components/fields/Color.uni.driver.d.ts +89 -0
- package/dist/types/components/fields/Color.uni.driver.d.ts.map +1 -0
- package/dist/types/components/fields/index.d.ts +1 -0
- package/dist/types/components/fields/index.d.ts.map +1 -1
- package/dist/types/components/layouts/FormField.d.ts.map +1 -1
- package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts +1 -1
- package/dist/types/dataSourceAdapters/cms/cmsAdapter.d.ts.map +1 -1
- package/dist/types/dataSourceAdapters/cms/cmsBackup.d.ts +3 -0
- package/dist/types/dataSourceAdapters/cms/cmsBackup.d.ts.map +1 -0
- package/dist/types/hooks/pluginsDynamicImports.d.ts +1 -0
- package/dist/types/hooks/pluginsDynamicImports.d.ts.map +1 -1
- package/dist/types/hooks/useActionCell.d.ts +1 -1
- package/dist/types/hooks/useActionCell.d.ts.map +1 -1
- package/dist/types/hooks/useColumns.d.ts.map +1 -1
- package/dist/types/hooks/useCommonCollectionFeatures.d.ts +1 -1
- package/dist/types/hooks/useGridFeaturesAsync.d.ts +1 -0
- package/dist/types/hooks/useGridFeaturesAsync.d.ts.map +1 -1
- package/dist/types/hooks/useImport.d.ts +8 -0
- package/dist/types/hooks/useImport.d.ts.map +1 -0
- package/dist/types/hooks/useTableFeaturesAsync.d.ts +1 -0
- package/dist/types/hooks/useTableFeaturesAsync.d.ts.map +1 -1
- package/dist/types/hooks/useTableGridSwitchFeaturesAsync.d.ts +1 -0
- package/dist/types/hooks/useTableGridSwitchFeaturesAsync.d.ts.map +1 -1
- package/dist/types/testkit/enzyme.d.ts +200 -2
- package/dist/types/testkit/enzyme.d.ts.map +1 -1
- package/dist/types/testkit/jsdom.d.ts +200 -2
- package/dist/types/testkit/jsdom.d.ts.map +1 -1
- package/dist/types/testkit/playwright.d.ts +200 -2
- package/dist/types/testkit/playwright.d.ts.map +1 -1
- package/dist/types/testkit/puppeteer.d.ts +200 -2
- package/dist/types/testkit/puppeteer.d.ts.map +1 -1
- package/dist/types/types/CollectionPageConfig.d.ts +8 -0
- package/dist/types/types/CollectionPageConfig.d.ts.map +1 -1
- package/dist/types/types/SchemaConfig.d.ts +211 -0
- package/dist/types/types/SchemaConfig.d.ts.map +1 -0
- package/dist/types/types/types.d.ts +1 -160
- package/dist/types/types/types.d.ts.map +1 -1
- package/dist/types/utils/backupPolling.d.ts +12 -0
- package/dist/types/utils/backupPolling.d.ts.map +1 -0
- package/package.json +6 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["process","env","NODE_ENV","require","React","useEffect","useState","RootAppProvider","AppContextProvider","AutoPatternsRoutes","useWixPatternsContainer","minimalRequiredPatternsRuntimeCheck","AutoPatternsAppContainer","AutoPatternsAppContainerProvider","AutoPatternsApp","_ref","configuration","children","required","requiredBy","patternsContainer","state","init","createElement","value","appConfig","config"],"sources":["../../../../src/components/AutoPatternsApp/AutoPatternsApp.tsx"],"sourcesContent":["if (process.env.NODE_ENV === 'test') {\n require('./AutoPatternsAppTestPolyfills');\n}\n\nimport React, { useEffect, useState } from 'react';\nimport { AppConfig } from '../../types';\nimport { RootAppProvider } from '../../providers/RootAppProvider';\nimport { AppContextProvider } from '../../providers/AppContext';\nimport { AutoPatternsRoutes } from '../AutoPatternsRoute/AutoPatternsRoutes';\nimport { useWixPatternsContainer } from '@wix/patterns';\nimport { minimalRequiredPatternsRuntimeCheck } from '../../utils/minimalRequiredPatternsRuntimeCheck';\nimport { AutoPatternsAppContainer } from './AutoPatternsAppContainer';\nimport { AutoPatternsAppContainerProvider } from './AutoPatternsAppContainerProvider';\n\nexport interface AutoPatternsAppProps {\n configuration: AppConfig;\n children?: React.ReactNode;\n}\n\nexport const AutoPatternsApp: React.FC<AutoPatternsAppProps> = ({\n configuration,\n children,\n}) => {\n if (process.env.NODE_ENV !== 'production') {\n minimalRequiredPatternsRuntimeCheck({\n required: '^1.
|
|
1
|
+
{"version":3,"names":["process","env","NODE_ENV","require","React","useEffect","useState","RootAppProvider","AppContextProvider","AutoPatternsRoutes","useWixPatternsContainer","minimalRequiredPatternsRuntimeCheck","AutoPatternsAppContainer","AutoPatternsAppContainerProvider","AutoPatternsApp","_ref","configuration","children","required","requiredBy","patternsContainer","state","init","createElement","value","appConfig","config"],"sources":["../../../../src/components/AutoPatternsApp/AutoPatternsApp.tsx"],"sourcesContent":["if (process.env.NODE_ENV === 'test') {\n require('./AutoPatternsAppTestPolyfills');\n}\n\nimport React, { useEffect, useState } from 'react';\nimport { AppConfig } from '../../types';\nimport { RootAppProvider } from '../../providers/RootAppProvider';\nimport { AppContextProvider } from '../../providers/AppContext';\nimport { AutoPatternsRoutes } from '../AutoPatternsRoute/AutoPatternsRoutes';\nimport { useWixPatternsContainer } from '@wix/patterns';\nimport { minimalRequiredPatternsRuntimeCheck } from '../../utils/minimalRequiredPatternsRuntimeCheck';\nimport { AutoPatternsAppContainer } from './AutoPatternsAppContainer';\nimport { AutoPatternsAppContainerProvider } from './AutoPatternsAppContainerProvider';\n\nexport interface AutoPatternsAppProps {\n configuration: AppConfig;\n children?: React.ReactNode;\n}\n\nexport const AutoPatternsApp: React.FC<AutoPatternsAppProps> = ({\n configuration,\n children,\n}) => {\n if (process.env.NODE_ENV !== 'production') {\n minimalRequiredPatternsRuntimeCheck({\n required: '^1.359.0',\n requiredBy: 'AutoPatternsApp',\n });\n }\n\n const patternsContainer = useWixPatternsContainer();\n\n const [state] = useState(\n () =>\n new AutoPatternsAppContainer({\n patternsContainer,\n }),\n );\n\n useEffect(() => state.init(), [state]);\n\n return (\n <AutoPatternsAppContainerProvider value={state}>\n <AppContextProvider>\n <RootAppProvider appConfig={configuration}>\n <AutoPatternsRoutes config={configuration} />\n </RootAppProvider>\n {children}\n </AppContextProvider>\n </AutoPatternsAppContainerProvider>\n );\n};\n"],"mappings":"AAAA,IAAIA,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,MAAM,EAAE;EACnCC,OAAO,CAAC,gCAAgC,CAAC;AAC3C;AAEA,OAAOC,KAAK,IAAIC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAElD,SAASC,eAAe,QAAQ,iCAAiC;AACjE,SAASC,kBAAkB,QAAQ,4BAA4B;AAC/D,SAASC,kBAAkB,QAAQ,yCAAyC;AAC5E,SAASC,uBAAuB,QAAQ,eAAe;AACvD,SAASC,mCAAmC,QAAQ,iDAAiD;AACrG,SAASC,wBAAwB,QAAQ,4BAA4B;AACrE,SAASC,gCAAgC,QAAQ,oCAAoC;AAOrF,OAAO,MAAMC,eAA+C,GAAGC,IAAA,IAGzD;EAAA,IAH0D;IAC9DC,aAAa;IACbC;EACF,CAAC,GAAAF,IAAA;EACC,IAAIf,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzCS,mCAAmC,CAAC;MAClCO,QAAQ,EAAE,UAAU;MACpBC,UAAU,EAAE;IACd,CAAC,CAAC;EACJ;EAEA,MAAMC,iBAAiB,GAAGV,uBAAuB,CAAC,CAAC;EAEnD,MAAM,CAACW,KAAK,CAAC,GAAGf,QAAQ,CACtB,MACE,IAAIM,wBAAwB,CAAC;IAC3BQ;EACF,CAAC,CACL,CAAC;EAEDf,SAAS,CAAC,MAAMgB,KAAK,CAACC,IAAI,CAAC,CAAC,EAAE,CAACD,KAAK,CAAC,CAAC;EAEtC,oBACEjB,KAAA,CAAAmB,aAAA,CAACV,gCAAgC;IAACW,KAAK,EAAEH;EAAM,gBAC7CjB,KAAA,CAAAmB,aAAA,CAACf,kBAAkB,qBACjBJ,KAAA,CAAAmB,aAAA,CAAChB,eAAe;IAACkB,SAAS,EAAET;EAAc,gBACxCZ,KAAA,CAAAmB,aAAA,CAACd,kBAAkB;IAACiB,MAAM,EAAEV;EAAc,CAAE,CAC7B,CAAC,EACjBC,QACiB,CACY,CAAC;AAEvC,CAAC","ignoreList":[]}
|
|
@@ -37,7 +37,8 @@ const AutoPatternsGridLoaded = props => {
|
|
|
37
37
|
|
|
38
38
|
// Extract loaded async features from the successful feature loading state
|
|
39
39
|
const {
|
|
40
|
-
dragAndDrop
|
|
40
|
+
dragAndDrop,
|
|
41
|
+
importFeature
|
|
41
42
|
} = useSelector(() => ({
|
|
42
43
|
...asyncFeaturesState.status.data
|
|
43
44
|
}));
|
|
@@ -57,6 +58,7 @@ const AutoPatternsGridLoaded = props => {
|
|
|
57
58
|
|
|
58
59
|
// Extract grid-specific drag and drop props if feature is loaded
|
|
59
60
|
const dragAndDropProps = dragAndDrop == null || dragAndDrop.useGridDragAndDrop == null ? void 0 : dragAndDrop.useGridDragAndDrop(config);
|
|
61
|
+
const importProps = importFeature == null || importFeature.useImport == null ? void 0 : importFeature.useImport(config);
|
|
60
62
|
|
|
61
63
|
// FINAL STEP: Render the fully-featured Grid component
|
|
62
64
|
// Combines grid display features with loaded async features
|
|
@@ -66,7 +68,7 @@ const AutoPatternsGridLoaded = props => {
|
|
|
66
68
|
imagePlacement: imagePlacement,
|
|
67
69
|
renderItem: renderItem,
|
|
68
70
|
state: state
|
|
69
|
-
}, baseCollectionComponentReadyFeatures, dragAndDropProps));
|
|
71
|
+
}, baseCollectionComponentReadyFeatures, dragAndDropProps, importProps));
|
|
70
72
|
};
|
|
71
73
|
|
|
72
74
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useState","Grid","GridState","useCreateCollection","useGridCollection","useSelector","useWixPatternsContainer","useBasePatternsStateParams","useGridFeaturesAsync","useBaseGridFeatures","useBaseCollectionComponentReadyFeatures","AutoPatternsGridLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","renderItem","imagePlacement","preset","dragAndDrop","status","data","state","params","baseCollectionComponentReadyFeatures","collection","reportBi","toolbar","dragAndDropProps","useGridDragAndDrop","createElement","_extends","AutoPatternsGrid","visibleFieldIds","container","createCollection","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsGrid/AutoPatternsGrid.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n Grid,\n GridState,\n useCreateCollection,\n useGridCollection,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { GridConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useGridFeaturesAsync } from '../../hooks';\nimport { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsGridContentProps {\n config: GridConfig;\n}\n\n/**\n * AutoPatternsGridLoaded - Step 4 in Grid Flow\n *\n * FLOW 2: AutoPatternsCollectionComponent → AutoPatternsGrid → useGridFeaturesAsync → [AutoPatternsGridLoaded] → useBaseCollectionComponentReadyFeatures → Grid\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the grid flow and handles:\n *\n * Key Responsibilities:\n * - Creates the grid collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Extracts grid-specific features (renderItem, preset, imagePlacement) from base features\n * - Extracts async features like dragAndDrop if enabled\n * - Renders the final Grid component with all features combined\n */\nconst AutoPatternsGridLoaded = (\n props: NonNullable<ReturnType<typeof useGridFeaturesAsync>> &\n AutoPatternsGridContentProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract grid-specific display features (how items are rendered and displayed)\n const { renderItem, imagePlacement, preset } = useBaseGridFeatures(config);\n\n // Extract loaded async features from the successful feature loading state\n const { dragAndDrop } = useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // Create grid collection state with the loaded async dependencies\n const state = useGridCollection<any>(baseStateParams.params);\n\n // STEP 5: Call shared hook that prepares final collection features\n // This hook is shared across all three flows (Table, Grid, TableGridSwitch)\n const baseCollectionComponentReadyFeatures =\n useBaseCollectionComponentReadyFeatures({\n config,\n collection: state.collection,\n reportBi: state.toolbar.reportBi,\n asyncFeaturesState,\n baseStateParams,\n });\n\n // Extract grid-specific drag and drop props if feature is loaded\n const dragAndDropProps = dragAndDrop?.useGridDragAndDrop?.(config);\n\n // FINAL STEP: Render the fully-featured Grid component\n // Combines grid display features with loaded async features\n return (\n <Grid\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n state={state}\n {...baseCollectionComponentReadyFeatures}\n {...dragAndDropProps}\n />\n );\n};\n\n/**\n * AutoPatternsGrid - Step 2 in Grid Flow\n *\n * FLOW 2: AutoPatternsCollectionComponent → [AutoPatternsGrid] → useGridFeaturesAsync → AutoPatternsGridLoaded → useBaseCollectionComponentReadyFeatures → Grid\n *\n * This is the main grid component that orchestrates the grid rendering flow.\n * It handles the loading states and coordinates between async feature loading and final rendering.\n *\n * Key Responsibilities:\n * - Extracts grid display features (renderItem, preset, imagePlacement) and visible field IDs\n * - Calls useGridFeaturesAsync (Step 3) to load grid-specific async features\n * - Creates initial grid state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton grid during loading or AutoPatternsGridLoaded when ready\n */\nexport const AutoPatternsGrid = (props: AutoPatternsGridContentProps) => {\n const { config } = props;\n\n // Extract grid display features and visible field IDs from configuration\n const { renderItem, imagePlacement, preset, visibleFieldIds } =\n useBaseGridFeatures(config);\n\n // Initialize base state parameters with collection config and visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load grid-specific async features (currently only drag&drop)\n const { asyncFeaturesState } = useGridFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize grid state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new GridState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n }),\n );\n\n // Monitor async features loading status\n const isReady = useSelector(\n () =>\n asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError,\n );\n\n const dataHook = 'auto-patterns-grid';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured grid\n return (\n <AutoPatternsGridLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic grid skeleton while features are loading\n return (\n <Grid\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n state={state}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,IAAI,EACJC,SAAS,EACTC,mBAAmB,EACnBC,iBAAiB,EACjBC,WAAW,EACXC,uBAAuB,QAClB,eAAe;AAEtB,SAASC,0BAA0B,QAAQ,wCAAwC;AACnF,SAASC,oBAAoB,QAAQ,aAAa;AAClD,SAASC,mBAAmB,QAAQ,iCAAiC;AACrE,SAASC,uCAAuC,QAAQ,qDAAqD;AAM7G;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAC1BC,KAIG,IACA;EACH,MAAM;IAAEC,MAAM;IAAEC,kBAAkB;IAAEC,eAAe;IAAEC;EAAS,CAAC,GAAGJ,KAAK;;EAEvE;EACA,MAAM;IAAEK,UAAU;IAAEC,cAAc;IAAEC;EAAO,CAAC,GAAGV,mBAAmB,CAACI,MAAM,CAAC;;EAE1E;EACA,MAAM;IAAEO;
|
|
1
|
+
{"version":3,"names":["React","useState","Grid","GridState","useCreateCollection","useGridCollection","useSelector","useWixPatternsContainer","useBasePatternsStateParams","useGridFeaturesAsync","useBaseGridFeatures","useBaseCollectionComponentReadyFeatures","AutoPatternsGridLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","renderItem","imagePlacement","preset","dragAndDrop","importFeature","status","data","state","params","baseCollectionComponentReadyFeatures","collection","reportBi","toolbar","dragAndDropProps","useGridDragAndDrop","importProps","useImport","createElement","_extends","AutoPatternsGrid","visibleFieldIds","container","createCollection","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsGrid/AutoPatternsGrid.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport {\n Grid,\n GridState,\n useCreateCollection,\n useGridCollection,\n useSelector,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { GridConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useGridFeaturesAsync } from '../../hooks';\nimport { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsGridContentProps {\n config: GridConfig;\n}\n\n/**\n * AutoPatternsGridLoaded - Step 4 in Grid Flow\n *\n * FLOW 2: AutoPatternsCollectionComponent → AutoPatternsGrid → useGridFeaturesAsync → [AutoPatternsGridLoaded] → useBaseCollectionComponentReadyFeatures → Grid\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the grid flow and handles:\n *\n * Key Responsibilities:\n * - Creates the grid collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Extracts grid-specific features (renderItem, preset, imagePlacement) from base features\n * - Extracts async features like dragAndDrop if enabled\n * - Renders the final Grid component with all features combined\n */\nconst AutoPatternsGridLoaded = (\n props: NonNullable<ReturnType<typeof useGridFeaturesAsync>> &\n AutoPatternsGridContentProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract grid-specific display features (how items are rendered and displayed)\n const { renderItem, imagePlacement, preset } = useBaseGridFeatures(config);\n\n // Extract loaded async features from the successful feature loading state\n const { dragAndDrop, importFeature } = useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // Create grid collection state with the loaded async dependencies\n const state = useGridCollection<any>(baseStateParams.params);\n\n // STEP 5: Call shared hook that prepares final collection features\n // This hook is shared across all three flows (Table, Grid, TableGridSwitch)\n const baseCollectionComponentReadyFeatures =\n useBaseCollectionComponentReadyFeatures({\n config,\n collection: state.collection,\n reportBi: state.toolbar.reportBi,\n asyncFeaturesState,\n baseStateParams,\n });\n\n // Extract grid-specific drag and drop props if feature is loaded\n const dragAndDropProps = dragAndDrop?.useGridDragAndDrop?.(config);\n const importProps = importFeature?.useImport?.(config);\n\n // FINAL STEP: Render the fully-featured Grid component\n // Combines grid display features with loaded async features\n return (\n <Grid\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n state={state}\n {...baseCollectionComponentReadyFeatures}\n {...dragAndDropProps}\n {...importProps}\n />\n );\n};\n\n/**\n * AutoPatternsGrid - Step 2 in Grid Flow\n *\n * FLOW 2: AutoPatternsCollectionComponent → [AutoPatternsGrid] → useGridFeaturesAsync → AutoPatternsGridLoaded → useBaseCollectionComponentReadyFeatures → Grid\n *\n * This is the main grid component that orchestrates the grid rendering flow.\n * It handles the loading states and coordinates between async feature loading and final rendering.\n *\n * Key Responsibilities:\n * - Extracts grid display features (renderItem, preset, imagePlacement) and visible field IDs\n * - Calls useGridFeaturesAsync (Step 3) to load grid-specific async features\n * - Creates initial grid state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton grid during loading or AutoPatternsGridLoaded when ready\n */\nexport const AutoPatternsGrid = (props: AutoPatternsGridContentProps) => {\n const { config } = props;\n\n // Extract grid display features and visible field IDs from configuration\n const { renderItem, imagePlacement, preset, visibleFieldIds } =\n useBaseGridFeatures(config);\n\n // Initialize base state parameters with collection config and visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load grid-specific async features (currently only drag&drop)\n const { asyncFeaturesState } = useGridFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize grid state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new GridState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n }),\n );\n\n // Monitor async features loading status\n const isReady = useSelector(\n () =>\n asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError,\n );\n\n const dataHook = 'auto-patterns-grid';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured grid\n return (\n <AutoPatternsGridLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic grid skeleton while features are loading\n return (\n <Grid\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n state={state}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SACEC,IAAI,EACJC,SAAS,EACTC,mBAAmB,EACnBC,iBAAiB,EACjBC,WAAW,EACXC,uBAAuB,QAClB,e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AAmB,CACxC,CAAC;EAEN;;EAEA;EACA,oBACEf,KAAA,CAAAmC,aAAA,CAACjC,IAAI;IACHe,QAAQ,EAAEA,QAAS;IACnBG,MAAM,EAAEA,MAAO;IACfD,cAAc,EAAEA,cAAe;IAC/BD,UAAU,EAAEA,UAAW;IACvBO,KAAK,EAAEA;EAAM,CACd,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -31,7 +31,8 @@ const AutoPatternsTableLoaded = props => {
|
|
|
31
31
|
const {
|
|
32
32
|
baseTableFeatures,
|
|
33
33
|
sections,
|
|
34
|
-
dragAndDrop
|
|
34
|
+
dragAndDrop,
|
|
35
|
+
importFeature
|
|
35
36
|
} = useSelector(() => ({
|
|
36
37
|
...asyncFeaturesState.status.data
|
|
37
38
|
}));
|
|
@@ -53,6 +54,7 @@ const AutoPatternsTableLoaded = props => {
|
|
|
53
54
|
const dragAndDropProps = dragAndDrop == null || dragAndDrop.useTableDragAndDrop == null ? void 0 : dragAndDrop.useTableDragAndDrop(config);
|
|
54
55
|
const baseTableFeaturesProps = baseTableFeatures == null ? void 0 : baseTableFeatures.useBaseTableFeatures(config);
|
|
55
56
|
const sectionsProps = sections == null ? void 0 : sections.useTableSections(config);
|
|
57
|
+
const importProps = importFeature == null || importFeature.useImport == null ? void 0 : importFeature.useImport(config);
|
|
56
58
|
|
|
57
59
|
// FINAL STEP: Render the fully-featured Table component
|
|
58
60
|
// Combines all loaded features into final table props
|
|
@@ -63,7 +65,7 @@ const AutoPatternsTableLoaded = props => {
|
|
|
63
65
|
useNewInfiniteScrollLoader: true
|
|
64
66
|
}, sectionsProps && {
|
|
65
67
|
sections: sectionsProps
|
|
66
|
-
}, baseTableFeaturesProps, baseCollectionComponentReadyFeatures, dragAndDropProps));
|
|
68
|
+
}, baseTableFeaturesProps, baseCollectionComponentReadyFeatures, dragAndDropProps, importProps));
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","useState","Table","TableState","useCreateCollection","useSelector","useTableCollection","useWixPatternsContainer","useBasePatternsStateParams","useTableFeaturesAsync","useBaseCollectionComponentReadyFeatures","AutoPatternsTableLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","baseTableFeatures","sections","dragAndDrop","status","data","state","params","baseCollectionComponentReadyFeatures","collection","reportBi","toolbar","dragAndDropProps","useTableDragAndDrop","baseTableFeaturesProps","useBaseTableFeatures","sectionsProps","useTableSections","createElement","_extends","columns","useNewInfiniteScrollLoader","AutoPatternsTable","visibleFieldIds","map","column","id","container","createCollection","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n Table,\n TableState,\n useCreateCollection,\n useSelector,\n useTableCollection,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { TableConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useTableFeaturesAsync } from '../../hooks/useTableFeaturesAsync';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsTableContentProps {\n config: TableConfig;\n}\n\n/**\n * AutoPatternsTableLoaded - Step 4 in Table Flow\n *\n * FLOW 1: AutoPatternsCollectionComponent → AutoPatternsTable → useTableFeaturesAsync → [AutoPatternsTableLoaded] → useBaseCollectionComponentReadyFeatures → Table\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the table flow and handles:\n *\n * Key Responsibilities:\n * - Creates the table collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Extracts and applies table-specific features (baseTableFeatures, sections, dragAndDrop)\n * - Renders the final Table component with all features combined\n * - Merges all feature props into a single props object for the Table\n */\nconst AutoPatternsTableLoaded = (\n props: NonNullable<ReturnType<typeof useTableFeaturesAsync>> &\n AutoPatternsTableContentProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract loaded async features from the successful feature loading state\n const { baseTableFeatures, sections, dragAndDrop }
|
|
1
|
+
{"version":3,"names":["React","useMemo","useState","Table","TableState","useCreateCollection","useSelector","useTableCollection","useWixPatternsContainer","useBasePatternsStateParams","useTableFeaturesAsync","useBaseCollectionComponentReadyFeatures","AutoPatternsTableLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","baseTableFeatures","sections","dragAndDrop","importFeature","status","data","state","params","baseCollectionComponentReadyFeatures","collection","reportBi","toolbar","dragAndDropProps","useTableDragAndDrop","baseTableFeaturesProps","useBaseTableFeatures","sectionsProps","useTableSections","importProps","useImport","createElement","_extends","columns","useNewInfiniteScrollLoader","AutoPatternsTable","visibleFieldIds","map","column","id","container","createCollection","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n Table,\n TableState,\n useCreateCollection,\n useSelector,\n useTableCollection,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { TableConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useTableFeaturesAsync } from '../../hooks/useTableFeaturesAsync';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsTableContentProps {\n config: TableConfig;\n}\n\n/**\n * AutoPatternsTableLoaded - Step 4 in Table Flow\n *\n * FLOW 1: AutoPatternsCollectionComponent → AutoPatternsTable → useTableFeaturesAsync → [AutoPatternsTableLoaded] → useBaseCollectionComponentReadyFeatures → Table\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the table flow and handles:\n *\n * Key Responsibilities:\n * - Creates the table collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Extracts and applies table-specific features (baseTableFeatures, sections, dragAndDrop)\n * - Renders the final Table component with all features combined\n * - Merges all feature props into a single props object for the Table\n */\nconst AutoPatternsTableLoaded = (\n props: NonNullable<ReturnType<typeof useTableFeaturesAsync>> &\n AutoPatternsTableContentProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract loaded async features from the successful feature loading state\n const { baseTableFeatures, sections, dragAndDrop, importFeature } =\n useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // Create table collection state with the loaded async dependencies\n const state = useTableCollection<any>(baseStateParams.params);\n\n // STEP 5: Call shared hook that prepares final collection features\n // This hook is shared across all three flows (Table, Grid, TableGridSwitch)\n const baseCollectionComponentReadyFeatures =\n useBaseCollectionComponentReadyFeatures({\n config,\n collection: state.collection,\n reportBi: state.toolbar.reportBi,\n asyncFeaturesState,\n baseStateParams,\n });\n\n // Extract feature-specific props from loaded features\n const dragAndDropProps = dragAndDrop?.useTableDragAndDrop?.(config);\n const baseTableFeaturesProps =\n baseTableFeatures?.useBaseTableFeatures(config);\n const sectionsProps = sections?.useTableSections(config);\n const importProps = importFeature?.useImport?.(config);\n\n // FINAL STEP: Render the fully-featured Table component\n // Combines all loaded features into final table props\n return (\n <Table\n dataHook={dataHook}\n state={state}\n columns={[]}\n useNewInfiniteScrollLoader\n {...(sectionsProps && { sections: sectionsProps })}\n {...baseTableFeaturesProps}\n {...baseCollectionComponentReadyFeatures}\n {...dragAndDropProps}\n {...importProps}\n />\n );\n};\n\n/**\n * AutoPatternsTable - Step 2 in Table Flow\n *\n * FLOW 1: AutoPatternsCollectionComponent → [AutoPatternsTable] → useTableFeaturesAsync → AutoPatternsTableLoaded → useBaseCollectionComponentReadyFeatures → Table\n *\n * This is the main table component that orchestrates the table rendering flow.\n * It handles the loading states and coordinates between async feature loading and final rendering.\n *\n * Key Responsibilities:\n * - Prepares visible field IDs from table column configuration\n * - Calls useTableFeaturesAsync (Step 3) to load table-specific async features\n * - Creates initial table state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton table during loading or AutoPatternsTableLoaded when ready\n */\nexport const AutoPatternsTable = (props: AutoPatternsTableContentProps) => {\n const { config } = props;\n\n // Extract visible field IDs from table columns for data fetching optimization\n const visibleFieldIds = useMemo(\n () => config.columns.map((column) => column.id),\n [config],\n );\n\n // Initialize base state parameters with collection config and visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load table-specific async features (drag&drop, sections, base table features)\n const { asyncFeaturesState } = useTableFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize table state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new TableState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n }),\n );\n\n // Monitor async features loading status\n const isReady = useSelector(\n () =>\n asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError,\n );\n\n const dataHook = 'auto-patterns-table';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured table\n return (\n <AutoPatternsTableLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic table skeleton while features are loading\n return (\n <Table\n dataHook={dataHook}\n useNewInfiniteScrollLoader\n state={state}\n columns={[]}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAChD,SACEC,KAAK,EACLC,UAAU,EACVC,mBAAmB,EACnBC,WAAW,EACXC,kBAAkB,EAClBC,uBAAuB,QAClB,eAAe;AAEtB,SAASC,0BAA0B,QAAQ,wCAAwC;AACnF,SAASC,qBAAqB,QAAQ,mCAAmC;AACzE,SAASC,uCAAuC,QAAQ,qDAAqD;AAM7G;AACA;AACA;AACA;AACA;A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MACjCD,kBAAkB,EAAEA;IAAmB,CACxC,CAAC;EAEN;;EAEA;EACA,oBACEf,KAAA,CAAAsC,aAAA,CAACnC,KAAK;IACJc,QAAQ,EAAEA,QAAS;IACnBwB,0BAA0B;IAC1BjB,KAAK,EAAEA,KAAM;IACbgB,OAAO,EAAE;EAAG,CACb,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { TableUniDriver } from '@wix/patterns/testkit/unidriver';
|
|
2
2
|
import { ImageUniDriver } from '@wix/design-system/dist/testkit/unidriver';
|
|
3
|
+
import { ColorViewUniDriver } from '../../cms-fields/components/color-view/color-view.uni.driver';
|
|
3
4
|
export const AutoPatternsTableUniDriver = (base, body) => {
|
|
4
5
|
const table = TableUniDriver(base.$('[data-hook="auto-patterns-table"]'), body);
|
|
5
6
|
return {
|
|
@@ -7,6 +8,10 @@ export const AutoPatternsTableUniDriver = (base, body) => {
|
|
|
7
8
|
getImageGalleryImageAt: (rowIndex, colIndex, index) => {
|
|
8
9
|
const imageBase = table.getCellDriverByIndex(rowIndex, colIndex).base.$$('[data-hook="media-image-image"]').get(index);
|
|
9
10
|
return ImageUniDriver(imageBase, body);
|
|
11
|
+
},
|
|
12
|
+
getColorViewAt: (rowIndex, colIndex) => {
|
|
13
|
+
const cellBase = table.getCellDriverByIndex(rowIndex, colIndex).base;
|
|
14
|
+
return ColorViewUniDriver(cellBase, body);
|
|
10
15
|
}
|
|
11
16
|
};
|
|
12
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TableUniDriver","ImageUniDriver","AutoPatternsTableUniDriver","base","body","table","$","getImageGalleryImageAt","rowIndex","colIndex","index","imageBase","getCellDriverByIndex","$$","get"],"sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.uni.driver.ts"],"sourcesContent":["import { UniDriver } from '@wix/wix-ui-test-utils/unidriver';\nimport { TableUniDriver } from '@wix/patterns/testkit/unidriver';\nimport { ImageUniDriver } from '@wix/design-system/dist/testkit/unidriver';\n\nexport const AutoPatternsTableUniDriver = (\n base: UniDriver,\n body: UniDriver,\n) => {\n const table = TableUniDriver(\n base.$('[data-hook=\"auto-patterns-table\"]'),\n body,\n );\n\n return {\n ...table,\n getImageGalleryImageAt: (\n rowIndex: number,\n colIndex: number,\n index: number,\n ) => {\n const imageBase = table\n .getCellDriverByIndex(rowIndex, colIndex)\n .base.$$('[data-hook=\"media-image-image\"]')\n .get(index);\n\n return ImageUniDriver(imageBase, body);\n },\n };\n};\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,iCAAiC;AAChE,SAASC,cAAc,QAAQ,2CAA2C;
|
|
1
|
+
{"version":3,"names":["TableUniDriver","ImageUniDriver","ColorViewUniDriver","AutoPatternsTableUniDriver","base","body","table","$","getImageGalleryImageAt","rowIndex","colIndex","index","imageBase","getCellDriverByIndex","$$","get","getColorViewAt","cellBase"],"sources":["../../../../src/components/AutoPatternsTable/AutoPatternsTable.uni.driver.ts"],"sourcesContent":["import { UniDriver } from '@wix/wix-ui-test-utils/unidriver';\nimport { TableUniDriver } from '@wix/patterns/testkit/unidriver';\nimport { ImageUniDriver } from '@wix/design-system/dist/testkit/unidriver';\nimport { ColorViewUniDriver } from '../../cms-fields/components/color-view/color-view.uni.driver';\n\nexport const AutoPatternsTableUniDriver = (\n base: UniDriver,\n body: UniDriver,\n) => {\n const table = TableUniDriver(\n base.$('[data-hook=\"auto-patterns-table\"]'),\n body,\n );\n\n return {\n ...table,\n getImageGalleryImageAt: (\n rowIndex: number,\n colIndex: number,\n index: number,\n ) => {\n const imageBase = table\n .getCellDriverByIndex(rowIndex, colIndex)\n .base.$$('[data-hook=\"media-image-image\"]')\n .get(index);\n\n return ImageUniDriver(imageBase, body);\n },\n getColorViewAt: (rowIndex: number, colIndex: number) => {\n const cellBase = table.getCellDriverByIndex(rowIndex, colIndex).base;\n return ColorViewUniDriver(cellBase, body);\n },\n };\n};\n"],"mappings":"AACA,SAASA,cAAc,QAAQ,iCAAiC;AAChE,SAASC,cAAc,QAAQ,2CAA2C;AAC1E,SAASC,kBAAkB,QAAQ,8DAA8D;AAEjG,OAAO,MAAMC,0BAA0B,GAAGA,CACxCC,IAAe,EACfC,IAAe,KACZ;EACH,MAAMC,KAAK,GAAGN,cAAc,CAC1BI,IAAI,CAACG,CAAC,CAAC,mCAAmC,CAAC,EAC3CF,IACF,CAAC;EAED,OAAO;IACL,GAAGC,KAAK;IACRE,sBAAsB,EAAEA,CACtBC,QAAgB,EAChBC,QAAgB,EAChBC,KAAa,KACV;MACH,MAAMC,SAAS,GAAGN,KAAK,CACpBO,oBAAoB,CAACJ,QAAQ,EAAEC,QAAQ,CAAC,CACxCN,IAAI,CAACU,EAAE,CAAC,iCAAiC,CAAC,CAC1CC,GAAG,CAACJ,KAAK,CAAC;MAEb,OAAOV,cAAc,CAACW,SAAS,EAAEP,IAAI,CAAC;IACxC,CAAC;IACDW,cAAc,EAAEA,CAACP,QAAgB,EAAEC,QAAgB,KAAK;MACtD,MAAMO,QAAQ,GAAGX,KAAK,CAACO,oBAAoB,CAACJ,QAAQ,EAAEC,QAAQ,CAAC,CAACN,IAAI;MACpE,OAAOF,kBAAkB,CAACe,QAAQ,EAAEZ,IAAI,CAAC;IAC3C;EACF,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -39,7 +39,8 @@ const AutoPatternsTableGridSwitchLoaded = props => {
|
|
|
39
39
|
// Extract loaded async features from the successful feature loading state
|
|
40
40
|
const {
|
|
41
41
|
baseTableFeatures,
|
|
42
|
-
dragAndDrop
|
|
42
|
+
dragAndDrop,
|
|
43
|
+
importFeature
|
|
43
44
|
} = useSelector(() => ({
|
|
44
45
|
...asyncFeaturesState.status.data
|
|
45
46
|
}));
|
|
@@ -62,6 +63,7 @@ const AutoPatternsTableGridSwitchLoaded = props => {
|
|
|
62
63
|
|
|
63
64
|
// Extract table-specific features (for table mode when user switches)
|
|
64
65
|
const baseTableFeaturesProps = baseTableFeatures == null ? void 0 : baseTableFeatures.useBaseTableFeatures(config);
|
|
66
|
+
const importProps = importFeature == null || importFeature.useImport == null ? void 0 : importFeature.useImport(config);
|
|
65
67
|
|
|
66
68
|
// FINAL STEP: Render the fully-featured TableGridSwitch component
|
|
67
69
|
// Combines table features, grid features, and switch functionality
|
|
@@ -72,7 +74,7 @@ const AutoPatternsTableGridSwitchLoaded = props => {
|
|
|
72
74
|
renderItem: renderItem,
|
|
73
75
|
columns: [],
|
|
74
76
|
state: state
|
|
75
|
-
}, baseCollectionComponentReadyFeatures, baseTableFeaturesProps, dragAndDropProps));
|
|
77
|
+
}, baseCollectionComponentReadyFeatures, baseTableFeaturesProps, dragAndDropProps, importProps));
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useMemo","useState","TableGridSwitch","TableGridSwitchState","useCreateCollection","useSelector","useTableGridSwitchCollection","useWixPatternsContainer","useBasePatternsStateParams","useTableGridSwitchFeaturesAsync","useBaseGridFeatures","useBaseCollectionComponentReadyFeatures","AutoPatternsTableGridSwitchLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","renderItem","imagePlacement","preset","baseTableFeatures","dragAndDrop","status","data","state","params","baseCollectionComponentReadyFeatures","collection","reportBi","toolbar","dragAndDropProps","useTableGridSwitchDragAndDrop","baseTableFeaturesProps","useBaseTableFeatures","createElement","_extends","columns","AutoPatternsTableGridSwitch","tableVisibleFieldIds","map","column","id","visibleFieldIds","gridVisibleFieldIds","Array","from","Set","container","createCollection","containerOverrides","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n TableGridSwitch,\n TableGridSwitchState,\n useCreateCollection,\n useSelector,\n useTableGridSwitchCollection,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { TableGridSwitchConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useTableGridSwitchFeaturesAsync } from '../../hooks/useTableGridSwitchFeaturesAsync';\nimport { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsTableGridSwitchProps {\n config: TableGridSwitchConfig;\n}\n\n/**\n * AutoPatternsTableGridSwitchLoaded - Step 4 in TableGridSwitch Flow\n *\n * FLOW 3: AutoPatternsCollectionComponent → AutoPatternsTableGridSwitch → useTableGridSwitchFeaturesAsync → [AutoPatternsTableGridSwitchLoaded] → useBaseCollectionComponentReadyFeatures → TableGridSwitch\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the table-grid switch flow and handles:\n *\n * Key Responsibilities:\n * - Creates the table-grid-switch collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Combines both table features (baseTableFeatures) and grid features (renderItem, preset, imagePlacement)\n * - Extracts async features like dragAndDrop if enabled\n * - Renders the final TableGridSwitch component with all features combined\n * - Provides both table columns AND grid display props to support switching\n */\nconst AutoPatternsTableGridSwitchLoaded = (\n props: NonNullable<ReturnType<typeof useTableGridSwitchFeaturesAsync>> &\n AutoPatternsTableGridSwitchProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract grid-specific display features (for grid mode when user switches)\n const { renderItem, imagePlacement, preset } = useBaseGridFeatures(config);\n\n // Extract loaded async features from the successful feature loading state\n const { baseTableFeatures, dragAndDrop } = useSelector(() => ({\n ...asyncFeaturesState.status.data,\n }));\n\n // Create table-grid-switch collection state with the loaded async dependencies\n const state = useTableGridSwitchCollection<any>(baseStateParams.params);\n\n // STEP 5: Call shared hook that prepares final collection features\n // This hook is shared across all three flows (Table, Grid, TableGridSwitch)\n const baseCollectionComponentReadyFeatures =\n useBaseCollectionComponentReadyFeatures({\n config,\n collection: state.collection,\n reportBi: state.toolbar.reportBi,\n asyncFeaturesState,\n baseStateParams,\n });\n\n // Extract table-grid-switch specific drag and drop props if feature is loaded\n const dragAndDropProps = dragAndDrop?.useTableGridSwitchDragAndDrop?.(config);\n\n // Extract table-specific features (for table mode when user switches)\n const baseTableFeaturesProps =\n baseTableFeatures?.useBaseTableFeatures(config);\n\n // FINAL STEP: Render the fully-featured TableGridSwitch component\n // Combines table features, grid features, and switch functionality\n return (\n <TableGridSwitch\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n columns={[]}\n state={state}\n {...baseCollectionComponentReadyFeatures}\n {...baseTableFeaturesProps}\n {...dragAndDropProps}\n />\n );\n};\n\n/**\n * AutoPatternsTableGridSwitch - Step 2 in TableGridSwitch Flow\n *\n * FLOW 3: AutoPatternsCollectionComponent → [AutoPatternsTableGridSwitch] → useTableGridSwitchFeaturesAsync → AutoPatternsTableGridSwitchLoaded → useBaseCollectionComponentReadyFeatures → TableGridSwitch\n *\n * This is the main table-grid-switch component that orchestrates the combined table/grid rendering flow.\n * It handles both table and grid configurations simultaneously to support runtime switching.\n *\n * Key Responsibilities:\n * - Merges visible field IDs from both table columns AND grid features for comprehensive data fetching\n * - Extracts grid display features (renderItem, preset, imagePlacement) for grid mode\n * - Calls useTableGridSwitchFeaturesAsync (Step 3) to load combined async features\n * - Creates initial table-grid-switch state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton TableGridSwitch during loading or AutoPatternsTableGridSwitchLoaded when ready\n */\nexport const AutoPatternsTableGridSwitch = (\n props: AutoPatternsTableGridSwitchProps,\n) => {\n const { config } = props;\n\n // Extract visible field IDs from table columns (for table mode)\n const tableVisibleFieldIds = useMemo(\n () => config.columns.map((column) => column.id),\n [config],\n );\n\n // Extract grid display features and visible field IDs (for grid mode)\n const {\n renderItem,\n imagePlacement,\n preset,\n visibleFieldIds: gridVisibleFieldIds,\n } = useBaseGridFeatures(config);\n\n // IMPORTANT: Merge visible fields from BOTH table AND grid to support switching\n // This ensures all necessary data is loaded regardless of current view mode\n const visibleFieldIds = useMemo(\n () =>\n Array.from(new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds])),\n [tableVisibleFieldIds, gridVisibleFieldIds],\n );\n\n // Initialize base state parameters with collection config and combined visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load table-grid-switch async features (combines table + grid features)\n const { asyncFeaturesState } = useTableGridSwitchFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize table-grid-switch state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new TableGridSwitchState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n containerOverrides: {},\n }),\n );\n\n // Monitor async features loading status\n const isReady = useSelector(\n () =>\n asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError,\n );\n\n const dataHook = 'auto-patterns-table-grid-switch';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured table-grid-switch\n return (\n <AutoPatternsTableGridSwitchLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic table-grid-switch skeleton while features are loading\n return (\n <TableGridSwitch\n dataHook={dataHook}\n state={state}\n columns={[]}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AAChD,SACEC,eAAe,EACfC,oBAAoB,EACpBC,mBAAmB,EACnBC,WAAW,EACXC,4BAA4B,EAC5BC,uBAAuB,QAClB,eAAe;AAEtB,SAASC,0BAA0B,QAAQ,wCAAwC;AACnF,SAASC,+BAA+B,QAAQ,6CAA6C;AAC7F,SAASC,mBAAm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L,CAAC;;EAED;EACA,MAAMC,OAAO,GAAG9C,WAAW,CACzB,MACEU,kBAAkB,CAACQ,MAAM,CAAC6B,SAAS,IAAIrC,kBAAkB,CAACQ,MAAM,CAAC8B,OACrE,CAAC;EAED,MAAMpC,QAAQ,GAAG,iCAAiC;EAElD,IAAIkC,OAAO,EAAE;IACX;IACA,oBACEpD,KAAA,CAAAoC,aAAA,CAACvB,iCAAiC;MAChCK,QAAQ,EAAEA,QAAS;MACnBH,MAAM,EAAEA,MAAO;MACfE,eAAe,EAAEA,eAAgB;MACjCD,kBAAkB,EAAEA;IAAmB,CACxC,CAAC;EAEN;;EAEA;EACA,oBACEhB,KAAA,CAAAoC,aAAA,CAACjC,eAAe;IACde,QAAQ,EAAEA,QAAS;IACnBQ,KAAK,EAAEA,KAAM;IACbY,OAAO,EAAE,EAAG;IACZjB,MAAM,EAAEA,MAAO;IACfD,cAAc,EAAEA,cAAe;IAC/BD,UAAU,EAAEA;EAAW,CACxB,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["React","useMemo","useState","TableGridSwitch","TableGridSwitchState","useCreateCollection","useSelector","useTableGridSwitchCollection","useWixPatternsContainer","useBasePatternsStateParams","useTableGridSwitchFeaturesAsync","useBaseGridFeatures","useBaseCollectionComponentReadyFeatures","AutoPatternsTableGridSwitchLoaded","props","config","asyncFeaturesState","baseStateParams","dataHook","renderItem","imagePlacement","preset","baseTableFeatures","dragAndDrop","importFeature","status","data","state","params","baseCollectionComponentReadyFeatures","collection","reportBi","toolbar","dragAndDropProps","useTableGridSwitchDragAndDrop","baseTableFeaturesProps","useBaseTableFeatures","importProps","useImport","createElement","_extends","columns","AutoPatternsTableGridSwitch","tableVisibleFieldIds","map","column","id","visibleFieldIds","gridVisibleFieldIds","Array","from","Set","container","createCollection","containerOverrides","isReady","isSuccess","isError"],"sources":["../../../../src/components/AutoPatternsTableGridSwitch/AutoPatternsTableGridSwitch.tsx"],"sourcesContent":["import React, { useMemo, useState } from 'react';\nimport {\n TableGridSwitch,\n TableGridSwitchState,\n useCreateCollection,\n useSelector,\n useTableGridSwitchCollection,\n useWixPatternsContainer,\n} from '@wix/patterns';\nimport { TableGridSwitchConfig } from '../../types';\nimport { useBasePatternsStateParams } from '../../hooks/useBasePatternsStateParams';\nimport { useTableGridSwitchFeaturesAsync } from '../../hooks/useTableGridSwitchFeaturesAsync';\nimport { useBaseGridFeatures } from '../../hooks/useBaseGridFeatures';\nimport { useBaseCollectionComponentReadyFeatures } from '../../hooks/useBaseCollectionComponentReadyFeatures';\n\nexport interface AutoPatternsTableGridSwitchProps {\n config: TableGridSwitchConfig;\n}\n\n/**\n * AutoPatternsTableGridSwitchLoaded - Step 4 in TableGridSwitch Flow\n *\n * FLOW 3: AutoPatternsCollectionComponent → AutoPatternsTableGridSwitch → useTableGridSwitchFeaturesAsync → [AutoPatternsTableGridSwitchLoaded] → useBaseCollectionComponentReadyFeatures → TableGridSwitch\n *\n * This component renders when all async features have been loaded and are ready.\n * It represents the \"loaded\" state of the table-grid switch flow and handles:\n *\n * Key Responsibilities:\n * - Creates the table-grid-switch collection state using loaded async features\n * - Calls useBaseCollectionComponentReadyFeatures for final feature preparation\n * - Combines both table features (baseTableFeatures) and grid features (renderItem, preset, imagePlacement)\n * - Extracts async features like dragAndDrop if enabled\n * - Renders the final TableGridSwitch component with all features combined\n * - Provides both table columns AND grid display props to support switching\n */\nconst AutoPatternsTableGridSwitchLoaded = (\n props: NonNullable<ReturnType<typeof useTableGridSwitchFeaturesAsync>> &\n AutoPatternsTableGridSwitchProps & {\n baseStateParams: ReturnType<typeof useBasePatternsStateParams>;\n dataHook?: string;\n },\n) => {\n const { config, asyncFeaturesState, baseStateParams, dataHook } = props;\n\n // Extract grid-specific display features (for grid mode when user switches)\n const { renderItem, imagePlacement, preset } = useBaseGridFeatures(config);\n\n // Extract loaded async features from the successful feature loading state\n const { baseTableFeatures, dragAndDrop, importFeature } = useSelector(\n () => ({\n ...asyncFeaturesState.status.data,\n }),\n );\n\n // Create table-grid-switch collection state with the loaded async dependencies\n const state = useTableGridSwitchCollection<any>(baseStateParams.params);\n\n // STEP 5: Call shared hook that prepares final collection features\n // This hook is shared across all three flows (Table, Grid, TableGridSwitch)\n const baseCollectionComponentReadyFeatures =\n useBaseCollectionComponentReadyFeatures({\n config,\n collection: state.collection,\n reportBi: state.toolbar.reportBi,\n asyncFeaturesState,\n baseStateParams,\n });\n\n // Extract table-grid-switch specific drag and drop props if feature is loaded\n const dragAndDropProps = dragAndDrop?.useTableGridSwitchDragAndDrop?.(config);\n\n // Extract table-specific features (for table mode when user switches)\n const baseTableFeaturesProps =\n baseTableFeatures?.useBaseTableFeatures(config);\n const importProps = importFeature?.useImport?.(config);\n\n // FINAL STEP: Render the fully-featured TableGridSwitch component\n // Combines table features, grid features, and switch functionality\n return (\n <TableGridSwitch\n dataHook={dataHook}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n columns={[]}\n state={state}\n {...baseCollectionComponentReadyFeatures}\n {...baseTableFeaturesProps}\n {...dragAndDropProps}\n {...importProps}\n />\n );\n};\n\n/**\n * AutoPatternsTableGridSwitch - Step 2 in TableGridSwitch Flow\n *\n * FLOW 3: AutoPatternsCollectionComponent → [AutoPatternsTableGridSwitch] → useTableGridSwitchFeaturesAsync → AutoPatternsTableGridSwitchLoaded → useBaseCollectionComponentReadyFeatures → TableGridSwitch\n *\n * This is the main table-grid-switch component that orchestrates the combined table/grid rendering flow.\n * It handles both table and grid configurations simultaneously to support runtime switching.\n *\n * Key Responsibilities:\n * - Merges visible field IDs from both table columns AND grid features for comprehensive data fetching\n * - Extracts grid display features (renderItem, preset, imagePlacement) for grid mode\n * - Calls useTableGridSwitchFeaturesAsync (Step 3) to load combined async features\n * - Creates initial table-grid-switch state with basic collection\n * - Monitors loading status and switches between loading/loaded states\n * - Renders skeleton TableGridSwitch during loading or AutoPatternsTableGridSwitchLoaded when ready\n */\nexport const AutoPatternsTableGridSwitch = (\n props: AutoPatternsTableGridSwitchProps,\n) => {\n const { config } = props;\n\n // Extract visible field IDs from table columns (for table mode)\n const tableVisibleFieldIds = useMemo(\n () => config.columns.map((column) => column.id),\n [config],\n );\n\n // Extract grid display features and visible field IDs (for grid mode)\n const {\n renderItem,\n imagePlacement,\n preset,\n visibleFieldIds: gridVisibleFieldIds,\n } = useBaseGridFeatures(config);\n\n // IMPORTANT: Merge visible fields from BOTH table AND grid to support switching\n // This ensures all necessary data is loaded regardless of current view mode\n const visibleFieldIds = useMemo(\n () =>\n Array.from(new Set([...tableVisibleFieldIds, ...gridVisibleFieldIds])),\n [tableVisibleFieldIds, gridVisibleFieldIds],\n );\n\n // Initialize base state parameters with collection config and combined visible fields\n const baseStateParams = useBasePatternsStateParams(config, {\n visibleFieldIds,\n });\n\n // STEP 3: Load table-grid-switch async features (combines table + grid features)\n const { asyncFeaturesState } = useTableGridSwitchFeaturesAsync({ config });\n\n // Create patterns container and collection factory\n const container = useWixPatternsContainer();\n const createCollection = useCreateCollection();\n\n // Initialize table-grid-switch state with basic collection (used during loading)\n const [state] = useState(\n () =>\n new TableGridSwitchState<any, {}>({\n collection: createCollection<any, {}>(baseStateParams.params),\n container,\n containerOverrides: {},\n }),\n );\n\n // Monitor async features loading status\n const isReady = useSelector(\n () =>\n asyncFeaturesState.status.isSuccess || asyncFeaturesState.status.isError,\n );\n\n const dataHook = 'auto-patterns-table-grid-switch';\n\n if (isReady) {\n // STEP 4: All features loaded - render the fully-featured table-grid-switch\n return (\n <AutoPatternsTableGridSwitchLoaded\n dataHook={dataHook}\n config={config}\n baseStateParams={baseStateParams}\n asyncFeaturesState={asyncFeaturesState}\n />\n );\n }\n\n // LOADING STATE: Render basic table-grid-switch skeleton while features are loading\n return (\n <TableGridSwitch\n dataHook={dataHook}\n state={state}\n columns={[]}\n preset={preset}\n imagePlacement={imagePlacement}\n renderItem={renderItem}\n />\n );\n};\n"],"mappings":";AAAA,OAAOA,KAAK,IAAIC,OAAO,EAAEC,QAAQ,QAA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AEK;EAAO,CAAC,CAAC;;EAE1E;EACA,MAAMqC,SAAS,GAAG5C,uBAAuB,CAAC,CAAC;EAC3C,MAAM6C,gBAAgB,GAAGhD,mBAAmB,CAAC,CAAC;;EAE9C;EACA,MAAM,CAACsB,KAAK,CAAC,GAAGzB,QAAQ,CACtB,MACE,IAAIE,oBAAoB,CAAU;IAChC0B,UAAU,EAAEuB,gBAAgB,CAAUpC,eAAe,CAACW,MAAM,CAAC;IAC7DwB,SAAS;IACTE,kBAAkB,EAAE,CAAC;EACvB,CAAC,CACL,CAAC;;EAED;EACA,MAAMC,OAAO,GAAGjD,WAAW,CACzB,MACEU,kBAAkB,CAACS,MAAM,CAAC+B,SAAS,IAAIxC,kBAAkB,CAACS,MAAM,CAACgC,OACrE,CAAC;EAED,MAAMvC,QAAQ,GAAG,iCAAiC;EAElD,IAAIqC,OAAO,EAAE;IACX;IACA,oBACEvD,KAAA,CAAAuC,aAAA,CAAC1B,iCAAiC;MAChCK,QAAQ,EAAEA,QAAS;MACnBH,MAAM,EAAEA,MAAO;MACfE,eAAe,EAAEA,eAAgB;MACjCD,kBAAkB,EAAEA;IAAmB,CACxC,CAAC;EAEN;;EAEA;EACA,oBACEhB,KAAA,CAAAuC,aAAA,CAACpC,eAAe;IACde,QAAQ,EAAEA,QAAS;IACnBS,KAAK,EAAEA,KAAM;IACbc,OAAO,EAAE,EAAG;IACZpB,MAAM,EAAEA,MAAO;IACfD,cAAc,EAAEA,cAAe;IAC/BD,UAAU,EAAEA;EAAW,CACxB,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormField } from '@wix/design-system';
|
|
3
|
+
import { useController } from '@wix/patterns/form';
|
|
4
|
+
import { FormColorInput } from '../../cms-fields';
|
|
5
|
+
export const Color = props => {
|
|
6
|
+
var _field$validation;
|
|
7
|
+
const {
|
|
8
|
+
field,
|
|
9
|
+
dataHook,
|
|
10
|
+
formControl,
|
|
11
|
+
data
|
|
12
|
+
} = props;
|
|
13
|
+
const controller = useController({
|
|
14
|
+
name: (field == null ? void 0 : field.id) ?? '',
|
|
15
|
+
control: formControl,
|
|
16
|
+
defaultValue: data == null ? void 0 : data[(field == null ? void 0 : field.id) ?? '']
|
|
17
|
+
});
|
|
18
|
+
return /*#__PURE__*/React.createElement(FormField, {
|
|
19
|
+
label: field.displayName,
|
|
20
|
+
required: (_field$validation = field.validation) == null ? void 0 : _field$validation.required,
|
|
21
|
+
dataHook: dataHook
|
|
22
|
+
}, /*#__PURE__*/React.createElement(FormColorInput, {
|
|
23
|
+
autoFocus: false,
|
|
24
|
+
data: controller.field.value,
|
|
25
|
+
onChange: hex => controller.field.onChange(hex),
|
|
26
|
+
onBlur: controller.field.onBlur,
|
|
27
|
+
ref: controller.field.ref,
|
|
28
|
+
dataHook: `color-${field.id}`
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=Color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","FormField","useController","FormColorInput","Color","props","_field$validation","field","dataHook","formControl","data","controller","name","id","control","defaultValue","createElement","label","displayName","required","validation","autoFocus","value","onChange","hex","onBlur","ref"],"sources":["../../../../src/components/fields/Color.tsx"],"sourcesContent":["import React from 'react';\nimport { FormField } from '@wix/design-system';\nimport { BaseInputProps } from './types';\nimport { useController } from '@wix/patterns/form';\nimport { FormColorInput } from '../../cms-fields';\n\nexport interface ColorProps extends BaseInputProps<string> {}\n\nexport const Color = (props: ColorProps) => {\n const { field, dataHook, formControl, data } = props;\n\n const controller = useController({\n name: field?.id ?? '',\n control: formControl,\n defaultValue: data?.[field?.id ?? ''],\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n dataHook={dataHook}\n >\n <FormColorInput\n autoFocus={false}\n data={controller.field.value as string | undefined}\n onChange={(hex) => controller.field.onChange(hex)}\n onBlur={controller.field.onBlur}\n ref={controller.field.ref}\n d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|
+
import { InputUniDriver, FillPreviewUniDriver, FillButtonUniDriver } from '@wix/design-system/dist/testkit/unidriver';
|
|
2
|
+
import { baseUniDriverFactory } from '../AutoPatternsApp/AutoPatternsApp.uni.driver';
|
|
3
|
+
export function ColorFieldUniDriver(base, body, fieldName) {
|
|
4
|
+
const inputBase = base.$(`[data-hook="color-${fieldName}"]`);
|
|
5
|
+
const input = InputUniDriver(inputBase, body);
|
|
6
|
+
return {
|
|
7
|
+
...baseUniDriverFactory(inputBase),
|
|
8
|
+
getInput: () => input,
|
|
9
|
+
getValue: () => input.getValue(),
|
|
10
|
+
enterText: text => input.enterText(text),
|
|
11
|
+
getFillPreview: () => FillPreviewUniDriver(inputBase, body),
|
|
12
|
+
getFillButton: () => FillButtonUniDriver(inputBase, body)
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=Color.uni.driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["InputUniDriver","FillPreviewUniDriver","FillButtonUniDriver","baseUniDriverFactory","ColorFieldUniDriver","base","body","fieldName","inputBase","$","input","getInput","getValue","enterText","text","getFillPreview","getFillButton"],"sources":["../../../../src/components/fields/Color.uni.driver.ts"],"sourcesContent":["import { UniDriver } from '@wix/wix-ui-test-utils/unidriver';\nimport {\n InputUniDriver,\n FillPreviewUniDriver,\n FillButtonUniDriver,\n} from '@wix/design-system/dist/testkit/unidriver';\nimport { baseUniDriverFactory } from '../AutoPatternsApp/AutoPatternsApp.uni.driver';\n\nexport function ColorFieldUniDriver(\n base: UniDriver,\n body: UniDriver,\n fieldName: string,\n) {\n const inputBase = base.$(`[data-hook=\"color-${fieldName}\"]`);\n const input = InputUniDriver(inputBase, body);\n\n return {\n ...baseUniDriverFactory(inputBase),\n getInput: () => input,\n getValue: () => input.getValue(),\n enterText: (text: string) => input.enterText(text),\n getFillPreview: () => FillPreviewUniDriver(inputBase, body),\n getFillButton: () => FillButtonUniDriver(inputBase, body),\n };\n}\n"],"mappings":"AACA,SACEA,cAAc,EACdC,oBAAoB,EACpBC,mBAAmB,QACd,2CAA2C;AAClD,SAASC,oBAAoB,QAAQ,+CAA+C;AAEpF,OAAO,SAASC,mBAAmBA,CACjCC,IAAe,EACfC,IAAe,EACfC,SAAiB,EACjB;EACA,MAAMC,SAAS,GAAGH,IAAI,CAACI,CAAC,CAAC,qBAAqBF,SAAS,IAAI,CAAC;EAC5D,MAAMG,KAAK,GAAGV,cAAc,CAACQ,SAAS,EAAEF,IAAI,CAAC;EAE7C,OAAO;IACL,GAAGH,oBAAoB,CAACK,SAAS,CAAC;IAClCG,QAAQ,EAAEA,CAAA,KAAMD,KAAK;IACrBE,QAAQ,EAAEA,CAAA,KAAMF,KAAK,CAACE,QAAQ,CAAC,CAAC;IAChCC,SAAS,EAAGC,IAAY,IAAKJ,KAAK,CAACG,SAAS,CAACC,IAAI,CAAC;IAClDC,cAAc,EAAEA,CAAA,KAAMd,oBAAoB,CAACO,SAAS,EAAEF,IAAI,CAAC;IAC3DU,aAAa,EAAEA,CAAA,KAAMd,mBAAmB,CAACM,SAAS,EAAEF,IAAI;EAC1D,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Audio","Checkbox","Email","DateInput","DateTime","Document","MultiDocument","ImageInput","LongText","Number","Reference","MultiReference","ShortText","Time","Url","Object","Address","RichContent","RichText","MediaGallery"],"sources":["../../../../src/components/fields/index.ts"],"sourcesContent":["export { Audio } from './Audio';\nexport { Checkbox } from './Checkbox';\nexport { Email } from './Email';\nexport { DateInput } from './DateInput';\nexport { DateTime } from './DateTime';\nexport { Document } from './Document';\nexport { MultiDocument } from './MultiDocument';\nexport { ImageInput } from './ImageInput';\nexport { LongText } from './LongText';\nexport { Number } from './Number';\nexport { Reference } from './Reference';\nexport { MultiReference } from './MultiReference';\nexport { ShortText } from './ShortText';\nexport { Time } from './Time';\nexport { Url } from './Url';\nexport { Object } from './Object';\nexport { Address } from './Address';\nexport { RichContent } from './RichContent';\nexport { RichText } from './RichText';\nexport { MediaGallery } from './MediaGallery';\nexport * from './types';\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,SAAS;AAC/B,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,GAAG,QAAQ,OAAO;AAC3B,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,cAAc,SAAS","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Audio","Checkbox","Color","Email","DateInput","DateTime","Document","MultiDocument","ImageInput","LongText","Number","Reference","MultiReference","ShortText","Time","Url","Object","Address","RichContent","RichText","MediaGallery"],"sources":["../../../../src/components/fields/index.ts"],"sourcesContent":["export { Audio } from './Audio';\nexport { Checkbox } from './Checkbox';\nexport { Color } from './Color';\nexport { Email } from './Email';\nexport { DateInput } from './DateInput';\nexport { DateTime } from './DateTime';\nexport { Document } from './Document';\nexport { MultiDocument } from './MultiDocument';\nexport { ImageInput } from './ImageInput';\nexport { LongText } from './LongText';\nexport { Number } from './Number';\nexport { Reference } from './Reference';\nexport { MultiReference } from './MultiReference';\nexport { ShortText } from './ShortText';\nexport { Time } from './Time';\nexport { Url } from './Url';\nexport { Object } from './Object';\nexport { Address } from './Address';\nexport { RichContent } from './RichContent';\nexport { RichText } from './RichText';\nexport { MediaGallery } from './MediaGallery';\nexport * from './types';\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,SAAS;AAC/B,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,KAAK,QAAQ,SAAS;AAC/B,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,SAAS,QAAQ,aAAa;AACvC,SAASC,IAAI,QAAQ,QAAQ;AAC7B,SAASC,GAAG,QAAQ,OAAO;AAC3B,SAASC,MAAM,QAAQ,UAAU;AACjC,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,QAAQ,QAAQ,YAAY;AACrC,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,cAAc,SAAS","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useController } from '@wix/patterns/form';
|
|
3
|
-
import { Audio, ShortText, LongText, Checkbox, DateInput, DateTime, Time, Number, Url, Email, ImageInput, Reference, Object, Address, RichContent, RichText, Document, MultiDocument, MultiReference, MediaGallery } from '../fields';
|
|
3
|
+
import { Audio, ShortText, LongText, Checkbox, Color, DateInput, DateTime, Time, Number, Url, Email, ImageInput, Reference, Object, Address, RichContent, RichText, Document, MultiDocument, MultiReference, MediaGallery } from '../fields';
|
|
4
4
|
export const EDITABLE_INPUT_ELEMENTS = {
|
|
5
5
|
AUDIO: Audio,
|
|
6
6
|
SHORT_TEXT: ShortText,
|
|
@@ -21,7 +21,8 @@ export const EDITABLE_INPUT_ELEMENTS = {
|
|
|
21
21
|
DOCUMENT: Document,
|
|
22
22
|
MULTI_DOCUMENT: MultiDocument,
|
|
23
23
|
EMAIL: Email,
|
|
24
|
-
MEDIA_GALLERY: MediaGallery
|
|
24
|
+
MEDIA_GALLERY: MediaGallery,
|
|
25
|
+
COLOR: Color
|
|
25
26
|
};
|
|
26
27
|
export const FormField = _ref => {
|
|
27
28
|
let {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useController","Audio","ShortText","LongText","Checkbox","DateInput","DateTime","Time","Number","Url","Email","ImageInput","Reference","Object","Address","RichContent","RichText","Document","MultiDocument","MultiReference","MediaGallery","EDITABLE_INPUT_ELEMENTS","AUDIO","SHORT_TEXT","LONG_TEXT","BOOLEAN","DATE","DATETIME","TIME","NUMBER","URL","IMAGE","REFERENCE","MULTI_REFERENCE","OBJECT","ADDRESS","RICH_CONTENT","RICH_TEXT","DOCUMENT","MULTI_DOCUMENT","EMAIL","MEDIA_GALLERY","FormField","_ref","field","inputRef","formControl","data","controller","name","id","control","defaultValue","hasOwnProperty","type","FieldInput","createElement","value","onChange","dataHook"],"sources":["../../../../src/components/layouts/FormField.tsx"],"sourcesContent":["import React from 'react';\nimport { useController, Control } from '@wix/patterns/form';\nimport { Field, PatternsFieldType } from '../../types';\nimport {\n Audio,\n ShortText,\n LongText,\n Checkbox,\n DateInput,\n DateTime,\n Time,\n Number,\n Url,\n Email,\n ImageInput,\n Reference,\n BaseInputProps,\n Object,\n Address,\n RichContent,\n RichText,\n Document,\n MultiDocument,\n MultiReference,\n MediaGallery,\n} from '../fields';\n\nexport const EDITABLE_INPUT_ELEMENTS: Partial<\n Record<PatternsFieldType, React.ComponentType<any>>\n> = {\n AUDIO: Audio,\n SHORT_TEXT: ShortText,\n LONG_TEXT: LongText,\n BOOLEAN: Checkbox,\n DATE: DateInput,\n DATETIME: DateTime,\n TIME: Time,\n NUMBER: Number,\n URL: Url,\n IMAGE: ImageInput,\n REFERENCE: Reference,\n MULTI_REFERENCE: MultiReference,\n OBJECT: Object,\n ADDRESS: Address,\n RICH_CONTENT: RichContent,\n RICH_TEXT: RichText,\n DOCUMENT: Document,\n MULTI_DOCUMENT: MultiDocument,\n EMAIL: Email,\n MEDIA_GALLERY: MediaGallery,\n};\n\nexport interface FormFieldProps {\n field: Field;\n inputRef?: BaseInputProps<any>['inputRef'];\n formControl?: Control<any>;\n data?: Record<string, any>;\n}\n\nexport const FormField: React.FC<FormFieldProps> = ({\n field,\n inputRef,\n formControl,\n data,\n}) => {\n const controller = useController({\n name: field?.id ?? '',\n control: formControl,\n defaultValue: data?.[field?.id ?? ''],\n });\n\n if (!EDITABLE_INPUT_ELEMENTS.hasOwnProperty(field.type)) {\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 formControl={formControl}\n data={data ?? {}}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAiB,oBAAoB;AAE3D,SACEC,KAAK,EACLC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,MAAM,EACNC,GAAG,EACHC,KAAK,EACLC,UAAU,EACVC,SAAS,EAETC,MAAM,EACNC,OAAO,EACPC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,aAAa,EACbC,cAAc,EACdC,YAAY,QACP,WAAW;AAElB,OAAO,MAAMC,uBAEZ,GAAG;EACFC,KAAK,
|
|
1
|
+
{"version":3,"names":["React","useController","Audio","ShortText","LongText","Checkbox","Color","DateInput","DateTime","Time","Number","Url","Email","ImageInput","Reference","Object","Address","RichContent","RichText","Document","MultiDocument","MultiReference","MediaGallery","EDITABLE_INPUT_ELEMENTS","AUDIO","SHORT_TEXT","LONG_TEXT","BOOLEAN","DATE","DATETIME","TIME","NUMBER","URL","IMAGE","REFERENCE","MULTI_REFERENCE","OBJECT","ADDRESS","RICH_CONTENT","RICH_TEXT","DOCUMENT","MULTI_DOCUMENT","EMAIL","MEDIA_GALLERY","COLOR","FormField","_ref","field","inputRef","formControl","data","controller","name","id","control","defaultValue","hasOwnProperty","type","FieldInput","createElement","value","onChange","dataHook"],"sources":["../../../../src/components/layouts/FormField.tsx"],"sourcesContent":["import React from 'react';\nimport { useController, Control } from '@wix/patterns/form';\nimport { Field, PatternsFieldType } from '../../types';\nimport {\n Audio,\n ShortText,\n LongText,\n Checkbox,\n Color,\n DateInput,\n DateTime,\n Time,\n Number,\n Url,\n Email,\n ImageInput,\n Reference,\n BaseInputProps,\n Object,\n Address,\n RichContent,\n RichText,\n Document,\n MultiDocument,\n MultiReference,\n MediaGallery,\n} from '../fields';\n\nexport const EDITABLE_INPUT_ELEMENTS: Partial<\n Record<PatternsFieldType, React.ComponentType<any>>\n> = {\n AUDIO: Audio,\n SHORT_TEXT: ShortText,\n LONG_TEXT: LongText,\n BOOLEAN: Checkbox,\n DATE: DateInput,\n DATETIME: DateTime,\n TIME: Time,\n NUMBER: Number,\n URL: Url,\n IMAGE: ImageInput,\n REFERENCE: Reference,\n MULTI_REFERENCE: MultiReference,\n OBJECT: Object,\n ADDRESS: Address,\n RICH_CONTENT: RichContent,\n RICH_TEXT: RichText,\n DOCUMENT: Document,\n MULTI_DOCUMENT: MultiDocument,\n EMAIL: Email,\n MEDIA_GALLERY: MediaGallery,\n COLOR: Color,\n};\n\nexport interface FormFieldProps {\n field: Field;\n inputRef?: BaseInputProps<any>['inputRef'];\n formControl?: Control<any>;\n data?: Record<string, any>;\n}\n\nexport const FormField: React.FC<FormFieldProps> = ({\n field,\n inputRef,\n formControl,\n data,\n}) => {\n const controller = useController({\n name: field?.id ?? '',\n control: formControl,\n defaultValue: data?.[field?.id ?? ''],\n });\n\n if (!EDITABLE_INPUT_ELEMENTS.hasOwnProperty(field.type)) {\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 formControl={formControl}\n data={data ?? {}}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,aAAa,QAAiB,oBAAoB;AAE3D,SACEC,KAAK,EACLC,SAAS,EACTC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,QAAQ,EACRC,IAAI,EACJC,MAAM,EACNC,GAAG,EACHC,KAAK,EACLC,UAAU,EACVC,SAAS,EAETC,MAAM,EACNC,OAAO,EACPC,WAAW,EACXC,QAAQ,EACRC,QAAQ,EACRC,aAAa,EACbC,cAAc,EACdC,YAAY,QACP,WAAW;AAElB,OAAO,MAAMC,uBAEZ,GAAG;EACFC,KAAK,EAAEtB,KAAK;EACZuB,UAAU,EAAEtB,SAAS;EACrBuB,SAAS,EAAEtB,QAAQ;EACnBuB,OAAO,EAAEtB,QAAQ;EACjBuB,IAAI,EAAErB,SAAS;EACfsB,QAAQ,EAAErB,QAAQ;EAClBsB,IAAI,EAAErB,IAAI;EACVsB,MAAM,EAAErB,MAAM;EACdsB,GAAG,EAAErB,GAAG;EACRsB,KAAK,EAAEpB,UAAU;EACjBqB,SAAS,EAAEpB,SAAS;EACpBqB,eAAe,EAAEd,cAAc;EAC/Be,MAAM,EAAErB,MAAM;EACdsB,OAAO,EAAErB,OAAO;EAChBsB,YAAY,EAAErB,WAAW;EACzBsB,SAAS,EAAErB,QAAQ;EACnBsB,QAAQ,EAAErB,QAAQ;EAClBsB,cAAc,EAAErB,aAAa;EAC7BsB,KAAK,EAAE9B,KAAK;EACZ+B,aAAa,EAAErB,YAAY;EAC3BsB,KAAK,EAAEtC;AACT,CAAC;AASD,OAAO,MAAMuC,SAAmC,GAAGC,IAAA,IAK7C;EAAA,IAL8C;IAClDC,KAAK;IACLC,QAAQ;IACRC,WAAW;IACXC;EACF,CAAC,GAAAJ,IAAA;EACC,MAAMK,UAAU,GAAGlD,aAAa,CAAC;IAC/BmD,IAAI,EAAE,CAAAL,KAAK,oBAALA,KAAK,CAAEM,EAAE,KAAI,EAAE;IACrBC,OAAO,EAAEL,WAAW;IACpBM,YAAY,EAAEL,IAAI,oBAAJA,IAAI,CAAG,CAAAH,KAAK,oBAALA,KAAK,CAAEM,EAAE,KAAI,EAAE;EACtC,CAAC,CAAC;EAEF,IAAI,CAAC9B,uBAAuB,CAACiC,cAAc,CAACT,KAAK,CAACU,IAAI,CAAC,EAAE;IACvD,OAAO,IAAI;EACb;EAEA,MAAMC,UAAU,GAAGnC,uBAAuB,CAACwB,KAAK,CAACU,IAAI,CAAE;EAEvD,oBACEzD,KAAA,CAAA2D,aAAA,CAACD,UAAU;IACTX,KAAK,EAAEA,KAAM;IACba,KAAK,EAAET,UAAU,CAACJ,KAAK,CAACa,KAAM;IAC9BC,QAAQ,EAAEV,UAAU,CAACJ,KAAK,CAACc,QAAS;IACpCC,QAAQ,EAAE,cAAcf,KAAK,CAACM,EAAE,EAAG;IACnCL,QAAQ,EAAEA,QAAS;IACnBC,WAAW,EAAEA,WAAY;IACzBC,IAAI,EAAEA,IAAI,IAAI,CAAC;EAAE,CAClB,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { collections, items } from '@wix/data';
|
|
2
2
|
import { fetchCmsData } from './fetchCmsData';
|
|
3
3
|
import { errorHandler } from '@wix/essentials';
|
|
4
|
+
import { createCmsBackupConfig } from './cmsBackup';
|
|
4
5
|
|
|
5
6
|
// The CMS backend returns 'EMAIL' as a field type but the @wix/data SDK
|
|
6
7
|
// doesn't expose it in collections.Type. We use a string literal as a workaround until the SDK is updated.
|
|
@@ -27,7 +28,8 @@ export const CmsFieldTypeToPatternsFieldType = {
|
|
|
27
28
|
[collections.Type.DOCUMENT]: 'DOCUMENT',
|
|
28
29
|
[collections.Type.ARRAY_DOCUMENT]: 'MULTI_DOCUMENT',
|
|
29
30
|
[collections.Type.AUDIO]: 'AUDIO',
|
|
30
|
-
[CMS_EMAIL_TYPE]: 'EMAIL'
|
|
31
|
+
[CMS_EMAIL_TYPE]: 'EMAIL',
|
|
32
|
+
[collections.Type.LEGACY_COLOR]: 'COLOR'
|
|
31
33
|
};
|
|
32
34
|
export async function fetchCmsSchema(collectionId) {
|
|
33
35
|
const schema = await errorHandler.withErrorHandler(async () => collections.getDataCollection(collectionId), {});
|
|
@@ -136,6 +138,23 @@ export function transformCmsSchema(schema) {
|
|
|
136
138
|
options = {};
|
|
137
139
|
}
|
|
138
140
|
return fetchCmsData(collectionId, query, transformedFields, options);
|
|
141
|
+
},
|
|
142
|
+
backup: createCmsBackupConfig(),
|
|
143
|
+
bulkInsert: async entities => {
|
|
144
|
+
const {
|
|
145
|
+
inserted,
|
|
146
|
+
updated,
|
|
147
|
+
errors
|
|
148
|
+
} = await errorHandler.withErrorHandler(async () => items.bulkInsert(collectionId, entities), {});
|
|
149
|
+
return {
|
|
150
|
+
succeeded: inserted + updated,
|
|
151
|
+
failed: errors.length,
|
|
152
|
+
errors: errors.map(e => ({
|
|
153
|
+
rowIndex: e.originalIndex,
|
|
154
|
+
message: e.message,
|
|
155
|
+
code: e.code
|
|
156
|
+
}))
|
|
157
|
+
};
|
|
139
158
|
}
|
|
140
159
|
}
|
|
141
160
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["collections","items","fetchCmsData","errorHandler","CMS_EMAIL_TYPE","CmsFieldTypeToPatternsFieldType","Type","TEXT","DATE","DATETIME","TIME","NUMBER","BOOLEAN","URL","ADDRESS","OBJECT","RICH_TEXT","RICH_CONTENT","ARRAY","ARRAY_STRING","REFERENCE","MULTI_REFERENCE","IMAGE","MEDIA_GALLERY","DOCUMENT","ARRAY_DOCUMENT","AUDIO","fetchCmsSchema","collectionId","schema","withErrorHandler","getDataCollection","getReferenceFields","fields","Object","values","filter","f","type","updateMultiReferences","entityId","entity","multiReferenceFields","Promise","all","map","field","rawValue","id","multipleReferenceValues","multipleReferenceIds","value","_id","replaceReferences","transformCmsSchema","transformedFields","reduce","acc","_field$capabilities","_field$capabilities2","_field$typeMetadata","_field$typeMetadata2","key","fieldType","baseField","displayName","validation","numberRange","min","undefined","max","stringLengthRange","minLength","maxLength","required","capabilities","supportedQueryOperators","queryOperators","sortable","referencedCollectionId","typeMetadata","reference","multiReference","isReference","referenceMetadata","referenceFields","allReferenceFieldIds","schemaConfig","displayField","idField","actions","get","dataQuery","query","eq","length","include","res","find","returnTotalCount","Error","create","created","insert","createdId","update","delete","remove","bulkDelete","entityIds","bulkRemove","options"],"sources":["../../../../src/dataSourceAdapters/cms/cmsAdapter.ts"],"sourcesContent":["import { Field, SchemaConfig, PatternsFieldType } from '../../types';\nimport { collections, items } from '@wix/data';\nimport { fetchCmsData } from './fetchCmsData';\nimport { errorHandler } from '@wix/essentials';\n\n// The CMS backend returns 'EMAIL' as a field type but the @wix/data SDK\n// doesn't expose it in collections.Type. We use a string literal as a workaround until the SDK is updated.\n// TODO: remove this once the SDK is updated\nconst CMS_EMAIL_TYPE = 'EMAIL' as collections.Type;\n\nexport const CmsFieldTypeToPatternsFieldType: Partial<\n Record<collections.Type, PatternsFieldType>\n> = {\n [collections.Type.TEXT]: 'SHORT_TEXT',\n [collections.Type.DATE]: 'DATE',\n [collections.Type.DATETIME]: 'DATETIME',\n [collections.Type.TIME]: 'TIME',\n [collections.Type.NUMBER]: 'NUMBER',\n [collections.Type.BOOLEAN]: 'BOOLEAN',\n [collections.Type.URL]: 'URL',\n [collections.Type.ADDRESS]: 'ADDRESS',\n [collections.Type.OBJECT]: 'OBJECT',\n [collections.Type.RICH_TEXT]: 'RICH_TEXT',\n [collections.Type.RICH_CONTENT]: 'RICH_CONTENT',\n [collections.Type.ARRAY]: 'ARRAY',\n [collections.Type.ARRAY_STRING]: 'ARRAY',\n [collections.Type.REFERENCE]: 'REFERENCE',\n [collections.Type.MULTI_REFERENCE]: 'MULTI_REFERENCE',\n [collections.Type.IMAGE]: 'IMAGE',\n [collections.Type.MEDIA_GALLERY]: 'MEDIA_GALLERY',\n [collections.Type.DOCUMENT]: 'DOCUMENT',\n [collections.Type.ARRAY_DOCUMENT]: 'MULTI_DOCUMENT',\n [collections.Type.AUDIO]: 'AUDIO',\n [CMS_EMAIL_TYPE]: 'EMAIL',\n};\n\nexport async function fetchCmsSchema(\n collectionId: string,\n): Promise<collections.DataCollection> {\n const schema = await errorHandler.withErrorHandler(\n async () => collections.getDataCollection(collectionId),\n {},\n );\n return schema;\n}\n\nconst getReferenceFields = (fields: Record<string, Field>) =>\n Object.values(fields).filter(\n (f): f is Field => f?.type === 'REFERENCE' || f?.type === 'MULTI_REFERENCE',\n );\n\nconst updateMultiReferences = async (\n collectionId: string,\n entityId: string,\n entity: Record<string, any>,\n multiReferenceFields: Field[],\n) => {\n await Promise.all(\n multiReferenceFields.map(async (field) => {\n const rawValue = entity[field.id];\n const multipleReferenceValues = rawValue as Record<string, unknown>[];\n const multipleReferenceIds = multipleReferenceValues.map(\n (value) => value._id as string,\n );\n\n await items.replaceReferences(\n collectionId,\n field.id,\n entityId,\n multipleReferenceIds,\n );\n }),\n );\n};\n\nexport function transformCmsSchema(\n schema: collections.DataCollection,\n): SchemaConfig {\n const collectionId = schema._id as string;\n\n const transformedFields = (schema.fields || []).reduce<Record<string, Field>>(\n (acc, field) => {\n if (!field.key) {\n return acc;\n }\n\n const fieldType = field.type\n ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT'\n : 'SHORT_TEXT';\n const baseField = {\n id: field.key,\n displayName: field.displayName || '',\n validation: {\n numberRange: field.numberRange\n ? {\n min: field.numberRange.min ?? undefined,\n max: field.numberRange.max ?? undefined,\n }\n : undefined,\n stringLengthRange: field.stringLengthRange\n ? {\n minLength: field.stringLengthRange.minLength ?? undefined,\n maxLength: field.stringLengthRange.maxLength ?? undefined,\n }\n : undefined,\n required: field.required ?? false,\n },\n capabilities: {\n supportedQueryOperators: field.capabilities?.queryOperators || [],\n sortable: field.capabilities?.sortable || false,\n },\n };\n\n const referencedCollectionId =\n field.typeMetadata?.reference?.referencedCollectionId ??\n field.typeMetadata?.multiReference?.referencedCollectionId;\n\n const isReference =\n fieldType === 'REFERENCE' || fieldType === 'MULTI_REFERENCE';\n\n if (isReference && referencedCollectionId) {\n acc[field.key] = {\n ...baseField,\n type: fieldType as 'REFERENCE' | 'MULTI_REFERENCE',\n referenceMetadata: { referencedCollectionId },\n };\n } else {\n acc[field.key] = {\n ...baseField,\n type: isReference ? 'SHORT_TEXT' : fieldType,\n };\n }\n\n return acc;\n },\n {},\n );\n\n const referenceFields = getReferenceFields(transformedFields);\n const multiReferenceFields = referenceFields.filter(\n (f) => f.type === 'MULTI_REFERENCE',\n );\n const allReferenceFieldIds = referenceFields.map((f) => f.id);\n\n const schemaConfig: SchemaConfig = {\n id: collectionId,\n displayField: schema.displayField ?? '_id',\n idField: '_id',\n fields: transformedFields,\n actions: {\n get: async (entityId: string) => {\n let dataQuery = items.query(collectionId).eq('_id', entityId);\n if (allReferenceFieldIds.length > 0) {\n dataQuery = dataQuery.include(...allReferenceFieldIds);\n }\n\n const res = await dataQuery.find({ returnTotalCount: false });\n const entity = res.items[0];\n\n if (!entity) {\n throw new Error(`Entity not found: ${entityId}`);\n }\n\n return entity;\n },\n\n create: async (entity) => {\n const created = await items.insert(collectionId, entity);\n const createdId = created._id as string;\n\n if (createdId) {\n await updateMultiReferences(\n collectionId,\n createdId,\n entity as Record<string, unknown>,\n multiReferenceFields,\n );\n }\n\n return { ...entity, _id: createdId };\n },\n\n update: async (entity) => {\n await items.update(\n collectionId,\n entity as typeof entity & { _id: string },\n );\n\n const entityId = entity._id as string;\n\n if (entityId) {\n await updateMultiReferences(\n collectionId,\n entityId,\n entity,\n multiReferenceFields,\n );\n }\n\n return entity;\n },\n\n delete: (entityId) => items.remove(collectionId, entityId),\n bulkDelete: (entityIds) => items.bulkRemove(collectionId, entityIds),\n\n find: async (\n query,\n options: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n } = {},\n ) => {\n return fetchCmsData(collectionId, query, transformedFields, options);\n },\n },\n };\n\n return schemaConfig;\n}\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,KAAK,QAAQ,WAAW;AAC9C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;;AAE9C;AACA;AACA;AACA,MAAMC,cAAc,GAAG,OAA2B;AAElD,OAAO,MAAMC,+BAEZ,GAAG;EACF,CAACL,WAAW,CAACM,IAAI,CAACC,IAAI,GAAG,YAAY;EACrC,CAACP,WAAW,CAACM,IAAI,CAACE,IAAI,GAAG,MAAM;EAC/B,CAACR,WAAW,CAACM,IAAI,CAACG,QAAQ,GAAG,UAAU;EACvC,CAACT,WAAW,CAACM,IAAI,CAACI,IAAI,GAAG,MAAM;EAC/B,CAACV,WAAW,CAACM,IAAI,CAACK,MAAM,GAAG,QAAQ;EACnC,CAACX,WAAW,CAACM,IAAI,CAACM,OAAO,GAAG,SAAS;EACrC,CAACZ,WAAW,CAACM,IAAI,CAACO,GAAG,GAAG,KAAK;EAC7B,CAACb,WAAW,CAACM,IAAI,CAACQ,OAAO,GAAG,SAAS;EACrC,CAACd,WAAW,CAACM,IAAI,CAACS,MAAM,GAAG,QAAQ;EACnC,CAACf,WAAW,CAACM,IAAI,CAACU,SAAS,GAAG,WAAW;EACzC,CAAChB,WAAW,CAACM,IAAI,CAACW,YAAY,GAAG,cAAc;EAC/C,CAACjB,WAAW,CAACM,IAAI,CAACY,KAAK,GAAG,OAAO;EACjC,CAAClB,WAAW,CAACM,IAAI,CAACa,YAAY,GAAG,OAAO;EACxC,CAACnB,WAAW,CAACM,IAAI,CAACc,SAAS,GA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,CAACW,GAAa;QAErC,IAAIZ,QAAQ,EAAE;UACZ,MAAMD,qBAAqB,CACzBX,YAAY,EACZY,QAAQ,EACRC,MAAM,EACNC,oBACF,CAAC;QACH;QAEA,OAAOD,MAAM;MACf,CAAC;MAEDiE,MAAM,EAAGlE,QAAQ,IAAKvC,KAAK,CAAC0G,MAAM,CAAC/E,YAAY,EAAEY,QAAQ,CAAC;MAC1DoE,UAAU,EAAGC,SAAS,IAAK5G,KAAK,CAAC6G,UAAU,CAAClF,YAAY,EAAEiF,SAAS,CAAC;MAEpEX,IAAI,EAAE,eAAAA,CACJL,KAAK,EACLkB,OAGC,EACE;QAAA,IAJHA,OAGC;UAHDA,OAGC,GAAG,CAAC,CAAC;QAAA;QAEN,OAAO7G,YAAY,CAAC0B,YAAY,EAAEiE,KAAK,EAAEtC,iBAAiB,EAAEwD,OAAO,CAAC;MACtE;IACF;EACF,CAAC;EAED,OAAOxB,YAAY;AACrB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["collections","items","fetchCmsData","errorHandler","createCmsBackupConfig","CMS_EMAIL_TYPE","CmsFieldTypeToPatternsFieldType","Type","TEXT","DATE","DATETIME","TIME","NUMBER","BOOLEAN","URL","ADDRESS","OBJECT","RICH_TEXT","RICH_CONTENT","ARRAY","ARRAY_STRING","REFERENCE","MULTI_REFERENCE","IMAGE","MEDIA_GALLERY","DOCUMENT","ARRAY_DOCUMENT","AUDIO","LEGACY_COLOR","fetchCmsSchema","collectionId","schema","withErrorHandler","getDataCollection","getReferenceFields","fields","Object","values","filter","f","type","updateMultiReferences","entityId","entity","multiReferenceFields","Promise","all","map","field","rawValue","id","multipleReferenceValues","multipleReferenceIds","value","_id","replaceReferences","transformCmsSchema","transformedFields","reduce","acc","_field$capabilities","_field$capabilities2","_field$typeMetadata","_field$typeMetadata2","key","fieldType","baseField","displayName","validation","numberRange","min","undefined","max","stringLengthRange","minLength","maxLength","required","capabilities","supportedQueryOperators","queryOperators","sortable","referencedCollectionId","typeMetadata","reference","multiReference","isReference","referenceMetadata","referenceFields","allReferenceFieldIds","schemaConfig","displayField","idField","actions","get","dataQuery","query","eq","length","include","res","find","returnTotalCount","Error","create","created","insert","createdId","update","delete","remove","bulkDelete","entityIds","bulkRemove","options","backup","bulkInsert","entities","inserted","updated","errors","succeeded","failed","e","rowIndex","originalIndex","message","code"],"sources":["../../../../src/dataSourceAdapters/cms/cmsAdapter.ts"],"sourcesContent":["import { Field, PatternsFieldType, SchemaConfig } from '../../types';\nimport { collections, items } from '@wix/data';\nimport { fetchCmsData } from './fetchCmsData';\nimport { errorHandler } from '@wix/essentials';\nimport { createCmsBackupConfig } from './cmsBackup';\n\n// The CMS backend returns 'EMAIL' as a field type but the @wix/data SDK\n// doesn't expose it in collections.Type. We use a string literal as a workaround until the SDK is updated.\n// TODO: remove this once the SDK is updated\nconst CMS_EMAIL_TYPE = 'EMAIL' as collections.Type;\n\nexport const CmsFieldTypeToPatternsFieldType: Partial<\n Record<collections.Type, PatternsFieldType>\n> = {\n [collections.Type.TEXT]: 'SHORT_TEXT',\n [collections.Type.DATE]: 'DATE',\n [collections.Type.DATETIME]: 'DATETIME',\n [collections.Type.TIME]: 'TIME',\n [collections.Type.NUMBER]: 'NUMBER',\n [collections.Type.BOOLEAN]: 'BOOLEAN',\n [collections.Type.URL]: 'URL',\n [collections.Type.ADDRESS]: 'ADDRESS',\n [collections.Type.OBJECT]: 'OBJECT',\n [collections.Type.RICH_TEXT]: 'RICH_TEXT',\n [collections.Type.RICH_CONTENT]: 'RICH_CONTENT',\n [collections.Type.ARRAY]: 'ARRAY',\n [collections.Type.ARRAY_STRING]: 'ARRAY',\n [collections.Type.REFERENCE]: 'REFERENCE',\n [collections.Type.MULTI_REFERENCE]: 'MULTI_REFERENCE',\n [collections.Type.IMAGE]: 'IMAGE',\n [collections.Type.MEDIA_GALLERY]: 'MEDIA_GALLERY',\n [collections.Type.DOCUMENT]: 'DOCUMENT',\n [collections.Type.ARRAY_DOCUMENT]: 'MULTI_DOCUMENT',\n [collections.Type.AUDIO]: 'AUDIO',\n [CMS_EMAIL_TYPE]: 'EMAIL',\n [collections.Type.LEGACY_COLOR]: 'COLOR',\n};\n\nexport async function fetchCmsSchema(\n collectionId: string,\n): Promise<collections.DataCollection> {\n const schema = await errorHandler.withErrorHandler(\n async () => collections.getDataCollection(collectionId),\n {},\n );\n return schema;\n}\n\nconst getReferenceFields = (fields: Record<string, Field>) =>\n Object.values(fields).filter(\n (f): f is Field => f?.type === 'REFERENCE' || f?.type === 'MULTI_REFERENCE',\n );\n\nconst updateMultiReferences = async (\n collectionId: string,\n entityId: string,\n entity: Record<string, any>,\n multiReferenceFields: Field[],\n) => {\n await Promise.all(\n multiReferenceFields.map(async (field) => {\n const rawValue = entity[field.id];\n const multipleReferenceValues = rawValue as Record<string, unknown>[];\n const multipleReferenceIds = multipleReferenceValues.map(\n (value) => value._id as string,\n );\n\n await items.replaceReferences(\n collectionId,\n field.id,\n entityId,\n multipleReferenceIds,\n );\n }),\n );\n};\n\nexport function transformCmsSchema(\n schema: collections.DataCollection,\n): SchemaConfig {\n const collectionId = schema._id as string;\n\n const transformedFields = (schema.fields || []).reduce<Record<string, Field>>(\n (acc, field) => {\n if (!field.key) {\n return acc;\n }\n\n const fieldType = field.type\n ? CmsFieldTypeToPatternsFieldType[field.type] || 'SHORT_TEXT'\n : 'SHORT_TEXT';\n const baseField = {\n id: field.key,\n displayName: field.displayName || '',\n validation: {\n numberRange: field.numberRange\n ? {\n min: field.numberRange.min ?? undefined,\n max: field.numberRange.max ?? undefined,\n }\n : undefined,\n stringLengthRange: field.stringLengthRange\n ? {\n minLength: field.stringLengthRange.minLength ?? undefined,\n maxLength: field.stringLengthRange.maxLength ?? undefined,\n }\n : undefined,\n required: field.required ?? false,\n },\n capabilities: {\n supportedQueryOperators: field.capabilities?.queryOperators || [],\n sortable: field.capabilities?.sortable || false,\n },\n };\n\n const referencedCollectionId =\n field.typeMetadata?.reference?.referencedCollectionId ??\n field.typeMetadata?.multiReference?.referencedCollectionId;\n\n const isReference =\n fieldType === 'REFERENCE' || fieldType === 'MULTI_REFERENCE';\n\n if (isReference && referencedCollectionId) {\n acc[field.key] = {\n ...baseField,\n type: fieldType as 'REFERENCE' | 'MULTI_REFERENCE',\n referenceMetadata: { referencedCollectionId },\n };\n } else {\n acc[field.key] = {\n ...baseField,\n type: isReference ? 'SHORT_TEXT' : fieldType,\n };\n }\n\n return acc;\n },\n {},\n );\n\n const referenceFields = getReferenceFields(transformedFields);\n const multiReferenceFields = referenceFields.filter(\n (f) => f.type === 'MULTI_REFERENCE',\n );\n const allReferenceFieldIds = referenceFields.map((f) => f.id);\n\n const schemaConfig: SchemaConfig = {\n id: collectionId,\n displayField: schema.displayField ?? '_id',\n idField: '_id',\n fields: transformedFields,\n actions: {\n get: async (entityId: string) => {\n let dataQuery = items.query(collectionId).eq('_id', entityId);\n if (allReferenceFieldIds.length > 0) {\n dataQuery = dataQuery.include(...allReferenceFieldIds);\n }\n\n const res = await dataQuery.find({ returnTotalCount: false });\n const entity = res.items[0];\n\n if (!entity) {\n throw new Error(`Entity not found: ${entityId}`);\n }\n\n return entity;\n },\n\n create: async (entity) => {\n const created = await items.insert(collectionId, entity);\n const createdId = created._id as string;\n\n if (createdId) {\n await updateMultiReferences(\n collectionId,\n createdId,\n entity as Record<string, unknown>,\n multiReferenceFields,\n );\n }\n\n return { ...entity, _id: createdId };\n },\n\n update: async (entity) => {\n await items.update(\n collectionId,\n entity as typeof entity & { _id: string },\n );\n\n const entityId = entity._id as string;\n\n if (entityId) {\n await updateMultiReferences(\n collectionId,\n entityId,\n entity,\n multiReferenceFields,\n );\n }\n\n return entity;\n },\n\n delete: (entityId) => items.remove(collectionId, entityId),\n bulkDelete: (entityIds) => items.bulkRemove(collectionId, entityIds),\n\n find: async (\n query,\n options: {\n searchableFieldIds?: string[];\n filterFieldMapping?: Record<string, { fieldId: string }>;\n } = {},\n ) => {\n return fetchCmsData(collectionId, query, transformedFields, options);\n },\n backup: createCmsBackupConfig(),\n bulkInsert: async (entities) => {\n const { inserted, updated, errors } =\n await errorHandler.withErrorHandler(\n async () => items.bulkInsert(collectionId, entities),\n {},\n );\n\n return {\n succeeded: inserted + updated,\n failed: errors.length,\n errors: errors.map((e) => ({\n rowIndex: e.originalIndex,\n message: e.message,\n code: e.code,\n })),\n };\n },\n },\n };\n\n return schemaConfig;\n}\n"],"mappings":"AACA,SAASA,WAAW,EAAEC,KAAK,QAAQ,WAAW;AAC9C,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,YAAY,QAAQ,iBAAiB;AAC9C,SAASC,qBAAqB,QAAQ,aAAa;;AAEnD;AACA;AACA;AACA,MAAMC,cAAc,GAAG,OAA2B;AAElD,OAAO,MAAMC,+BAEZ,GAAG;EACF,CAACN,WAAW,CAACO,IAAI,CAACC,IAAI,GAAG,YAAY;EACrC,CAACR,WAAW,CAACO,IAAI,CAACE,IAAI,GAAG,MAAM;EAC/B,CAACT,WAAW,CAACO,IAAI,CAACG,QAAQ,GAAG,UAAU;EACvC,CAACV,WAAW,CAACO,IAAI,CAACI,IAAI,GAAG,MAAM;EAC/B,CAACX,WAAW,CAACO,IAAI,CAACK,MAAM,GAAG,QAAQ;EACnC,CAACZ,WAAW,CAACO,IAAI,CAACM,OAAO,GAAG,SAAS;EACrC,CAACb,WAAW,CAACO,IAAI,CAACO,GAAG,GAAG,KAAK;EAC7B,CAACd,WAAW,CAACO,IAAI,CAACQ,OAAO,GAAG,SAAS;EACrC,CAACf,WAAW,CAACO,IAAI,CAACS,MAAM,GAAG,QAAQ;EACnC,CAAChB,WAAW,CAACO,IAAI,CAACU,SAAS,GAAG,WAAW;EACzC,CAACjB,WAAW,CAACO,IAAI,CAACW,YAAY,GAAG,cAAc;EAC/C,CAAClB,WAAW,CAACO,IAAI,CAACY,KAAK,GAAG,OAAO;EACjC,CAACnB,WAAW,CAACO,IAAI,CAACa,YAAY,GAAG,OAAO;EACxC,CAACpB,WAAW,CAACO,IAAI,CAACc,SA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List":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { backups } from '@wix/data';
|
|
2
|
+
import { errorHandler } from '@wix/essentials';
|
|
3
|
+
import { pollUntilReady } from '../../utils/backupPolling';
|
|
4
|
+
export function createCmsBackupConfig() {
|
|
5
|
+
return {
|
|
6
|
+
restore: async backupId => {
|
|
7
|
+
var _response$restoration;
|
|
8
|
+
const response = await errorHandler.withErrorHandler(async () => backups.restoreBackup(backupId), {});
|
|
9
|
+
return {
|
|
10
|
+
restorationId: response == null || (_response$restoration = response.restoration) == null ? void 0 : _response$restoration._id
|
|
11
|
+
};
|
|
12
|
+
},
|
|
13
|
+
waitForRestoration: async (restorationId, options) => {
|
|
14
|
+
await pollUntilReady(async () => {
|
|
15
|
+
const {
|
|
16
|
+
restorations: list
|
|
17
|
+
} = await errorHandler.withErrorHandler(() => backups.listRestorations(), {});
|
|
18
|
+
const found = list == null ? void 0 : list.find(r => r._id === restorationId);
|
|
19
|
+
return (found == null ? void 0 : found.status) === 'COMPLETED' || (found == null ? void 0 : found.status) === 'FAILED';
|
|
20
|
+
}, {
|
|
21
|
+
signal: options == null ? void 0 : options.signal
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
create: async () => {
|
|
25
|
+
var _response$backup;
|
|
26
|
+
const response = await errorHandler.withErrorHandler(async () => backups.createBackup(), {});
|
|
27
|
+
return {
|
|
28
|
+
backupId: response == null || (_response$backup = response.backup) == null ? void 0 : _response$backup._id
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
waitForCompletion: async (backupId, options) => {
|
|
32
|
+
await pollUntilReady(async () => {
|
|
33
|
+
const {
|
|
34
|
+
backups: list
|
|
35
|
+
} = await errorHandler.withErrorHandler(() => backups.listBackups(), {});
|
|
36
|
+
const found = list == null ? void 0 : list.find(b => b._id === backupId);
|
|
37
|
+
return (found == null ? void 0 : found.status) === 'READY' || (found == null ? void 0 : found.status) === 'FAILED';
|
|
38
|
+
}, {
|
|
39
|
+
signal: options == null ? void 0 : options.signal
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=cmsBackup.js.map
|