@blaze-cms/admin 0.146.0-node18.0 → 0.146.0-rc-eagle.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/CHANGELOG.md +3 -5
- package/lib/components/CardPrompt/CardPrompt.js +18 -20
- package/lib/components/CardPrompt/CardPrompt.js.map +1 -1
- package/lib/components/CardPrompt/index.js +2 -3
- package/lib/components/CardPrompt/index.js.map +1 -1
- package/lib/components/CopyDataFromAction/CopyDataFromAction.js +80 -144
- package/lib/components/CopyDataFromAction/CopyDataFromAction.js.map +1 -1
- package/lib/components/CopyDataFromAction/helpers.js +20 -12
- package/lib/components/CopyDataFromAction/helpers.js.map +1 -1
- package/lib/components/CopyDataFromAction/index.js +2 -3
- package/lib/components/CopyDataFromAction/index.js.map +1 -1
- package/lib/components/DeleteAction/DeleteAction.js +14 -14
- package/lib/components/DeleteAction/DeleteAction.js.map +1 -1
- package/lib/components/DeleteAction/index.js +2 -3
- package/lib/components/DeleteAction/index.js.map +1 -1
- package/lib/components/LeaveAction/LeaveAction.js +11 -14
- package/lib/components/LeaveAction/LeaveAction.js.map +1 -1
- package/lib/components/LeaveAction/index.js +2 -3
- package/lib/components/LeaveAction/index.js.map +1 -1
- package/lib/components/Loading/Loading.js +16 -17
- package/lib/components/Loading/Loading.js.map +1 -1
- package/lib/components/Loading/constants.js +5 -6
- package/lib/components/Loading/constants.js.map +1 -1
- package/lib/components/Loading/index.js +2 -3
- package/lib/components/Loading/index.js.map +1 -1
- package/lib/components/MetaTitle/MetaTitle.js +18 -17
- package/lib/components/MetaTitle/MetaTitle.js.map +1 -1
- package/lib/components/MetaTitle/index.js +2 -3
- package/lib/components/MetaTitle/index.js.map +1 -1
- package/lib/components/PageHeader/PageHeader.js +37 -44
- package/lib/components/PageHeader/PageHeader.js.map +1 -1
- package/lib/components/PageHeader/index.js +2 -3
- package/lib/components/PageHeader/index.js.map +1 -1
- package/lib/components/RevertToTemplate/RevertToTemplate.js +14 -14
- package/lib/components/RevertToTemplate/RevertToTemplate.js.map +1 -1
- package/lib/components/RevertToTemplate/index.js +2 -3
- package/lib/components/RevertToTemplate/index.js.map +1 -1
- package/lib/index.js +17 -18
- package/lib/index.js.map +1 -1
- package/lib/utils/build-interface.js +39 -67
- package/lib/utils/build-interface.js.map +1 -1
- package/lib/utils/get-blaze-admin.js +7 -10
- package/lib/utils/get-blaze-admin.js.map +1 -1
- package/package.json +19 -21
- package/src/utils/build-interface.js +3 -3
- package/lib-es/components/CardPrompt/CardPrompt.js +0 -26
- package/lib-es/components/CardPrompt/CardPrompt.js.map +0 -1
- package/lib-es/components/CardPrompt/index.js +0 -3
- package/lib-es/components/CardPrompt/index.js.map +0 -1
- package/lib-es/components/CopyDataFromAction/CopyDataFromAction.js +0 -140
- package/lib-es/components/CopyDataFromAction/CopyDataFromAction.js.map +0 -1
- package/lib-es/components/CopyDataFromAction/helpers.js +0 -23
- package/lib-es/components/CopyDataFromAction/helpers.js.map +0 -1
- package/lib-es/components/CopyDataFromAction/index.js +0 -3
- package/lib-es/components/CopyDataFromAction/index.js.map +0 -1
- package/lib-es/components/DeleteAction/DeleteAction.js +0 -32
- package/lib-es/components/DeleteAction/DeleteAction.js.map +0 -1
- package/lib-es/components/DeleteAction/index.js +0 -3
- package/lib-es/components/DeleteAction/index.js.map +0 -1
- package/lib-es/components/LeaveAction/LeaveAction.js +0 -32
- package/lib-es/components/LeaveAction/LeaveAction.js.map +0 -1
- package/lib-es/components/LeaveAction/index.js +0 -3
- package/lib-es/components/LeaveAction/index.js.map +0 -1
- package/lib-es/components/Loading/Loading.js +0 -26
- package/lib-es/components/Loading/Loading.js.map +0 -1
- package/lib-es/components/Loading/constants.js +0 -10
- package/lib-es/components/Loading/constants.js.map +0 -1
- package/lib-es/components/Loading/index.js +0 -3
- package/lib-es/components/Loading/index.js.map +0 -1
- package/lib-es/components/MetaTitle/MetaTitle.js +0 -31
- package/lib-es/components/MetaTitle/MetaTitle.js.map +0 -1
- package/lib-es/components/MetaTitle/index.js +0 -3
- package/lib-es/components/MetaTitle/index.js.map +0 -1
- package/lib-es/components/PageHeader/PageHeader.js +0 -51
- package/lib-es/components/PageHeader/PageHeader.js.map +0 -1
- package/lib-es/components/PageHeader/index.js +0 -3
- package/lib-es/components/PageHeader/index.js.map +0 -1
- package/lib-es/components/RevertToTemplate/RevertToTemplate.js +0 -30
- package/lib-es/components/RevertToTemplate/RevertToTemplate.js.map +0 -1
- package/lib-es/components/RevertToTemplate/index.js +0 -3
- package/lib-es/components/RevertToTemplate/index.js.map +0 -1
- package/lib-es/index.js +0 -11
- package/lib-es/index.js.map +0 -1
- package/lib-es/utils/build-interface.js +0 -47
- package/lib-es/utils/build-interface.js.map +0 -1
- package/lib-es/utils/get-blaze-admin.js +0 -14
- package/lib-es/utils/get-blaze-admin.js.map +0 -1
package/lib/index.js
CHANGED
|
@@ -1,61 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
Object.defineProperty(exports, "CardPrompt", {
|
|
9
8
|
enumerable: true,
|
|
10
|
-
get: function
|
|
11
|
-
return _CardPrompt
|
|
9
|
+
get: function () {
|
|
10
|
+
return _CardPrompt.default;
|
|
12
11
|
}
|
|
13
12
|
});
|
|
14
13
|
Object.defineProperty(exports, "CopyDataFromAction", {
|
|
15
14
|
enumerable: true,
|
|
16
|
-
get: function
|
|
17
|
-
return _CopyDataFromAction
|
|
15
|
+
get: function () {
|
|
16
|
+
return _CopyDataFromAction.default;
|
|
18
17
|
}
|
|
19
18
|
});
|
|
20
19
|
Object.defineProperty(exports, "DeleteAction", {
|
|
21
20
|
enumerable: true,
|
|
22
|
-
get: function
|
|
23
|
-
return _DeleteAction
|
|
21
|
+
get: function () {
|
|
22
|
+
return _DeleteAction.default;
|
|
24
23
|
}
|
|
25
24
|
});
|
|
26
25
|
Object.defineProperty(exports, "LeaveAction", {
|
|
27
26
|
enumerable: true,
|
|
28
|
-
get: function
|
|
29
|
-
return _LeaveAction
|
|
27
|
+
get: function () {
|
|
28
|
+
return _LeaveAction.default;
|
|
30
29
|
}
|
|
31
30
|
});
|
|
32
31
|
Object.defineProperty(exports, "Loading", {
|
|
33
32
|
enumerable: true,
|
|
34
|
-
get: function
|
|
35
|
-
return _Loading
|
|
33
|
+
get: function () {
|
|
34
|
+
return _Loading.default;
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
37
|
Object.defineProperty(exports, "MetaTitle", {
|
|
39
38
|
enumerable: true,
|
|
40
|
-
get: function
|
|
41
|
-
return _MetaTitle
|
|
39
|
+
get: function () {
|
|
40
|
+
return _MetaTitle.default;
|
|
42
41
|
}
|
|
43
42
|
});
|
|
44
43
|
Object.defineProperty(exports, "PageHeader", {
|
|
45
44
|
enumerable: true,
|
|
46
|
-
get: function
|
|
47
|
-
return _PageHeader
|
|
45
|
+
get: function () {
|
|
46
|
+
return _PageHeader.default;
|
|
48
47
|
}
|
|
49
48
|
});
|
|
50
49
|
Object.defineProperty(exports, "RevertToTemplate", {
|
|
51
50
|
enumerable: true,
|
|
52
|
-
get: function
|
|
53
|
-
return _RevertToTemplate
|
|
51
|
+
get: function () {
|
|
52
|
+
return _RevertToTemplate.default;
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
Object.defineProperty(exports, "getBlazeAdmin", {
|
|
57
56
|
enumerable: true,
|
|
58
|
-
get: function
|
|
57
|
+
get: function () {
|
|
59
58
|
return _getBlazeAdmin.getBlazeAdmin;
|
|
60
59
|
}
|
|
61
60
|
});
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_PageHeader","_interopRequireDefault","require","_DeleteAction","_CardPrompt","_CopyDataFromAction","_MetaTitle","_LeaveAction","_RevertToTemplate","_Loading","_getBlazeAdmin"],"sources":["../src/index.js"],"sourcesContent":["import PageHeader from './components/PageHeader';\nimport DeleteAction from './components/DeleteAction';\nimport CardPrompt from './components/CardPrompt';\nimport CopyDataFromAction from './components/CopyDataFromAction';\nimport MetaTitle from './components/MetaTitle';\nimport LeaveAction from './components/LeaveAction';\nimport RevertToTemplate from './components/RevertToTemplate';\nimport Loading from './components/Loading';\nimport { getBlazeAdmin } from './utils/get-blaze-admin';\n\nexport {\n getBlazeAdmin,\n PageHeader,\n DeleteAction,\n CardPrompt,\n CopyDataFromAction,\n MetaTitle,\n LeaveAction,\n RevertToTemplate,\n Loading\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["_PageHeader","_interopRequireDefault","require","_DeleteAction","_CardPrompt","_CopyDataFromAction","_MetaTitle","_LeaveAction","_RevertToTemplate","_Loading","_getBlazeAdmin"],"sources":["../src/index.js"],"sourcesContent":["import PageHeader from './components/PageHeader';\nimport DeleteAction from './components/DeleteAction';\nimport CardPrompt from './components/CardPrompt';\nimport CopyDataFromAction from './components/CopyDataFromAction';\nimport MetaTitle from './components/MetaTitle';\nimport LeaveAction from './components/LeaveAction';\nimport RevertToTemplate from './components/RevertToTemplate';\nimport Loading from './components/Loading';\nimport { getBlazeAdmin } from './utils/get-blaze-admin';\n\nexport {\n getBlazeAdmin,\n PageHeader,\n DeleteAction,\n CardPrompt,\n CopyDataFromAction,\n MetaTitle,\n LeaveAction,\n RevertToTemplate,\n Loading\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,mBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,UAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,YAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,iBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,QAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,cAAA,GAAAR,OAAA","ignoreList":[]}
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
|
-
exports
|
|
9
|
-
var
|
|
10
|
-
require("core-js/modules/es.array.map.js");
|
|
11
|
-
require("core-js/modules/es.object.to-string.js");
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
exports.default = buildInterface;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
14
9
|
var _client = require("react-dom/client");
|
|
15
10
|
var _client2 = require("@apollo/client");
|
|
16
11
|
var _reactRouterDom = require("react-router-dom");
|
|
@@ -19,65 +14,42 @@ var _toaster = require("@blaze-react/toaster");
|
|
|
19
14
|
var _coreErrorsUi = _interopRequireDefault(require("@blaze-cms/core-errors-ui"));
|
|
20
15
|
var _coreAuthUi = require("@blaze-cms/core-auth-ui");
|
|
21
16
|
var _LeaveAction = _interopRequireDefault(require("../components/LeaveAction"));
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
path = _ref.path,
|
|
60
|
-
exact = _ref.exact,
|
|
61
|
-
key = _ref.key,
|
|
62
|
-
redirect = _ref.redirect;
|
|
63
|
-
return redirect ? /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Redirect, {
|
|
64
|
-
to: redirect,
|
|
65
|
-
from: path,
|
|
66
|
-
exact: exact,
|
|
67
|
-
key: key
|
|
68
|
-
}) : /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Route, {
|
|
69
|
-
component: component,
|
|
70
|
-
path: path,
|
|
71
|
-
exact: exact,
|
|
72
|
-
key: key
|
|
73
|
-
});
|
|
74
|
-
}))))))))));
|
|
75
|
-
case 11:
|
|
76
|
-
case "end":
|
|
77
|
-
return _context.stop();
|
|
78
|
-
}
|
|
79
|
-
}, _callee);
|
|
80
|
-
}));
|
|
81
|
-
return _buildInterface.apply(this, arguments);
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
|
+
async function buildInterface(app) {
|
|
19
|
+
await app.init();
|
|
20
|
+
const Layout = app.getLayout();
|
|
21
|
+
const routes = app.getRoutes();
|
|
22
|
+
const client = app.createClient();
|
|
23
|
+
const browserHistory = (0, _history.createBrowserHistory)();
|
|
24
|
+
await (0, _coreAuthUi.setupCheckAccessToken)(client);
|
|
25
|
+
const container = document.getElementById('root');
|
|
26
|
+
const root = (0, _client.createRoot)(container);
|
|
27
|
+
root.render(/*#__PURE__*/_react.default.createElement(_coreErrorsUi.default, {
|
|
28
|
+
app: app
|
|
29
|
+
}, /*#__PURE__*/_react.default.createElement(_client2.ApolloProvider, {
|
|
30
|
+
client: client
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Router, {
|
|
32
|
+
history: browserHistory
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, {
|
|
34
|
+
getUserConfirmation: (message, callback) => (0, _LeaveAction.default)(message, callback)
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement(_toaster.ToastProvider, null, /*#__PURE__*/_react.default.createElement(Layout, null, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
36
|
+
fallback: /*#__PURE__*/_react.default.createElement("div", null, "Loading...")
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRouterDom.Switch, null, routes.map(({
|
|
38
|
+
component,
|
|
39
|
+
path,
|
|
40
|
+
exact,
|
|
41
|
+
key,
|
|
42
|
+
redirect
|
|
43
|
+
}) => redirect ? /*#__PURE__*/_react.default.createElement(_reactRouterDom.Redirect, {
|
|
44
|
+
to: redirect,
|
|
45
|
+
from: path,
|
|
46
|
+
exact: exact,
|
|
47
|
+
key: key
|
|
48
|
+
}) : /*#__PURE__*/_react.default.createElement(_reactRouterDom.Route, {
|
|
49
|
+
component: component,
|
|
50
|
+
path: path,
|
|
51
|
+
exact: exact,
|
|
52
|
+
key: key
|
|
53
|
+
})))))))))));
|
|
82
54
|
}
|
|
83
55
|
//# sourceMappingURL=build-interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-interface.js","names":["_react","
|
|
1
|
+
{"version":3,"file":"build-interface.js","names":["_react","_interopRequireWildcard","require","_client","_client2","_reactRouterDom","_history","_toaster","_coreErrorsUi","_interopRequireDefault","_coreAuthUi","_LeaveAction","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","buildInterface","app","init","Layout","getLayout","routes","getRoutes","client","createClient","browserHistory","createBrowserHistory","setupCheckAccessToken","container","document","getElementById","root","createRoot","render","createElement","ApolloProvider","Router","history","BrowserRouter","getUserConfirmation","message","callback","LeaveAction","ToastProvider","Suspense","fallback","Switch","map","component","path","exact","key","redirect","Redirect","to","from","Route"],"sources":["../../src/utils/build-interface.js"],"sourcesContent":["import React, { Suspense } from 'react';\nimport { createRoot } from 'react-dom/client';\nimport { ApolloProvider } from '@apollo/client';\nimport { Router, Switch, Route, Redirect, BrowserRouter } from 'react-router-dom';\nimport { createBrowserHistory } from 'history';\nimport { ToastProvider } from '@blaze-react/toaster';\nimport ErrorBoundary from '@blaze-cms/core-errors-ui';\nimport { setupCheckAccessToken } from '@blaze-cms/core-auth-ui';\nimport LeaveAction from '../components/LeaveAction';\n\nexport default async function buildInterface(app) {\n await app.init();\n\n const Layout = app.getLayout();\n const routes = app.getRoutes();\n const client = app.createClient();\n const browserHistory = createBrowserHistory();\n\n await setupCheckAccessToken(client);\n const container = document.getElementById('root');\n const root = createRoot(container);\n\n root.render(\n <ErrorBoundary app={app}>\n <ApolloProvider client={client}>\n <Router history={browserHistory}>\n <BrowserRouter\n getUserConfirmation={(message, callback) => LeaveAction(message, callback)}>\n <ToastProvider>\n <Layout>\n <Suspense fallback={<div>Loading...</div>}>\n <Switch>\n {routes.map(({ component, path, exact, key, redirect }) =>\n redirect ? (\n <Redirect to={redirect} from={path} exact={exact} key={key} />\n ) : (\n <Route component={component} path={path} exact={exact} key={key} />\n )\n )}\n </Switch>\n </Suspense>\n </Layout>\n </ToastProvider>\n </BrowserRouter>\n </Router>\n </ApolloProvider>\n </Error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jD,MAAA,CAAA2D,QAAQ;IAACC,QAAQ,eAAE5D,MAAA,CAAAsB,OAAA,CAAA2B,aAAA,cAAK,YAAe;EAAE,gBACxCjD,MAAA,CAAAsB,OAAA,CAAA2B,aAAA,CAAC5C,eAAA,CAAAwD,MAAM,QACJzB,MAAM,CAAC0B,GAAG,CAAC,CAAC;IAAEC,SAAS;IAAEC,IAAI;IAAEC,KAAK;IAAEC,GAAG;IAAEC;EAAS,CAAC,KACpDA,QAAQ,gBACNnE,MAAA,CAAAsB,OAAA,CAAA2B,aAAA,CAAC5C,eAAA,CAAA+D,QAAQ;IAACC,EAAE,EAAEF,QAAS;IAACG,IAAI,EAAEN,IAAK;IAACC,KAAK,EAAEA,KAAM;IAACC,GAAG,EAAEA;EAAI,CAAE,CAAC,gBAE9DlE,MAAA,CAAAsB,OAAA,CAAA2B,aAAA,CAAC5C,eAAA,CAAAkE,KAAK;IAACR,SAAS,EAAEA,SAAU;IAACC,IAAI,EAAEA,IAAK;IAACC,KAAK,EAAEA,KAAM;IAACC,GAAG,EAAEA;EAAI,CAAE,CAEtE,CACM,CACA,CACJ,CACK,CACF,CACT,CACM,CACH,CACjB,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
require("core-js/modules/es.object.define-property.js");
|
|
4
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
@@ -9,16 +8,14 @@ exports.getBlazeAdmin = getBlazeAdmin;
|
|
|
9
8
|
var _coreUi = _interopRequireDefault(require("@blaze-cms/core-ui"));
|
|
10
9
|
var _blaze = _interopRequireDefault(require("../../blaze.config"));
|
|
11
10
|
var _buildInterface = _interopRequireDefault(require("./build-interface"));
|
|
12
|
-
function getBlazeAdmin(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
config
|
|
11
|
+
function getBlazeAdmin({
|
|
12
|
+
buildConfig
|
|
13
|
+
} = {}) {
|
|
14
|
+
const config = buildConfig ? buildConfig(_blaze.default) : _blaze.default;
|
|
15
|
+
const app = (0, _coreUi.default)({
|
|
16
|
+
config
|
|
18
17
|
});
|
|
19
|
-
app.render =
|
|
20
|
-
return (0, _buildInterface["default"])(app);
|
|
21
|
-
};
|
|
18
|
+
app.render = () => (0, _buildInterface.default)(app);
|
|
22
19
|
return app;
|
|
23
20
|
}
|
|
24
21
|
//# sourceMappingURL=get-blaze-admin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-blaze-admin.js","names":["_coreUi","_interopRequireDefault","require","_blaze","_buildInterface","getBlazeAdmin","
|
|
1
|
+
{"version":3,"file":"get-blaze-admin.js","names":["_coreUi","_interopRequireDefault","require","_blaze","_buildInterface","getBlazeAdmin","buildConfig","config","blazeConfig","app","getBlazeUi","render","buildInterface"],"sources":["../../src/utils/get-blaze-admin.js"],"sourcesContent":["import getBlazeUi from '@blaze-cms/core-ui';\nimport blazeConfig from '../../blaze.config';\nimport buildInterface from './build-interface';\n\nexport function getBlazeAdmin({ buildConfig } = {}) {\n const config = buildConfig ? buildConfig(blazeConfig) : blazeConfig;\n const app = getBlazeUi({ config });\n app.render = () => buildInterface(app);\n return app;\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEO,SAASG,aAAaA,CAAC;EAAEC;AAAY,CAAC,GAAG,CAAC,CAAC,EAAE;EAClD,MAAMC,MAAM,GAAGD,WAAW,GAAGA,WAAW,CAACE,cAAW,CAAC,GAAGA,cAAW;EACnE,MAAMC,GAAG,GAAG,IAAAC,eAAU,EAAC;IAAEH;EAAO,CAAC,CAAC;EAClCE,GAAG,CAACE,MAAM,GAAG,MAAM,IAAAC,uBAAc,EAACH,GAAG,CAAC;EACtC,OAAOA,GAAG;AACZ","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/admin",
|
|
3
|
-
"version": "0.146.0-
|
|
3
|
+
"version": "0.146.0-rc-eagle.0",
|
|
4
4
|
"description": "Blaze example project",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
7
|
-
"
|
|
7
|
+
"source": "src/index.js",
|
|
8
8
|
"directories": {
|
|
9
9
|
"src": "src/"
|
|
10
10
|
},
|
|
@@ -27,24 +27,23 @@
|
|
|
27
27
|
},
|
|
28
28
|
"license": "GPL-3.0",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@apollo/client": "
|
|
31
|
-
"@blaze-cms/admin-ui-utils": "0.146.0-
|
|
32
|
-
"@blaze-cms/core-errors-ui": "0.146.0-
|
|
33
|
-
"@blaze-cms/core-ui": "0.146.0-
|
|
34
|
-
"@blaze-cms/plugin-admin-core-ui": "0.146.0-
|
|
35
|
-
"@blaze-cms/plugin-auth-local-ui": "0.146.0-
|
|
36
|
-
"@blaze-cms/plugin-auth-ui": "0.146.0-
|
|
37
|
-
"@blaze-cms/plugin-data-ui": "0.146.0-
|
|
38
|
-
"@blaze-cms/plugin-google-maps-ui": "0.146.0-
|
|
39
|
-
"@blaze-cms/plugin-gtm-ui": "0.146.0-
|
|
40
|
-
"@blaze-cms/plugin-media-ui": "0.146.0-
|
|
41
|
-
"@blaze-cms/plugin-page-builder-ui": "0.146.0-
|
|
42
|
-
"@blaze-cms/react-form-builder": "0.146.0-
|
|
43
|
-
"@blaze-cms/setup-ui": "0.146.0-
|
|
30
|
+
"@apollo/client": "3.13.8",
|
|
31
|
+
"@blaze-cms/admin-ui-utils": "0.146.0-rc-eagle.0",
|
|
32
|
+
"@blaze-cms/core-errors-ui": "0.146.0-rc-eagle.0",
|
|
33
|
+
"@blaze-cms/core-ui": "0.146.0-rc-eagle.0",
|
|
34
|
+
"@blaze-cms/plugin-admin-core-ui": "0.146.0-rc-eagle.0",
|
|
35
|
+
"@blaze-cms/plugin-auth-local-ui": "0.146.0-rc-eagle.0",
|
|
36
|
+
"@blaze-cms/plugin-auth-ui": "0.146.0-rc-eagle.0",
|
|
37
|
+
"@blaze-cms/plugin-data-ui": "0.146.0-rc-eagle.0",
|
|
38
|
+
"@blaze-cms/plugin-google-maps-ui": "0.146.0-rc-eagle.0",
|
|
39
|
+
"@blaze-cms/plugin-gtm-ui": "0.146.0-rc-eagle.0",
|
|
40
|
+
"@blaze-cms/plugin-media-ui": "0.146.0-rc-eagle.0",
|
|
41
|
+
"@blaze-cms/plugin-page-builder-ui": "0.146.0-rc-eagle.0",
|
|
42
|
+
"@blaze-cms/react-form-builder": "0.146.0-rc-eagle.0",
|
|
43
|
+
"@blaze-cms/setup-ui": "0.146.0-rc-eagle.0",
|
|
44
44
|
"@blaze-react/alert": "^0.7.0",
|
|
45
45
|
"@blaze-react/modal": "^0.7.0",
|
|
46
46
|
"@blaze-react/toaster": "^0.7.0",
|
|
47
|
-
"core-js": "^3.2.1",
|
|
48
47
|
"graphql": "^15.2.0",
|
|
49
48
|
"history": "^5.0.0",
|
|
50
49
|
"lodash.capitalize": "^4.2.1",
|
|
@@ -55,12 +54,11 @@
|
|
|
55
54
|
},
|
|
56
55
|
"peerDependencies": {
|
|
57
56
|
"prop-types": "^15.7.2",
|
|
58
|
-
"react": "
|
|
59
|
-
"react-dom": "
|
|
57
|
+
"react": ">= 18",
|
|
58
|
+
"react-dom": ">= 18"
|
|
60
59
|
},
|
|
61
60
|
"eslintIgnore": [
|
|
62
61
|
"lib/*",
|
|
63
62
|
"lib-es/*"
|
|
64
|
-
]
|
|
65
|
-
"gitHead": "c60370714e89e0c96f2169d61e4c56bc542f7686"
|
|
63
|
+
]
|
|
66
64
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { Suspense } from 'react';
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import { ApolloProvider } from '@apollo/client';
|
|
4
4
|
import { Router, Switch, Route, Redirect, BrowserRouter } from 'react-router-dom';
|
|
@@ -28,7 +28,7 @@ export default async function buildInterface(app) {
|
|
|
28
28
|
getUserConfirmation={(message, callback) => LeaveAction(message, callback)}>
|
|
29
29
|
<ToastProvider>
|
|
30
30
|
<Layout>
|
|
31
|
-
<
|
|
31
|
+
<Suspense fallback={<div>Loading...</div>}>
|
|
32
32
|
<Switch>
|
|
33
33
|
{routes.map(({ component, path, exact, key, redirect }) =>
|
|
34
34
|
redirect ? (
|
|
@@ -38,7 +38,7 @@ export default async function buildInterface(app) {
|
|
|
38
38
|
)
|
|
39
39
|
)}
|
|
40
40
|
</Switch>
|
|
41
|
-
</
|
|
41
|
+
</Suspense>
|
|
42
42
|
</Layout>
|
|
43
43
|
</ToastProvider>
|
|
44
44
|
</BrowserRouter>
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
const CardPrompt = ({
|
|
4
|
-
children
|
|
5
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
6
|
-
className: "card card--prompt",
|
|
7
|
-
"data-testid": "card-prompt"
|
|
8
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
9
|
-
className: "card__image amber"
|
|
10
|
-
}, /*#__PURE__*/React.createElement("img", {
|
|
11
|
-
src: "https://images.thisisblaze.com/empty-icon-140-140.png",
|
|
12
|
-
alt: "prompt"
|
|
13
|
-
})), /*#__PURE__*/React.createElement("div", {
|
|
14
|
-
className: "card__content card__content--prompt"
|
|
15
|
-
}, /*#__PURE__*/React.createElement("h2", {
|
|
16
|
-
className: "card__title"
|
|
17
|
-
}, "Nothing to see here!"), /*#__PURE__*/React.createElement("p", null, "How about adding some content now?"), children));
|
|
18
|
-
CardPrompt.displayName = 'CardPrompt';
|
|
19
|
-
CardPrompt.propTypes = {
|
|
20
|
-
children: PropTypes.oneOfType([PropTypes.array, PropTypes.object, PropTypes.string])
|
|
21
|
-
};
|
|
22
|
-
CardPrompt.defaultProps = {
|
|
23
|
-
children: ''
|
|
24
|
-
};
|
|
25
|
-
export default CardPrompt;
|
|
26
|
-
//# sourceMappingURL=CardPrompt.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CardPrompt.js","names":["React","PropTypes","CardPrompt","children","createElement","className","src","alt","displayName","propTypes","oneOfType","array","object","string","defaultProps"],"sources":["../../../src/components/CardPrompt/CardPrompt.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst CardPrompt = ({ children }) => (\n <div className=\"card card--prompt\" data-testid=\"card-prompt\">\n <div className=\"card__image amber\">\n <img src=\"https://images.thisisblaze.com/empty-icon-140-140.png\" alt=\"prompt\" />\n </div>\n <div className=\"card__content card__content--prompt\">\n <h2 className=\"card__title\">Nothing to see here!</h2>\n <p>How about adding some content now?</p>\n {children}\n </div>\n </div>\n);\n\nCardPrompt.displayName = 'CardPrompt';\n\nCardPrompt.propTypes = {\n children: PropTypes.oneOfType([PropTypes.array, PropTypes.object, PropTypes.string])\n};\n\nCardPrompt.defaultProps = {\n children: ''\n};\n\nexport default CardPrompt;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,UAAU,GAAGA,CAAC;EAAEC;AAAS,CAAC,kBAC9BH,KAAA,CAAAI,aAAA;EAAKC,SAAS,EAAC,mBAAmB;EAAC,eAAY;AAAa,gBAC1DL,KAAA,CAAAI,aAAA;EAAKC,SAAS,EAAC;AAAmB,gBAChCL,KAAA,CAAAI,aAAA;EAAKE,GAAG,EAAC,uDAAuD;EAACC,GAAG,EAAC;AAAQ,CAAE,CAC5E,CAAC,eACNP,KAAA,CAAAI,aAAA;EAAKC,SAAS,EAAC;AAAqC,gBAClDL,KAAA,CAAAI,aAAA;EAAIC,SAAS,EAAC;AAAa,GAAC,sBAAwB,CAAC,eACrDL,KAAA,CAAAI,aAAA,YAAG,oCAAqC,CAAC,EACxCD,QACE,CACF,CACN;AAEDD,UAAU,CAACM,WAAW,GAAG,YAAY;AAErCN,UAAU,CAACO,SAAS,GAAG;EACrBN,QAAQ,EAAEF,SAAS,CAACS,SAAS,CAAC,CAACT,SAAS,CAACU,KAAK,EAAEV,SAAS,CAACW,MAAM,EAAEX,SAAS,CAACY,MAAM,CAAC;AACrF,CAAC;AAEDX,UAAU,CAACY,YAAY,GAAG;EACxBX,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeD,UAAU","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CardPrompt"],"sources":["../../../src/components/CardPrompt/index.js"],"sourcesContent":["import CardPrompt from './CardPrompt';\n\nexport default CardPrompt;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,cAAc;AAErC,eAAeA,UAAU","ignoreList":[]}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
const _excluded = ["id", "displayName", "actions"];
|
|
4
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
|
-
import Alert from '@blaze-react/alert';
|
|
9
|
-
import Modal from '@blaze-react/modal';
|
|
10
|
-
import { useQuery, useApolloClient } from '@apollo/client';
|
|
11
|
-
import { formFieldTypes } from '@blaze-cms/react-form-builder';
|
|
12
|
-
import { getQuery, getDataProperties } from '@blaze-cms/admin-ui-utils';
|
|
13
|
-
import { getAction } from './helpers';
|
|
14
|
-
const CopyDataFromAction = ({
|
|
15
|
-
onClose,
|
|
16
|
-
copyAction,
|
|
17
|
-
getFormData
|
|
18
|
-
}) => {
|
|
19
|
-
const [entityRecordsOptions, setEntityRecordsOptions] = useState([]);
|
|
20
|
-
const [actionName, setActionName] = useState();
|
|
21
|
-
const [selectedEntity, setSelectedEntity] = useState();
|
|
22
|
-
const [autocompleteDisabledStatus, setAutocompleteDisabledStatus] = useState(true);
|
|
23
|
-
const client = useApolloClient();
|
|
24
|
-
const {
|
|
25
|
-
select: Select,
|
|
26
|
-
autocomplete: Autocomplete
|
|
27
|
-
} = formFieldTypes;
|
|
28
|
-
const entitiesAction = [];
|
|
29
|
-
let entityProperties = {};
|
|
30
|
-
const modalActions = [{
|
|
31
|
-
textButton: 'Cancel',
|
|
32
|
-
callback: onClose,
|
|
33
|
-
modifiers: ['cancel']
|
|
34
|
-
}, {
|
|
35
|
-
textButton: 'Copy',
|
|
36
|
-
callback: copyAction,
|
|
37
|
-
modifiers: [],
|
|
38
|
-
'data-testid': 'copyDataFromAction-copy-button'
|
|
39
|
-
}];
|
|
40
|
-
const fetchEntityRecords = async action => {
|
|
41
|
-
const {
|
|
42
|
-
data = {}
|
|
43
|
-
} = await client.query({
|
|
44
|
-
query: getAction(action)
|
|
45
|
-
});
|
|
46
|
-
if (Object.keys(data).length) {
|
|
47
|
-
const entityRecords = data[action].map(({
|
|
48
|
-
id,
|
|
49
|
-
name
|
|
50
|
-
}) => ({
|
|
51
|
-
id,
|
|
52
|
-
name
|
|
53
|
-
}));
|
|
54
|
-
setEntityRecordsOptions(entityRecords);
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const onEntityChange = ({
|
|
58
|
-
value
|
|
59
|
-
}) => {
|
|
60
|
-
const {
|
|
61
|
-
action
|
|
62
|
-
} = entitiesAction.find(entity => entity.id === value);
|
|
63
|
-
if (action) {
|
|
64
|
-
setActionName(action);
|
|
65
|
-
setSelectedEntity(value);
|
|
66
|
-
fetchEntityRecords(action);
|
|
67
|
-
setAutocompleteDisabledStatus(false);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
const onEntityRecordChange = async event => {
|
|
71
|
-
const fields = entityProperties[selectedEntity];
|
|
72
|
-
const {
|
|
73
|
-
data = {}
|
|
74
|
-
} = await client.query({
|
|
75
|
-
query: getAction(actionName, event.id, fields)
|
|
76
|
-
});
|
|
77
|
-
if (Object.keys(data).length) {
|
|
78
|
-
getFormData(data[actionName][0]);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
const {
|
|
82
|
-
data: {
|
|
83
|
-
getEntitySchemas
|
|
84
|
-
} = {}
|
|
85
|
-
} = useQuery(getQuery('GET_USER_EDITABLE_ENTITIES'));
|
|
86
|
-
if (getEntitySchemas) {
|
|
87
|
-
const entities = getEntitySchemas.map(_ref => {
|
|
88
|
-
let {
|
|
89
|
-
id,
|
|
90
|
-
displayName,
|
|
91
|
-
actions
|
|
92
|
-
} = _ref,
|
|
93
|
-
otherSchemaProps = _objectWithoutProperties(_ref, _excluded);
|
|
94
|
-
entitiesAction.push({
|
|
95
|
-
id,
|
|
96
|
-
action: actions.getAll
|
|
97
|
-
});
|
|
98
|
-
entityProperties = _objectSpread({
|
|
99
|
-
[id]: getDataProperties(otherSchemaProps).join(', ')
|
|
100
|
-
}, entityProperties);
|
|
101
|
-
return [id, displayName];
|
|
102
|
-
});
|
|
103
|
-
return /*#__PURE__*/React.createElement(Modal, {
|
|
104
|
-
title: "Copy data from",
|
|
105
|
-
actions: modalActions,
|
|
106
|
-
onClose: onClose
|
|
107
|
-
}, /*#__PURE__*/React.createElement(Alert, {
|
|
108
|
-
type: "info"
|
|
109
|
-
}, "By performing this action it will copy and overwrite any unsaved data you have."), /*#__PURE__*/React.createElement(Select, {
|
|
110
|
-
"data-testid": "copyDataFromAction-select",
|
|
111
|
-
label: "Entity",
|
|
112
|
-
value: "",
|
|
113
|
-
id: "entity",
|
|
114
|
-
onChange: onEntityChange,
|
|
115
|
-
options: entities
|
|
116
|
-
}), /*#__PURE__*/React.createElement(Autocomplete, {
|
|
117
|
-
inputProps: {
|
|
118
|
-
'data-testid': 'copyDataFromAction-autocomplete'
|
|
119
|
-
},
|
|
120
|
-
disabled: autocompleteDisabledStatus,
|
|
121
|
-
data: {
|
|
122
|
-
data: entityRecordsOptions,
|
|
123
|
-
keyValue: 'name',
|
|
124
|
-
filterBy: ['name']
|
|
125
|
-
},
|
|
126
|
-
selected: onEntityRecordChange,
|
|
127
|
-
utils: {
|
|
128
|
-
uniqueId: data => data.id
|
|
129
|
-
}
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
132
|
-
return null;
|
|
133
|
-
};
|
|
134
|
-
CopyDataFromAction.propTypes = {
|
|
135
|
-
onClose: PropTypes.func.isRequired,
|
|
136
|
-
copyAction: PropTypes.func.isRequired,
|
|
137
|
-
getFormData: PropTypes.func.isRequired
|
|
138
|
-
};
|
|
139
|
-
export default CopyDataFromAction;
|
|
140
|
-
//# sourceMappingURL=CopyDataFromAction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CopyDataFromAction.js","names":["React","useState","PropTypes","Alert","Modal","useQuery","useApolloClient","formFieldTypes","getQuery","getDataProperties","getAction","CopyDataFromAction","onClose","copyAction","getFormData","entityRecordsOptions","setEntityRecordsOptions","actionName","setActionName","selectedEntity","setSelectedEntity","autocompleteDisabledStatus","setAutocompleteDisabledStatus","client","select","Select","autocomplete","Autocomplete","entitiesAction","entityProperties","modalActions","textButton","callback","modifiers","fetchEntityRecords","action","data","query","Object","keys","length","entityRecords","map","id","name","onEntityChange","value","find","entity","onEntityRecordChange","event","fields","getEntitySchemas","entities","_ref","displayName","actions","otherSchemaProps","_objectWithoutProperties","_excluded","push","getAll","_objectSpread","join","createElement","title","type","label","onChange","options","inputProps","disabled","keyValue","filterBy","selected","utils","uniqueId","propTypes","func","isRequired"],"sources":["../../../src/components/CopyDataFromAction/CopyDataFromAction.js"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport Alert from '@blaze-react/alert';\nimport Modal from '@blaze-react/modal';\nimport { useQuery, useApolloClient } from '@apollo/client';\nimport { formFieldTypes } from '@blaze-cms/react-form-builder';\nimport { getQuery, getDataProperties } from '@blaze-cms/admin-ui-utils';\nimport { getAction } from './helpers';\n\nconst CopyDataFromAction = ({ onClose, copyAction, getFormData }) => {\n const [entityRecordsOptions, setEntityRecordsOptions] = useState([]);\n const [actionName, setActionName] = useState();\n const [selectedEntity, setSelectedEntity] = useState();\n const [autocompleteDisabledStatus, setAutocompleteDisabledStatus] = useState(true);\n\n const client = useApolloClient();\n const { select: Select, autocomplete: Autocomplete } = formFieldTypes;\n const entitiesAction = [];\n let entityProperties = {};\n\n const modalActions = [\n {\n textButton: 'Cancel',\n callback: onClose,\n modifiers: ['cancel']\n },\n {\n textButton: 'Copy',\n callback: copyAction,\n modifiers: [],\n 'data-testid': 'copyDataFromAction-copy-button'\n }\n ];\n\n const fetchEntityRecords = async action => {\n const { data = {} } = await client.query({\n query: getAction(action)\n });\n\n if (Object.keys(data).length) {\n const entityRecords = data[action].map(({ id, name }) => ({ id, name }));\n setEntityRecordsOptions(entityRecords);\n }\n };\n\n const onEntityChange = ({ value }) => {\n const { action } = entitiesAction.find(entity => entity.id === value);\n if (action) {\n setActionName(action);\n setSelectedEntity(value);\n fetchEntityRecords(action);\n setAutocompleteDisabledStatus(false);\n }\n };\n\n const onEntityRecordChange = async event => {\n const fields = entityProperties[selectedEntity];\n const { data = {} } = await client.query({\n query: getAction(actionName, event.id, fields)\n });\n\n if (Object.keys(data).length) {\n getFormData(data[actionName][0]);\n }\n };\n const { data: { getEntitySchemas } = {} } = useQuery(getQuery('GET_USER_EDITABLE_ENTITIES'));\n\n if (getEntitySchemas) {\n const entities = getEntitySchemas.map(({ id, displayName, actions, ...otherSchemaProps }) => {\n entitiesAction.push({ id, action: actions.getAll });\n entityProperties = {\n [id]: getDataProperties(otherSchemaProps).join(', '),\n ...entityProperties\n };\n return [id, displayName];\n });\n\n return (\n <Modal title=\"Copy data from\" actions={modalActions} onClose={onClose}>\n <Alert type=\"info\">\n By performing this action it will copy and overwrite any unsaved data you have.\n </Alert>\n <Select\n data-testid=\"copyDataFromAction-select\"\n label=\"Entity\"\n value=\"\"\n id=\"entity\"\n onChange={onEntityChange}\n options={entities}\n />\n <Autocomplete\n inputProps={{ 'data-testid': 'copyDataFromAction-autocomplete' }}\n disabled={autocompleteDisabledStatus}\n data={{ data: entityRecordsOptions, keyValue: 'name', filterBy: ['name'] }}\n selected={onEntityRecordChange}\n utils={{ uniqueId: data => data.id }}\n />\n </Modal>\n );\n }\n\n return null;\n};\n\nCopyDataFromAction.propTypes = {\n onClose: PropTypes.func.isRequired,\n copyAction: PropTypes.func.isRequired,\n getFormData: PropTypes.func.isRequired\n};\n\nexport default CopyDataFromAction;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,OAAOC,KAAK,MAAM,oBAAoB;AACtC,SAASC,QAAQ,EAAEC,eAAe,QAAQ,gBAAgB;AAC1D,SAASC,cAAc,QAAQ,+BAA+B;AAC9D,SAASC,QAAQ,EAAEC,iBAAiB,QAAQ,2BAA2B;AACvE,SAASC,SAAS,QAAQ,WAAW;AAErC,MAAMC,kBAAkB,GAAGA,CAAC;EAAEC,O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AAS,CAAC4E,IAAI,CAACC,UAAU;EACrCjE,WAAW,EAAEZ,SAAS,CAAC4E,IAAI,CAACC;AAC9B,CAAC;AAED,eAAepE,kBAAkB","ignoreList":[]}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client';
|
|
2
|
-
const generateQuery = (action, id, fragment) => id ? `
|
|
3
|
-
query getEntityData{
|
|
4
|
-
${action}(where:{ id: "${id}" }){
|
|
5
|
-
name
|
|
6
|
-
${fragment}
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
` : `query getEntityData{
|
|
10
|
-
${action}{
|
|
11
|
-
id,
|
|
12
|
-
name
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
`;
|
|
16
|
-
const getAction = (action, id, fields = '') => {
|
|
17
|
-
const query = id ? generateQuery(action, id, fields) : generateQuery(action);
|
|
18
|
-
return gql`
|
|
19
|
-
${query}
|
|
20
|
-
`;
|
|
21
|
-
};
|
|
22
|
-
export { getAction };
|
|
23
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["gql","generateQuery","action","id","fragment","getAction","fields","query"],"sources":["../../../src/components/CopyDataFromAction/helpers.js"],"sourcesContent":["import { gql } from '@apollo/client';\n\nconst generateQuery = (action, id, fragment) =>\n id\n ? `\n query getEntityData{\n ${action}(where:{ id: \"${id}\" }){\n name\n ${fragment}\n }\n }\n `\n : `query getEntityData{\n ${action}{\n id,\n name\n }\n }\n `;\n\nconst getAction = (action, id, fields = '') => {\n const query = id ? generateQuery(action, id, fields) : generateQuery(action);\n return gql`\n ${query}\n `;\n};\n\nexport { getAction };\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,gBAAgB;AAEpC,MAAMC,aAAa,GAAGA,CAACC,MAAM,EAAEC,EAAE,EAAEC,QAAQ,KACzCD,EAAE,GACE;AACN;AACA,QAAQD,MAAM,iBAAiBC,EAAE;AACjC;AACA,UAAUC,QAAQ;AAClB;AACA;AACA,KAAK,GACC;AACN,UAAUF,MAAM;AAChB;AACA;AACA;AACA;AACA,KAAK;AAEL,MAAMG,SAAS,GAAGA,CAACH,MAAM,EAAEC,EAAE,EAAEG,MAAM,GAAG,EAAE,KAAK;EAC7C,MAAMC,KAAK,GAAGJ,EAAE,GAAGF,aAAa,CAACC,MAAM,EAAEC,EAAE,EAAEG,MAAM,CAAC,GAAGL,aAAa,CAACC,MAAM,CAAC;EAC5E,OAAOF,GAAG;AACZ,MAAMO,KAAK;AACX,GAAG;AACH,CAAC;AAED,SAASF,SAAS","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["CopyDataFromAction"],"sources":["../../../src/components/CopyDataFromAction/index.js"],"sourcesContent":["import CopyDataFromAction from './CopyDataFromAction';\n\nexport default CopyDataFromAction;\n"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,sBAAsB;AAErD,eAAeA,kBAAkB","ignoreList":[]}
|