@webiny/app-dynamic-pages 5.42.0-beta.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/LICENSE +21 -0
- package/README.md +20 -0
- package/admin/ContentEntryForm/AddPreviewPane.d.ts +2 -0
- package/admin/ContentEntryForm/AddPreviewPane.js +52 -0
- package/admin/ContentEntryForm/AddPreviewPane.js.map +1 -0
- package/admin/ContentEntryForm/PassEntryToDataSource.d.ts +2 -0
- package/admin/ContentEntryForm/PassEntryToDataSource.js +78 -0
- package/admin/ContentEntryForm/PassEntryToDataSource.js.map +1 -0
- package/admin/ContentEntryForm/PreviewPane.d.ts +6 -0
- package/admin/ContentEntryForm/PreviewPane.js +65 -0
- package/admin/ContentEntryForm/PreviewPane.js.map +1 -0
- package/admin/Extensions.d.ts +2 -0
- package/admin/Extensions.js +23 -0
- package/admin/Extensions.js.map +1 -0
- package/admin/PageTemplateDialog/CreateTemplateDialog.d.ts +11 -0
- package/admin/PageTemplateDialog/CreateTemplateDialog.js +203 -0
- package/admin/PageTemplateDialog/CreateTemplateDialog.js.map +1 -0
- package/admin/PageTemplateDialog/PageTemplateDialog.d.ts +2 -0
- package/admin/PageTemplateDialog/PageTemplateDialog.js +55 -0
- package/admin/PageTemplateDialog/PageTemplateDialog.js.map +1 -0
- package/admin/SetupDynamicPages.d.ts +2 -0
- package/admin/SetupDynamicPages.js +23 -0
- package/admin/SetupDynamicPages.js.map +1 -0
- package/admin/elements/Elements.d.ts +2 -0
- package/admin/elements/Elements.js +19 -0
- package/admin/elements/Elements.js.map +1 -0
- package/admin/elements/entriesList.d.ts +2 -0
- package/admin/elements/entriesList.js +42 -0
- package/admin/elements/entriesList.js.map +1 -0
- package/admin/elements/entriesSearch.d.ts +2 -0
- package/admin/elements/entriesSearch.js +41 -0
- package/admin/elements/entriesSearch.js.map +1 -0
- package/admin/elements/eventHandlers/ContentTraverser.d.ts +11 -0
- package/admin/elements/eventHandlers/ContentTraverser.js +35 -0
- package/admin/elements/eventHandlers/ContentTraverser.js.map +1 -0
- package/admin/elements/renderers/DynamicGrid.d.ts +2 -0
- package/admin/elements/renderers/DynamicGrid.js +55 -0
- package/admin/elements/renderers/DynamicGrid.js.map +1 -0
- package/admin/elements/renderers/EntriesList.d.ts +10 -0
- package/admin/elements/renderers/EntriesList.js +30 -0
- package/admin/elements/renderers/EntriesList.js.map +1 -0
- package/admin/elements/renderers/Repeater.d.ts +7 -0
- package/admin/elements/renderers/Repeater.js +29 -0
- package/admin/elements/renderers/Repeater.js.map +1 -0
- package/admin/elements/repeater.d.ts +2 -0
- package/admin/elements/repeater.js +41 -0
- package/admin/elements/repeater.js.map +1 -0
- package/admin/index.d.ts +1 -0
- package/admin/index.js +14 -0
- package/admin/index.js.map +1 -0
- package/admin/pageEditor/DynamicPageEditorConfig.d.ts +2 -0
- package/admin/pageEditor/DynamicPageEditorConfig.js +17 -0
- package/admin/pageEditor/DynamicPageEditorConfig.js.map +1 -0
- package/admin/pageEditor/ElementEventHandlers.d.ts +1 -0
- package/admin/pageEditor/ElementEventHandlers.js +107 -0
- package/admin/pageEditor/ElementEventHandlers.js.map +1 -0
- package/admin/templateEditor/DynamicTemplateEditorConfig.d.ts +2 -0
- package/admin/templateEditor/DynamicTemplateEditorConfig.js +31 -0
- package/admin/templateEditor/DynamicTemplateEditorConfig.js.map +1 -0
- package/admin/templateEditor/ElementEventHandlers.d.ts +1 -0
- package/admin/templateEditor/ElementEventHandlers.js +107 -0
- package/admin/templateEditor/ElementEventHandlers.js.map +1 -0
- package/admin/templateEditor/EntrySelector/EntrySelector.d.ts +2 -0
- package/admin/templateEditor/EntrySelector/EntrySelector.js +38 -0
- package/admin/templateEditor/EntrySelector/EntrySelector.js.map +1 -0
- package/admin/templateEditor/EntrySelector/index.d.ts +1 -0
- package/admin/templateEditor/EntrySelector/index.js +18 -0
- package/admin/templateEditor/EntrySelector/index.js.map +1 -0
- package/dataInjection/AddEntriesListDataSourceContext.d.ts +2 -0
- package/dataInjection/AddEntriesListDataSourceContext.js +33 -0
- package/dataInjection/AddEntriesListDataSourceContext.js.map +1 -0
- package/dataInjection/editor/DisableGridDelete.d.ts +2 -0
- package/dataInjection/editor/DisableGridDelete.js +23 -0
- package/dataInjection/editor/DisableGridDelete.js.map +1 -0
- package/dataInjection/editor/ElementDataSettings.d.ts +2 -0
- package/dataInjection/editor/ElementDataSettings.js +28 -0
- package/dataInjection/editor/ElementDataSettings.js.map +1 -0
- package/dataInjection/editor/HideIfChildOfEntriesList.d.ts +6 -0
- package/dataInjection/editor/HideIfChildOfEntriesList.js +24 -0
- package/dataInjection/editor/HideIfChildOfEntriesList.js.map +1 -0
- package/dataInjection/editor/HideIfEntriesListGridWithDataSource.d.ts +6 -0
- package/dataInjection/editor/HideIfEntriesListGridWithDataSource.js +31 -0
- package/dataInjection/editor/HideIfEntriesListGridWithDataSource.js.map +1 -0
- package/dataInjection/editor/SetupElementDataSettings.d.ts +2 -0
- package/dataInjection/editor/SetupElementDataSettings.js +19 -0
- package/dataInjection/editor/SetupElementDataSettings.js.map +1 -0
- package/dataInjection/renderers/DynamicElementRenderers.d.ts +2 -0
- package/dataInjection/renderers/DynamicElementRenderers.js +27 -0
- package/dataInjection/renderers/DynamicElementRenderers.js.map +1 -0
- package/dataInjection/renderers/DynamicGrid.d.ts +2 -0
- package/dataInjection/renderers/DynamicGrid.js +50 -0
- package/dataInjection/renderers/DynamicGrid.js.map +1 -0
- package/dataInjection/renderers/EntriesList.d.ts +70 -0
- package/dataInjection/renderers/EntriesList.js +51 -0
- package/dataInjection/renderers/EntriesList.js.map +1 -0
- package/dataInjection/renderers/EntriesSearch.d.ts +47 -0
- package/dataInjection/renderers/EntriesSearch.js +38 -0
- package/dataInjection/renderers/EntriesSearch.js.map +1 -0
- package/dataInjection/renderers/Repeater.d.ts +70 -0
- package/dataInjection/renderers/Repeater.js +51 -0
- package/dataInjection/renderers/Repeater.js.map +1 -0
- package/features/index.d.ts +3 -0
- package/features/index.js +40 -0
- package/features/index.js.map +1 -0
- package/features/pageTemplate/createDynamicTemplate/useCreateDynamicTemplate.d.ts +4 -0
- package/features/pageTemplate/createDynamicTemplate/useCreateDynamicTemplate.js +65 -0
- package/features/pageTemplate/createDynamicTemplate/useCreateDynamicTemplate.js.map +1 -0
- package/features/pageTemplate/hasMainDataSource.d.ts +2 -0
- package/features/pageTemplate/hasMainDataSource.js +13 -0
- package/features/pageTemplate/hasMainDataSource.js.map +1 -0
- package/features/pageTemplate/listDynamicTemplates/useListDynamicTemplates.d.ts +3 -0
- package/features/pageTemplate/listDynamicTemplates/useListDynamicTemplates.js +20 -0
- package/features/pageTemplate/listDynamicTemplates/useListDynamicTemplates.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ElementInput } from "@webiny/app-page-builder-elements";
|
|
3
|
+
import { GenericRecord } from "@webiny/app/types";
|
|
4
|
+
export declare const elementInputs: {
|
|
5
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
6
|
+
};
|
|
7
|
+
interface EntriesListRendererProps {
|
|
8
|
+
ifEmpty?: JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export declare const EntriesListRenderer: React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & EntriesListRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
11
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
12
|
+
}>> & {
|
|
13
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<EntriesListRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
16
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
17
|
+
}>, Record<string, any>>;
|
|
18
|
+
originalName: string;
|
|
19
|
+
displayName: string;
|
|
20
|
+
} & {
|
|
21
|
+
original: React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & EntriesListRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
22
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
23
|
+
}>> & {
|
|
24
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
25
|
+
} & {
|
|
26
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<EntriesListRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
27
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
28
|
+
}>, Record<string, any>>;
|
|
29
|
+
originalName: string;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
originalName: string;
|
|
33
|
+
displayName: string;
|
|
34
|
+
} & {
|
|
35
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & EntriesListRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
36
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
37
|
+
}>> & {
|
|
38
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<EntriesListRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
41
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
42
|
+
}>, Record<string, any>>;
|
|
43
|
+
originalName: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
46
|
+
} & {
|
|
47
|
+
Component: React.FunctionComponent<EntriesListRendererProps> & {
|
|
48
|
+
original: React.FunctionComponent<EntriesListRendererProps>;
|
|
49
|
+
originalName: string;
|
|
50
|
+
displayName: string;
|
|
51
|
+
} & {
|
|
52
|
+
original: React.FunctionComponent<EntriesListRendererProps> & {
|
|
53
|
+
original: React.FunctionComponent<EntriesListRendererProps>;
|
|
54
|
+
originalName: string;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
57
|
+
originalName: string;
|
|
58
|
+
displayName: string;
|
|
59
|
+
} & {
|
|
60
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<React.FunctionComponent<EntriesListRendererProps> & {
|
|
61
|
+
original: React.FunctionComponent<EntriesListRendererProps>;
|
|
62
|
+
originalName: string;
|
|
63
|
+
displayName: string;
|
|
64
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
65
|
+
};
|
|
66
|
+
inputs?: {
|
|
67
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
68
|
+
} | undefined;
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.elementInputs = exports.EntriesListRenderer = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _appPageBuilderElements = require("@webiny/app-page-builder-elements");
|
|
10
|
+
var _dataInjection = require("@webiny/app-page-builder/dataInjection");
|
|
11
|
+
var elementInputs = exports.elementInputs = {
|
|
12
|
+
dataSource: _appPageBuilderElements.ElementInput.create({
|
|
13
|
+
name: "dataSource",
|
|
14
|
+
type: "array",
|
|
15
|
+
translatable: false,
|
|
16
|
+
getDefaultValue: function getDefaultValue() {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
var EntriesListRenderer = exports.EntriesListRenderer = (0, _appPageBuilderElements.createRenderer)(function (_ref) {
|
|
22
|
+
var _ref$ifEmpty = _ref.ifEmpty,
|
|
23
|
+
ifEmpty = _ref$ifEmpty === void 0 ? null : _ref$ifEmpty;
|
|
24
|
+
var _useRenderer = (0, _appPageBuilderElements.useRenderer)(),
|
|
25
|
+
getElement = _useRenderer.getElement,
|
|
26
|
+
getInputValues = _useRenderer.getInputValues;
|
|
27
|
+
var element = getElement();
|
|
28
|
+
var inputs = getInputValues();
|
|
29
|
+
var dataSources = inputs.dataSource || [];
|
|
30
|
+
if (element.elements.length === 0) {
|
|
31
|
+
return ifEmpty;
|
|
32
|
+
}
|
|
33
|
+
if (!dataSources.length) {
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_appPageBuilderElements.Elements, {
|
|
35
|
+
element: element
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, dataSources.map(function (dataSource, index) {
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_dataInjection.DataSourceDataProvider, {
|
|
40
|
+
dataSource: dataSource,
|
|
41
|
+
key: index
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_appPageBuilderElements.Elements, {
|
|
43
|
+
element: element,
|
|
44
|
+
elementKeyPrefix: index.toString()
|
|
45
|
+
}));
|
|
46
|
+
}));
|
|
47
|
+
}, {
|
|
48
|
+
inputs: elementInputs
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=EntriesList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_appPageBuilderElements","_dataInjection","elementInputs","exports","dataSource","ElementInput","create","name","type","translatable","getDefaultValue","EntriesListRenderer","createRenderer","_ref","_ref$ifEmpty","ifEmpty","_useRenderer","useRenderer","getElement","getInputValues","element","inputs","dataSources","elements","length","default","createElement","Elements","Fragment","map","index","DataSourceDataProvider","key","elementKeyPrefix","toString"],"sources":["EntriesList.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n createRenderer,\n ElementInput,\n Elements,\n useRenderer\n} from \"@webiny/app-page-builder-elements\";\nimport { GenericRecord } from \"@webiny/app/types\";\nimport { DataSourceDataProvider } from \"@webiny/app-page-builder/dataInjection\";\n\nexport const elementInputs = {\n dataSource: ElementInput.create<GenericRecord[]>({\n name: \"dataSource\",\n type: \"array\",\n translatable: false,\n getDefaultValue() {\n return [];\n }\n })\n};\n\ninterface EntriesListRendererProps {\n ifEmpty?: JSX.Element;\n}\n\nexport const EntriesListRenderer = createRenderer<EntriesListRendererProps, typeof elementInputs>(\n ({ ifEmpty = null }) => {\n const { getElement, getInputValues } = useRenderer();\n\n const element = getElement();\n const inputs = getInputValues<typeof elementInputs>();\n const dataSources = inputs.dataSource || [];\n\n if (element.elements.length === 0) {\n return ifEmpty;\n }\n\n if (!dataSources.length) {\n return <Elements element={element} />;\n }\n\n return (\n <>\n {dataSources.map((dataSource, index) => {\n return (\n <DataSourceDataProvider dataSource={dataSource} key={index}>\n <Elements element={element} elementKeyPrefix={index.toString()} />\n </DataSourceDataProvider>\n );\n })}\n </>\n );\n },\n {\n inputs: elementInputs\n }\n);\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAOA,IAAAE,cAAA,GAAAF,OAAA;AAEO,IAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EACzBE,UAAU,EAAEC,oCAAY,CAACC,MAAM,CAAkB;IAC7CC,IAAI,EAAE,YAAY;IAClBC,IAAI,EAAE,OAAO;IACbC,YAAY,EAAE,KAAK;IACnBC,eAAe,WAAfA,eAAeA,CAAA,EAAG;MACd,OAAO,EAAE;IACb;EACJ,CAAC;AACL,CAAC;AAMM,IAAMC,mBAAmB,GAAAR,OAAA,CAAAQ,mBAAA,GAAG,IAAAC,sCAAc,EAC7C,UAAAC,IAAA,EAAwB;EAAA,IAAAC,YAAA,GAAAD,IAAA,CAArBE,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,IAAI,GAAAA,YAAA;EACb,IAAAE,YAAA,GAAuC,IAAAC,mCAAW,EAAC,CAAC;IAA5CC,UAAU,GAAAF,YAAA,CAAVE,UAAU;IAAEC,cAAc,GAAAH,YAAA,CAAdG,cAAc;EAElC,IAAMC,OAAO,GAAGF,UAAU,CAAC,CAAC;EAC5B,IAAMG,MAAM,GAAGF,cAAc,CAAuB,CAAC;EACrD,IAAMG,WAAW,GAAGD,MAAM,CAACjB,UAAU,IAAI,EAAE;EAE3C,IAAIgB,OAAO,CAACG,QAAQ,CAACC,MAAM,KAAK,CAAC,EAAE;IAC/B,OAAOT,OAAO;EAClB;EAEA,IAAI,CAACO,WAAW,CAACE,MAAM,EAAE;IACrB,oBAAO3B,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAAC1B,uBAAA,CAAA2B,QAAQ;MAACP,OAAO,EAAEA;IAAQ,CAAE,CAAC;EACzC;EAEA,oBACIvB,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAAA7B,MAAA,CAAA4B,OAAA,CAAAG,QAAA,QACKN,WAAW,CAACO,GAAG,CAAC,UAACzB,UAAU,EAAE0B,KAAK,EAAK;IACpC,oBACIjC,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAACzB,cAAA,CAAA8B,sBAAsB;MAAC3B,UAAU,EAAEA,UAAW;MAAC4B,GAAG,EAAEF;IAAM,gBACvDjC,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAAC1B,uBAAA,CAAA2B,QAAQ;MAACP,OAAO,EAAEA,OAAQ;MAACa,gBAAgB,EAAEH,KAAK,CAACI,QAAQ,CAAC;IAAE,CAAE,CAC7C,CAAC;EAEjC,CAAC,CACH,CAAC;AAEX,CAAC,EACD;EACIb,MAAM,EAAEnB;AACZ,CACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const EntriesSearchRenderer: React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & Record<string, any> & import("@webiny/app-page-builder-elements").Inputs<import("@webiny/app-page-builder-elements").ElementInputs>> & {
|
|
3
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
4
|
+
} & {
|
|
5
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<Record<string, any> & import("@webiny/app-page-builder-elements").Inputs<import("@webiny/app-page-builder-elements").ElementInputs>, Record<string, any>>;
|
|
6
|
+
originalName: string;
|
|
7
|
+
displayName: string;
|
|
8
|
+
} & {
|
|
9
|
+
original: React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & Record<string, any> & import("@webiny/app-page-builder-elements").Inputs<import("@webiny/app-page-builder-elements").ElementInputs>> & {
|
|
10
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
11
|
+
} & {
|
|
12
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<Record<string, any> & import("@webiny/app-page-builder-elements").Inputs<import("@webiny/app-page-builder-elements").ElementInputs>, Record<string, any>>;
|
|
13
|
+
originalName: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
originalName: string;
|
|
17
|
+
displayName: string;
|
|
18
|
+
} & {
|
|
19
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & Record<string, any> & import("@webiny/app-page-builder-elements").Inputs<import("@webiny/app-page-builder-elements").ElementInputs>> & {
|
|
20
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
21
|
+
} & {
|
|
22
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<Record<string, any> & import("@webiny/app-page-builder-elements").Inputs<import("@webiny/app-page-builder-elements").ElementInputs>, Record<string, any>>;
|
|
23
|
+
originalName: string;
|
|
24
|
+
displayName: string;
|
|
25
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
26
|
+
} & {
|
|
27
|
+
Component: React.FunctionComponent<Record<string, any>> & {
|
|
28
|
+
original: React.FunctionComponent<Record<string, any>>;
|
|
29
|
+
originalName: string;
|
|
30
|
+
displayName: string;
|
|
31
|
+
} & {
|
|
32
|
+
original: React.FunctionComponent<Record<string, any>> & {
|
|
33
|
+
original: React.FunctionComponent<Record<string, any>>;
|
|
34
|
+
originalName: string;
|
|
35
|
+
displayName: string;
|
|
36
|
+
};
|
|
37
|
+
originalName: string;
|
|
38
|
+
displayName: string;
|
|
39
|
+
} & {
|
|
40
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<React.FunctionComponent<Record<string, any>> & {
|
|
41
|
+
original: React.FunctionComponent<Record<string, any>>;
|
|
42
|
+
originalName: string;
|
|
43
|
+
displayName: string;
|
|
44
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
45
|
+
};
|
|
46
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
47
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.EntriesSearchRenderer = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _appPageBuilderElements = require("@webiny/app-page-builder-elements");
|
|
12
|
+
var _dataInjection = require("@webiny/app-page-builder/dataInjection");
|
|
13
|
+
var EntriesSearchRenderer = exports.EntriesSearchRenderer = (0, _appPageBuilderElements.createRenderer)(function () {
|
|
14
|
+
var data = (0, _dataInjection.useDataSource)();
|
|
15
|
+
var _useState = (0, _react.useState)(""),
|
|
16
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
17
|
+
value = _useState2[0],
|
|
18
|
+
setValue = _useState2[1];
|
|
19
|
+
var onChange = (0, _react.useCallback)(function (e) {
|
|
20
|
+
if (!data) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
var value = e.target.value;
|
|
25
|
+
setValue(value);
|
|
26
|
+
data.loadData({
|
|
27
|
+
search: value !== "" ? value : undefined
|
|
28
|
+
});
|
|
29
|
+
}, [data]);
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
31
|
+
type: "text",
|
|
32
|
+
placeholder: "Search",
|
|
33
|
+
value: value,
|
|
34
|
+
onChange: onChange
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=EntriesSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_appPageBuilderElements","_dataInjection","EntriesSearchRenderer","exports","createRenderer","data","useDataSource","_useState","useState","_useState2","_slicedToArray2","default","value","setValue","onChange","useCallback","e","preventDefault","target","loadData","search","undefined","createElement","type","placeholder"],"sources":["EntriesSearch.tsx"],"sourcesContent":["import React, { ChangeEvent, useCallback, useState } from \"react\";\nimport { createRenderer } from \"@webiny/app-page-builder-elements\";\nimport { useDataSource } from \"@webiny/app-page-builder/dataInjection\";\n\nexport const EntriesSearchRenderer = createRenderer(() => {\n const data = useDataSource();\n const [value, setValue] = useState(\"\");\n\n const onChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n if (!data) {\n return;\n }\n\n e.preventDefault();\n\n const value = e.target.value;\n\n setValue(value);\n\n data.loadData({\n search: value !== \"\" ? value : undefined\n });\n },\n [data]\n );\n\n return <input type={\"text\"} placeholder={\"Search\"} value={value} onChange={onChange} />;\n});\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AAEO,IAAMG,qBAAqB,GAAAC,OAAA,CAAAD,qBAAA,GAAG,IAAAE,sCAAc,EAAC,YAAM;EACtD,IAAMC,IAAI,GAAG,IAAAC,4BAAa,EAAC,CAAC;EAC5B,IAAAC,SAAA,GAA0B,IAAAC,eAAQ,EAAC,EAAE,CAAC;IAAAC,UAAA,OAAAC,eAAA,CAAAC,OAAA,EAAAJ,SAAA;IAA/BK,KAAK,GAAAH,UAAA;IAAEI,QAAQ,GAAAJ,UAAA;EAEtB,IAAMK,QAAQ,GAAG,IAAAC,kBAAW,EACxB,UAACC,CAAgC,EAAK;IAClC,IAAI,CAACX,IAAI,EAAE;MACP;IACJ;IAEAW,CAAC,CAACC,cAAc,CAAC,CAAC;IAElB,IAAML,KAAK,GAAGI,CAAC,CAACE,MAAM,CAACN,KAAK;IAE5BC,QAAQ,CAACD,KAAK,CAAC;IAEfP,IAAI,CAACc,QAAQ,CAAC;MACVC,MAAM,EAAER,KAAK,KAAK,EAAE,GAAGA,KAAK,GAAGS;IACnC,CAAC,CAAC;EACN,CAAC,EACD,CAAChB,IAAI,CACT,CAAC;EAED,oBAAOR,MAAA,CAAAc,OAAA,CAAAW,aAAA;IAAOC,IAAI,EAAE,MAAO;IAACC,WAAW,EAAE,QAAS;IAACZ,KAAK,EAAEA,KAAM;IAACE,QAAQ,EAAEA;EAAS,CAAE,CAAC;AAC3F,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ElementInput } from "@webiny/app-page-builder-elements";
|
|
3
|
+
import { GenericRecord } from "@webiny/app/types";
|
|
4
|
+
export declare const elementInputs: {
|
|
5
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
6
|
+
};
|
|
7
|
+
interface RepeaterRendererProps {
|
|
8
|
+
ifEmpty?: JSX.Element;
|
|
9
|
+
}
|
|
10
|
+
export declare const RepeaterRenderer: React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & RepeaterRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
11
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
12
|
+
}>> & {
|
|
13
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
14
|
+
} & {
|
|
15
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<RepeaterRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
16
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
17
|
+
}>, Record<string, any>>;
|
|
18
|
+
originalName: string;
|
|
19
|
+
displayName: string;
|
|
20
|
+
} & {
|
|
21
|
+
original: React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & RepeaterRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
22
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
23
|
+
}>> & {
|
|
24
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
25
|
+
} & {
|
|
26
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<RepeaterRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
27
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
28
|
+
}>, Record<string, any>>;
|
|
29
|
+
originalName: string;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
originalName: string;
|
|
33
|
+
displayName: string;
|
|
34
|
+
} & {
|
|
35
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<React.FunctionComponent<import("@webiny/app-page-builder-elements/types").RendererProps<Record<string, any>> & RepeaterRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
36
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
37
|
+
}>> & {
|
|
38
|
+
inputs?: import("@webiny/app-page-builder-elements").ElementInputs | undefined;
|
|
39
|
+
} & {
|
|
40
|
+
original: import("@webiny/app-page-builder-elements/types").Renderer<RepeaterRendererProps & import("@webiny/app-page-builder-elements").Inputs<{
|
|
41
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
42
|
+
}>, Record<string, any>>;
|
|
43
|
+
originalName: string;
|
|
44
|
+
displayName: string;
|
|
45
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
46
|
+
} & {
|
|
47
|
+
Component: React.FunctionComponent<RepeaterRendererProps> & {
|
|
48
|
+
original: React.FunctionComponent<RepeaterRendererProps>;
|
|
49
|
+
originalName: string;
|
|
50
|
+
displayName: string;
|
|
51
|
+
} & {
|
|
52
|
+
original: React.FunctionComponent<RepeaterRendererProps> & {
|
|
53
|
+
original: React.FunctionComponent<RepeaterRendererProps>;
|
|
54
|
+
originalName: string;
|
|
55
|
+
displayName: string;
|
|
56
|
+
};
|
|
57
|
+
originalName: string;
|
|
58
|
+
displayName: string;
|
|
59
|
+
} & {
|
|
60
|
+
createDecorator: (decorator: import("@webiny/react-composition").ComponentDecorator<React.FunctionComponent<RepeaterRendererProps> & {
|
|
61
|
+
original: React.FunctionComponent<RepeaterRendererProps>;
|
|
62
|
+
originalName: string;
|
|
63
|
+
displayName: string;
|
|
64
|
+
}>) => (props: unknown) => React.JSX.Element;
|
|
65
|
+
};
|
|
66
|
+
inputs?: {
|
|
67
|
+
dataSource: ElementInput<GenericRecord<import("@webiny/app/types").GenericRecordKey, any>[], any>;
|
|
68
|
+
} | undefined;
|
|
69
|
+
};
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.elementInputs = exports.RepeaterRenderer = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _appPageBuilderElements = require("@webiny/app-page-builder-elements");
|
|
10
|
+
var _dataInjection = require("@webiny/app-page-builder/dataInjection");
|
|
11
|
+
var elementInputs = exports.elementInputs = {
|
|
12
|
+
dataSource: _appPageBuilderElements.ElementInput.create({
|
|
13
|
+
name: "dataSource",
|
|
14
|
+
type: "array",
|
|
15
|
+
translatable: false,
|
|
16
|
+
getDefaultValue: function getDefaultValue() {
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
var RepeaterRenderer = exports.RepeaterRenderer = (0, _appPageBuilderElements.createRenderer)(function (_ref) {
|
|
22
|
+
var _ref$ifEmpty = _ref.ifEmpty,
|
|
23
|
+
ifEmpty = _ref$ifEmpty === void 0 ? null : _ref$ifEmpty;
|
|
24
|
+
var _useRenderer = (0, _appPageBuilderElements.useRenderer)(),
|
|
25
|
+
getElement = _useRenderer.getElement,
|
|
26
|
+
getInputValues = _useRenderer.getInputValues;
|
|
27
|
+
var element = getElement();
|
|
28
|
+
var inputs = getInputValues();
|
|
29
|
+
var dataSources = inputs.dataSource || [];
|
|
30
|
+
if (element.elements.length === 0) {
|
|
31
|
+
return ifEmpty;
|
|
32
|
+
}
|
|
33
|
+
if (!dataSources.length) {
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_appPageBuilderElements.Elements, {
|
|
35
|
+
element: element
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, dataSources.map(function (dataSource, index) {
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_dataInjection.DataSourceDataProvider, {
|
|
40
|
+
dataSource: dataSource,
|
|
41
|
+
key: index
|
|
42
|
+
}, /*#__PURE__*/_react.default.createElement(_appPageBuilderElements.Elements, {
|
|
43
|
+
element: element,
|
|
44
|
+
elementKeyPrefix: index.toString()
|
|
45
|
+
}));
|
|
46
|
+
}));
|
|
47
|
+
}, {
|
|
48
|
+
inputs: elementInputs
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=Repeater.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_appPageBuilderElements","_dataInjection","elementInputs","exports","dataSource","ElementInput","create","name","type","translatable","getDefaultValue","RepeaterRenderer","createRenderer","_ref","_ref$ifEmpty","ifEmpty","_useRenderer","useRenderer","getElement","getInputValues","element","inputs","dataSources","elements","length","default","createElement","Elements","Fragment","map","index","DataSourceDataProvider","key","elementKeyPrefix","toString"],"sources":["Repeater.tsx"],"sourcesContent":["import React from \"react\";\nimport {\n createRenderer,\n ElementInput,\n Elements,\n useRenderer\n} from \"@webiny/app-page-builder-elements\";\nimport { GenericRecord } from \"@webiny/app/types\";\nimport { DataSourceDataProvider } from \"@webiny/app-page-builder/dataInjection\";\n\nexport const elementInputs = {\n dataSource: ElementInput.create<GenericRecord[]>({\n name: \"dataSource\",\n type: \"array\",\n translatable: false,\n getDefaultValue() {\n return [];\n }\n })\n};\n\ninterface RepeaterRendererProps {\n ifEmpty?: JSX.Element;\n}\n\nexport const RepeaterRenderer = createRenderer<RepeaterRendererProps, typeof elementInputs>(\n ({ ifEmpty = null }) => {\n const { getElement, getInputValues } = useRenderer();\n\n const element = getElement();\n const inputs = getInputValues<typeof elementInputs>();\n const dataSources = inputs.dataSource || [];\n\n if (element.elements.length === 0) {\n return ifEmpty;\n }\n\n if (!dataSources.length) {\n return <Elements element={element} />;\n }\n\n return (\n <>\n {dataSources.map((dataSource, index) => {\n return (\n <DataSourceDataProvider dataSource={dataSource} key={index}>\n <Elements element={element} elementKeyPrefix={index.toString()} />\n </DataSourceDataProvider>\n );\n })}\n </>\n );\n },\n {\n inputs: elementInputs\n }\n);\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAOA,IAAAE,cAAA,GAAAF,OAAA;AAEO,IAAMG,aAAa,GAAAC,OAAA,CAAAD,aAAA,GAAG;EACzBE,UAAU,EAAEC,oCAAY,CAACC,MAAM,CAAkB;IAC7CC,IAAI,EAAE,YAAY;IAClBC,IAAI,EAAE,OAAO;IACbC,YAAY,EAAE,KAAK;IACnBC,eAAe,WAAfA,eAAeA,CAAA,EAAG;MACd,OAAO,EAAE;IACb;EACJ,CAAC;AACL,CAAC;AAMM,IAAMC,gBAAgB,GAAAR,OAAA,CAAAQ,gBAAA,GAAG,IAAAC,sCAAc,EAC1C,UAAAC,IAAA,EAAwB;EAAA,IAAAC,YAAA,GAAAD,IAAA,CAArBE,OAAO;IAAPA,OAAO,GAAAD,YAAA,cAAG,IAAI,GAAAA,YAAA;EACb,IAAAE,YAAA,GAAuC,IAAAC,mCAAW,EAAC,CAAC;IAA5CC,UAAU,GAAAF,YAAA,CAAVE,UAAU;IAAEC,cAAc,GAAAH,YAAA,CAAdG,cAAc;EAElC,IAAMC,OAAO,GAAGF,UAAU,CAAC,CAAC;EAC5B,IAAMG,MAAM,GAAGF,cAAc,CAAuB,CAAC;EACrD,IAAMG,WAAW,GAAGD,MAAM,CAACjB,UAAU,IAAI,EAAE;EAE3C,IAAIgB,OAAO,CAACG,QAAQ,CAACC,MAAM,KAAK,CAAC,EAAE;IAC/B,OAAOT,OAAO;EAClB;EAEA,IAAI,CAACO,WAAW,CAACE,MAAM,EAAE;IACrB,oBAAO3B,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAAC1B,uBAAA,CAAA2B,QAAQ;MAACP,OAAO,EAAEA;IAAQ,CAAE,CAAC;EACzC;EAEA,oBACIvB,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAAA7B,MAAA,CAAA4B,OAAA,CAAAG,QAAA,QACKN,WAAW,CAACO,GAAG,CAAC,UAACzB,UAAU,EAAE0B,KAAK,EAAK;IACpC,oBACIjC,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAACzB,cAAA,CAAA8B,sBAAsB;MAAC3B,UAAU,EAAEA,UAAW;MAAC4B,GAAG,EAAEF;IAAM,gBACvDjC,MAAA,CAAA4B,OAAA,CAAAC,aAAA,CAAC1B,uBAAA,CAAA2B,QAAQ;MAACP,OAAO,EAAEA,OAAQ;MAACa,gBAAgB,EAAEH,KAAK,CAACI,QAAQ,CAAC;IAAE,CAAE,CAC7C,CAAC;EAEjC,CAAC,CACH,CAAC;AAEX,CAAC,EACD;EACIb,MAAM,EAAEnB;AACZ,CACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _hasMainDataSource = require("./pageTemplate/hasMainDataSource");
|
|
7
|
+
Object.keys(_hasMainDataSource).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _hasMainDataSource[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function get() {
|
|
13
|
+
return _hasMainDataSource[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _useCreateDynamicTemplate = require("./pageTemplate/createDynamicTemplate/useCreateDynamicTemplate");
|
|
18
|
+
Object.keys(_useCreateDynamicTemplate).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _useCreateDynamicTemplate[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _useCreateDynamicTemplate[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _useListDynamicTemplates = require("./pageTemplate/listDynamicTemplates/useListDynamicTemplates");
|
|
29
|
+
Object.keys(_useListDynamicTemplates).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _useListDynamicTemplates[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function get() {
|
|
35
|
+
return _useListDynamicTemplates[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_hasMainDataSource","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_useCreateDynamicTemplate","_useListDynamicTemplates"],"sources":["index.ts"],"sourcesContent":["export * from \"./pageTemplate/hasMainDataSource\";\nexport * from \"./pageTemplate/createDynamicTemplate/useCreateDynamicTemplate\";\nexport * from \"./pageTemplate/listDynamicTemplates/useListDynamicTemplates\";\n"],"mappings":";;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,kBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,kBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAT,kBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,yBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,yBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,yBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAC,yBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,wBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,wBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,wBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,IAAA;MAAA,OAAAE,wBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useCreateDynamicPageTemplate = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _slugify = _interopRequireDefault(require("slugify"));
|
|
10
|
+
var _features = require("@webiny/app-page-builder/features");
|
|
11
|
+
var _useListDynamicTemplates = require("../listDynamicTemplates/useListDynamicTemplates");
|
|
12
|
+
var useCreateDynamicPageTemplate = exports.useCreateDynamicPageTemplate = function useCreateDynamicPageTemplate() {
|
|
13
|
+
var _useListDynamicTempla = (0, _useListDynamicTemplates.useListDynamicTemplates)(),
|
|
14
|
+
dynamicTemplates = _useListDynamicTempla.dynamicTemplates;
|
|
15
|
+
var _useCreatePageTemplat = (0, _features.useCreatePageTemplate)(),
|
|
16
|
+
createPageTemplate = _useCreatePageTemplat.createPageTemplate;
|
|
17
|
+
var createDynamicPageTemplate = (0, _react.useCallback)(async function (model) {
|
|
18
|
+
var existingDynamicTemplate = dynamicTemplates.find(function (template) {
|
|
19
|
+
var dataSource = template.dataSources.find(function (ds) {
|
|
20
|
+
return ds.name === "main";
|
|
21
|
+
});
|
|
22
|
+
if (!dataSource) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return dataSource.config.modelId === model.modelId;
|
|
26
|
+
});
|
|
27
|
+
if (existingDynamicTemplate) {
|
|
28
|
+
return existingDynamicTemplate;
|
|
29
|
+
}
|
|
30
|
+
var templateSlug = (0, _slugify.default)(model.name, {
|
|
31
|
+
replacement: "-",
|
|
32
|
+
lower: true,
|
|
33
|
+
remove: /[*#\?<>_\{\}\[\]+~.()'"!:;@]/g,
|
|
34
|
+
trim: false
|
|
35
|
+
});
|
|
36
|
+
return createPageTemplate({
|
|
37
|
+
title: "".concat(model.name, " Page Template"),
|
|
38
|
+
slug: templateSlug,
|
|
39
|
+
description: "Dynamic page template",
|
|
40
|
+
tags: ["model:".concat(model.modelId)],
|
|
41
|
+
layout: "static",
|
|
42
|
+
dataSources: [{
|
|
43
|
+
name: "main",
|
|
44
|
+
type: "cms.entry",
|
|
45
|
+
config: {
|
|
46
|
+
modelId: model.modelId
|
|
47
|
+
}
|
|
48
|
+
}],
|
|
49
|
+
dataBindings: [{
|
|
50
|
+
dataSource: "main",
|
|
51
|
+
bindFrom: "title",
|
|
52
|
+
bindTo: "page:title"
|
|
53
|
+
}, {
|
|
54
|
+
dataSource: "main",
|
|
55
|
+
bindFrom: "title",
|
|
56
|
+
bindTo: "page:settings.general.title"
|
|
57
|
+
}]
|
|
58
|
+
});
|
|
59
|
+
}, [dynamicTemplates]);
|
|
60
|
+
return {
|
|
61
|
+
createDynamicPageTemplate: createDynamicPageTemplate
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
//# sourceMappingURL=useCreateDynamicTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_slugify","_interopRequireDefault","_features","_useListDynamicTemplates","useCreateDynamicPageTemplate","exports","_useListDynamicTempla","useListDynamicTemplates","dynamicTemplates","_useCreatePageTemplat","useCreatePageTemplate","createPageTemplate","createDynamicPageTemplate","useCallback","model","existingDynamicTemplate","find","template","dataSource","dataSources","ds","name","config","modelId","templateSlug","slugify","replacement","lower","remove","trim","title","concat","slug","description","tags","layout","type","dataBindings","bindFrom","bindTo"],"sources":["useCreateDynamicTemplate.ts"],"sourcesContent":["import { useCallback } from \"react\";\nimport slugify from \"slugify\";\nimport { CmsModel } from \"@webiny/app-headless-cms/types\";\nimport { useCreatePageTemplate } from \"@webiny/app-page-builder/features\";\nimport { useListDynamicTemplates } from \"~/features/pageTemplate/listDynamicTemplates/useListDynamicTemplates\";\n\nexport const useCreateDynamicPageTemplate = () => {\n const { dynamicTemplates } = useListDynamicTemplates();\n const { createPageTemplate } = useCreatePageTemplate();\n\n const createDynamicPageTemplate = useCallback(\n async (model: CmsModel) => {\n const existingDynamicTemplate = dynamicTemplates.find(template => {\n const dataSource = template.dataSources.find(ds => ds.name === \"main\");\n if (!dataSource) {\n return false;\n }\n\n return dataSource.config.modelId === model.modelId;\n });\n\n if (existingDynamicTemplate) {\n return existingDynamicTemplate;\n }\n\n const templateSlug = slugify(model.name, {\n replacement: \"-\",\n lower: true,\n remove: /[*#\\?<>_\\{\\}\\[\\]+~.()'\"!:;@]/g,\n trim: false\n });\n\n return createPageTemplate({\n title: `${model.name} Page Template`,\n slug: templateSlug,\n description: \"Dynamic page template\",\n tags: [`model:${model.modelId}`],\n layout: \"static\",\n dataSources: [\n {\n name: \"main\",\n type: \"cms.entry\",\n config: {\n modelId: model.modelId\n }\n }\n ],\n dataBindings: [\n {\n dataSource: \"main\",\n bindFrom: \"title\",\n bindTo: \"page:title\"\n },\n {\n dataSource: \"main\",\n bindFrom: \"title\",\n bindTo: \"page:settings.general.title\"\n }\n ]\n });\n },\n [dynamicTemplates]\n );\n\n return { createDynamicPageTemplate };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,wBAAA,GAAAJ,OAAA;AAEO,IAAMK,4BAA4B,GAAAC,OAAA,CAAAD,4BAAA,GAAG,SAA/BA,4BAA4BA,CAAA,EAAS;EAC9C,IAAAE,qBAAA,GAA6B,IAAAC,gDAAuB,EAAC,CAAC;IAA9CC,gBAAgB,GAAAF,qBAAA,CAAhBE,gBAAgB;EACxB,IAAAC,qBAAA,GAA+B,IAAAC,+BAAqB,EAAC,CAAC;IAA9CC,kBAAkB,GAAAF,qBAAA,CAAlBE,kBAAkB;EAE1B,IAAMC,yBAAyB,GAAG,IAAAC,kBAAW,EACzC,gBAAOC,KAAe,EAAK;IACvB,IAAMC,uBAAuB,GAAGP,gBAAgB,CAACQ,IAAI,CAAC,UAAAC,QAAQ,EAAI;MAC9D,IAAMC,UAAU,GAAGD,QAAQ,CAACE,WAAW,CAACH,IAAI,CAAC,UAAAI,EAAE;QAAA,OAAIA,EAAE,CAACC,IAAI,KAAK,MAAM;MAAA,EAAC;MACtE,IAAI,CAACH,UAAU,EAAE;QACb,OAAO,KAAK;MAChB;MAEA,OAAOA,UAAU,CAACI,MAAM,CAACC,OAAO,KAAKT,KAAK,CAACS,OAAO;IACtD,CAAC,CAAC;IAEF,IAAIR,uBAAuB,EAAE;MACzB,OAAOA,uBAAuB;IAClC;IAEA,IAAMS,YAAY,GAAG,IAAAC,gBAAO,EAACX,KAAK,CAACO,IAAI,EAAE;MACrCK,WAAW,EAAE,GAAG;MAChBC,KAAK,EAAE,IAAI;MACXC,MAAM,EAAE,+BAA+B;MACvCC,IAAI,EAAE;IACV,CAAC,CAAC;IAEF,OAAOlB,kBAAkB,CAAC;MACtBmB,KAAK,KAAAC,MAAA,CAAKjB,KAAK,CAACO,IAAI,mBAAgB;MACpCW,IAAI,EAAER,YAAY;MAClBS,WAAW,EAAE,uBAAuB;MACpCC,IAAI,EAAE,UAAAH,MAAA,CAAUjB,KAAK,CAACS,OAAO,EAAG;MAChCY,MAAM,EAAE,QAAQ;MAChBhB,WAAW,EAAE,CACT;QACIE,IAAI,EAAE,MAAM;QACZe,IAAI,EAAE,WAAW;QACjBd,MAAM,EAAE;UACJC,OAAO,EAAET,KAAK,CAACS;QACnB;MACJ,CAAC,CACJ;MACDc,YAAY,EAAE,CACV;QACInB,UAAU,EAAE,MAAM;QAClBoB,QAAQ,EAAE,OAAO;QACjBC,MAAM,EAAE;MACZ,CAAC,EACD;QACIrB,UAAU,EAAE,MAAM;QAClBoB,QAAQ,EAAE,OAAO;QACjBC,MAAM,EAAE;MACZ,CAAC;IAET,CAAC,CAAC;EACN,CAAC,EACD,CAAC/B,gBAAgB,CACrB,CAAC;EAED,OAAO;IAAEI,yBAAyB,EAAzBA;EAA0B,CAAC;AACxC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.hasMainDataSource = void 0;
|
|
7
|
+
var hasMainDataSource = exports.hasMainDataSource = function hasMainDataSource(dataSources) {
|
|
8
|
+
return dataSources.some(function (source) {
|
|
9
|
+
return source.name === "main";
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=hasMainDataSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hasMainDataSource","exports","dataSources","some","source","name"],"sources":["hasMainDataSource.ts"],"sourcesContent":["import type { PbDataSource } from \"@webiny/app-page-builder/types\";\n\nexport const hasMainDataSource = (dataSources: PbDataSource[]): boolean => {\n return dataSources.some(source => source.name === \"main\");\n};\n"],"mappings":";;;;;;AAEO,IAAMA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,SAApBA,iBAAiBA,CAAIE,WAA2B,EAAc;EACvE,OAAOA,WAAW,CAACC,IAAI,CAAC,UAAAC,MAAM;IAAA,OAAIA,MAAM,CAACC,IAAI,KAAK,MAAM;EAAA,EAAC;AAC7D,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useListDynamicTemplates = void 0;
|
|
7
|
+
var _features = require("@webiny/app-page-builder/features");
|
|
8
|
+
var _ = require("../..");
|
|
9
|
+
var useListDynamicTemplates = exports.useListDynamicTemplates = function useListDynamicTemplates() {
|
|
10
|
+
var _useListPageTemplates = (0, _features.useListPageTemplates)(),
|
|
11
|
+
pageTemplates = _useListPageTemplates.pageTemplates;
|
|
12
|
+
var dynamicTemplates = pageTemplates.filter(function (template) {
|
|
13
|
+
return (0, _.hasMainDataSource)(template.dataSources);
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
dynamicTemplates: dynamicTemplates
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=useListDynamicTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_features","require","_","useListDynamicTemplates","exports","_useListPageTemplates","useListPageTemplates","pageTemplates","dynamicTemplates","filter","template","hasMainDataSource","dataSources"],"sources":["useListDynamicTemplates.ts"],"sourcesContent":["import { useListPageTemplates } from \"@webiny/app-page-builder/features\";\nimport { hasMainDataSource } from \"~/features\";\n\nexport const useListDynamicTemplates = () => {\n const { pageTemplates } = useListPageTemplates();\n\n const dynamicTemplates = pageTemplates.filter(template =>\n hasMainDataSource(template.dataSources)\n );\n\n return { dynamicTemplates };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,CAAA,GAAAD,OAAA;AAEO,IAAME,uBAAuB,GAAAC,OAAA,CAAAD,uBAAA,GAAG,SAA1BA,uBAAuBA,CAAA,EAAS;EACzC,IAAAE,qBAAA,GAA0B,IAAAC,8BAAoB,EAAC,CAAC;IAAxCC,aAAa,GAAAF,qBAAA,CAAbE,aAAa;EAErB,IAAMC,gBAAgB,GAAGD,aAAa,CAACE,MAAM,CAAC,UAAAC,QAAQ;IAAA,OAClD,IAAAC,mBAAiB,EAACD,QAAQ,CAACE,WAAW,CAAC;EAAA,CAC3C,CAAC;EAED,OAAO;IAAEJ,gBAAgB,EAAhBA;EAAiB,CAAC;AAC/B,CAAC","ignoreList":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webiny/app-dynamic-pages",
|
|
3
|
+
"version": "5.42.0-beta.0",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/webiny/webiny-js.git"
|
|
8
|
+
},
|
|
9
|
+
"author": "Webiny Ltd",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@emotion/react": "11.10.8",
|
|
13
|
+
"@emotion/styled": "11.10.6",
|
|
14
|
+
"@fortawesome/fontawesome-svg-core": "1.3.0",
|
|
15
|
+
"@fortawesome/react-fontawesome": "0.1.19",
|
|
16
|
+
"@material-design-icons/svg": "0.14.13",
|
|
17
|
+
"@types/react": "18.2.79",
|
|
18
|
+
"@webiny/app": "5.42.0-beta.0",
|
|
19
|
+
"@webiny/app-admin": "5.42.0-beta.0",
|
|
20
|
+
"@webiny/app-headless-cms": "5.42.0-beta.0",
|
|
21
|
+
"@webiny/app-page-builder": "5.42.0-beta.0",
|
|
22
|
+
"@webiny/app-page-builder-elements": "5.42.0-beta.0",
|
|
23
|
+
"@webiny/plugins": "5.42.0-beta.0",
|
|
24
|
+
"@webiny/react-router": "5.42.0-beta.0",
|
|
25
|
+
"@webiny/ui": "5.42.0-beta.0",
|
|
26
|
+
"apollo-client": "2.6.10",
|
|
27
|
+
"emotion": "10.0.27",
|
|
28
|
+
"graphql": "15.9.0",
|
|
29
|
+
"mobx": "6.9.0",
|
|
30
|
+
"react": "18.2.0",
|
|
31
|
+
"react-dom": "18.2.0",
|
|
32
|
+
"slugify": "1.6.6"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@emotion/babel-plugin": "11.11.0",
|
|
36
|
+
"@webiny/cli": "5.42.0-beta.0",
|
|
37
|
+
"@webiny/project-utils": "5.42.0-beta.0",
|
|
38
|
+
"rimraf": "6.0.1",
|
|
39
|
+
"ttypescript": "1.5.15",
|
|
40
|
+
"typescript": "4.9.5"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public",
|
|
44
|
+
"directory": "dist"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "yarn webiny run build",
|
|
48
|
+
"watch": "yarn webiny run watch"
|
|
49
|
+
},
|
|
50
|
+
"svgo": {
|
|
51
|
+
"plugins": {
|
|
52
|
+
"removeViewBox": false
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"gitHead": "ebf90f62ed3f28114ffdb012b7e5f80988af53d3"
|
|
56
|
+
}
|