@lowdefy/client 4.0.0-rc.0 → 4.0.0-rc.2

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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,7 +22,7 @@ import initLowdefyContext from './initLowdefyContext.js';
22
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
27
  auth,
28
28
  Components,
package/dist/Context.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
package/dist/ErrorPage.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
package/dist/Head.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 = ({ blockId , blockLayout , blockProperties , blockStyle , context , lowdefy , skeleton , })=>{
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]) {
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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,7 +16,7 @@
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 , blockLayout , blockProperties , blockStyle , Component , context , lowdefy , skeleton , })=>{
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)=>{
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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,7 +16,7 @@
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 , blockLayout , blockProperties , blockStyle , Component , context , lowdefy , skeleton , })=>{
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(()=>{
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,19 +1,5 @@
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
- }
15
1
  /*
16
- Copyright 2020-2022 Lowdefy, Inc
2
+ Copyright 2020-2023 Lowdefy, Inc
17
3
 
18
4
  Licensed under the Apache License, Version 2.0 (the "License");
19
5
  you may not use this file except in compliance with the License.
@@ -26,7 +12,21 @@ function _extends() {
26
12
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27
13
  See the License for the specific language governing permissions and
28
14
  limitations under the License.
29
- */ import React from 'react';
15
+ */ function _extends() {
16
+ _extends = Object.assign || function(target) {
17
+ for(var i = 1; i < arguments.length; i++){
18
+ var source = arguments[i];
19
+ for(var key in source){
20
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
21
+ target[key] = source[key];
22
+ }
23
+ }
24
+ }
25
+ return target;
26
+ };
27
+ return _extends.apply(this, arguments);
28
+ }
29
+ import React from 'react';
30
30
  import classNames from 'classnames';
31
31
  import { omit, type } from '@lowdefy/helpers';
32
32
  import Icon from '@ant-design/icons';
@@ -45,7 +45,7 @@ const lowdefyProps = [
45
45
  'registerEvent',
46
46
  'registerMethod',
47
47
  'schemaErrors',
48
- 'validation',
48
+ 'validation'
49
49
  ];
50
50
  const createIcon = (Icons)=>{
51
51
  const AiOutlineLoading3Quarters = Icons['AiOutlineLoading3Quarters'];
@@ -62,7 +62,7 @@ const createIcon = (Icons)=>{
62
62
  {
63
63
  cursor: (onClick || events.onClick) && 'pointer'
64
64
  },
65
- propertiesObj.style,
65
+ propertiesObj.style
66
66
  ])]: true,
67
67
  'icon-spin': spin
68
68
  }),
@@ -3,24 +3,31 @@ import { createLink } from '@lowdefy/engine';
3
3
  import { type } from '@lowdefy/helpers';
4
4
  const createLinkComponent = (lowdefy, Link)=>{
5
5
  const { window } = lowdefy._internal.globals;
6
- const backLink = ({ ariaLabel , children , className , id , rel })=>/*#__PURE__*/ React.createElement("a", {
6
+ const backLink = ({ ariaLabel , children , className , id , onClick =()=>{} , rel })=>/*#__PURE__*/ React.createElement("a", {
7
7
  id: id,
8
- onClick: ()=>lowdefy._internal.router.back(),
9
8
  className: className,
10
9
  rel: rel,
11
- "aria-label": ariaLabel || 'back'
10
+ "aria-label": ariaLabel || 'back',
11
+ onClick: (...params)=>{
12
+ lowdefy._internal.router.back();
13
+ onClick(...params);
14
+ }
12
15
  }, type.isFunction(children) ? children(id) : children);
13
- const newOriginLink = ({ ariaLabel , children , className , id , newTab , pageId , query , rel , url , })=>{
16
+ const newOriginLink = ({ ariaLabel , children , className , href , id , onClick =()=>{} , newTab , pageId , query , rel , url })=>{
14
17
  return /*#__PURE__*/ React.createElement("a", {
15
18
  id: id,
16
19
  "aria-label": ariaLabel,
17
20
  className: className,
18
- href: `${url}${query ? `?${query}` : ''}`,
21
+ href: href || `${url}${query ? `?${query}` : ''}`,
19
22
  rel: rel || newTab && 'noopener noreferrer',
20
- target: newTab && '_blank'
23
+ target: newTab && '_blank',
24
+ onClick: async (...params)=>{
25
+ await onClick(...params);
26
+ return true;
27
+ }
21
28
  }, type.isFunction(children) ? children(pageId || url || id) : children);
22
29
  };
23
- 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 })=>{
24
31
  if (newTab) {
25
32
  return(// eslint-disable-next-line react/jsx-no-target-blank
26
33
  /*#__PURE__*/ React.createElement("a", {
@@ -29,7 +36,11 @@ const createLinkComponent = (lowdefy, Link)=>{
29
36
  className: className,
30
37
  href: `${window.location.origin}${lowdefy._internal.router.basePath}${pathname}${query ? `?${query}` : ''}`,
31
38
  rel: rel || 'noopener noreferrer',
32
- target: "_blank"
39
+ target: "_blank",
40
+ onClick: async (...params)=>{
41
+ await onClick(...params);
42
+ return true;
43
+ }
33
44
  }, type.isFunction(children) ? children(pageId || url || id) : children));
34
45
  }
35
46
  return /*#__PURE__*/ React.createElement(Link, {
@@ -44,12 +55,16 @@ const createLinkComponent = (lowdefy, Link)=>{
44
55
  "aria-label": ariaLabel,
45
56
  className: className,
46
57
  rel: rel,
47
- onClick: setInput
58
+ onClick: (...params)=>{
59
+ setInput();
60
+ onClick(...params);
61
+ }
48
62
  }, type.isFunction(children) ? children(pageId || url || id) : children));
49
63
  };
50
- const noLink = ({ className , children , id })=>/*#__PURE__*/ React.createElement("span", {
64
+ const noLink = ({ className , children , id , onClick =()=>{} })=>/*#__PURE__*/ React.createElement("span", {
51
65
  id: id,
52
- className: className
66
+ className: className,
67
+ onClick: onClick
53
68
  }, type.isFunction(children) ? children(id) : children);
54
69
  return createLink({
55
70
  backLink,
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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.
package/dist/request.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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 body = await res.json();
25
+ const body1 = await res.json();
26
26
  console.log(res);
27
- console.log(body);
28
- throw new Error(body.message || 'Request 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-2022 Lowdefy, Inc
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.
package/dist/style.less CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- Copyright 2020-2022 Lowdefy, Inc
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
- transform: rotate(0deg);
23
+ transform: rotate(0deg);
24
24
  }
25
25
 
26
26
  100% {
27
- transform: rotate(360deg);
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-rc.0",
3
+ "version": "4.0.0-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy Client",
6
6
  "homepage": "https://lowdefy.com",
@@ -37,28 +37,28 @@
37
37
  "clean": "rm -rf dist",
38
38
  "copyfiles": "copyfiles -u 1 \"./src/**/*\" dist -e \"./src/**/*.js\" -e \"./src/**/*.yaml\" -e \"./src/**/*.snap\"",
39
39
  "prepublishOnly": "pnpm build",
40
- "test:watch": "jest --coverage --watch",
41
- "test": "jest --coverage"
40
+ "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js"
42
41
  },
43
42
  "dependencies": {
44
- "@ant-design/icons": "4.7.0",
45
- "@lowdefy/block-utils": "4.0.0-rc.0",
46
- "@lowdefy/engine": "4.0.0-rc.0",
47
- "@lowdefy/helpers": "4.0.0-rc.0",
48
- "@lowdefy/layout": "4.0.0-rc.0",
49
- "classnames": "2.3.1",
43
+ "@ant-design/icons": "4.8.0",
44
+ "@lowdefy/block-utils": "4.0.0-rc.2",
45
+ "@lowdefy/engine": "4.0.0-rc.2",
46
+ "@lowdefy/helpers": "4.0.0-rc.2",
47
+ "@lowdefy/layout": "4.0.0-rc.2",
48
+ "classnames": "2.3.2",
50
49
  "react": "18.2.0",
51
50
  "react-dom": "18.2.0"
52
51
  },
53
52
  "devDependencies": {
54
- "@emotion/jest": "11.9.1",
55
- "@lowdefy/jest-yaml-transform": "4.0.0-rc.0",
56
- "@swc/cli": "0.1.57",
57
- "@swc/core": "1.2.194",
58
- "@swc/jest": "0.2.21",
59
- "@testing-library/dom": "8.13.0",
60
- "@testing-library/react": "13.3.0",
61
- "@testing-library/user-event": "14.2.0",
53
+ "@emotion/jest": "11.10.5",
54
+ "@jest/globals": "28.1.0",
55
+ "@lowdefy/jest-yaml-transform": "4.0.0-rc.2",
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
63
  "jest": "28.1.0",
64
64
  "jest-environment-jsdom": "28.1.0",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "f6872d7ff6da421710096536fce7b2016ef8f35c"
70
+ "gitHead": "ac0dec732efb3b3cb06c82941d8f829c9fa65dff"
71
71
  }