@lowdefy/client 4.0.0-alpha.11 → 4.0.0-alpha.14
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 +7 -8
- package/dist/Context.js +2 -2
- package/dist/DisplayMessage.js +2 -2
- package/dist/ErrorBoundary.js +2 -2
- package/dist/ErrorPage.js +1 -2
- package/dist/Head.js +1 -1
- package/dist/MountEvents.js +4 -10
- package/dist/ProgressBarController.js +4 -6
- package/dist/auth/createAuthMethods.js +5 -5
- package/dist/block/Block.js +3 -5
- package/dist/block/CategorySwitch.js +12 -12
- package/dist/block/Container.js +3 -5
- package/dist/block/List.js +3 -5
- package/dist/block/LoadingBlock.js +6 -6
- package/dist/block/LoadingContainer.js +3 -5
- package/dist/block/LoadingList.js +3 -5
- package/dist/createIcon.js +18 -20
- package/dist/createLinkComponent.js +7 -10
- package/dist/initLowdefyContext.js +9 -9
- package/dist/setupLink.js +1 -2
- package/package.json +19 -18
package/dist/Client.js
CHANGED
|
@@ -22,18 +22,17 @@ import initLowdefyContext from './initLowdefyContext.js';
|
|
|
22
22
|
const Client = ({ auth , Components , config , resetContext ={
|
|
23
23
|
reset: false,
|
|
24
24
|
setReset: ()=>undefined
|
|
25
|
-
} , router ,
|
|
25
|
+
} , router , stage , types , window , })=>{
|
|
26
26
|
const lowdefy = initLowdefyContext({
|
|
27
27
|
auth,
|
|
28
28
|
Components,
|
|
29
29
|
config,
|
|
30
30
|
router,
|
|
31
|
-
session,
|
|
32
31
|
stage,
|
|
33
32
|
types,
|
|
34
33
|
window
|
|
35
34
|
});
|
|
36
|
-
return
|
|
35
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(ProgressBarController, {
|
|
37
36
|
id: "lowdefy-progress-bar",
|
|
38
37
|
key: `${config.pageConfig.id}-progress-bar`,
|
|
39
38
|
lowdefy: lowdefy,
|
|
@@ -54,16 +53,16 @@ const Client = ({ auth , Components , config , resetContext ={
|
|
|
54
53
|
resetContext: resetContext
|
|
55
54
|
}, (context)=>{
|
|
56
55
|
if (!context._internal.onInitDone) return '';
|
|
57
|
-
return
|
|
56
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Head, {
|
|
58
57
|
Component: Components.Head,
|
|
59
|
-
properties: context._internal.RootBlocks.map[config.pageConfig.
|
|
58
|
+
properties: context._internal.RootBlocks.map[config.pageConfig.blockId].eval.properties
|
|
60
59
|
}), /*#__PURE__*/ React.createElement(Block, {
|
|
61
|
-
block: context._internal.RootBlocks.map[config.pageConfig.
|
|
60
|
+
block: context._internal.RootBlocks.map[config.pageConfig.blockId],
|
|
62
61
|
Blocks: context._internal.RootBlocks,
|
|
63
62
|
context: context,
|
|
64
63
|
lowdefy: lowdefy,
|
|
65
64
|
parentLoading: false
|
|
66
|
-
}))
|
|
67
|
-
}))
|
|
65
|
+
}));
|
|
66
|
+
}));
|
|
68
67
|
};
|
|
69
68
|
export default Client;
|
package/dist/Context.js
CHANGED
|
@@ -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
|
@@ -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
|
@@ -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
package/dist/Head.js
CHANGED
|
@@ -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
|
@@ -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,
|
|
@@ -79,6 +77,6 @@ const ProgressBarController = ({ id , lowdefy , resetContext })=>{
|
|
|
79
77
|
},
|
|
80
78
|
pageId: lowdefy.pageId,
|
|
81
79
|
properties: state
|
|
82
|
-
})
|
|
80
|
+
});
|
|
83
81
|
};
|
|
84
82
|
export default ProgressBarController;
|
|
@@ -18,8 +18,7 @@ function getCallbackUrl({ lowdefy , callbackUrl ={} }) {
|
|
|
18
18
|
if ([
|
|
19
19
|
!home,
|
|
20
20
|
!pageId
|
|
21
|
-
].filter((v)=>!v
|
|
22
|
-
).length > 1) {
|
|
21
|
+
].filter((v)=>!v).length > 1) {
|
|
23
22
|
throw Error(`Invalid Link: To avoid ambiguity, only one of 'home' or 'pageId' can be defined.`);
|
|
24
23
|
}
|
|
25
24
|
const query = type.isNone(urlQuery) ? '' : `${urlQueryFn.stringify(urlQuery)}`;
|
|
@@ -31,12 +30,13 @@ function getCallbackUrl({ lowdefy , callbackUrl ={} }) {
|
|
|
31
30
|
}
|
|
32
31
|
return undefined;
|
|
33
32
|
}
|
|
34
|
-
function createAuthMethods(lowdefy, auth) {
|
|
33
|
+
function createAuthMethods({ lowdefy , auth }) {
|
|
35
34
|
// login and logout are Lowdefy function that handle action params
|
|
36
35
|
// signIn and signOut are the next-auth methods
|
|
37
36
|
function login({ providerId , callbackUrl , authUrl ={} } = {}) {
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (type.isNone(providerId) && auth.authConfig.providers.length === 1) {
|
|
38
|
+
providerId = auth.authConfig.providers[0].id;
|
|
39
|
+
}
|
|
40
40
|
auth.signIn(providerId, {
|
|
41
41
|
callbackUrl: getCallbackUrl({
|
|
42
42
|
lowdefy,
|
package/dist/block/Block.js
CHANGED
|
@@ -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;
|
|
@@ -21,42 +21,42 @@ 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
34
|
context: context,
|
|
35
35
|
lowdefy: lowdefy,
|
|
36
36
|
skeleton: block.eval.skeleton
|
|
37
|
-
})
|
|
37
|
+
});
|
|
38
38
|
}
|
|
39
39
|
switch(Component.meta.category){
|
|
40
40
|
case 'list':
|
|
41
|
-
return
|
|
41
|
+
return /*#__PURE__*/ React.createElement(List, {
|
|
42
42
|
block: block,
|
|
43
43
|
Blocks: Blocks,
|
|
44
44
|
Component: Component,
|
|
45
45
|
context: context,
|
|
46
46
|
loading: loading,
|
|
47
47
|
lowdefy: lowdefy
|
|
48
|
-
})
|
|
48
|
+
});
|
|
49
49
|
case 'container':
|
|
50
|
-
return
|
|
50
|
+
return /*#__PURE__*/ React.createElement(Container, {
|
|
51
51
|
block: block,
|
|
52
52
|
Blocks: Blocks,
|
|
53
53
|
Component: Component,
|
|
54
54
|
context: context,
|
|
55
55
|
loading: loading,
|
|
56
56
|
lowdefy: lowdefy
|
|
57
|
-
})
|
|
57
|
+
});
|
|
58
58
|
case 'input':
|
|
59
|
-
return
|
|
59
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
60
60
|
id: `bl-${block.blockId}`,
|
|
61
61
|
blockStyle: block.eval.style,
|
|
62
62
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
@@ -82,9 +82,9 @@ const CategorySwitch = ({ block , Blocks , context , loading , lowdefy })=>{
|
|
|
82
82
|
required: block.eval.required,
|
|
83
83
|
validation: block.eval.validation,
|
|
84
84
|
value: block.value
|
|
85
|
-
}))
|
|
85
|
+
}));
|
|
86
86
|
default:
|
|
87
|
-
return
|
|
87
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
88
88
|
id: `bl-${block.blockId}`,
|
|
89
89
|
blockStyle: block.eval.style,
|
|
90
90
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
@@ -108,7 +108,7 @@ const CategorySwitch = ({ block , Blocks , context , loading , lowdefy })=>{
|
|
|
108
108
|
properties: block.eval.properties,
|
|
109
109
|
required: block.eval.required,
|
|
110
110
|
validation: block.eval.validation
|
|
111
|
-
}))
|
|
111
|
+
}));
|
|
112
112
|
}
|
|
113
113
|
};
|
|
114
114
|
export default CategorySwitch;
|
package/dist/block/Container.js
CHANGED
|
@@ -42,11 +42,9 @@ 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,
|
|
@@ -71,6 +69,6 @@ const Container = ({ block , Blocks , Component , context , loading , lowdefy }
|
|
|
71
69
|
properties: block.eval.properties,
|
|
72
70
|
required: block.eval.required,
|
|
73
71
|
validation: block.eval.validation
|
|
74
|
-
}))
|
|
72
|
+
}));
|
|
75
73
|
};
|
|
76
74
|
export default Container;
|
package/dist/block/List.js
CHANGED
|
@@ -42,15 +42,13 @@ 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,
|
|
@@ -80,6 +78,6 @@ const List = ({ block , Blocks , Component , context , loading , lowdefy })=>{
|
|
|
80
78
|
properties: block.eval.properties,
|
|
81
79
|
required: block.eval.required,
|
|
82
80
|
validation: block.eval.validation
|
|
83
|
-
}))
|
|
81
|
+
}));
|
|
84
82
|
};
|
|
85
83
|
export default List;
|
|
@@ -44,25 +44,25 @@ const LoadingBlock = ({ blockLayout , blockId , context , lowdefy , skeleton })
|
|
|
44
44
|
const layout = skeleton.layout || blockLayout || {};
|
|
45
45
|
switch(Component.meta.category){
|
|
46
46
|
case 'list':
|
|
47
|
-
return
|
|
47
|
+
return /*#__PURE__*/ React.createElement(LoadingList, {
|
|
48
48
|
blockId: blockId,
|
|
49
49
|
Component: Component,
|
|
50
50
|
context: context,
|
|
51
51
|
layout: layout,
|
|
52
52
|
lowdefy: lowdefy,
|
|
53
53
|
skeleton: skeleton
|
|
54
|
-
})
|
|
54
|
+
});
|
|
55
55
|
case 'container':
|
|
56
|
-
return
|
|
56
|
+
return /*#__PURE__*/ React.createElement(LoadingContainer, {
|
|
57
57
|
blockId: blockId,
|
|
58
58
|
Component: Component,
|
|
59
59
|
context: context,
|
|
60
60
|
layout: layout,
|
|
61
61
|
lowdefy: lowdefy,
|
|
62
62
|
skeleton: skeleton
|
|
63
|
-
})
|
|
63
|
+
});
|
|
64
64
|
default:
|
|
65
|
-
return
|
|
65
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
66
66
|
blockStyle: skeleton.style,
|
|
67
67
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
68
68
|
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
@@ -77,7 +77,7 @@ const LoadingBlock = ({ blockLayout , blockId , context , lowdefy , skeleton })
|
|
|
77
77
|
methods: blockMethods,
|
|
78
78
|
pageId: lowdefy.pageId,
|
|
79
79
|
properties: skeleton.properties
|
|
80
|
-
}))
|
|
80
|
+
}));
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
export default LoadingBlock;
|
|
@@ -40,11 +40,9 @@ 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
|
|
45
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
48
46
|
blockStyle: skeleton.style,
|
|
49
47
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
50
48
|
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
@@ -62,6 +60,6 @@ const LoadingContainer = ({ blockId , Component , context , layout , lowdefy , s
|
|
|
62
60
|
},
|
|
63
61
|
pageId: lowdefy.pageId,
|
|
64
62
|
properties: skeleton.properties
|
|
65
|
-
}))
|
|
63
|
+
}));
|
|
66
64
|
};
|
|
67
65
|
export default LoadingContainer;
|
|
@@ -41,15 +41,13 @@ 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
|
|
50
|
+
return /*#__PURE__*/ React.createElement(BlockLayout, {
|
|
53
51
|
blockStyle: skeleton.style,
|
|
54
52
|
highlightBorders: lowdefy.lowdefyGlobal.highlightBorders,
|
|
55
53
|
id: `s-bl-${blockId}-${skeleton.id}`,
|
|
@@ -66,6 +64,6 @@ const LoadingList = ({ blockId , Component , context , layout , lowdefy , skelet
|
|
|
66
64
|
},
|
|
67
65
|
pageId: lowdefy.pageId,
|
|
68
66
|
properties: skeleton.properties
|
|
69
|
-
}))
|
|
67
|
+
}));
|
|
70
68
|
};
|
|
71
69
|
export default LoadingList;
|
package/dist/createIcon.js
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
function _extends() {
|
|
2
|
+
_extends = Object.assign || function(target) {
|
|
3
|
+
for(var i = 1; i < arguments.length; i++){
|
|
4
|
+
var source = arguments[i];
|
|
5
|
+
for(var key in source){
|
|
6
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
7
|
+
target[key] = source[key];
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
return target;
|
|
12
|
+
};
|
|
13
|
+
return _extends.apply(this, arguments);
|
|
14
|
+
}
|
|
1
15
|
/*
|
|
2
16
|
Copyright 2020-2022 Lowdefy, Inc
|
|
3
17
|
|
|
@@ -18,20 +32,6 @@ import { omit, type } from '@lowdefy/helpers';
|
|
|
18
32
|
import Icon from '@ant-design/icons';
|
|
19
33
|
import { blockDefaultProps, makeCssClass } from '@lowdefy/block-utils';
|
|
20
34
|
import ErrorBoundary from './ErrorBoundary.js';
|
|
21
|
-
function _extends() {
|
|
22
|
-
_extends = Object.assign || function(target) {
|
|
23
|
-
for(var i = 1; i < arguments.length; i++){
|
|
24
|
-
var source = arguments[i];
|
|
25
|
-
for(var key in source){
|
|
26
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
27
|
-
target[key] = source[key];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
|
-
return _extends.apply(this, arguments);
|
|
34
|
-
}
|
|
35
35
|
const lowdefyProps = [
|
|
36
36
|
'actionLog',
|
|
37
37
|
'basePath',
|
|
@@ -77,7 +77,7 @@ const createIcon = (Icons)=>{
|
|
|
77
77
|
if (!IconComp) {
|
|
78
78
|
IconComp = AiOutlineExclamationCircle;
|
|
79
79
|
}
|
|
80
|
-
return
|
|
80
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, spin ? /*#__PURE__*/ React.createElement(AiOutlineLoading3Quarters, _extends({}, iconProps)) : /*#__PURE__*/ React.createElement(ErrorBoundary, {
|
|
81
81
|
fallback: ()=>/*#__PURE__*/ React.createElement(AiOutlineExclamationCircle, _extends({}, {
|
|
82
82
|
...iconProps,
|
|
83
83
|
color: '#F00'
|
|
@@ -86,16 +86,14 @@ const createIcon = (Icons)=>{
|
|
|
86
86
|
id: blockId,
|
|
87
87
|
onClick: onClick || events.onClick && (()=>methods.triggerEvent({
|
|
88
88
|
name: 'onClick'
|
|
89
|
-
})
|
|
90
|
-
),
|
|
89
|
+
})),
|
|
91
90
|
size: propertiesObj.size,
|
|
92
91
|
title: propertiesObj.title
|
|
93
|
-
}, iconProps))))
|
|
92
|
+
}, iconProps))));
|
|
94
93
|
};
|
|
95
94
|
const AntIcon = (all)=>/*#__PURE__*/ React.createElement(Icon, {
|
|
96
95
|
component: ()=>/*#__PURE__*/ React.createElement(IconBlock, _extends({}, all))
|
|
97
|
-
})
|
|
98
|
-
;
|
|
96
|
+
});
|
|
99
97
|
AntIcon.defaultProps = blockDefaultProps;
|
|
100
98
|
return AntIcon;
|
|
101
99
|
};
|
|
@@ -4,22 +4,20 @@ import { type } from '@lowdefy/helpers';
|
|
|
4
4
|
const createLinkComponent = (lowdefy, Link)=>{
|
|
5
5
|
const backLink = ({ ariaLabel , children , className , id , rel })=>/*#__PURE__*/ React.createElement("a", {
|
|
6
6
|
id: id,
|
|
7
|
-
onClick: ()=>lowdefy._internal.router.back()
|
|
8
|
-
,
|
|
7
|
+
onClick: ()=>lowdefy._internal.router.back(),
|
|
9
8
|
className: className,
|
|
10
9
|
rel: rel,
|
|
11
10
|
"aria-label": ariaLabel || 'back'
|
|
12
|
-
}, type.isFunction(children) ? children(id) : children)
|
|
13
|
-
;
|
|
11
|
+
}, type.isFunction(children) ? children(id) : children);
|
|
14
12
|
const newOriginLink = ({ ariaLabel , children , className , id , newTab , pageId , query , rel , url , })=>{
|
|
15
|
-
return
|
|
13
|
+
return /*#__PURE__*/ React.createElement("a", {
|
|
16
14
|
id: id,
|
|
17
15
|
"aria-label": ariaLabel,
|
|
18
16
|
className: className,
|
|
19
17
|
href: `${url}${query ? `?${query}` : ''}`,
|
|
20
18
|
rel: rel || newTab && 'noopener noreferrer',
|
|
21
19
|
target: newTab && '_blank'
|
|
22
|
-
}, type.isFunction(children) ? children(pageId || url || id) : children)
|
|
20
|
+
}, type.isFunction(children) ? children(pageId || url || id) : children);
|
|
23
21
|
};
|
|
24
22
|
const sameOriginLink = ({ ariaLabel , children , className , id , newTab , pageId , pathname , query , rel , replace , scroll , setInput , url , })=>{
|
|
25
23
|
if (newTab) {
|
|
@@ -33,7 +31,7 @@ const createLinkComponent = (lowdefy, Link)=>{
|
|
|
33
31
|
target: "_blank"
|
|
34
32
|
}, type.isFunction(children) ? children(pageId || url || id) : children));
|
|
35
33
|
}
|
|
36
|
-
return
|
|
34
|
+
return /*#__PURE__*/ React.createElement(Link, {
|
|
37
35
|
href: {
|
|
38
36
|
pathname,
|
|
39
37
|
query
|
|
@@ -46,13 +44,12 @@ const createLinkComponent = (lowdefy, Link)=>{
|
|
|
46
44
|
className: className,
|
|
47
45
|
rel: rel,
|
|
48
46
|
onClick: setInput
|
|
49
|
-
}, type.isFunction(children) ? children(pageId || url || id) : children))
|
|
47
|
+
}, type.isFunction(children) ? children(pageId || url || id) : children));
|
|
50
48
|
};
|
|
51
49
|
const noLink = ({ className , children , id })=>/*#__PURE__*/ React.createElement("span", {
|
|
52
50
|
id: id,
|
|
53
51
|
className: className
|
|
54
|
-
}, type.isFunction(children) ? children(id) : children)
|
|
55
|
-
;
|
|
52
|
+
}, type.isFunction(children) ? children(id) : children);
|
|
56
53
|
return createLink({
|
|
57
54
|
backLink,
|
|
58
55
|
lowdefy,
|
|
@@ -25,11 +25,9 @@ const lowdefy = {
|
|
|
25
25
|
updaters: {},
|
|
26
26
|
displayMessage: ({ content })=>{
|
|
27
27
|
console.log(content);
|
|
28
|
-
return ()=>undefined
|
|
29
|
-
;
|
|
28
|
+
return ()=>undefined;
|
|
30
29
|
},
|
|
31
|
-
link: ()=>undefined
|
|
32
|
-
,
|
|
30
|
+
link: ()=>undefined,
|
|
33
31
|
progress: {
|
|
34
32
|
state: {
|
|
35
33
|
progress: 0
|
|
@@ -41,7 +39,7 @@ const lowdefy = {
|
|
|
41
39
|
inputs: {},
|
|
42
40
|
lowdefyGlobal: {}
|
|
43
41
|
};
|
|
44
|
-
function initLowdefyContext({ auth , Components , config , router ,
|
|
42
|
+
function initLowdefyContext({ auth , Components , config , router , stage , types , window }) {
|
|
45
43
|
if (stage === 'dev') {
|
|
46
44
|
window.lowdefy = lowdefy;
|
|
47
45
|
}
|
|
@@ -51,20 +49,22 @@ function initLowdefyContext({ auth , Components , config , router , session , st
|
|
|
51
49
|
lowdefy.menus = config.rootConfig.menus;
|
|
52
50
|
lowdefy.pageId = config.pageConfig.pageId;
|
|
53
51
|
lowdefy.urlQuery = urlQuery.parse(window.location.search.slice(1));
|
|
54
|
-
lowdefy.user = session?.user ?? null;
|
|
52
|
+
lowdefy.user = auth?.session?.user ?? null;
|
|
55
53
|
lowdefy._internal.window = window;
|
|
56
54
|
lowdefy._internal.document = window.document;
|
|
57
55
|
lowdefy._internal.router = router;
|
|
58
56
|
lowdefy._internal.link = setupLink(lowdefy);
|
|
59
|
-
lowdefy._internal.updateBlock = (blockId)=>lowdefy._internal.updaters[blockId] && lowdefy._internal.updaters[blockId]()
|
|
60
|
-
;
|
|
57
|
+
lowdefy._internal.updateBlock = (blockId)=>lowdefy._internal.updaters[blockId] && lowdefy._internal.updaters[blockId]();
|
|
61
58
|
lowdefy._internal.components.Link = createLinkComponent(lowdefy, Components.Link);
|
|
62
59
|
lowdefy._internal.components.Icon = createIcon(types.icons);
|
|
63
60
|
lowdefy._internal.actions = types.actions;
|
|
64
61
|
lowdefy._internal.blockComponents = types.blocks;
|
|
65
62
|
lowdefy._internal.operators = types.operators;
|
|
66
63
|
// TODO: discuss not using object arguments
|
|
67
|
-
lowdefy._internal.auth = createAuthMethods(
|
|
64
|
+
lowdefy._internal.auth = createAuthMethods({
|
|
65
|
+
lowdefy,
|
|
66
|
+
auth
|
|
67
|
+
});
|
|
68
68
|
return lowdefy;
|
|
69
69
|
}
|
|
70
70
|
export default initLowdefyContext;
|
package/dist/setupLink.js
CHANGED
|
@@ -15,8 +15,7 @@
|
|
|
15
15
|
*/ import { createLink } from '@lowdefy/engine';
|
|
16
16
|
function setupLink(lowdefy) {
|
|
17
17
|
const { router , window } = lowdefy._internal;
|
|
18
|
-
const backLink = ()=>router.back()
|
|
19
|
-
;
|
|
18
|
+
const backLink = ()=>router.back();
|
|
20
19
|
const disabledLink = ()=>{};
|
|
21
20
|
const newOriginLink = ({ url , query , newTab })=>{
|
|
22
21
|
if (newTab) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lowdefy/client",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.14",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Lowdefy Client",
|
|
6
6
|
"homepage": "https://lowdefy.com",
|
|
@@ -43,29 +43,30 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ant-design/icons": "4.7.0",
|
|
46
|
-
"@lowdefy/block-utils": "4.0.0-alpha.
|
|
47
|
-
"@lowdefy/engine": "4.0.0-alpha.
|
|
48
|
-
"@lowdefy/helpers": "4.0.0-alpha.
|
|
49
|
-
"@lowdefy/layout": "4.0.0-alpha.
|
|
46
|
+
"@lowdefy/block-utils": "4.0.0-alpha.14",
|
|
47
|
+
"@lowdefy/engine": "4.0.0-alpha.14",
|
|
48
|
+
"@lowdefy/helpers": "4.0.0-alpha.14",
|
|
49
|
+
"@lowdefy/layout": "4.0.0-alpha.14",
|
|
50
50
|
"classnames": "2.3.1",
|
|
51
|
-
"react": "
|
|
52
|
-
"react-dom": "
|
|
51
|
+
"react": "18.1.0",
|
|
52
|
+
"react-dom": "18.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@emotion/jest": "11.
|
|
56
|
-
"@
|
|
57
|
-
"@swc/
|
|
58
|
-
"@swc/
|
|
59
|
-
"@
|
|
60
|
-
"@testing-library/
|
|
61
|
-
"@testing-library/
|
|
55
|
+
"@emotion/jest": "11.9.1",
|
|
56
|
+
"@lowdefy/jest-yaml-transform": "4.0.0-alpha.14",
|
|
57
|
+
"@swc/cli": "0.1.57",
|
|
58
|
+
"@swc/core": "1.2.194",
|
|
59
|
+
"@swc/jest": "0.2.21",
|
|
60
|
+
"@testing-library/dom": "8.13.0",
|
|
61
|
+
"@testing-library/react": "13.3.0",
|
|
62
|
+
"@testing-library/user-event": "14.2.0",
|
|
62
63
|
"copyfiles": "2.4.1",
|
|
63
|
-
"jest": "
|
|
64
|
-
"jest-
|
|
65
|
-
"jest-
|
|
64
|
+
"jest": "28.1.0",
|
|
65
|
+
"jest-environment-jsdom": "28.1.0",
|
|
66
|
+
"jest-serializer-html": "7.1.0"
|
|
66
67
|
},
|
|
67
68
|
"publishConfig": {
|
|
68
69
|
"access": "public"
|
|
69
70
|
},
|
|
70
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "9cc0b7280c82a16689c31aaf71be278f3a40edc6"
|
|
71
72
|
}
|