@blaze-cms/plugin-data-ui 0.127.0 → 0.128.0-admin-updates.3
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/CHANGELOG.md +29 -0
- package/lib/components/EntityDataListing/EntityDataListing.js +4 -4
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +184 -189
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +26 -28
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +89 -89
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +31 -33
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +40 -42
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +43 -45
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +65 -69
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +10 -12
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +62 -66
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +121 -129
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +17 -19
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +18 -2
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/constants.js.map +1 -1
- package/lib/index.js +56 -60
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +25 -27
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +19 -17
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +13 -7
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib-es/components/EntityManager/utils/query.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +5 -2
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/build-update-data-query.js.map +1 -1
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib-es/utils/get-default-query-params.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/lib-es/utils/hooks/useToggle.js.map +1 -1
- package/package.json +9 -9
- package/src/components/EntityManager/Entity/Entity.js +61 -59
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +23 -9
- package/src/components/Tabs/index.js +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListingTable.js","names":["useApolloClient","React","useEffect","useState","Fragment","PropTypes","withRouter","Link","More","MainContext","useMainContext","PageHeader","DeleteAction","useToasts","ListingTableContent","availableActions","fetchData","populateRows","formatRows","getDefaultQueryParams","OVER_SCAN_BUFFER","ListingTable","match","entitySchema","selectedMenuItem","tableData","setTableData","modalStatus","setModalStatus","itemToDelete","setItemToDelete","previousSchema","setPreviousSchema","id","scrollToIndex","setScrollToIndex","verifiedRanges","setVerifiedRanges","queryParamsDefault","schema","queryParams","setQueryParams","menuItems","setMenuItems","client","addToast","data","querySettings","populatedTable","toggleModal","url","rows","onCloseCardPrompt","updatedSelectedMenuItem","isDisplayedPrompt","header","items","updatedItems","map","item","name","deleteAction","delete","submit","parsedFormValues","updatedTableData","filter","handleSort","event","property","direction","Object","entries","sortQueryParams","sort","columns","firstColumn","appliedSort","handleRenderedItems","params","startIndex","rowsLength","length","loadIndex","Math","floor","includes","updatedQueryParams","offset","updatedRows","displayName","propTypes","object","isRequired"],"sources":["../../../src/components/ListingTable/ListingTable.js"],"sourcesContent":["import { useApolloClient } from '@apollo/client';\nimport React, { useEffect, useState, Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport { withRouter, Link } from 'react-router-dom';\nimport More from '@blaze-react/more';\nimport { MainContext, useMainContext } from '@blaze-cms/admin-ui-utils';\nimport { PageHeader, DeleteAction } from '@blaze-cms/admin';\nimport { useToasts } from '@blaze-react/toaster';\nimport ListingTableContent from './ListingTableContent';\nimport availableActions from '../EntityManager/Entity/actions-handlers';\nimport { fetchData } from './service';\nimport { populateRows, formatRows } from './mappers/populate-rows';\nimport { getDefaultQueryParams } from '../../utils/get-default-query-params';\n\nconst OVER_SCAN_BUFFER = 10;\n\nconst ListingTable = ({ match, entitySchema, selectedMenuItem }) => {\n const [tableData, setTableData] = useState({});\n const [modalStatus, setModalStatus] = useState(false);\n const [itemToDelete, setItemToDelete] = useState({});\n const [previousSchema, setPreviousSchema] = useState({ id: null });\n const [scrollToIndex, setScrollToIndex] = useState(0);\n const [verifiedRanges, setVerifiedRanges] = useState([]);\n const queryParamsDefault = getDefaultQueryParams({ schema: entitySchema });\n const [queryParams, setQueryParams] = useState(queryParamsDefault);\n const { menuItems, setMenuItems } = useMainContext(MainContext);\n const client = useApolloClient();\n const { addToast } = useToasts();\n\n useEffect(\n () => {\n (async () => {\n if (\n entitySchema.id !== previousSchema.id ||\n (previousSchema.id === null && entitySchema.id)\n ) {\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: queryParamsDefault\n }\n });\n const populatedTable = populateRows({\n toggleModal,\n url: match.url,\n entitySchema,\n rows: data\n });\n setTableData(populatedTable);\n setPreviousSchema({ id: entitySchema.id });\n }\n })();\n },\n [client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps\n );\n\n const onCloseCardPrompt = () => {\n const updatedSelectedMenuItem = {\n ...selectedMenuItem,\n isDisplayedPrompt: false\n };\n const [{ header, items }] = menuItems;\n const updatedItems = items.map(\n item => (item.name === selectedMenuItem.name ? updatedSelectedMenuItem : item)\n );\n setMenuItems([{ header, items: updatedItems }]);\n };\n\n const toggleModal = item => {\n setModalStatus(!!item);\n setItemToDelete(item || {});\n };\n\n const deleteAction = async () => {\n await availableActions.delete.submit(\n {\n entitySchema,\n parsedFormValues: { id: itemToDelete.id },\n client\n },\n addToast\n );\n\n toggleModal();\n\n const updatedTableData = {\n ...tableData,\n rows: tableData.rows.filter(({ id }) => id !== itemToDelete.id)\n };\n\n setTableData(updatedTableData);\n };\n\n const handleSort = async event => {\n const [[property, direction]] = Object.entries(event);\n const sortQueryParams = {\n ...queryParamsDefault,\n sort: [{ property, direction }]\n };\n setScrollToIndex(0);\n setVerifiedRanges([]);\n setQueryParams(sortQueryParams);\n\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: sortQueryParams\n }\n });\n const { columns } = tableData;\n const [firstColumn] = columns;\n\n setTableData({\n ...tableData,\n appliedSort: { [property]: direction },\n rows: formatRows({ rows: data, url: match.url, toggleModal, firstColumn })\n });\n };\n\n const handleRenderedItems = async params => {\n const { startIndex } = params;\n const rowsLength = tableData.rows.length;\n const loadIndex = Math.floor(rowsLength / 3) - OVER_SCAN_BUFFER;\n if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {\n const updatedQueryParams = {\n ...queryParams,\n offset: rowsLength\n };\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: updatedQueryParams\n }\n });\n const updatedRows = [\n ...tableData.rows,\n ...formatRows({ rows: data, url: match.url, toggleModal })\n ];\n\n setVerifiedRanges([...verifiedRanges, loadIndex]);\n setQueryParams(updatedQueryParams);\n setTableData({\n ...tableData,\n rows: updatedRows\n });\n setScrollToIndex(startIndex + OVER_SCAN_BUFFER);\n }\n };\n\n if (!tableData || !tableData.rows) return 'loading';\n\n return (\n <div className=\"page\">\n {modalStatus && (\n <DeleteAction\n onClose={toggleModal}\n deleteAction={deleteAction}\n itemName={itemToDelete.name}\n />\n )}\n <PageHeader title={entitySchema.displayName} subtitle=\"\">\n {(!selectedMenuItem.isDisplayedPrompt || !!tableData.rows.length) && (\n <Fragment>\n <Link\n data-testid=\"addEntity\"\n className=\"button button--small\"\n to={`${match.url}/create`}>\n Add\n </Link>\n <PageHeader.Actions>\n <More>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu />\n </More>\n </PageHeader.Actions>\n </Fragment>\n )}\n </PageHeader>\n <ListingTableContent\n overScanBuffer={OVER_SCAN_BUFFER}\n onSort={handleSort}\n onRenderItems={handleRenderedItems}\n tableData={tableData}\n onCloseCardPrompt={onCloseCardPrompt}\n selectedMenuItem={selectedMenuItem}\n scrollToIndex={scrollToIndex}\n />\n </div>\n );\n};\nListingTable.propTypes = {\n entitySchema: PropTypes.object.isRequired,\n match: PropTypes.object.isRequired,\n selectedMenuItem: PropTypes.object.isRequired\n};\n\nexport default withRouter(ListingTable);\n"],"mappings":";;;AAAA,SAASA,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,IAAI,QAAQ,kBAAkB;AACnD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,WAAW,EAAEC,cAAc,QAAQ,2BAA2B;AACvE,SAASC,UAAU,EAAEC,YAAY,QAAQ,kBAAkB;AAC3D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,gBAAgB,MAAM,0CAA0C;AACvE,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,YAAY,EAAEC,UAAU,QAAQ,yBAAyB;AAClE,SAASC,qBAAqB,QAAQ,sCAAsC;AAE5E,MAAMC,gBAAgB,GAAG,EAAE;AAE3B,MAAMC,YAAY,GAAG,CAAC;EAAEC,KAAK;EAAEC,YAAY;EAAEC;AAAiB,CAAC,KAAK;EAClE,MAAM,CAACC,SAAS,EAAEC,YAAY,CAAC,GAAGvB,QAAQ,CAAC,CAAC,CAAC,CAAC;EAC9C,MAAM,CAACwB,WAAW,EAAEC,cAAc,CAAC,GAAGzB,QAAQ,CAAC,KAAK,CAAC;EACrD,MAAM,CAAC0B,YAAY,EAAEC,eAAe,CAAC,GAAG3B,QAAQ,CAAC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AAO;IAAC,UAAU;EAAA,EAAG,CACtB,CACY,CAExB,CACU,eACb,oBAAC,mBAAmB;IAClB,cAAc,EAAE9B,gBAAiB;IACjC,MAAM,EAAE+C,UAAW;IACnB,aAAa,EAAEW,mBAAoB;IACnC,SAAS,EAAErD,SAAU;IACrB,iBAAiB,EAAE2B,iBAAkB;IACrC,gBAAgB,EAAE5B,gBAAiB;IACnC,aAAa,EAAEU;EAAc,EAC7B,CACE;AAEV,CAAC;AACDb,YAAY,CAACsE,SAAS,GAAG;EACvBpE,YAAY,EAAElB,SAAS,CAACuF,MAAM,CAACC,UAAU;EACzCvE,KAAK,EAAEjB,SAAS,CAACuF,MAAM,CAACC,UAAU;EAClCrE,gBAAgB,EAAEnB,SAAS,CAACuF,MAAM,CAACC;AACrC,CAAC;AAED,eAAevF,UAAU,CAACe,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"ListingTable.js","names":["useApolloClient","React","useEffect","useState","Fragment","PropTypes","withRouter","Link","More","MainContext","useMainContext","PageHeader","DeleteAction","useToasts","ListingTableContent","availableActions","fetchData","populateRows","formatRows","getDefaultQueryParams","OVER_SCAN_BUFFER","ListingTable","match","entitySchema","selectedMenuItem","tableData","setTableData","modalStatus","setModalStatus","itemToDelete","setItemToDelete","previousSchema","setPreviousSchema","id","scrollToIndex","setScrollToIndex","verifiedRanges","setVerifiedRanges","queryParamsDefault","schema","queryParams","setQueryParams","menuItems","setMenuItems","client","addToast","data","querySettings","populatedTable","toggleModal","url","rows","onCloseCardPrompt","updatedSelectedMenuItem","_objectSpread","isDisplayedPrompt","header","items","updatedItems","map","item","name","deleteAction","delete","submit","parsedFormValues","updatedTableData","filter","handleSort","event","property","direction","Object","entries","sortQueryParams","sort","columns","firstColumn","appliedSort","handleRenderedItems","params","startIndex","rowsLength","length","loadIndex","Math","floor","includes","updatedQueryParams","offset","updatedRows","createElement","className","onClose","itemName","title","displayName","subtitle","to","Actions","Avatar","isMoreMenu","Content","overScanBuffer","onSort","onRenderItems","propTypes","object","isRequired"],"sources":["../../../src/components/ListingTable/ListingTable.js"],"sourcesContent":["import { useApolloClient } from '@apollo/client';\nimport React, { useEffect, useState, Fragment } from 'react';\nimport PropTypes from 'prop-types';\nimport { withRouter, Link } from 'react-router-dom';\nimport More from '@blaze-react/more';\nimport { MainContext, useMainContext } from '@blaze-cms/admin-ui-utils';\nimport { PageHeader, DeleteAction } from '@blaze-cms/admin';\nimport { useToasts } from '@blaze-react/toaster';\nimport ListingTableContent from './ListingTableContent';\nimport availableActions from '../EntityManager/Entity/actions-handlers';\nimport { fetchData } from './service';\nimport { populateRows, formatRows } from './mappers/populate-rows';\nimport { getDefaultQueryParams } from '../../utils/get-default-query-params';\n\nconst OVER_SCAN_BUFFER = 10;\n\nconst ListingTable = ({ match, entitySchema, selectedMenuItem }) => {\n const [tableData, setTableData] = useState({});\n const [modalStatus, setModalStatus] = useState(false);\n const [itemToDelete, setItemToDelete] = useState({});\n const [previousSchema, setPreviousSchema] = useState({ id: null });\n const [scrollToIndex, setScrollToIndex] = useState(0);\n const [verifiedRanges, setVerifiedRanges] = useState([]);\n const queryParamsDefault = getDefaultQueryParams({ schema: entitySchema });\n const [queryParams, setQueryParams] = useState(queryParamsDefault);\n const { menuItems, setMenuItems } = useMainContext(MainContext);\n const client = useApolloClient();\n const { addToast } = useToasts();\n\n useEffect(\n () => {\n (async () => {\n if (\n entitySchema.id !== previousSchema.id ||\n (previousSchema.id === null && entitySchema.id)\n ) {\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: queryParamsDefault\n }\n });\n const populatedTable = populateRows({\n toggleModal,\n url: match.url,\n entitySchema,\n rows: data\n });\n setTableData(populatedTable);\n setPreviousSchema({ id: entitySchema.id });\n }\n })();\n },\n [client, entitySchema, match.url, previousSchema.id, queryParams] // eslint-disable-line react-hooks/exhaustive-deps\n );\n\n const onCloseCardPrompt = () => {\n const updatedSelectedMenuItem = {\n ...selectedMenuItem,\n isDisplayedPrompt: false\n };\n const [{ header, items }] = menuItems;\n const updatedItems = items.map(\n item => (item.name === selectedMenuItem.name ? updatedSelectedMenuItem : item)\n );\n setMenuItems([{ header, items: updatedItems }]);\n };\n\n const toggleModal = item => {\n setModalStatus(!!item);\n setItemToDelete(item || {});\n };\n\n const deleteAction = async () => {\n await availableActions.delete.submit(\n {\n entitySchema,\n parsedFormValues: { id: itemToDelete.id },\n client\n },\n addToast\n );\n\n toggleModal();\n\n const updatedTableData = {\n ...tableData,\n rows: tableData.rows.filter(({ id }) => id !== itemToDelete.id)\n };\n\n setTableData(updatedTableData);\n };\n\n const handleSort = async event => {\n const [[property, direction]] = Object.entries(event);\n const sortQueryParams = {\n ...queryParamsDefault,\n sort: [{ property, direction }]\n };\n setScrollToIndex(0);\n setVerifiedRanges([]);\n setQueryParams(sortQueryParams);\n\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: sortQueryParams\n }\n });\n const { columns } = tableData;\n const [firstColumn] = columns;\n\n setTableData({\n ...tableData,\n appliedSort: { [property]: direction },\n rows: formatRows({ rows: data, url: match.url, toggleModal, firstColumn })\n });\n };\n\n const handleRenderedItems = async params => {\n const { startIndex } = params;\n const rowsLength = tableData.rows.length;\n const loadIndex = Math.floor(rowsLength / 3) - OVER_SCAN_BUFFER;\n if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {\n const updatedQueryParams = {\n ...queryParams,\n offset: rowsLength\n };\n const data = await fetchData({\n client,\n querySettings: {\n entitySchema,\n queryParams: updatedQueryParams\n }\n });\n const updatedRows = [\n ...tableData.rows,\n ...formatRows({ rows: data, url: match.url, toggleModal })\n ];\n\n setVerifiedRanges([...verifiedRanges, loadIndex]);\n setQueryParams(updatedQueryParams);\n setTableData({\n ...tableData,\n rows: updatedRows\n });\n setScrollToIndex(startIndex + OVER_SCAN_BUFFER);\n }\n };\n\n if (!tableData || !tableData.rows) return 'loading';\n\n return (\n <div className=\"page\">\n {modalStatus && (\n <DeleteAction\n onClose={toggleModal}\n deleteAction={deleteAction}\n itemName={itemToDelete.name}\n />\n )}\n <PageHeader title={entitySchema.displayName} subtitle=\"\">\n {(!selectedMenuItem.isDisplayedPrompt || !!tableData.rows.length) && (\n <Fragment>\n <Link\n data-testid=\"addEntity\"\n className=\"button button--small\"\n to={`${match.url}/create`}>\n Add\n </Link>\n <PageHeader.Actions>\n <More>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu />\n </More>\n </PageHeader.Actions>\n </Fragment>\n )}\n </PageHeader>\n <ListingTableContent\n overScanBuffer={OVER_SCAN_BUFFER}\n onSort={handleSort}\n onRenderItems={handleRenderedItems}\n tableData={tableData}\n onCloseCardPrompt={onCloseCardPrompt}\n selectedMenuItem={selectedMenuItem}\n scrollToIndex={scrollToIndex}\n />\n </div>\n );\n};\nListingTable.propTypes = {\n entitySchema: PropTypes.object.isRequired,\n match: PropTypes.object.isRequired,\n selectedMenuItem: PropTypes.object.isRequired\n};\n\nexport default withRouter(ListingTable);\n"],"mappings":";;;AAAA,SAASA,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,KAAK,IAAIC,SAAS,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,OAAO;AAC5D,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,EAAEC,IAAI,QAAQ,kBAAkB;AACnD,OAAOC,IAAI,MAAM,mBAAmB;AACpC,SAASC,WAAW,EAAEC,cAAc,QAAQ,2BAA2B;AACvE,SAASC,UAAU,EAAEC,YAAY,QAAQ,kBAAkB;AAC3D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,gBAAgB,MAAM,0CAA0C;AACvE,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,YAAY,EAAEC,UAAU,QAAQ,yBAAyB;AAClE,SAASC,qBAAqB,QAAQ,sCAAsC;AAE5E,MAAMC,gBAAgB,GAAG,EAAE;AAE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gBAAgB,EAAEnB,SAAS,CAACsG,MAAM,CAACC;AACrC,CAAC;AAED,eAAetG,UAAU,CAACe,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListingTableContent.js","names":["React","Table","PropTypes","CardPrompt","Link","withRouter","ListingTableContent","tableData","handleSelect","onCloseCardPrompt","selectedMenuItem","match","onSort","onClickRow","overScanBuffer","onRenderItems","scrollToIndex","displayTable","rows","length","isDisplayedPrompt","url","propTypes","object","isRequired","func","shape","string","number","defaultProps"],"sources":["../../../../src/components/ListingTable/ListingTableContent/ListingTableContent.js"],"sourcesContent":["import React from 'react';\nimport Table from '@blaze-react/table';\nimport PropTypes from 'prop-types';\nimport { CardPrompt } from '@blaze-cms/admin';\nimport { Link, withRouter } from 'react-router-dom';\n\nconst ListingTableContent = ({\n tableData,\n handleSelect,\n onCloseCardPrompt,\n selectedMenuItem,\n match,\n onSort,\n onClickRow,\n overScanBuffer,\n onRenderItems,\n scrollToIndex\n}) => {\n const displayTable = tableData && tableData.rows && !!tableData.rows.length;\n\n return (\n <>\n {displayTable ? (\n <>\n <div className=\"page__content\">\n <Table\n scrollToIndex={scrollToIndex}\n onSort={onSort}\n onClickRow={onClickRow}\n overScanBuffer={overScanBuffer}\n onRenderItems={onRenderItems}\n data={tableData}\n checkboxes\n onSelect={handleSelect}\n data-testid=\"listing-table-content\"\n />\n </div>\n </>\n ) : (\n selectedMenuItem.isDisplayedPrompt && (\n <CardPrompt onClose={onCloseCardPrompt} data-testid=\"card-prompt\">\n <Link\n className=\"button button--rounded button--cta\"\n to={`${match.url}/create`}\n data-testid=\"add-button\">\n Add\n </Link>\n </CardPrompt>\n )\n )}\n </>\n );\n};\n\nListingTableContent.propTypes = {\n tableData: PropTypes.object.isRequired,\n onCloseCardPrompt: PropTypes.func.isRequired,\n selectedMenuItem: PropTypes.object.isRequired,\n match: PropTypes.shape({\n url: PropTypes.string\n }).isRequired,\n handleSelect: PropTypes.func,\n onSort: PropTypes.func,\n onClickRow: PropTypes.func,\n overScanBuffer: PropTypes.number,\n scrollToIndex: PropTypes.number,\n onRenderItems: PropTypes.func\n};\n\nListingTableContent.defaultProps = {\n handleSelect: () => {},\n onSort: () => {},\n onClickRow: () => {},\n overScanBuffer: 0,\n scrollToIndex: 0,\n onRenderItems: () => {}\n};\n\nexport default withRouter(ListingTableContent);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,IAAI,EAAEC,UAAU,QAAQ,kBAAkB;AAEnD,MAAMC,mBAAmB,
|
|
1
|
+
{"version":3,"file":"ListingTableContent.js","names":["React","Table","PropTypes","CardPrompt","Link","withRouter","ListingTableContent","tableData","handleSelect","onCloseCardPrompt","selectedMenuItem","match","onSort","onClickRow","overScanBuffer","onRenderItems","scrollToIndex","displayTable","rows","length","createElement","Fragment","className","data","checkboxes","onSelect","isDisplayedPrompt","onClose","to","url","propTypes","object","isRequired","func","shape","string","number","defaultProps"],"sources":["../../../../src/components/ListingTable/ListingTableContent/ListingTableContent.js"],"sourcesContent":["import React from 'react';\nimport Table from '@blaze-react/table';\nimport PropTypes from 'prop-types';\nimport { CardPrompt } from '@blaze-cms/admin';\nimport { Link, withRouter } from 'react-router-dom';\n\nconst ListingTableContent = ({\n tableData,\n handleSelect,\n onCloseCardPrompt,\n selectedMenuItem,\n match,\n onSort,\n onClickRow,\n overScanBuffer,\n onRenderItems,\n scrollToIndex\n}) => {\n const displayTable = tableData && tableData.rows && !!tableData.rows.length;\n\n return (\n <>\n {displayTable ? (\n <>\n <div className=\"page__content\">\n <Table\n scrollToIndex={scrollToIndex}\n onSort={onSort}\n onClickRow={onClickRow}\n overScanBuffer={overScanBuffer}\n onRenderItems={onRenderItems}\n data={tableData}\n checkboxes\n onSelect={handleSelect}\n data-testid=\"listing-table-content\"\n />\n </div>\n </>\n ) : (\n selectedMenuItem.isDisplayedPrompt && (\n <CardPrompt onClose={onCloseCardPrompt} data-testid=\"card-prompt\">\n <Link\n className=\"button button--rounded button--cta\"\n to={`${match.url}/create`}\n data-testid=\"add-button\">\n Add\n </Link>\n </CardPrompt>\n )\n )}\n </>\n );\n};\n\nListingTableContent.propTypes = {\n tableData: PropTypes.object.isRequired,\n onCloseCardPrompt: PropTypes.func.isRequired,\n selectedMenuItem: PropTypes.object.isRequired,\n match: PropTypes.shape({\n url: PropTypes.string\n }).isRequired,\n handleSelect: PropTypes.func,\n onSort: PropTypes.func,\n onClickRow: PropTypes.func,\n overScanBuffer: PropTypes.number,\n scrollToIndex: PropTypes.number,\n onRenderItems: PropTypes.func\n};\n\nListingTableContent.defaultProps = {\n handleSelect: () => {},\n onSort: () => {},\n onClickRow: () => {},\n overScanBuffer: 0,\n scrollToIndex: 0,\n onRenderItems: () => {}\n};\n\nexport default withRouter(ListingTableContent);\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,IAAI,EAAEC,UAAU,QAAQ,kBAAkB;AAEnD,MAAMC,mBAAmB,GAAGA,CAAC;EAC3BC,SAAS;EACTC,YAAY;EACZC,iBAAiB;EACjBC,gBAAgB;EAChBC,KAAK;EACLC,MAAM;EACNC,UAAU;EACVC,cAAc;EACdC,aAAa;EACbC;AACF,CAAC,KAAK;EACJ,MAAMC,YAAY,GAAGV,SAAS,IAAIA,SAAS,CAACW,IAAI,IAAI,CAAC,CAACX,SAAS,CAACW,IAAI,CAACC,MAAM;EAE3E,oBACEnB,KAAA,CAAAoB,aAAA,CAAApB,KAAA,CAAAqB,QAAA,QACGJ,YAAY,gBACXjB,KAAA,CAAAoB,aAAA,CAAApB,KAAA,CAAAqB,QAAA,qBACErB,KAAA,CAAAoB,aAAA;IAAK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C7B,YAAY,EAAEA,CAAA,KAAM,CAAC,CAAC;EACtBI,MAAM,EAAEA,CAAA,KAAM,CAAC,CAAC;EAChBC,UAAU,EAAEA,CAAA,KAAM,CAAC,CAAC;EACpBC,cAAc,EAAE,CAAC;EACjBE,aAAa,EAAE,CAAC;EAChBD,aAAa,EAAEA,CAAA,KAAM,CAAC;AACxB,CAAC;AAED,eAAeV,UAAU,CAACC,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableActions.js","names":["React","Link","PropTypes","More","Button","TableActions","editUrl","data","showDeleteModal","propTypes","string","isRequired","func","object"],"sources":["../../../../src/components/ListingTable/TableActions/TableActions.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport More from '@blaze-react/more';\nimport Button from '@blaze-react/button';\n\nconst TableActions = ({ editUrl, data, showDeleteModal }) => (\n <div className=\"more-menu__wrapper\">\n <More isMoreMenu>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu>\n <Link to={editUrl} className=\"more-menu__link\" role=\"button\">\n Edit\n </Link>\n <Button className=\"more-menu__link\" onClick={() => showDeleteModal(data)}>\n Delete\n </Button>\n </More.Content>\n </More>\n </div>\n);\n\nTableActions.propTypes = {\n editUrl: PropTypes.string.isRequired,\n showDeleteModal: PropTypes.func.isRequired,\n data: PropTypes.object.isRequired\n};\n\nexport default TableActions;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,MAAM,MAAM,qBAAqB;AAExC,MAAMC,YAAY,
|
|
1
|
+
{"version":3,"file":"TableActions.js","names":["React","Link","PropTypes","More","Button","TableActions","editUrl","data","showDeleteModal","createElement","className","isMoreMenu","Avatar","Content","to","role","onClick","propTypes","string","isRequired","func","object"],"sources":["../../../../src/components/ListingTable/TableActions/TableActions.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport PropTypes from 'prop-types';\nimport More from '@blaze-react/more';\nimport Button from '@blaze-react/button';\n\nconst TableActions = ({ editUrl, data, showDeleteModal }) => (\n <div className=\"more-menu__wrapper\">\n <More isMoreMenu>\n <More.Avatar isMoreMenu>\n <span className=\"material-icons\">more_vert</span>\n </More.Avatar>\n <More.Content isMoreMenu>\n <Link to={editUrl} className=\"more-menu__link\" role=\"button\">\n Edit\n </Link>\n <Button className=\"more-menu__link\" onClick={() => showDeleteModal(data)}>\n Delete\n </Button>\n </More.Content>\n </More>\n </div>\n);\n\nTableActions.propTypes = {\n editUrl: PropTypes.string.isRequired,\n showDeleteModal: PropTypes.func.isRequired,\n data: PropTypes.object.isRequired\n};\n\nexport default TableActions;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,IAAI,MAAM,mBAAmB;AACpC,OAAOC,MAAM,MAAM,qBAAqB;AAExC,MAAMC,YAAY,GAAGA,CAAC;EAAEC,OAAO;EAAEC,IAAI;EAAEC;AAAgB,CAAC,kBACtDR,KAAA,CAAAS,aAAA;EAAKC,SAAS,EAAC;AAAoB,gBACjCV,KAAA,CAAAS,aAAA,CAACN,IAAI;EAACQ,UAAU;AAAA,gBACdX,KAAA,CAAAS,aAAA,CAACN,IAAI,CAACS,MAAM;EAACD,UAAU;AAAA,gBACrBX,KAAA,CAAAS,aAAA;EAAMC,SAAS,EAAC;AAAgB,GAAC,WAAS,CAAO,CACrC,eACdV,KAAA,CAAAS,aAAA,CAACN,IAAI,CAACU,OAAO;EAACF,UAAU;AAAA,gBACtBX,KAAA,CAAAS,aAAA,CAACR,IAAI;EAACa,EAAE,EAAER,OAAQ;EAACI,SAAS,EAAC,iBAAiB;EAACK,IAAI,EAAC;AAAQ,GAAC,MAE7D,CAAO,eACPf,KAAA,CAAAS,aAAA,CAACL,MAAM;EAACM,SAAS,EAAC,iBAAiB;EAACM,OAAO,EAAEA,CAAA,KAAMR,eAAe,CAACD,IAAI;AAAE,GAAC,QAE1E,CAAS,CACI,CACV,CAEV;AAEDF,YAAY,CAACY,SAAS,GAAG;EACvBX,OAAO,EAAEJ,SAAS,CAACgB,MAAM,CAACC,UAAU;EACpCX,eAAe,EAAEN,SAAS,CAACkB,IAAI,CAACD,UAAU;EAC1CZ,IAAI,EAAEL,SAAS,CAACmB,MAAM,CAACF;AACzB,CAAC;AAED,eAAed,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"populate-rows.js","names":["React","Link","TableActions","ACTIONS","formatRows","rows","url","toggleModal","label","firstColumn","map","data","editUrl","id","actions","getSanitizedColumnLabel","columnProp","sanitizedChar","index","length","toUpperCase","toLowerCase","getColumnLabels","listingProperties","properties","dynamicProperties","allProperties","reduce","acc","listingProperty","populateRows","entitySchema","formProperties","columns","labels","identification","sort","orderBy"],"sources":["../../../../src/components/ListingTable/mappers/populate-rows.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport TableActions from '../TableActions';\nimport { ACTIONS } from '../../../constants';\n\nconst formatRows = ({ rows, url, toggleModal, label, firstColumn = 'name' }) =>\n rows.map(data => {\n const editUrl = `${url}/update/${data.id}`;\n return {\n ...data,\n [firstColumn]: (\n <Link to={editUrl} role=\"button\">\n {data[firstColumn]}\n </Link>\n ),\n actions: <TableActions editUrl={editUrl} data={data} showDeleteModal={toggleModal} />\n };\n });\n\nconst getSanitizedColumnLabel = columnProp => {\n let sanitizedChar = '';\n\n for (let index = 0; index < columnProp.length; index += 1) {\n if (index && columnProp[index] === columnProp[index].toUpperCase())\n sanitizedChar = `${sanitizedChar} ${columnProp[index].toLowerCase()}`;\n else sanitizedChar += columnProp[index];\n }\n return sanitizedChar;\n};\n\nconst getColumnLabels = (listingProperties, properties, dynamicProperties) => {\n const allProperties = { ...properties, ...dynamicProperties };\n return listingProperties.reduce((acc, listingProperty) => {\n const label = allProperties[listingProperty].label || getSanitizedColumnLabel(listingProperty);\n return { ...acc, ...{ [listingProperty]: label } };\n }, {});\n};\n\nconst populateRows = ({ toggleModal, url, entitySchema, rows }) => {\n const { listingProperties, properties, dynamicProperties = {}, formProperties } = entitySchema;\n const columns = [...listingProperties, ACTIONS];\n const [firstColumn] = columns;\n const labels = {\n ...getColumnLabels(listingProperties, properties, dynamicProperties),\n [ACTIONS]: ACTIONS\n };\n\n return {\n identification: 'id',\n sort: null,\n columns,\n labels,\n orderBy: [...formProperties],\n rows: formatRows({ firstColumn, rows, url, toggleModal })\n };\n};\n\nexport { populateRows, formatRows };\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,MAAMC,UAAU,
|
|
1
|
+
{"version":3,"file":"populate-rows.js","names":["React","Link","TableActions","ACTIONS","formatRows","rows","url","toggleModal","label","firstColumn","map","data","editUrl","id","_objectSpread","createElement","to","role","actions","showDeleteModal","getSanitizedColumnLabel","columnProp","sanitizedChar","index","length","toUpperCase","toLowerCase","getColumnLabels","listingProperties","properties","dynamicProperties","allProperties","reduce","acc","listingProperty","populateRows","entitySchema","formProperties","columns","labels","identification","sort","orderBy"],"sources":["../../../../src/components/ListingTable/mappers/populate-rows.js"],"sourcesContent":["import React from 'react';\nimport { Link } from 'react-router-dom';\nimport TableActions from '../TableActions';\nimport { ACTIONS } from '../../../constants';\n\nconst formatRows = ({ rows, url, toggleModal, label, firstColumn = 'name' }) =>\n rows.map(data => {\n const editUrl = `${url}/update/${data.id}`;\n return {\n ...data,\n [firstColumn]: (\n <Link to={editUrl} role=\"button\">\n {data[firstColumn]}\n </Link>\n ),\n actions: <TableActions editUrl={editUrl} data={data} showDeleteModal={toggleModal} />\n };\n });\n\nconst getSanitizedColumnLabel = columnProp => {\n let sanitizedChar = '';\n\n for (let index = 0; index < columnProp.length; index += 1) {\n if (index && columnProp[index] === columnProp[index].toUpperCase())\n sanitizedChar = `${sanitizedChar} ${columnProp[index].toLowerCase()}`;\n else sanitizedChar += columnProp[index];\n }\n return sanitizedChar;\n};\n\nconst getColumnLabels = (listingProperties, properties, dynamicProperties) => {\n const allProperties = { ...properties, ...dynamicProperties };\n return listingProperties.reduce((acc, listingProperty) => {\n const label = allProperties[listingProperty].label || getSanitizedColumnLabel(listingProperty);\n return { ...acc, ...{ [listingProperty]: label } };\n }, {});\n};\n\nconst populateRows = ({ toggleModal, url, entitySchema, rows }) => {\n const { listingProperties, properties, dynamicProperties = {}, formProperties } = entitySchema;\n const columns = [...listingProperties, ACTIONS];\n const [firstColumn] = columns;\n const labels = {\n ...getColumnLabels(listingProperties, properties, dynamicProperties),\n [ACTIONS]: ACTIONS\n };\n\n return {\n identification: 'id',\n sort: null,\n columns,\n labels,\n orderBy: [...formProperties],\n rows: formatRows({ firstColumn, rows, url, toggleModal })\n };\n};\n\nexport { populateRows, formatRows };\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,kBAAkB;AACvC,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,SAASC,OAAO,QAAQ,oBAAoB;AAE5C,MAAMC,UAAU,GAAGA,CAAC;EAAEC,IAAI;EAAEC,GAAG;EAAEC,WAAW;EAAEC,KAAK;EAAEC,WAAW,GAAG;AAAO,CAAC,KACzEJ,IAAI,CAACK,GAAG,CAACC,IAAI,IAAI;EACf,MAAMC,OAAO,GAAI,GAAEN,GAAI,WAAUK,IAAI,CAACE,EAAG,EAAC;EAC1C,OAAAC,aAAA,CAAAA,aAAA,KACKH,IAAI;IACP,CAACF,WAAW,gBACVT,KAAA,CAAAe,aAAA,CAACd,IAAI;MAACe,EAAE,EAAEJ,O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;AAAK,CAAC,KAAK;EACjE,MAAM;IAAEuB,iBAAiB;IAAEC,UAAU;IAAEC,iBAAiB,GAAG,CAAC,CAAC;IAAEO;EAAe,CAAC,GAAGD,YAAY;EAC9F,MAAME,OAAO,GAAG,CAAC,GAAGV,iBAAiB,EAAEzB,OAAO,CAAC;EAC/C,MAAM,CAACM,WAAW,CAAC,GAAG6B,OAAO;EAC7B,MAAMC,MAAM,GAAAzB,aAAA,CAAAA,aAAA,KACPa,eAAe,CAACC,iBAAiB,EAAEC,UAAU,EAAEC,iBAAiB,CAAC;IACpE,CAAC3B,OAAO,GAAGA;EAAO,EACnB;EAED,OAAO;IACLqC,cAAc,EAAE,IAAI;IACpBC,IAAI,EAAE,IAAI;IACVH,OAAO;IACPC,MAAM;IACNG,OAAO,EAAE,CAAC,GAAGL,cAAc,CAAC;IAC5BhC,IAAI,EAAED,UAAU,CAAC;MAAEK,WAAW;MAAEJ,IAAI;MAAEC,GAAG;MAAEC;IAAY,CAAC;EAC1D,CAAC;AACH,CAAC;AAED,SAAS4B,YAAY,EAAE/B,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["buildListingQuery","fetchData","client","querySettings","entitySchema","queryParams","query","data","listingData","variables","fetchPolicy"],"sources":["../../../../src/components/ListingTable/service/index.js"],"sourcesContent":["import buildListingQuery from '../../../utils/build-listing-query';\n\nconst fetchData = async ({ client, querySettings: { entitySchema, queryParams } }) => {\n const query = buildListingQuery(entitySchema);\n const {\n data: { listingData }\n } = await client.query({ query, variables: queryParams, fetchPolicy: 'network-only' });\n\n return listingData;\n};\n\nexport { fetchData };\n"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,oCAAoC;AAElE,MAAMC,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"index.js","names":["buildListingQuery","fetchData","client","querySettings","entitySchema","queryParams","query","data","listingData","variables","fetchPolicy"],"sources":["../../../../src/components/ListingTable/service/index.js"],"sourcesContent":["import buildListingQuery from '../../../utils/build-listing-query';\n\nconst fetchData = async ({ client, querySettings: { entitySchema, queryParams } }) => {\n const query = buildListingQuery(entitySchema);\n const {\n data: { listingData }\n } = await client.query({ query, variables: queryParams, fetchPolicy: 'network-only' });\n\n return listingData;\n};\n\nexport { fetchData };\n"],"mappings":"AAAA,OAAOA,iBAAiB,MAAM,oCAAoC;AAElE,MAAMC,SAAS,GAAG,MAAAA,CAAO;EAAEC,MAAM;EAAEC,aAAa,EAAE;IAAEC,YAAY;IAAEC;EAAY;AAAE,CAAC,KAAK;EACpF,MAAMC,KAAK,GAAGN,iBAAiB,CAACI,YAAY,CAAC;EAC7C,MAAM;IACJG,IAAI,EAAE;MAAEC;IAAY;EACtB,CAAC,GAAG,MAAMN,MAAM,CAACI,KAAK,CAAC;IAAEA,KAAK;IAAEG,SAAS,EAAEJ,WAAW;IAAEK,WAAW,EAAE;EAAe,CAAC,CAAC;EAEtF,OAAOF,WAAW;AACpB,CAAC;AAED,SAASP,SAAS"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Tab, TabItem } from '@blaze-react/tab';
|
|
4
4
|
import { useReadFromCache, GET_CURRENT_TAB_ID, TabsContextProvider } from '@blaze-cms/admin-ui-utils';
|
|
@@ -13,9 +13,12 @@ const Tabs = ({
|
|
|
13
13
|
} = useReadFromCache({
|
|
14
14
|
query: GET_CURRENT_TAB_ID
|
|
15
15
|
}) || EDITOR_VIEW_TAB_INDEX;
|
|
16
|
+
const [activeAccordions, setActiveAccordions] = useState([]);
|
|
16
17
|
return enabled ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TabsContextProvider, {
|
|
17
18
|
value: {
|
|
18
|
-
currentTabId
|
|
19
|
+
currentTabId,
|
|
20
|
+
activeAccordions,
|
|
21
|
+
setActiveAccordions
|
|
19
22
|
}
|
|
20
23
|
}, /*#__PURE__*/React.createElement(Tab, {
|
|
21
24
|
selected: currentTabId
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","PropTypes","Tab","TabItem","useReadFromCache","GET_CURRENT_TAB_ID","TabsContextProvider","PAGE_BUILDER_TAB","PAGE_BUILDER_TAB_INDEX","EDITOR_VIEW_TAB","EDITOR_VIEW_TAB_INDEX","Tabs","children","onTabChange","enabled","currentTabId","query","propTypes","oneOfType","object","arrayOf","isRequired","func","bool"],"sources":["../../../src/components/Tabs/index.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { Tab, TabItem } from '@blaze-react/tab';\nimport {\n useReadFromCache,\n GET_CURRENT_TAB_ID,\n TabsContextProvider\n} from '@blaze-cms/admin-ui-utils';\nimport {\n PAGE_BUILDER_TAB,\n PAGE_BUILDER_TAB_INDEX,\n EDITOR_VIEW_TAB,\n EDITOR_VIEW_TAB_INDEX\n} from '../../constants';\n\nconst Tabs = ({ children, onTabChange, enabled }) => {\n const { currentTabId } = useReadFromCache({ query: GET_CURRENT_TAB_ID }) || EDITOR_VIEW_TAB_INDEX;\n\n return enabled ? (\n <>\n <TabsContextProvider value={{ currentTabId }}>\n <Tab selected={currentTabId}>\n <TabItem title={EDITOR_VIEW_TAB} action={() => onTabChange(EDITOR_VIEW_TAB_INDEX)}>\n {children}\n </TabItem>\n <TabItem title={PAGE_BUILDER_TAB} action={() => onTabChange(PAGE_BUILDER_TAB_INDEX)}>\n {children}\n </TabItem>\n </Tab>\n </TabsContextProvider>\n </>\n ) : (\n <>{children}</>\n );\n};\n\nTabs.propTypes = {\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]).isRequired,\n onTabChange: PropTypes.func.isRequired,\n enabled: PropTypes.bool.isRequired\n};\n\nexport default Tabs;\n"],"mappings":"AAAA,OAAOA,KAAK,
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useState","PropTypes","Tab","TabItem","useReadFromCache","GET_CURRENT_TAB_ID","TabsContextProvider","PAGE_BUILDER_TAB","PAGE_BUILDER_TAB_INDEX","EDITOR_VIEW_TAB","EDITOR_VIEW_TAB_INDEX","Tabs","children","onTabChange","enabled","currentTabId","query","activeAccordions","setActiveAccordions","createElement","Fragment","value","selected","title","action","propTypes","oneOfType","object","arrayOf","isRequired","func","bool"],"sources":["../../../src/components/Tabs/index.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { Tab, TabItem } from '@blaze-react/tab';\nimport {\n useReadFromCache,\n GET_CURRENT_TAB_ID,\n TabsContextProvider\n} from '@blaze-cms/admin-ui-utils';\nimport {\n PAGE_BUILDER_TAB,\n PAGE_BUILDER_TAB_INDEX,\n EDITOR_VIEW_TAB,\n EDITOR_VIEW_TAB_INDEX\n} from '../../constants';\n\nconst Tabs = ({ children, onTabChange, enabled }) => {\n const { currentTabId } = useReadFromCache({ query: GET_CURRENT_TAB_ID }) || EDITOR_VIEW_TAB_INDEX;\n const [activeAccordions, setActiveAccordions] = useState([]);\n\n return enabled ? (\n <>\n <TabsContextProvider value={{ currentTabId, activeAccordions, setActiveAccordions }}>\n <Tab selected={currentTabId}>\n <TabItem title={EDITOR_VIEW_TAB} action={() => onTabChange(EDITOR_VIEW_TAB_INDEX)}>\n {children}\n </TabItem>\n <TabItem title={PAGE_BUILDER_TAB} action={() => onTabChange(PAGE_BUILDER_TAB_INDEX)}>\n {children}\n </TabItem>\n </Tab>\n </TabsContextProvider>\n </>\n ) : (\n <>{children}</>\n );\n};\n\nTabs.propTypes = {\n children: PropTypes.oneOfType([PropTypes.object, PropTypes.arrayOf(PropTypes.object)]).isRequired,\n onTabChange: PropTypes.func.isRequired,\n enabled: PropTypes.bool.isRequired\n};\n\nexport default Tabs;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,GAAG,EAAEC,OAAO,QAAQ,kB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AS,CAAC0B,MAAM,CAAC,CAAC,CAAC,CAACE,UAAU;EACjGhB,WAAW,EAAEZ,SAAS,CAAC6B,IAAI,CAACD,UAAU;EACtCf,OAAO,EAAEb,SAAS,CAAC8B,IAAI,CAACF;AAC1B,CAAC;AAED,eAAelB,IAAI"}
|
package/lib-es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["getFormBuilderLookup","formFieldTypes","React","pkg","DATA_LISTING_PREFIX","PLUGIN_NAME","getAddContentMenuItems","EntityDataListing","lazy","EntityManager","load","app","sectionKey","events","once","addSection","header","order","addFieldType","Object","keys","forEach","type","component","emitAsync","entityDataListingRoute","path","key","exact","editEntityRoute","addEntityRoute","addRoute","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';\nimport React from 'react';\nimport pkg from '../package.json';\nimport { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';\nimport getAddContentMenuItems from './utils/add-content-menu-items';\n\nconst EntityDataListing = React.lazy(() =>\n import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')\n);\nconst EntityManager = React.lazy(() =>\n import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')\n);\n\nexport default async function load(app) {\n // To load different plugin information into menu\n const sectionKey = 'content';\n\n app.events.once('load:menu-section', addSection => {\n addSection(sectionKey, { header: 'content', order: 100 });\n });\n\n app.events.once('load:menu-items', getAddContentMenuItems(app, sectionKey));\n\n app.events.once('load:custom:field:type', addFieldType => {\n Object.keys(formFieldTypes).forEach(type => {\n addFieldType({ type, component: formFieldTypes[type] });\n });\n });\n\n app.events.once('plugin:data-ui:load:loaded', async () => {\n await app.events.emitAsync('load:custom:field:type', getFormBuilderLookup.addFieldType);\n });\n\n const entityDataListingRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier`,\n key: 'entityDataListing',\n component: EntityDataListing,\n exact: true\n };\n\n const editEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action/:id`,\n key: 'editEntity',\n component: EntityManager,\n exact: true\n };\n\n const addEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action`,\n key: 'createEntity',\n component: EntityManager,\n exact: true\n };\n\n app.addRoute(entityDataListingRoute);\n app.addRoute(editEntityRoute);\n app.addRoute(addEntityRoute);\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"AAAA,SAASA,oBAAoB,EAAEC,cAAc,QAAQ,+BAA+B;AACpF,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,mBAAmB,EAAEC,WAAW,QAAQ,aAAa;AAC9D,OAAOC,sBAAsB,MAAM,gCAAgC;AAEnE,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,IAAI,CAAC,MACnC,MAAM,EAAC,2CAA4C,gCAAgC,CAAC,CACrF;AACD,MAAMC,aAAa,GAAGP,KAAK,CAACM,IAAI,CAAC,MAC/B,MAAM,EAAC,uCAAwC,4BAA4B,CAAC,CAC7E;AAED,eAAe,eAAeE,
|
|
1
|
+
{"version":3,"file":"index.js","names":["getFormBuilderLookup","formFieldTypes","React","pkg","DATA_LISTING_PREFIX","PLUGIN_NAME","getAddContentMenuItems","EntityDataListing","lazy","EntityManager","load","app","sectionKey","events","once","addSection","header","order","addFieldType","Object","keys","forEach","type","component","emitAsync","entityDataListingRoute","path","key","exact","editEntityRoute","addEntityRoute","addRoute","name","version","pluginName"],"sources":["../src/index.js"],"sourcesContent":["import { getFormBuilderLookup, formFieldTypes } from '@blaze-cms/react-form-builder';\nimport React from 'react';\nimport pkg from '../package.json';\nimport { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';\nimport getAddContentMenuItems from './utils/add-content-menu-items';\n\nconst EntityDataListing = React.lazy(() =>\n import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')\n);\nconst EntityManager = React.lazy(() =>\n import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')\n);\n\nexport default async function load(app) {\n // To load different plugin information into menu\n const sectionKey = 'content';\n\n app.events.once('load:menu-section', addSection => {\n addSection(sectionKey, { header: 'content', order: 100 });\n });\n\n app.events.once('load:menu-items', getAddContentMenuItems(app, sectionKey));\n\n app.events.once('load:custom:field:type', addFieldType => {\n Object.keys(formFieldTypes).forEach(type => {\n addFieldType({ type, component: formFieldTypes[type] });\n });\n });\n\n app.events.once('plugin:data-ui:load:loaded', async () => {\n await app.events.emitAsync('load:custom:field:type', getFormBuilderLookup.addFieldType);\n });\n\n const entityDataListingRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier`,\n key: 'entityDataListing',\n component: EntityDataListing,\n exact: true\n };\n\n const editEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action/:id`,\n key: 'editEntity',\n component: EntityManager,\n exact: true\n };\n\n const addEntityRoute = {\n path: `${DATA_LISTING_PREFIX}/:entityIdentifier/:action`,\n key: 'createEntity',\n component: EntityManager,\n exact: true\n };\n\n app.addRoute(entityDataListingRoute);\n app.addRoute(editEntityRoute);\n app.addRoute(addEntityRoute);\n\n return {\n name: PLUGIN_NAME,\n version: pkg.version\n };\n}\n\nload.pluginName = PLUGIN_NAME;\n"],"mappings":"AAAA,SAASA,oBAAoB,EAAEC,cAAc,QAAQ,+BAA+B;AACpF,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,GAAG,MAAM,iBAAiB;AACjC,SAASC,mBAAmB,EAAEC,WAAW,QAAQ,aAAa;AAC9D,OAAOC,sBAAsB,MAAM,gCAAgC;AAEnE,MAAMC,iBAAiB,GAAGL,KAAK,CAACM,IAAI,CAAC,MACnC,MAAM,EAAC,2CAA4C,gCAAgC,CAAC,CACrF;AACD,MAAMC,aAAa,GAAGP,KAAK,CAACM,IAAI,CAAC,MAC/B,MAAM,EAAC,uCAAwC,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IACxDuB,GAAG,EAAE,cAAc;IACnBJ,SAAS,EAAEd,aAAa;IACxBmB,KAAK,EAAE;EACT,CAAC;EAEDjB,GAAG,CAACoB,QAAQ,CAACN,sBAAsB,CAAC;EACpCd,GAAG,CAACoB,QAAQ,CAACF,eAAe,CAAC;EAC7BlB,GAAG,CAACoB,QAAQ,CAACD,cAAc,CAAC;EAE5B,OAAO;IACLE,IAAI,EAAE3B,WAAW;IACjB4B,OAAO,EAAE9B,GAAG,CAAC8B;EACf,CAAC;AACH;AAEAvB,IAAI,CAACwB,UAAU,GAAG7B,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-content-menu-items.js","names":["getQuery","MENU_PERMISSIONS","require","getAddContentMenuItems","app","sectionKey","addItem","client","getClient","data","getEntitySchemas","query","variables","canDoActions","forEach","id","displayName","name","uri"],"sources":["../../src/utils/add-content-menu-items.js"],"sourcesContent":["import { getQuery } from '@blaze-cms/admin-ui-utils';\n\nconst { MENU_PERMISSIONS } = require('../constants');\n\nfunction getAddContentMenuItems(app, sectionKey) {\n return async addItem => {\n const client = app.getClient();\n const {\n data: { getEntitySchemas }\n } = await client.query({\n query: getQuery('GET_USER_EDITABLE_ENTITIES'),\n variables: {\n // only return entities that the current user can do the following actions on\n canDoActions: MENU_PERMISSIONS\n }\n });\n getEntitySchemas.forEach(({ id, displayName }) => {\n addItem({ name: displayName, uri: `/data-listing/${id}` }, sectionKey);\n });\n };\n}\n\nexport default getAddContentMenuItems;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AAEpD,MAAM;EAAEC;AAAiB,CAAC,GAAGC,OAAO,CAAC,cAAc,CAAC;AAEpD,SAASC,
|
|
1
|
+
{"version":3,"file":"add-content-menu-items.js","names":["getQuery","MENU_PERMISSIONS","require","getAddContentMenuItems","app","sectionKey","addItem","client","getClient","data","getEntitySchemas","query","variables","canDoActions","forEach","id","displayName","name","uri"],"sources":["../../src/utils/add-content-menu-items.js"],"sourcesContent":["import { getQuery } from '@blaze-cms/admin-ui-utils';\n\nconst { MENU_PERMISSIONS } = require('../constants');\n\nfunction getAddContentMenuItems(app, sectionKey) {\n return async addItem => {\n const client = app.getClient();\n const {\n data: { getEntitySchemas }\n } = await client.query({\n query: getQuery('GET_USER_EDITABLE_ENTITIES'),\n variables: {\n // only return entities that the current user can do the following actions on\n canDoActions: MENU_PERMISSIONS\n }\n });\n getEntitySchemas.forEach(({ id, displayName }) => {\n addItem({ name: displayName, uri: `/data-listing/${id}` }, sectionKey);\n });\n };\n}\n\nexport default getAddContentMenuItems;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,2BAA2B;AAEpD,MAAM;EAAEC;AAAiB,CAAC,GAAGC,OAAO,CAAC,cAAc,CAAC;AAEpD,SAASC,sBAAsBA,CAACC,GAAG,EAAEC,UAAU,EAAE;EAC/C,OAAO,MAAMC,OAAO,IAAI;IACtB,MAAMC,MAAM,GAAGH,GAAG,CAACI,SAAS,EAAE;IAC9B,MAAM;MACJC,IAAI,EAAE;QAAEC;MAAiB;IAC3B,CAAC,GAAG,MAAMH,MAAM,CAACI,KAAK,CAAC;MACrBA,KAAK,EAAEX,QAAQ,CAAC,4BAA4B,CAAC;MAC7CY,SAAS,EAAE;QACT;QACAC,YAAY,EAAEZ;MAChB;IACF,CAAC,CAAC;IACFS,gBAAgB,CAACI,OAAO,CAAC,CAAC;MAAEC,EAAE;MAAEC;IAAY,CAAC,KAAK;MAChDV,OAAO,CAAC;QAAEW,IAAI,EAAED,WAAW;QAAEE,GAAG,EAAG,iBAAgBH,EAAG;MAAE,CAAC,EAAEV,UAAU,CAAC;IACxE,CAAC,CAAC;EACJ,CAAC;AACH;AAEA,eAAeF,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-create-entity-mutation.js","names":["gql","BlazeError","upperfirst","getDataProperties","buildCreateEntityMutation","entitySchema","actions","create","properties","actionInput","dataProperties","join"],"sources":["../../src/utils/build-create-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildCreateEntityMutation(entitySchema) {\n if (\n !entitySchema ||\n !entitySchema.actions ||\n !entitySchema.actions.create ||\n !entitySchema.properties\n ) {\n throw new BlazeError(\n 'Create entity query requires create action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.create}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`mutation createEntity($input: ${actionInput}) {\n createdEntity: ${entitySchema.actions.create}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')}\n }\n }\n }`;\n}\n\nexport default buildCreateEntityMutation;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,
|
|
1
|
+
{"version":3,"file":"build-create-entity-mutation.js","names":["gql","BlazeError","upperfirst","getDataProperties","buildCreateEntityMutation","entitySchema","actions","create","properties","actionInput","dataProperties","join"],"sources":["../../src/utils/build-create-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildCreateEntityMutation(entitySchema) {\n if (\n !entitySchema ||\n !entitySchema.actions ||\n !entitySchema.actions.create ||\n !entitySchema.properties\n ) {\n throw new BlazeError(\n 'Create entity query requires create action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.create}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`mutation createEntity($input: ${actionInput}) {\n createdEntity: ${entitySchema.actions.create}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')}\n }\n }\n }`;\n}\n\nexport default buildCreateEntityMutation;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,yBAAyBA,CAACC,YAAY,EAAE;EAC/C,IACE,CAACA,YAAY,IACb,CAACA,YAAY,CAACC,OAAO,IACrB,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAC5B,CAACF,YAAY,CAACG,UAAU,EACxB;IACA,MAAM,IAAIP,UAAU,CAClB,8EAA8E,CAC/E;EACH;EAEA,MAAMQ,WAAW,GAAGP,UAAU,CAAE,GAAEG,YAAY,CAACC,OAAO,CAACC,MAAO,OAAM,CAAC;EACrE,MAAMG,cAAc,GAAGP,iBAAiB,CAACE,YAAY,CAAC;EAEtD,OAAOL,GAAI,kCAAiCS,WAAY;AAC1D,qBAAqBJ,YAAY,CAACC,OAAO,CAACC,MAAO;AACjD;AACA;AACA,YAAYG,cAAc,CAACC,IAAI,CAAC,KAAK,CAAE;AACvC;AACA;AACA,IAAI;AACJ;AAEA,eAAeP,yBAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-delete-entity-mutation.js","names":["gql","BlazeError","upperfirst","buildDeleteEntity","entitySchema","actions","delete","actionInput"],"sources":["../../src/utils/build-delete-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\n\nfunction buildDeleteEntity(entitySchema) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {\n throw new BlazeError('Delete query requires delete action from entity schema');\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.delete}Input`);\n\n return gql`\n mutation deleteEntity($input: ${actionInput}) {\n deleteEntity: ${entitySchema.actions.delete}(input: $input){\n result\n }\n }\n `;\n}\n\nexport default buildDeleteEntity;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAE1C,SAASC,
|
|
1
|
+
{"version":3,"file":"build-delete-entity-mutation.js","names":["gql","BlazeError","upperfirst","buildDeleteEntity","entitySchema","actions","delete","actionInput"],"sources":["../../src/utils/build-delete-entity-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\n\nfunction buildDeleteEntity(entitySchema) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.delete) {\n throw new BlazeError('Delete query requires delete action from entity schema');\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.delete}Input`);\n\n return gql`\n mutation deleteEntity($input: ${actionInput}) {\n deleteEntity: ${entitySchema.actions.delete}(input: $input){\n result\n }\n }\n `;\n}\n\nexport default buildDeleteEntity;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAE1C,SAASC,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,EAAE;IAC1E,MAAM,IAAIL,UAAU,CAAC,wDAAwD,CAAC;EAChF;EAEA,MAAMM,WAAW,GAAGL,UAAU,CAAE,GAAEE,YAAY,CAACC,OAAO,CAACC,MAAO,OAAM,CAAC;EAErE,OAAON,GAAI;AACb,mCAAmCO,WAAY;AAC/C,oBAAoBH,YAAY,CAACC,OAAO,CAACC,MAAO;AAChD;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeH,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","buildListingQuery","entitySchema","actions","getAll","listingProperties","sortType","toUpperCase","substr","join"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildListingQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${\n entitySchema.actions.getAll\n }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${\n entitySchema.actions.getAll\n }(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,
|
|
1
|
+
{"version":3,"file":"build-listing-query.js","names":["gql","BlazeError","buildListingQuery","entitySchema","actions","getAll","listingProperties","sortType","toUpperCase","substr","join"],"sources":["../../src/utils/build-listing-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildListingQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.getAll || !entitySchema.listingProperties) {\n throw new BlazeError(\n 'Listing query requires getAll action and listingProperties from entity schema'\n );\n }\n\n const sortType =\n entitySchema.actions.getAll[0].toUpperCase() + entitySchema.actions.getAll.substr(1);\n\n return gql`\n query ${\n entitySchema.actions.getAll\n }($where: JSON, $limit: Int, $offset:Int, $sort: [${sortType}SortItem]) {\n listingData: ${\n entitySchema.actions.getAll\n }(where: $where, limit: $limit, offset:$offset, sort:$sort){\n id,\n ${entitySchema.listingProperties.join(',\\n')}\n }\n }\n `;\n}\n\nexport default buildListingQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,iBAAiBA,CAACC,YAAY,EAAE;EACvC,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,iBAAiB,EAAE;IAC5F,MAAM,IAAIL,UAAU,CAClB,+EAA+E,CAChF;EACH;EAEA,MAAMM,QAAQ,GACZJ,YAAY,CAACC,OAAO,CAACC,MAAM,CAAC,CAAC,CAAC,CAACG,WAAW,EAAE,GAAGL,YAAY,CAACC,OAAO,CAACC,MAAM,CAACI,MAAM,CAAC,CAAC,CAAC;EAEtF,OAAOT,GAAI;AACb,YACMG,YAAY,CAACC,OAAO,CAACC,MACtB,oDAAmDE,QAAS;AACjE,qBACQJ,YAAY,CAACC,OAAO,CAACC,MACtB;AACP;AACA,UAAUF,YAAY,CAACG,iBAAiB,CAACI,IAAI,CAAC,KAAK,CAAE;AACrD;AACA;AACA,GAAG;AACH;AAEA,eAAeR,iBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-update-data-query.js","names":["gql","BlazeError","upperfirst","getDataProperties","buildUpdateDataQuery","entitySchema","actions","update","properties","actionInput","dataProperties","join"],"sources":["../../src/utils/build-update-data-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildUpdateDataQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.update || !entitySchema.properties) {\n throw new BlazeError(\n 'Update DataEntity query requires get action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.update}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`\n mutation updateEntity($input: ${actionInput}) {\n updateEntity: ${entitySchema.actions.update}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')},\n updated\n }\n }\n }\n `;\n}\n\nexport default buildUpdateDataQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,
|
|
1
|
+
{"version":3,"file":"build-update-data-query.js","names":["gql","BlazeError","upperfirst","getDataProperties","buildUpdateDataQuery","entitySchema","actions","update","properties","actionInput","dataProperties","join"],"sources":["../../src/utils/build-update-data-query.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\nimport upperfirst from 'lodash.upperfirst';\nimport { getDataProperties } from '@blaze-cms/admin-ui-utils';\n\nfunction buildUpdateDataQuery(entitySchema) {\n if (!entitySchema.actions || !entitySchema.actions.update || !entitySchema.properties) {\n throw new BlazeError(\n 'Update DataEntity query requires get action and properties from entity schema'\n );\n }\n\n const actionInput = upperfirst(`${entitySchema.actions.update}Input`);\n const dataProperties = getDataProperties(entitySchema);\n\n return gql`\n mutation updateEntity($input: ${actionInput}) {\n updateEntity: ${entitySchema.actions.update}(input: $input){\n result {\n id,\n ${dataProperties.join(',\\n')},\n updated\n }\n }\n }\n `;\n}\n\nexport default buildUpdateDataQuery;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AACnD,OAAOC,UAAU,MAAM,mBAAmB;AAC1C,SAASC,iBAAiB,QAAQ,2BAA2B;AAE7D,SAASC,oBAAoBA,CAACC,YAAY,EAAE;EAC1C,IAAI,CAACA,YAAY,CAACC,OAAO,IAAI,CAACD,YAAY,CAACC,OAAO,CAACC,MAAM,IAAI,CAACF,YAAY,CAACG,UAAU,EAAE;IACrF,MAAM,IAAIP,UAAU,CAClB,+EAA+E,CAChF;EACH;EAEA,MAAMQ,WAAW,GAAGP,UAAU,CAAE,GAAEG,YAAY,CAACC,OAAO,CAACC,MAAO,OAAM,CAAC;EACrE,MAAMG,cAAc,GAAGP,iBAAiB,CAACE,YAAY,CAAC;EAEtD,OAAOL,GAAI;AACb,mCAAmCS,WAAY;AAC/C,oBAAoBJ,YAAY,CAACC,OAAO,CAACC,MAAO;AAChD;AACA;AACA,YAAYG,cAAc,CAACC,IAAI,CAAC,KAAK,CAAE;AACvC;AACA;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeP,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-update-publish-unpublish-mutation.js","names":["gql","BlazeError","buildUpdatePublishUnpublishMutation","entitySchema","id","action","cache","actions","publish","withClient"],"sources":["../../src/utils/build-update-publish-unpublish-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildUpdatePublishUnpublishMutation(entitySchema, id, action, cache) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.publish || !id || !action) {\n throw new BlazeError(\n 'Update DataEntity query requires publish action from entity schema and id'\n );\n }\n\n const withClient = `${cache ? '@client' : ''}`;\n\n return gql`\n mutation {\n response: ${entitySchema.actions[action]} ${withClient}(input: {\n id: \"${id}\"\n }){\n result {\n id,\n status\n }\n }\n }\n `;\n}\n\nexport default buildUpdatePublishUnpublishMutation;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,
|
|
1
|
+
{"version":3,"file":"build-update-publish-unpublish-mutation.js","names":["gql","BlazeError","buildUpdatePublishUnpublishMutation","entitySchema","id","action","cache","actions","publish","withClient"],"sources":["../../src/utils/build-update-publish-unpublish-mutation.js"],"sourcesContent":["import { gql } from '@apollo/client';\nimport { BlazeError } from '@blaze-cms/core-errors';\n\nfunction buildUpdatePublishUnpublishMutation(entitySchema, id, action, cache) {\n if (!entitySchema || !entitySchema.actions || !entitySchema.actions.publish || !id || !action) {\n throw new BlazeError(\n 'Update DataEntity query requires publish action from entity schema and id'\n );\n }\n\n const withClient = `${cache ? '@client' : ''}`;\n\n return gql`\n mutation {\n response: ${entitySchema.actions[action]} ${withClient}(input: {\n id: \"${id}\"\n }){\n result {\n id,\n status\n }\n }\n }\n `;\n}\n\nexport default buildUpdatePublishUnpublishMutation;\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AACpC,SAASC,UAAU,QAAQ,wBAAwB;AAEnD,SAASC,mCAAmCA,CAACC,YAAY,EAAEC,EAAE,EAAEC,MAAM,EAAEC,KAAK,EAAE;EAC5E,IAAI,CAACH,YAAY,IAAI,CAACA,YAAY,CAACI,OAAO,IAAI,CAACJ,YAAY,CAACI,OAAO,CAACC,OAAO,IAAI,CAACJ,EAAE,IAAI,CAACC,MAAM,EAAE;IAC7F,MAAM,IAAIJ,UAAU,CAClB,2EAA2E,CAC5E;EACH;EAEA,MAAMQ,UAAU,GAAI,GAAEH,KAAK,GAAG,SAAS,GAAG,EAAG,EAAC;EAE9C,OAAON,GAAI;AACb;AACA,kBAAkBG,YAAY,CAACI,OAAO,CAACF,MAAM,CAAE,IAAGI,UAAW;AAC7D,eAAeL,EAAG;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AAEA,eAAeF,mCAAmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","adminDefaultListingFilter","where","displayProperties","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = ({ schema }) => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where } = schema.displayProperties || {};\n\n return {\n where,\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":"AAAA,MAAMA,qBAAqB,
|
|
1
|
+
{"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","adminDefaultListingFilter","where","displayProperties","limit","offset","sort","property","direction"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = ({ schema }) => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where } = schema.displayProperties || {};\n\n return {\n where,\n limit: 40,\n offset: 0,\n sort: updated\n ? [\n {\n property: 'updated',\n direction: 'desc'\n }\n ]\n : []\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAGA,CAAC;EAAEC;AAAO,CAAC,KAAK;EAC5C,MAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAC9D,MAAM;IAAEE,yBAAyB,EAAEC;EAAM,CAAC,GAAGJ,MAAM,CAACK,iBAAiB,IAAI,CAAC,CAAC;EAE3E,OAAO;IACLD,KAAK;IACLE,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTC,IAAI,EAAEP,OAAO,GACT,CACE;MACEQ,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF,GACD;EACN,CAAC;AACH,CAAC;AAED,SAASX,qBAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withContext.js","names":["React","useMainContext","MainContext","withContext","Component","props","contexts"],"sources":["../../../src/utils/hoc/withContext.js"],"sourcesContent":["import React from 'react';\nimport { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';\n\nexport const withContext = Component => props => {\n const contexts = useMainContext(MainContext);\n return <Component {...props} {...contexts} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,WAAW,QAAQ,2BAA2B;AAEvE,OAAO,MAAMC,WAAW,GAAGC,SAAS,IAAIC,KAAK,IAAI;EAC/C,MAAMC,QAAQ,GAAGL,cAAc,CAACC,WAAW,CAAC;EAC5C,
|
|
1
|
+
{"version":3,"file":"withContext.js","names":["React","useMainContext","MainContext","withContext","Component","props","contexts","createElement","_extends"],"sources":["../../../src/utils/hoc/withContext.js"],"sourcesContent":["import React from 'react';\nimport { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';\n\nexport const withContext = Component => props => {\n const contexts = useMainContext(MainContext);\n return <Component {...props} {...contexts} />;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,WAAW,QAAQ,2BAA2B;AAEvE,OAAO,MAAMC,WAAW,GAAGC,SAAS,IAAIC,KAAK,IAAI;EAC/C,MAAMC,QAAQ,GAAGL,cAAc,CAACC,WAAW,CAAC;EAC5C,oBAAOF,KAAA,CAAAO,aAAA,CAACH,SAAS,EAAAI,QAAA,KAAKH,KAAK,EAAMC,QAAQ,EAAI;AAC/C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToggle.js","names":["useState","useCallback","useToggle","initialValue","toggleValue","setToggleValue","toggler"],"sources":["../../../src/utils/hooks/useToggle.js"],"sourcesContent":["import { useState, useCallback } from 'react';\n\nfunction useToggle(initialValue) {\n const [toggleValue, setToggleValue] = useState(initialValue);\n const toggler = useCallback(() => setToggleValue(!toggleValue), [toggleValue]);\n\n return [toggleValue, toggler];\n}\n\nexport default useToggle;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAE7C,SAASC,
|
|
1
|
+
{"version":3,"file":"useToggle.js","names":["useState","useCallback","useToggle","initialValue","toggleValue","setToggleValue","toggler"],"sources":["../../../src/utils/hooks/useToggle.js"],"sourcesContent":["import { useState, useCallback } from 'react';\n\nfunction useToggle(initialValue) {\n const [toggleValue, setToggleValue] = useState(initialValue);\n const toggler = useCallback(() => setToggleValue(!toggleValue), [toggleValue]);\n\n return [toggleValue, toggler];\n}\n\nexport default useToggle;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAE7C,SAASC,SAASA,CAACC,YAAY,EAAE;EAC/B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGL,QAAQ,CAACG,YAAY,CAAC;EAC5D,MAAMG,OAAO,GAAGL,WAAW,CAAC,MAAMI,cAAc,CAAC,CAACD,WAAW,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAE9E,OAAO,CAACA,WAAW,EAAEE,OAAO,CAAC;AAC/B;AAEA,eAAeJ,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-data-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.128.0-admin-updates.3",
|
|
4
4
|
"description": "Blaze plugin data ui",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/admin-ui-utils": "
|
|
31
|
-
"@blaze-cms/core-errors": "
|
|
32
|
-
"@blaze-cms/react-form-builder": "
|
|
33
|
-
"@blaze-cms/react-page-builder": "
|
|
34
|
-
"@blaze-cms/setup-ui": "
|
|
35
|
-
"@blaze-cms/versioning-ui": "
|
|
30
|
+
"@blaze-cms/admin-ui-utils": "0.128.0-admin-updates.3",
|
|
31
|
+
"@blaze-cms/core-errors": "0.128.0-admin-updates.0",
|
|
32
|
+
"@blaze-cms/react-form-builder": "0.128.0-admin-updates.3",
|
|
33
|
+
"@blaze-cms/react-page-builder": "0.128.0-admin-updates.3",
|
|
34
|
+
"@blaze-cms/setup-ui": "0.128.0-admin-updates.0",
|
|
35
|
+
"@blaze-cms/versioning-ui": "0.128.0-admin-updates.0",
|
|
36
36
|
"@blaze-react/button": "0.5.19",
|
|
37
37
|
"@blaze-react/more": "0.5.19",
|
|
38
38
|
"@blaze-react/multiselect": "0.6.6",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"uuid": "^3.3.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@blaze-cms/core-ui": "
|
|
56
|
+
"@blaze-cms/core-ui": "0.128.0-admin-updates.0"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@apollo/client": "3.x",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"lib/*",
|
|
66
66
|
"lib-es/*"
|
|
67
67
|
],
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "f96b63b60fe8a99a75e822b6e3b3b88ea90d0cd2"
|
|
69
69
|
}
|
|
@@ -403,68 +403,70 @@ const Entity = ({
|
|
|
403
403
|
|
|
404
404
|
return (
|
|
405
405
|
<div className="page">
|
|
406
|
-
<
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
<div className="
|
|
423
|
-
<div className="
|
|
424
|
-
<
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
406
|
+
<EntityHeader
|
|
407
|
+
entityData={entityData}
|
|
408
|
+
entityIdentifier={entityIdentifier}
|
|
409
|
+
pageTitle={pageTitle}
|
|
410
|
+
pageName={pageName}
|
|
411
|
+
onSubmit={onSubmit}
|
|
412
|
+
handlePublishAndUnpublish={handlePublishAndUnpublish}
|
|
413
|
+
isSaveButtonAvailable={isSaveButtonAvailable}
|
|
414
|
+
isEnablePublishButton={isEnablePublishButton}
|
|
415
|
+
isEnablePreviewButton={isEnablePreviewButton}
|
|
416
|
+
toggleCopyModal={setCopyModalStatus}
|
|
417
|
+
toggleModal={setModalStatus}
|
|
418
|
+
formData={formData}
|
|
419
|
+
onViewUrl={onViewUrlHandler}
|
|
420
|
+
saveButtonText={saveButtonText}
|
|
421
|
+
/>
|
|
422
|
+
<div className="page-wrapper__content">
|
|
423
|
+
<div className="tabs-wrapper tabs-wrapper__tab">
|
|
424
|
+
<Prompt when={hasToDisplayPrompt} message={LEAVE_PAGE_MESSAGE} />
|
|
425
|
+
{showModal && (
|
|
426
|
+
<DeleteAction
|
|
427
|
+
onClose={setModalStatus}
|
|
428
|
+
deleteAction={onDelete}
|
|
429
|
+
itemName={formData.values.name}
|
|
430
|
+
/>
|
|
431
|
+
)}
|
|
432
|
+
{copyModalStatus && (
|
|
433
|
+
<CopyDataFromAction
|
|
434
|
+
onClose={handleCopyDataFromClose}
|
|
435
|
+
copyAction={onCopy}
|
|
436
|
+
getFormData={getFormData}
|
|
437
|
+
/>
|
|
438
|
+
)}
|
|
439
|
+
|
|
440
|
+
<div className="page__content--fixed">
|
|
441
|
+
<div className="page__content">
|
|
442
|
+
<div className="content">
|
|
443
|
+
<Tabs
|
|
444
|
+
enabled={showPageBuilderTabs}
|
|
445
|
+
onTabChange={tabId => {
|
|
446
|
+
client.writeQuery({
|
|
447
|
+
query: GET_CURRENT_TAB_ID,
|
|
448
|
+
data: { currentTabId: tabId }
|
|
449
|
+
});
|
|
450
|
+
setCurrentTabId(tabId);
|
|
451
|
+
}}>
|
|
452
|
+
<FormBuilder
|
|
453
|
+
getIsFormValid={setIsFormValid}
|
|
454
|
+
getFormValues={getFormValues}
|
|
455
|
+
schema={schema}
|
|
456
|
+
data={clonedFormData}
|
|
457
|
+
onChange={onChangeFormValues}
|
|
458
|
+
shouldCopyData={shouldCopyData}
|
|
459
|
+
updateCopyData={updateCopyData}
|
|
460
|
+
formValues={formValues}
|
|
461
|
+
isNewEntity={isNewEntity}
|
|
462
|
+
/>
|
|
463
|
+
</Tabs>
|
|
464
|
+
</div>
|
|
464
465
|
</div>
|
|
465
466
|
</div>
|
|
466
467
|
</div>
|
|
467
|
-
|
|
468
|
+
|
|
469
|
+
<div className="column column--one-third page-sidebar">
|
|
468
470
|
{showSideBarRelations && (
|
|
469
471
|
<SideBarRelations
|
|
470
472
|
entity={entity}
|
|
@@ -4,16 +4,21 @@ import uuidv1 from 'uuid/v1';
|
|
|
4
4
|
import { useApolloClient } from '@apollo/client';
|
|
5
5
|
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
6
6
|
import { formFieldTypes } from '@blaze-cms/react-form-builder';
|
|
7
|
-
import
|
|
7
|
+
import classnames from 'classnames';
|
|
8
8
|
import { VersionsList } from '@blaze-cms/versioning-ui';
|
|
9
|
-
import { PUBLISHED } from '../../../../constants';
|
|
9
|
+
import { PUBLISHED, UNPUBLISHED } from '../../../../constants';
|
|
10
10
|
|
|
11
11
|
const SideBarRelations = ({ schema, onChange, formData, entity }) => {
|
|
12
12
|
const { relation: RelationComponent } = formFieldTypes;
|
|
13
|
-
const {
|
|
13
|
+
const {
|
|
14
|
+
formattedStatus,
|
|
15
|
+
formattedUpdated,
|
|
16
|
+
formattedCreated,
|
|
17
|
+
formattedPublished,
|
|
18
|
+
status
|
|
19
|
+
} = formData;
|
|
14
20
|
const client = useApolloClient();
|
|
15
21
|
const [relationsComponents, setRelationsComponents] = useState(null);
|
|
16
|
-
|
|
17
22
|
useEffect(
|
|
18
23
|
() => {
|
|
19
24
|
(async () => {
|
|
@@ -51,17 +56,26 @@ const SideBarRelations = ({ schema, onChange, formData, entity }) => {
|
|
|
51
56
|
const { id: itemId } = entity;
|
|
52
57
|
const { identifier: itemEntity, interfaces } = schema;
|
|
53
58
|
|
|
59
|
+
const statusClassName = classnames('sidebar__status__badge', {
|
|
60
|
+
'sidebar__status__badge--published': status === PUBLISHED,
|
|
61
|
+
'sidebar__status__badge--unpublished': status === UNPUBLISHED
|
|
62
|
+
});
|
|
63
|
+
|
|
54
64
|
return (
|
|
55
65
|
<div className="sidebar" data-testid="sideBarRelations-main-div">
|
|
56
66
|
<div className="sidebar__content">
|
|
57
67
|
{formattedCreated && (
|
|
58
68
|
<div className="sidebar__status">
|
|
59
|
-
|
|
60
|
-
<
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
69
|
+
<div className="sidebar__status__wrapper">
|
|
70
|
+
<b>Status</b>
|
|
71
|
+
<span className={statusClassName}>{formattedStatus}</span>
|
|
72
|
+
</div>
|
|
73
|
+
{formattedStatus === PUBLISHED && (
|
|
74
|
+
<p>
|
|
75
|
+
{formattedStatus} on: <span> {formattedPublished}</span>
|
|
76
|
+
</p>
|
|
64
77
|
)}
|
|
78
|
+
|
|
65
79
|
<p>
|
|
66
80
|
Created: <span>{formattedCreated}</span>
|
|
67
81
|
</p>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { Tab, TabItem } from '@blaze-react/tab';
|
|
4
4
|
import {
|
|
@@ -15,10 +15,11 @@ import {
|
|
|
15
15
|
|
|
16
16
|
const Tabs = ({ children, onTabChange, enabled }) => {
|
|
17
17
|
const { currentTabId } = useReadFromCache({ query: GET_CURRENT_TAB_ID }) || EDITOR_VIEW_TAB_INDEX;
|
|
18
|
+
const [activeAccordions, setActiveAccordions] = useState([]);
|
|
18
19
|
|
|
19
20
|
return enabled ? (
|
|
20
21
|
<>
|
|
21
|
-
<TabsContextProvider value={{ currentTabId }}>
|
|
22
|
+
<TabsContextProvider value={{ currentTabId, activeAccordions, setActiveAccordions }}>
|
|
22
23
|
<Tab selected={currentTabId}>
|
|
23
24
|
<TabItem title={EDITOR_VIEW_TAB} action={() => onTabChange(EDITOR_VIEW_TAB_INDEX)}>
|
|
24
25
|
{children}
|