@lowdefy/client 4.0.0-alpha.9 → 4.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Client.js +10 -9
- package/dist/Context.js +3 -3
- package/dist/DisplayMessage.js +3 -3
- package/dist/ErrorBoundary.js +3 -3
- package/dist/ErrorPage.js +2 -3
- package/dist/Head.js +2 -2
- package/dist/MountEvents.js +5 -11
- package/dist/ProgressBarController.js +5 -8
- package/dist/auth/createAuthMethods.js +66 -0
- package/dist/block/Block.js +4 -6
- package/dist/block/CategorySwitch.js +17 -17
- package/dist/block/Container.js +8 -11
- package/dist/block/List.js +8 -11
- package/dist/block/LoadingBlock.js +14 -15
- package/dist/block/LoadingContainer.js +10 -13
- package/dist/block/LoadingList.js +11 -14
- package/dist/callRequest.js +1 -1
- package/dist/createIcon.js +14 -17
- package/dist/createLinkComponent.js +33 -20
- package/dist/index.js +1 -1
- package/dist/initLowdefyContext.js +18 -13
- package/dist/request.js +4 -4
- package/dist/setupLink.js +4 -4
- package/dist/style.less +3 -3
- package/package.json +25 -25
package/dist/Client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -19,11 +19,12 @@ import DisplayMessage from './DisplayMessage.js';
|
|
|
19
19
|
import Head from './Head.js';
|
|
20
20
|
import ProgressBarController from './ProgressBarController.js';
|
|
21
21
|
import initLowdefyContext from './initLowdefyContext.js';
|
|
22
|
-
const Client = ({ Components , config , resetContext ={
|
|
22
|
+
const Client = ({ auth , Components , config , resetContext ={
|
|
23
23
|
reset: false,
|
|
24
24
|
setReset: ()=>undefined
|
|
25
|
-
} , router , stage , types , window
|
|
25
|
+
} , router , stage , types , window })=>{
|
|
26
26
|
const lowdefy = initLowdefyContext({
|
|
27
|
+
auth,
|
|
27
28
|
Components,
|
|
28
29
|
config,
|
|
29
30
|
router,
|
|
@@ -31,7 +32,7 @@ const Client = ({ Components , config , resetContext ={
|
|
|
31
32
|
types,
|
|
32
33
|
window
|
|
33
34
|
});
|
|
34
|
-
return
|
|
35
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ProgressBarController, {
|
|
35
36
|
id: "lowdefy-progress-bar",
|
|
36
37
|
key: `${config.pageConfig.id}-progress-bar`,
|
|
37
38
|
lowdefy: lowdefy,
|
|
@@ -52,16 +53,16 @@ const Client = ({ Components , config , resetContext ={
|
|
|
52
53
|
resetContext: resetContext
|
|
53
54
|
}, (context)=>{
|
|
54
55
|
if (!context._internal.onInitDone) return '';
|
|
55
|
-
return
|
|
56
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Head, {
|
|
56
57
|
Component: Components.Head,
|
|
57
|
-
properties: context._internal.RootBlocks.map[config.pageConfig.
|
|
58
|
+
properties: context._internal.RootBlocks.map[config.pageConfig.blockId].eval.properties
|
|
58
59
|
}), /*#__PURE__*/ React.createElement(Block, {
|
|
59
|
-
block: context._internal.RootBlocks.map[config.pageConfig.
|
|
60
|
+
block: context._internal.RootBlocks.map[config.pageConfig.blockId],
|
|
60
61
|
Blocks: context._internal.RootBlocks,
|
|
61
62
|
context: context,
|
|
62
63
|
lowdefy: lowdefy,
|
|
63
64
|
parentLoading: false
|
|
64
|
-
}))
|
|
65
|
-
}))
|
|
65
|
+
}));
|
|
66
|
+
}));
|
|
66
67
|
};
|
|
67
68
|
export default Client;
|
package/dist/Context.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -21,7 +21,7 @@ const Context = ({ children , config , lowdefy , resetContext })=>{
|
|
|
21
21
|
lowdefy,
|
|
22
22
|
resetContext
|
|
23
23
|
});
|
|
24
|
-
return
|
|
24
|
+
return /*#__PURE__*/ React.createElement(MountEvents, {
|
|
25
25
|
context: context,
|
|
26
26
|
triggerEvent: async ()=>{
|
|
27
27
|
await context._internal.runOnInit(()=>{
|
|
@@ -40,6 +40,6 @@ const Context = ({ children , config , lowdefy , resetContext })=>{
|
|
|
40
40
|
}, (loadingOnInit)=>{
|
|
41
41
|
if (loadingOnInit) return '';
|
|
42
42
|
return children(context);
|
|
43
|
-
})
|
|
43
|
+
});
|
|
44
44
|
};
|
|
45
45
|
export default Context;
|
package/dist/DisplayMessage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*/ import React from 'react';
|
|
16
16
|
import { makeCssClass } from '@lowdefy/block-utils';
|
|
17
17
|
const DisplayMessage = ({ Component , id , methods })=>{
|
|
18
|
-
return
|
|
18
|
+
return /*#__PURE__*/ React.createElement(Component, {
|
|
19
19
|
blockId: id,
|
|
20
20
|
key: id,
|
|
21
21
|
methods: {
|
|
@@ -24,6 +24,6 @@ const DisplayMessage = ({ Component , id , methods })=>{
|
|
|
24
24
|
triggerEvent: ()=>undefined
|
|
25
25
|
},
|
|
26
26
|
properties: {}
|
|
27
|
-
})
|
|
27
|
+
});
|
|
28
28
|
};
|
|
29
29
|
export default DisplayMessage;
|
package/dist/ErrorBoundary.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -29,12 +29,12 @@ let ErrorBoundary = class ErrorBoundary extends Component {
|
|
|
29
29
|
return fallback(error);
|
|
30
30
|
}
|
|
31
31
|
if (fullPage) {
|
|
32
|
-
return
|
|
32
|
+
return /*#__PURE__*/ React.createElement(ErrorPage, {
|
|
33
33
|
code: error.number,
|
|
34
34
|
description: description || error.description,
|
|
35
35
|
message: message || error.message,
|
|
36
36
|
name: name || error.name
|
|
37
|
-
})
|
|
37
|
+
});
|
|
38
38
|
}
|
|
39
39
|
// Throw to console but fail silently to user?
|
|
40
40
|
return '';
|
package/dist/ErrorPage.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -56,6 +56,5 @@ const ErrorPage = ({ code , description , message , name })=>/*#__PURE__*/ Reac
|
|
|
56
56
|
}
|
|
57
57
|
}, /*#__PURE__*/ React.createElement("a", {
|
|
58
58
|
href: "/"
|
|
59
|
-
}, "Return to home page"))))
|
|
60
|
-
;
|
|
59
|
+
}, "Return to home page"))));
|
|
61
60
|
export default ErrorPage;
|
package/dist/Head.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import React from 'react';
|
|
16
16
|
const BindHead = ({ Component , properties })=>{
|
|
17
|
-
return
|
|
17
|
+
return /*#__PURE__*/ React.createElement(Component, null, /*#__PURE__*/ React.createElement("title", null, properties.title));
|
|
18
18
|
};
|
|
19
19
|
export default BindHead;
|
package/dist/MountEvents.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -17,27 +17,21 @@ const MountEvents = ({ children , context , triggerEvent , triggerEventAsync })
|
|
|
17
17
|
const [loading, setLoading] = useState(true);
|
|
18
18
|
const [error, setError] = useState(null);
|
|
19
19
|
useEffect(()=>{
|
|
20
|
-
let mounted = true;
|
|
21
20
|
setLoading(true);
|
|
22
21
|
const mount = async ()=>{
|
|
23
22
|
try {
|
|
24
23
|
await triggerEvent();
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
setLoading(false);
|
|
28
|
-
}
|
|
24
|
+
triggerEventAsync();
|
|
25
|
+
setLoading(false);
|
|
29
26
|
} catch (err) {
|
|
30
27
|
setError(err);
|
|
31
28
|
}
|
|
32
29
|
};
|
|
33
|
-
mount();
|
|
34
|
-
return ()=>{
|
|
35
|
-
mounted = false;
|
|
36
|
-
};
|
|
30
|
+
mount();
|
|
37
31
|
}, [
|
|
38
32
|
context
|
|
39
33
|
]);
|
|
40
34
|
if (error) throw error;
|
|
41
|
-
return
|
|
35
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, children(loading));
|
|
42
36
|
};
|
|
43
37
|
export default MountEvents;
|
|
@@ -57,10 +57,8 @@ const ProgressBarController = ({ id , lowdefy , resetContext })=>{
|
|
|
57
57
|
useEffect(()=>{
|
|
58
58
|
const timer = state.progress < 95 && setInterval(()=>dispatch({
|
|
59
59
|
type: 'auto-increment'
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
return ()=>clearInterval(timer)
|
|
63
|
-
;
|
|
60
|
+
}), 500);
|
|
61
|
+
return ()=>clearInterval(timer);
|
|
64
62
|
}, [
|
|
65
63
|
state
|
|
66
64
|
]);
|
|
@@ -69,7 +67,7 @@ const ProgressBarController = ({ id , lowdefy , resetContext })=>{
|
|
|
69
67
|
type: 'reset'
|
|
70
68
|
});
|
|
71
69
|
}
|
|
72
|
-
return
|
|
70
|
+
return /*#__PURE__*/ React.createElement(ProgressBar, {
|
|
73
71
|
basePath: lowdefy.basePath,
|
|
74
72
|
blockId: id,
|
|
75
73
|
components: lowdefy._internal.components,
|
|
@@ -78,8 +76,7 @@ const ProgressBarController = ({ id , lowdefy , resetContext })=>{
|
|
|
78
76
|
makeCssClass
|
|
79
77
|
},
|
|
80
78
|
pageId: lowdefy.pageId,
|
|
81
|
-
properties: state
|
|
82
|
-
|
|
83
|
-
}));
|
|
79
|
+
properties: state
|
|
80
|
+
});
|
|
84
81
|
};
|
|
85
82
|
export default ProgressBarController;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
*/ import { type, urlQuery as urlQueryFn } from '@lowdefy/helpers';
|
|
16
|
+
function getCallbackUrl({ lowdefy , callbackUrl ={} }) {
|
|
17
|
+
const { home , pageId , urlQuery , url } = callbackUrl;
|
|
18
|
+
if ([
|
|
19
|
+
!home,
|
|
20
|
+
!pageId,
|
|
21
|
+
!url
|
|
22
|
+
].filter((v)=>!v).length > 1) {
|
|
23
|
+
throw Error(`Invalid Link: To avoid ambiguity, only one of 'home', 'pageId' or 'url' can be defined.`);
|
|
24
|
+
}
|
|
25
|
+
const query = type.isNone(urlQuery) ? '' : `${urlQueryFn.stringify(urlQuery)}`;
|
|
26
|
+
if (home === true) {
|
|
27
|
+
return `/${lowdefy.home.configured ? '' : lowdefy.home.pageId}${query ? `?${query}` : ''}`;
|
|
28
|
+
}
|
|
29
|
+
if (type.isString(pageId)) {
|
|
30
|
+
return `/${pageId}${query ? `?${query}` : ''}`;
|
|
31
|
+
}
|
|
32
|
+
if (type.isString(url)) {
|
|
33
|
+
return `${url}${query ? `?${query}` : ''}`;
|
|
34
|
+
}
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
function createAuthMethods({ lowdefy , auth }) {
|
|
38
|
+
// login and logout are Lowdefy function that handle action params
|
|
39
|
+
// signIn and signOut are the next-auth methods
|
|
40
|
+
function login({ authUrl , callbackUrl , providerId , ...rest } = {}) {
|
|
41
|
+
if (type.isNone(providerId) && auth.authConfig.providers.length === 1) {
|
|
42
|
+
providerId = auth.authConfig.providers[0].id;
|
|
43
|
+
}
|
|
44
|
+
auth.signIn(providerId, {
|
|
45
|
+
...rest,
|
|
46
|
+
callbackUrl: getCallbackUrl({
|
|
47
|
+
lowdefy,
|
|
48
|
+
callbackUrl
|
|
49
|
+
})
|
|
50
|
+
}, authUrl?.urlQuery);
|
|
51
|
+
}
|
|
52
|
+
function logout({ callbackUrl , redirect } = {}) {
|
|
53
|
+
auth.signOut({
|
|
54
|
+
callbackUrl: getCallbackUrl({
|
|
55
|
+
lowdefy,
|
|
56
|
+
callbackUrl
|
|
57
|
+
}),
|
|
58
|
+
redirect
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
login,
|
|
63
|
+
logout
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export default createAuthMethods;
|
package/dist/block/Block.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -18,9 +18,8 @@ import ErrorBoundary from '../ErrorBoundary.js';
|
|
|
18
18
|
import MountEvents from '../MountEvents.js';
|
|
19
19
|
const Block = ({ block , Blocks , context , lowdefy , parentLoading })=>{
|
|
20
20
|
const [updates, setUpdate] = useState(0);
|
|
21
|
-
lowdefy._internal.updaters[block.id] = ()=>setUpdate(updates + 1)
|
|
22
|
-
|
|
23
|
-
return(/*#__PURE__*/ React.createElement(ErrorBoundary, null, /*#__PURE__*/ React.createElement(MountEvents, {
|
|
21
|
+
lowdefy._internal.updaters[block.id] = ()=>setUpdate(updates + 1);
|
|
22
|
+
return /*#__PURE__*/ React.createElement(ErrorBoundary, null, /*#__PURE__*/ React.createElement(MountEvents, {
|
|
24
23
|
context: context,
|
|
25
24
|
triggerEvent: async ()=>{
|
|
26
25
|
context._internal.lowdefy._internal.progress.dispatch({
|
|
@@ -56,7 +55,6 @@ const Block = ({ block , Blocks , context , lowdefy , parentLoading })=>{
|
|
|
56
55
|
loading: eventLoading || parentLoading || block.eval.loading,
|
|
57
56
|
lowdefy: lowdefy,
|
|
58
57
|
updates: updates
|
|
59
|
-
})
|
|
60
|
-
)));
|
|
58
|
+
})));
|
|
61
59
|
};
|
|
62
60
|
export default Block;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -21,46 +21,48 @@ import List from './List.js';
|
|
|
21
21
|
import LoadingBlock from './LoadingBlock.js';
|
|
22
22
|
const CategorySwitch = ({ block , Blocks , context , loading , lowdefy })=>{
|
|
23
23
|
if (!block.eval) return null; // TODO: check Renderer updates before eval is executed for the first time on lists. See #520
|
|
24
|
-
if (block.eval.visible === false) return
|
|
24
|
+
if (block.eval.visible === false) return /*#__PURE__*/ React.createElement("div", {
|
|
25
25
|
id: `vs-${block.blockId}`,
|
|
26
26
|
style: {
|
|
27
27
|
display: 'none'
|
|
28
28
|
}
|
|
29
|
-
})
|
|
29
|
+
});
|
|
30
30
|
const Component = lowdefy._internal.blockComponents[block.type];
|
|
31
31
|
if (loading && type.isObject(block.eval.skeleton)) {
|
|
32
|
-
return
|
|
32
|
+
return /*#__PURE__*/ React.createElement(LoadingBlock, {
|
|
33
33
|
blockLayout: block.eval.layout,
|
|
34
|
+
blockProperties: block.eval.properties,
|
|
35
|
+
blockStyle: block.eval.style,
|
|
34
36
|
context: context,
|
|
35
37
|
lowdefy: lowdefy,
|
|
36
38
|
skeleton: block.eval.skeleton
|
|
37
|
-
})
|
|
39
|
+
});
|
|
38
40
|
}
|
|
39
41
|
switch(Component.meta.category){
|
|
40
42
|
case 'list':
|
|
41
|
-
return
|
|
43
|
+
return /*#__PURE__*/ React.createElement(List, {
|
|
42
44
|
block: block,
|
|
43
45
|
Blocks: Blocks,
|
|
44
46
|
Component: Component,
|
|
45
47
|
context: context,
|
|
46
48
|
loading: loading,
|
|
47
49
|
lowdefy: lowdefy
|
|
48
|
-
})
|
|
50
|
+
});
|
|
49
51
|
case 'container':
|
|
50
|
-
return
|
|
52
|
+
return /*#__PURE__*/ React.createElement(Container, {
|
|
51
53
|
block: block,
|
|
52
54
|
Blocks: Blocks,
|
|
53
55
|
Component: Component,
|
|
54
56
|
context: context,
|
|
55
57
|
loading: loading,
|
|
56
58
|
lowdefy: lowdefy
|
|
57
|
-
})
|
|
59
|
+
});
|
|
58
60
|
case 'input':
|
|
59
|
-
return
|
|
61
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
60
62
|
id: `bl-${block.blockId}`,
|
|
61
63
|
blockStyle: block.eval.style,
|
|
62
64
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
63
|
-
layout: block.eval.layout
|
|
65
|
+
layout: block.eval.layout,
|
|
64
66
|
makeCssClass: makeCssClass
|
|
65
67
|
}, /*#__PURE__*/ React.createElement(Component, {
|
|
66
68
|
methods: Object.assign(block.methods, {
|
|
@@ -80,16 +82,15 @@ const CategorySwitch = ({ block , Blocks , context , loading , lowdefy })=>{
|
|
|
80
82
|
pageId: lowdefy.pageId,
|
|
81
83
|
properties: block.eval.properties,
|
|
82
84
|
required: block.eval.required,
|
|
83
|
-
user: lowdefy.user,
|
|
84
85
|
validation: block.eval.validation,
|
|
85
86
|
value: block.value
|
|
86
|
-
}))
|
|
87
|
+
}));
|
|
87
88
|
default:
|
|
88
|
-
return
|
|
89
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
89
90
|
id: `bl-${block.blockId}`,
|
|
90
91
|
blockStyle: block.eval.style,
|
|
91
92
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
92
|
-
layout: block.eval.layout
|
|
93
|
+
layout: block.eval.layout,
|
|
93
94
|
makeCssClass: makeCssClass
|
|
94
95
|
}, /*#__PURE__*/ React.createElement(Component, {
|
|
95
96
|
methods: Object.assign(block.methods, {
|
|
@@ -108,9 +109,8 @@ const CategorySwitch = ({ block , Blocks , context , loading , lowdefy })=>{
|
|
|
108
109
|
pageId: lowdefy.pageId,
|
|
109
110
|
properties: block.eval.properties,
|
|
110
111
|
required: block.eval.required,
|
|
111
|
-
user: lowdefy.user,
|
|
112
112
|
validation: block.eval.validation
|
|
113
|
-
}))
|
|
113
|
+
}));
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
export default CategorySwitch;
|
package/dist/block/Container.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -25,13 +25,13 @@ const Container = ({ block , Blocks , Component , context , loading , lowdefy }
|
|
|
25
25
|
id: `ar-${block.blockId}-${areaKey}`,
|
|
26
26
|
key: `ar-${block.blockId}-${areaKey}-${i}`,
|
|
27
27
|
area: layoutParamsToArea({
|
|
28
|
-
area: block.eval.areas[areaKey]
|
|
28
|
+
area: block.eval.areas[areaKey],
|
|
29
29
|
areaKey,
|
|
30
|
-
layout: block.eval.layout
|
|
30
|
+
layout: block.eval.layout
|
|
31
31
|
}),
|
|
32
32
|
areaStyle: [
|
|
33
33
|
areaStyle,
|
|
34
|
-
block.eval.areas[areaKey]
|
|
34
|
+
block.eval.areas[areaKey]?.style
|
|
35
35
|
],
|
|
36
36
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
37
37
|
makeCssClass: makeCssClass
|
|
@@ -42,15 +42,13 @@ const Container = ({ block , Blocks , Component , context , loading , lowdefy }
|
|
|
42
42
|
context: context,
|
|
43
43
|
parentLoading: loading,
|
|
44
44
|
lowdefy: lowdefy
|
|
45
|
-
})
|
|
46
|
-
))
|
|
47
|
-
;
|
|
45
|
+
})));
|
|
48
46
|
});
|
|
49
|
-
return
|
|
47
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
50
48
|
id: `bl-${block.blockId}`,
|
|
51
49
|
blockStyle: block.eval.style,
|
|
52
50
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
53
|
-
layout: block.eval.layout
|
|
51
|
+
layout: block.eval.layout,
|
|
54
52
|
makeCssClass: makeCssClass
|
|
55
53
|
}, /*#__PURE__*/ React.createElement(Component, {
|
|
56
54
|
methods: Object.assign(block.methods, {
|
|
@@ -70,8 +68,7 @@ const Container = ({ block , Blocks , Component , context , loading , lowdefy }
|
|
|
70
68
|
pageId: lowdefy.pageId,
|
|
71
69
|
properties: block.eval.properties,
|
|
72
70
|
required: block.eval.required,
|
|
73
|
-
user: lowdefy.user,
|
|
74
71
|
validation: block.eval.validation
|
|
75
|
-
}))
|
|
72
|
+
}));
|
|
76
73
|
};
|
|
77
74
|
export default Container;
|
package/dist/block/List.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -25,13 +25,13 @@ const List = ({ block , Blocks , Component , context , loading , lowdefy })=>{
|
|
|
25
25
|
id: `ar-${block.blockId}-${SBlock.id}-${areaKey}`,
|
|
26
26
|
key: `ar-${block.blockId}-${SBlock.id}-${areaKey}`,
|
|
27
27
|
area: layoutParamsToArea({
|
|
28
|
-
area: block.eval.areas[areaKey]
|
|
28
|
+
area: block.eval.areas[areaKey],
|
|
29
29
|
areaKey,
|
|
30
|
-
layout: block.eval.layout
|
|
30
|
+
layout: block.eval.layout
|
|
31
31
|
}),
|
|
32
32
|
areaStyle: [
|
|
33
33
|
areaStyle,
|
|
34
|
-
block.eval.areas[areaKey]
|
|
34
|
+
block.eval.areas[areaKey]?.style
|
|
35
35
|
],
|
|
36
36
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
37
37
|
makeCssClass: makeCssClass
|
|
@@ -42,19 +42,17 @@ const List = ({ block , Blocks , Component , context , loading , lowdefy })=>{
|
|
|
42
42
|
context: context,
|
|
43
43
|
parentLoading: loading,
|
|
44
44
|
lowdefy: lowdefy
|
|
45
|
-
})
|
|
46
|
-
))
|
|
47
|
-
;
|
|
45
|
+
})));
|
|
48
46
|
});
|
|
49
47
|
contentList.push({
|
|
50
48
|
...content
|
|
51
49
|
});
|
|
52
50
|
});
|
|
53
|
-
return
|
|
51
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
54
52
|
id: `bl-${block.blockId}`,
|
|
55
53
|
blockStyle: block.eval.style,
|
|
56
54
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
57
|
-
layout: block.eval.layout
|
|
55
|
+
layout: block.eval.layout,
|
|
58
56
|
makeCssClass: makeCssClass
|
|
59
57
|
}, /*#__PURE__*/ React.createElement(Component, {
|
|
60
58
|
methods: Object.assign(block.methods, {
|
|
@@ -79,8 +77,7 @@ const List = ({ block , Blocks , Component , context , loading , lowdefy })=>{
|
|
|
79
77
|
pageId: lowdefy.pageId,
|
|
80
78
|
properties: block.eval.properties,
|
|
81
79
|
required: block.eval.required,
|
|
82
|
-
user: lowdefy.user,
|
|
83
80
|
validation: block.eval.validation
|
|
84
|
-
}))
|
|
81
|
+
}));
|
|
85
82
|
};
|
|
86
83
|
export default List;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -29,7 +29,7 @@ const blockMethods = {
|
|
|
29
29
|
triggerEvent: ()=>{},
|
|
30
30
|
unshiftItem: ()=>{}
|
|
31
31
|
};
|
|
32
|
-
const LoadingBlock = ({ blockLayout ,
|
|
32
|
+
const LoadingBlock = ({ blockId , blockLayout , blockProperties , blockStyle , context , lowdefy , skeleton })=>{
|
|
33
33
|
let Component = lowdefy._internal.blockComponents[skeleton.type];
|
|
34
34
|
useEffect(()=>{
|
|
35
35
|
if (!lowdefy._internal.blockComponents[skeleton.type]) {
|
|
@@ -41,32 +41,32 @@ const LoadingBlock = ({ blockLayout , blockId , context , lowdefy , skeleton })
|
|
|
41
41
|
// default to box when a skeleton block is not found - should be a basic or loader block.
|
|
42
42
|
Component = lowdefy._internal.blockComponents.Box;
|
|
43
43
|
}
|
|
44
|
-
const layout = skeleton.layout || blockLayout || {};
|
|
45
44
|
switch(Component.meta.category){
|
|
46
45
|
case 'list':
|
|
47
|
-
return
|
|
46
|
+
return /*#__PURE__*/ React.createElement(LoadingList, {
|
|
48
47
|
blockId: blockId,
|
|
49
48
|
Component: Component,
|
|
50
49
|
context: context,
|
|
51
|
-
layout: layout,
|
|
52
50
|
lowdefy: lowdefy,
|
|
53
51
|
skeleton: skeleton
|
|
54
|
-
})
|
|
52
|
+
});
|
|
55
53
|
case 'container':
|
|
56
|
-
return
|
|
54
|
+
return /*#__PURE__*/ React.createElement(LoadingContainer, {
|
|
57
55
|
blockId: blockId,
|
|
56
|
+
blockLayout: blockLayout,
|
|
57
|
+
blockProperties: blockProperties,
|
|
58
|
+
blockStyle: blockStyle,
|
|
58
59
|
Component: Component,
|
|
59
60
|
context: context,
|
|
60
|
-
layout: layout,
|
|
61
61
|
lowdefy: lowdefy,
|
|
62
62
|
skeleton: skeleton
|
|
63
|
-
})
|
|
63
|
+
});
|
|
64
64
|
default:
|
|
65
|
-
return
|
|
66
|
-
blockStyle: skeleton.style,
|
|
65
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
66
|
+
blockStyle: skeleton.style ?? blockStyle,
|
|
67
67
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
68
68
|
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
69
|
-
layout: layout,
|
|
69
|
+
layout: skeleton.layout ?? blockLayout,
|
|
70
70
|
makeCssClass: makeCssClass
|
|
71
71
|
}, /*#__PURE__*/ React.createElement(Component, {
|
|
72
72
|
basePath: lowdefy.basePath,
|
|
@@ -76,9 +76,8 @@ const LoadingBlock = ({ blockLayout , blockId , context , lowdefy , skeleton })
|
|
|
76
76
|
menus: lowdefy.menus,
|
|
77
77
|
methods: blockMethods,
|
|
78
78
|
pageId: lowdefy.pageId,
|
|
79
|
-
properties: skeleton.properties
|
|
80
|
-
|
|
81
|
-
})));
|
|
79
|
+
properties: skeleton.properties ?? blockProperties
|
|
80
|
+
}));
|
|
82
81
|
}
|
|
83
82
|
};
|
|
84
83
|
export default LoadingBlock;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,15 +16,15 @@
|
|
|
16
16
|
import { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
|
|
17
17
|
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
18
|
import LoadingBlock from './LoadingBlock.js';
|
|
19
|
-
const LoadingContainer = ({ blockId ,
|
|
19
|
+
const LoadingContainer = ({ blockId , blockLayout , blockProperties , blockStyle , Component , context , lowdefy , skeleton })=>{
|
|
20
20
|
const content = {};
|
|
21
21
|
// eslint-disable-next-line prefer-destructuring
|
|
22
22
|
Object.keys(skeleton.areas).forEach((areaKey, i)=>{
|
|
23
23
|
content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
|
|
24
24
|
area: layoutParamsToArea({
|
|
25
|
-
area: skeleton.areas[areaKey]
|
|
25
|
+
area: skeleton.areas[areaKey],
|
|
26
26
|
areaKey,
|
|
27
|
-
layout
|
|
27
|
+
layout: skeleton.layout ?? blockLayout
|
|
28
28
|
}),
|
|
29
29
|
areaStyle: [
|
|
30
30
|
areaStyle,
|
|
@@ -40,15 +40,13 @@ const LoadingContainer = ({ blockId , Component , context , layout , lowdefy , s
|
|
|
40
40
|
key: `s-co-${skl.id}-${k}`,
|
|
41
41
|
lowdefy: lowdefy,
|
|
42
42
|
skeleton: skl
|
|
43
|
-
})
|
|
44
|
-
))
|
|
45
|
-
;
|
|
43
|
+
})));
|
|
46
44
|
});
|
|
47
|
-
return
|
|
48
|
-
blockStyle: skeleton.style,
|
|
45
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
46
|
+
blockStyle: skeleton.style ?? blockStyle,
|
|
49
47
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
50
48
|
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
51
|
-
layout: layout,
|
|
49
|
+
layout: skeleton.layout ?? blockLayout,
|
|
52
50
|
makeCssClass: makeCssClass
|
|
53
51
|
}, /*#__PURE__*/ React.createElement(Component, {
|
|
54
52
|
basePath: lowdefy.basePath,
|
|
@@ -61,8 +59,7 @@ const LoadingContainer = ({ blockId , Component , context , layout , lowdefy , s
|
|
|
61
59
|
makeCssClass
|
|
62
60
|
},
|
|
63
61
|
pageId: lowdefy.pageId,
|
|
64
|
-
properties: skeleton.properties
|
|
65
|
-
|
|
66
|
-
})));
|
|
62
|
+
properties: skeleton.properties ?? blockProperties
|
|
63
|
+
}));
|
|
67
64
|
};
|
|
68
65
|
export default LoadingContainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
import { Area, BlockLayout, layoutParamsToArea } from '@lowdefy/layout';
|
|
17
17
|
import { makeCssClass } from '@lowdefy/block-utils';
|
|
18
18
|
import LoadingBlock from './LoadingBlock.js';
|
|
19
|
-
const LoadingList = ({ blockId ,
|
|
19
|
+
const LoadingList = ({ blockId , blockLayout , blockProperties , blockStyle , Component , context , lowdefy , skeleton })=>{
|
|
20
20
|
const content = {};
|
|
21
21
|
const contentList = [];
|
|
22
22
|
new Array(3).forEach(()=>{
|
|
23
23
|
Object.keys(skeleton.areas).forEach((areaKey, i)=>{
|
|
24
24
|
content[areaKey] = (areaStyle)=>/*#__PURE__*/ React.createElement(Area, {
|
|
25
25
|
area: layoutParamsToArea({
|
|
26
|
-
area: skeleton.areas[areaKey]
|
|
26
|
+
area: skeleton.areas[areaKey],
|
|
27
27
|
areaKey,
|
|
28
|
-
layout
|
|
28
|
+
layout: skeleton.layout ?? blockLayout
|
|
29
29
|
}),
|
|
30
30
|
areaStyle: [
|
|
31
31
|
areaStyle,
|
|
32
|
-
skeleton.areas[areaKey]
|
|
32
|
+
skeleton.areas[areaKey]?.style
|
|
33
33
|
],
|
|
34
34
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
35
35
|
id: `s-ar-${blockId}-${skeleton.id}-${areaKey}`,
|
|
@@ -41,19 +41,17 @@ const LoadingList = ({ blockId , Component , context , layout , lowdefy , skelet
|
|
|
41
41
|
key: `s-co-${skl.id}-${k}`,
|
|
42
42
|
lowdefy: lowdefy,
|
|
43
43
|
skeleton: skl
|
|
44
|
-
})
|
|
45
|
-
))
|
|
46
|
-
;
|
|
44
|
+
})));
|
|
47
45
|
});
|
|
48
46
|
contentList.push({
|
|
49
47
|
...content
|
|
50
48
|
});
|
|
51
49
|
});
|
|
52
|
-
return
|
|
53
|
-
blockStyle: skeleton.style,
|
|
50
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
51
|
+
blockStyle: skeleton.style ?? blockStyle,
|
|
54
52
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
55
53
|
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
56
|
-
layout: layout,
|
|
54
|
+
layout: skeleton.layout ?? blockLayout,
|
|
57
55
|
makeCssClass: makeCssClass
|
|
58
56
|
}, /*#__PURE__*/ React.createElement(Component, {
|
|
59
57
|
basePath: lowdefy.basePath,
|
|
@@ -65,8 +63,7 @@ const LoadingList = ({ blockId , Component , context , layout , lowdefy , skelet
|
|
|
65
63
|
makeCssClass
|
|
66
64
|
},
|
|
67
65
|
pageId: lowdefy.pageId,
|
|
68
|
-
properties: skeleton.properties
|
|
69
|
-
|
|
70
|
-
})));
|
|
66
|
+
properties: skeleton.properties ?? blockProperties
|
|
67
|
+
}));
|
|
71
68
|
};
|
|
72
69
|
export default LoadingList;
|
package/dist/callRequest.js
CHANGED
package/dist/createIcon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,13 +12,7 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import classNames from 'classnames';
|
|
17
|
-
import { omit, type } from '@lowdefy/helpers';
|
|
18
|
-
import Icon from '@ant-design/icons';
|
|
19
|
-
import { blockDefaultProps, makeCssClass } from '@lowdefy/block-utils';
|
|
20
|
-
import ErrorBoundary from './ErrorBoundary.js';
|
|
21
|
-
function _extends() {
|
|
15
|
+
*/ function _extends() {
|
|
22
16
|
_extends = Object.assign || function(target) {
|
|
23
17
|
for(var i = 1; i < arguments.length; i++){
|
|
24
18
|
var source = arguments[i];
|
|
@@ -32,6 +26,12 @@ function _extends() {
|
|
|
32
26
|
};
|
|
33
27
|
return _extends.apply(this, arguments);
|
|
34
28
|
}
|
|
29
|
+
import React from 'react';
|
|
30
|
+
import classNames from 'classnames';
|
|
31
|
+
import { omit, type } from '@lowdefy/helpers';
|
|
32
|
+
import Icon from '@ant-design/icons';
|
|
33
|
+
import { blockDefaultProps, makeCssClass } from '@lowdefy/block-utils';
|
|
34
|
+
import ErrorBoundary from './ErrorBoundary.js';
|
|
35
35
|
const lowdefyProps = [
|
|
36
36
|
'actionLog',
|
|
37
37
|
'basePath',
|
|
@@ -45,8 +45,7 @@ const lowdefyProps = [
|
|
|
45
45
|
'registerEvent',
|
|
46
46
|
'registerMethod',
|
|
47
47
|
'schemaErrors',
|
|
48
|
-
'
|
|
49
|
-
'validation',
|
|
48
|
+
'validation'
|
|
50
49
|
];
|
|
51
50
|
const createIcon = (Icons)=>{
|
|
52
51
|
const AiOutlineLoading3Quarters = Icons['AiOutlineLoading3Quarters'];
|
|
@@ -63,7 +62,7 @@ const createIcon = (Icons)=>{
|
|
|
63
62
|
{
|
|
64
63
|
cursor: (onClick || events.onClick) && 'pointer'
|
|
65
64
|
},
|
|
66
|
-
propertiesObj.style
|
|
65
|
+
propertiesObj.style
|
|
67
66
|
])]: true,
|
|
68
67
|
'icon-spin': spin
|
|
69
68
|
}),
|
|
@@ -78,7 +77,7 @@ const createIcon = (Icons)=>{
|
|
|
78
77
|
if (!IconComp) {
|
|
79
78
|
IconComp = AiOutlineExclamationCircle;
|
|
80
79
|
}
|
|
81
|
-
return
|
|
80
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, spin ? /*#__PURE__*/ React.createElement(AiOutlineLoading3Quarters, _extends({}, iconProps)) : /*#__PURE__*/ React.createElement(ErrorBoundary, {
|
|
82
81
|
fallback: ()=>/*#__PURE__*/ React.createElement(AiOutlineExclamationCircle, _extends({}, {
|
|
83
82
|
...iconProps,
|
|
84
83
|
color: '#F00'
|
|
@@ -87,16 +86,14 @@ const createIcon = (Icons)=>{
|
|
|
87
86
|
id: blockId,
|
|
88
87
|
onClick: onClick || events.onClick && (()=>methods.triggerEvent({
|
|
89
88
|
name: 'onClick'
|
|
90
|
-
})
|
|
91
|
-
),
|
|
89
|
+
})),
|
|
92
90
|
size: propertiesObj.size,
|
|
93
91
|
title: propertiesObj.title
|
|
94
|
-
}, iconProps))))
|
|
92
|
+
}, iconProps))));
|
|
95
93
|
};
|
|
96
94
|
const AntIcon = (all)=>/*#__PURE__*/ React.createElement(Icon, {
|
|
97
95
|
component: ()=>/*#__PURE__*/ React.createElement(IconBlock, _extends({}, all))
|
|
98
|
-
})
|
|
99
|
-
;
|
|
96
|
+
});
|
|
100
97
|
AntIcon.defaultProps = blockDefaultProps;
|
|
101
98
|
return AntIcon;
|
|
102
99
|
};
|
|
@@ -2,26 +2,32 @@ import React from 'react';
|
|
|
2
2
|
import { createLink } from '@lowdefy/engine';
|
|
3
3
|
import { type } from '@lowdefy/helpers';
|
|
4
4
|
const createLinkComponent = (lowdefy, Link)=>{
|
|
5
|
-
const
|
|
5
|
+
const { window } = lowdefy._internal.globals;
|
|
6
|
+
const backLink = ({ ariaLabel , children , className , id , onClick =()=>{} , rel })=>/*#__PURE__*/ React.createElement("a", {
|
|
6
7
|
id: id,
|
|
7
|
-
onClick: ()=>lowdefy._internal.router.back()
|
|
8
|
-
,
|
|
9
8
|
className: className,
|
|
10
9
|
rel: rel,
|
|
11
|
-
"aria-label": ariaLabel || 'back'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
"aria-label": ariaLabel || 'back',
|
|
11
|
+
onClick: (...params)=>{
|
|
12
|
+
lowdefy._internal.router.back();
|
|
13
|
+
onClick(...params);
|
|
14
|
+
}
|
|
15
|
+
}, type.isFunction(children) ? children(id) : children);
|
|
16
|
+
const newOriginLink = ({ ariaLabel , children , className , href , id , onClick =()=>{} , newTab , pageId , query , rel , url })=>{
|
|
17
|
+
return /*#__PURE__*/ React.createElement("a", {
|
|
16
18
|
id: id,
|
|
17
19
|
"aria-label": ariaLabel,
|
|
18
20
|
className: className,
|
|
19
|
-
href: `${url}${query ? `?${query}` : ''}`,
|
|
21
|
+
href: href || `${url}${query ? `?${query}` : ''}`,
|
|
20
22
|
rel: rel || newTab && 'noopener noreferrer',
|
|
21
|
-
target: newTab && '_blank'
|
|
22
|
-
|
|
23
|
+
target: newTab && '_blank',
|
|
24
|
+
onClick: async (...params)=>{
|
|
25
|
+
await onClick(...params);
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}, type.isFunction(children) ? children(pageId || url || id) : children);
|
|
23
29
|
};
|
|
24
|
-
const sameOriginLink = ({ ariaLabel , children , className , id , newTab , pageId , pathname , query , rel , replace , scroll , setInput , url
|
|
30
|
+
const sameOriginLink = ({ ariaLabel , children , className , id , newTab , onClick =()=>{} , pageId , pathname , query , rel , replace , scroll , setInput , url })=>{
|
|
25
31
|
if (newTab) {
|
|
26
32
|
return(// eslint-disable-next-line react/jsx-no-target-blank
|
|
27
33
|
/*#__PURE__*/ React.createElement("a", {
|
|
@@ -30,10 +36,14 @@ const createLinkComponent = (lowdefy, Link)=>{
|
|
|
30
36
|
className: className,
|
|
31
37
|
href: `${window.location.origin}${lowdefy._internal.router.basePath}${pathname}${query ? `?${query}` : ''}`,
|
|
32
38
|
rel: rel || 'noopener noreferrer',
|
|
33
|
-
target: "_blank"
|
|
39
|
+
target: "_blank",
|
|
40
|
+
onClick: async (...params)=>{
|
|
41
|
+
await onClick(...params);
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
34
44
|
}, type.isFunction(children) ? children(pageId || url || id) : children));
|
|
35
45
|
}
|
|
36
|
-
return
|
|
46
|
+
return /*#__PURE__*/ React.createElement(Link, {
|
|
37
47
|
href: {
|
|
38
48
|
pathname,
|
|
39
49
|
query
|
|
@@ -45,14 +55,17 @@ const createLinkComponent = (lowdefy, Link)=>{
|
|
|
45
55
|
"aria-label": ariaLabel,
|
|
46
56
|
className: className,
|
|
47
57
|
rel: rel,
|
|
48
|
-
onClick:
|
|
49
|
-
|
|
58
|
+
onClick: (...params)=>{
|
|
59
|
+
setInput();
|
|
60
|
+
onClick(...params);
|
|
61
|
+
}
|
|
62
|
+
}, type.isFunction(children) ? children(pageId || url || id) : children));
|
|
50
63
|
};
|
|
51
|
-
const noLink = ({ className , children , id })=>/*#__PURE__*/ React.createElement("span", {
|
|
64
|
+
const noLink = ({ className , children , id , onClick =()=>{} })=>/*#__PURE__*/ React.createElement("span", {
|
|
52
65
|
id: id,
|
|
53
|
-
className: className
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
className: className,
|
|
67
|
+
onClick: onClick
|
|
68
|
+
}, type.isFunction(children) ? children(id) : children);
|
|
56
69
|
return createLink({
|
|
57
70
|
backLink,
|
|
58
71
|
lowdefy,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
See the License for the specific language governing permissions and
|
|
14
14
|
limitations under the License.
|
|
15
|
-
*/ import
|
|
16
|
-
import callRequest from './callRequest.js';
|
|
15
|
+
*/ import callRequest from './callRequest.js';
|
|
17
16
|
import createIcon from './createIcon.js';
|
|
17
|
+
import createAuthMethods from './auth/createAuthMethods.js';
|
|
18
18
|
import createLinkComponent from './createLinkComponent.js';
|
|
19
19
|
import setupLink from './setupLink.js';
|
|
20
20
|
const lowdefy = {
|
|
@@ -24,11 +24,9 @@ const lowdefy = {
|
|
|
24
24
|
updaters: {},
|
|
25
25
|
displayMessage: ({ content })=>{
|
|
26
26
|
console.log(content);
|
|
27
|
-
return ()=>undefined
|
|
28
|
-
;
|
|
27
|
+
return ()=>undefined;
|
|
29
28
|
},
|
|
30
|
-
link: ()=>undefined
|
|
31
|
-
,
|
|
29
|
+
link: ()=>undefined,
|
|
32
30
|
progress: {
|
|
33
31
|
state: {
|
|
34
32
|
progress: 0
|
|
@@ -40,7 +38,7 @@ const lowdefy = {
|
|
|
40
38
|
inputs: {},
|
|
41
39
|
lowdefyGlobal: {}
|
|
42
40
|
};
|
|
43
|
-
function initLowdefyContext({ Components , config , router , stage , types , window }) {
|
|
41
|
+
function initLowdefyContext({ auth , Components , config , router , stage , types , window }) {
|
|
44
42
|
if (stage === 'dev') {
|
|
45
43
|
window.lowdefy = lowdefy;
|
|
46
44
|
}
|
|
@@ -49,18 +47,25 @@ function initLowdefyContext({ Components , config , router , stage , types , win
|
|
|
49
47
|
lowdefy.lowdefyGlobal = config.rootConfig.lowdefyGlobal;
|
|
50
48
|
lowdefy.menus = config.rootConfig.menus;
|
|
51
49
|
lowdefy.pageId = config.pageConfig.pageId;
|
|
52
|
-
lowdefy.
|
|
53
|
-
lowdefy._internal.
|
|
54
|
-
|
|
50
|
+
lowdefy.user = auth?.session?.user ?? null;
|
|
51
|
+
lowdefy._internal.globals = {
|
|
52
|
+
document: window.document,
|
|
53
|
+
fetch: window.fetch,
|
|
54
|
+
window
|
|
55
|
+
};
|
|
55
56
|
lowdefy._internal.router = router;
|
|
56
57
|
lowdefy._internal.link = setupLink(lowdefy);
|
|
57
|
-
lowdefy._internal.updateBlock = (blockId)=>lowdefy._internal.updaters[blockId] && lowdefy._internal.updaters[blockId]()
|
|
58
|
-
;
|
|
58
|
+
lowdefy._internal.updateBlock = (blockId)=>lowdefy._internal.updaters[blockId] && lowdefy._internal.updaters[blockId]();
|
|
59
59
|
lowdefy._internal.components.Link = createLinkComponent(lowdefy, Components.Link);
|
|
60
60
|
lowdefy._internal.components.Icon = createIcon(types.icons);
|
|
61
61
|
lowdefy._internal.actions = types.actions;
|
|
62
62
|
lowdefy._internal.blockComponents = types.blocks;
|
|
63
63
|
lowdefy._internal.operators = types.operators;
|
|
64
|
+
// TODO: discuss not using object arguments
|
|
65
|
+
lowdefy._internal.auth = createAuthMethods({
|
|
66
|
+
lowdefy,
|
|
67
|
+
auth
|
|
68
|
+
});
|
|
64
69
|
return lowdefy;
|
|
65
70
|
}
|
|
66
71
|
export default initLowdefyContext;
|
package/dist/request.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
});
|
|
23
23
|
if (!res.ok) {
|
|
24
24
|
// TODO: check
|
|
25
|
-
const
|
|
25
|
+
const body1 = await res.json();
|
|
26
26
|
console.log(res);
|
|
27
|
-
console.log(
|
|
28
|
-
throw new Error(
|
|
27
|
+
console.log(body1);
|
|
28
|
+
throw new Error(body1.message || 'Request error');
|
|
29
29
|
}
|
|
30
30
|
return res.json();
|
|
31
31
|
}
|
package/dist/setupLink.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/ import { createLink } from '@lowdefy/engine';
|
|
16
16
|
function setupLink(lowdefy) {
|
|
17
|
-
const { router
|
|
18
|
-
const
|
|
19
|
-
;
|
|
17
|
+
const { router } = lowdefy._internal;
|
|
18
|
+
const { window } = lowdefy._internal.globals;
|
|
19
|
+
const backLink = ()=>router.back();
|
|
20
20
|
const disabledLink = ()=>{};
|
|
21
21
|
const newOriginLink = ({ url , query , newTab })=>{
|
|
22
22
|
if (newTab) {
|
package/dist/style.less
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Copyright 2020-
|
|
2
|
+
Copyright 2020-2023 Lowdefy, Inc
|
|
3
3
|
|
|
4
4
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
you may not use this file except in compliance with the License.
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
@keyframes spin {
|
|
22
22
|
0% {
|
|
23
|
-
|
|
23
|
+
transform: rotate(0deg);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
100% {
|
|
27
|
-
|
|
27
|
+
transform: rotate(360deg);
|
|
28
28
|
}
|
|
29
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/client",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-rc.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy Client",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -33,39 +33,39 @@
|
|
|
33
33
|
"dist/*"
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "
|
|
36
|
+
"build": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start && pnpm copyfiles",
|
|
37
37
|
"clean": "rm -rf dist",
|
|
38
38
|
"copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"test:watch": "jest --coverage --watch",
|
|
42
|
-
"test": "jest --coverage"
|
|
39
|
+
"prepublishOnly": "pnpm build",
|
|
40
|
+
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
|
|
43
41
|
},
|
|
44
42
|
"dependencies": {
|
|
45
|
-
"@ant-design/icons": "4.
|
|
46
|
-
"@lowdefy/block-utils": "4.0.0-
|
|
47
|
-
"@lowdefy/engine": "4.0.0-
|
|
48
|
-
"@lowdefy/helpers": "4.0.0-
|
|
49
|
-
"@lowdefy/layout": "4.0.0-
|
|
50
|
-
"classnames": "2.3.
|
|
51
|
-
"react": "
|
|
52
|
-
"react-dom": "
|
|
43
|
+
"@ant-design/icons": "4.8.0",
|
|
44
|
+
"@lowdefy/block-utils": "4.0.0-rc.1",
|
|
45
|
+
"@lowdefy/engine": "4.0.0-rc.1",
|
|
46
|
+
"@lowdefy/helpers": "4.0.0-rc.1",
|
|
47
|
+
"@lowdefy/layout": "4.0.0-rc.1",
|
|
48
|
+
"classnames": "2.3.2",
|
|
49
|
+
"react": "18.2.0",
|
|
50
|
+
"react-dom": "18.2.0"
|
|
53
51
|
},
|
|
54
52
|
"devDependencies": {
|
|
55
|
-
"@emotion/jest": "11.
|
|
56
|
-
"@
|
|
57
|
-
"@
|
|
58
|
-
"@swc/
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@testing-library/
|
|
53
|
+
"@emotion/jest": "11.10.5",
|
|
54
|
+
"@jest/globals": "28.1.0",
|
|
55
|
+
"@lowdefy/jest-yaml-transform": "4.0.0-rc.1",
|
|
56
|
+
"@swc/cli": "0.1.59",
|
|
57
|
+
"@swc/core": "1.3.24",
|
|
58
|
+
"@swc/jest": "0.2.24",
|
|
59
|
+
"@testing-library/dom": "8.19.1",
|
|
60
|
+
"@testing-library/react": "13.4.0",
|
|
61
|
+
"@testing-library/user-event": "14.4.3",
|
|
62
62
|
"copyfiles": "2.4.1",
|
|
63
|
-
"jest": "
|
|
64
|
-
"jest-
|
|
65
|
-
"jest-
|
|
63
|
+
"jest": "28.1.0",
|
|
64
|
+
"jest-environment-jsdom": "28.1.0",
|
|
65
|
+
"jest-serializer-html": "7.1.0"
|
|
66
66
|
},
|
|
67
67
|
"publishConfig": {
|
|
68
68
|
"access": "public"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "ecc4f16c19eede929eda177db524cf13a8053379"
|
|
71
71
|
}
|