@lowdefy/engine 3.23.0-alpha.0 → 4.0.0-alpha.4
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/Actions.js +221 -310
- package/dist/Blocks.js +577 -607
- package/dist/Events.js +120 -162
- package/dist/Requests.js +110 -144
- package/dist/State.js +55 -81
- package/dist/actions/CallMethod.js +20 -39
- package/dist/actions/JsAction.js +50 -72
- package/dist/actions/Link.js +22 -33
- package/dist/actions/Login.js +3 -28
- package/dist/actions/Logout.js +3 -27
- package/dist/actions/Message.js +9 -22
- package/dist/actions/Request.js +21 -63
- package/dist/actions/Reset.js +6 -20
- package/dist/actions/ResetValidation.js +18 -31
- package/dist/actions/ScrollTo.js +8 -34
- package/dist/actions/SetGlobal.js +18 -30
- package/dist/actions/SetState.js +18 -30
- package/dist/actions/Throw.js +25 -52
- package/dist/actions/Validate.js +20 -34
- package/dist/actions/Wait.js +21 -32
- package/dist/actions/index.js +31 -57
- package/dist/createLink.js +29 -59
- package/dist/getBlockMatcher.js +46 -58
- package/dist/getContext.js +100 -142
- package/dist/getFieldValues.js +18 -32
- package/dist/index.js +9 -70
- package/package.json +12 -13
- package/dist/makeContextId.js +0 -44
|
@@ -1,32 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function ResetValidation(
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _ResetValidation() {
|
|
21
|
-
_ResetValidation = _asyncToGenerator(function* (_ref) {
|
|
22
|
-
var {
|
|
23
|
-
context,
|
|
24
|
-
params
|
|
25
|
-
} = _ref;
|
|
26
|
-
context.RootBlocks.resetValidation((0, _getBlockMatcher.default)(params));
|
|
27
|
-
});
|
|
28
|
-
return _ResetValidation.apply(this, arguments);
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 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 getBlockMatcher from '../getBlockMatcher.js';
|
|
16
|
+
async function ResetValidation({ context , params }) {
|
|
17
|
+
context._internal.RootBlocks.resetValidation(getBlockMatcher(params));
|
|
29
18
|
}
|
|
30
|
-
|
|
31
|
-
var _default = ResetValidation;
|
|
32
|
-
exports.default = _default;
|
|
19
|
+
export default ResetValidation;
|
package/dist/actions/ScrollTo.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
|
|
10
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,30 +12,15 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
return _ScrollTo.apply(this, arguments);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function _ScrollTo() {
|
|
32
|
-
_ScrollTo = _asyncToGenerator(function* (_ref) {
|
|
33
|
-
var {
|
|
34
|
-
context,
|
|
35
|
-
params = {}
|
|
36
|
-
} = _ref;
|
|
37
|
-
|
|
15
|
+
*/ async function ScrollTo({ context , params ={
|
|
16
|
+
} }) {
|
|
38
17
|
if (params.blockId) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
18
|
+
const element = context._internal.lowdefy._internal.document.getElementById(params.blockId);
|
|
19
|
+
if (element) {
|
|
20
|
+
element.scrollIntoView(params.options);
|
|
21
|
+
}
|
|
44
22
|
} else {
|
|
45
|
-
|
|
23
|
+
context._internal.lowdefy._internal.window.scrollTo(params);
|
|
46
24
|
}
|
|
47
|
-
});
|
|
48
|
-
return _ScrollTo.apply(this, arguments);
|
|
49
25
|
}
|
|
50
|
-
|
|
51
|
-
var _default = ScrollTo;
|
|
52
|
-
exports.default = _default;
|
|
26
|
+
export default ScrollTo;
|
|
@@ -1,35 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
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
7
|
|
|
8
|
-
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_SetGlobal = _asyncToGenerator(function* (_ref) {
|
|
20
|
-
var {
|
|
21
|
-
arrayIndices,
|
|
22
|
-
context,
|
|
23
|
-
params
|
|
24
|
-
} = _ref;
|
|
25
|
-
Object.keys(params).forEach(key => {
|
|
26
|
-
(0, _helpers.set)(context.lowdefy.lowdefyGlobal, (0, _helpers.applyArrayIndices)(arrayIndices, key), params[key]);
|
|
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 { applyArrayIndices, set } from '@lowdefy/helpers';
|
|
16
|
+
async function SetGlobal({ arrayIndices , context , params }) {
|
|
17
|
+
Object.keys(params).forEach((key)=>{
|
|
18
|
+
set(context._internal.lowdefy.lowdefyGlobal, applyArrayIndices(arrayIndices, key), params[key]);
|
|
27
19
|
});
|
|
28
|
-
context.RootBlocks.reset();
|
|
29
|
-
context.update();
|
|
30
|
-
});
|
|
31
|
-
return _SetGlobal.apply(this, arguments);
|
|
20
|
+
context._internal.RootBlocks.reset();
|
|
21
|
+
context._internal.update();
|
|
32
22
|
}
|
|
33
|
-
|
|
34
|
-
var _default = SetGlobal;
|
|
35
|
-
exports.default = _default;
|
|
23
|
+
export default SetGlobal;
|
package/dist/actions/SetState.js
CHANGED
|
@@ -1,35 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 Lowdefy, Inc
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
exports.default = void 0;
|
|
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
7
|
|
|
8
|
-
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_SetState = _asyncToGenerator(function* (_ref) {
|
|
20
|
-
var {
|
|
21
|
-
arrayIndices,
|
|
22
|
-
context,
|
|
23
|
-
params
|
|
24
|
-
} = _ref;
|
|
25
|
-
Object.keys(params).forEach(key => {
|
|
26
|
-
context.State.set((0, _helpers.applyArrayIndices)(arrayIndices, key), params[key]);
|
|
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 { applyArrayIndices } from '@lowdefy/helpers';
|
|
16
|
+
async function SetState({ arrayIndices , context , params }) {
|
|
17
|
+
Object.keys(params).forEach((key)=>{
|
|
18
|
+
context._internal.State.set(applyArrayIndices(arrayIndices, key), params[key]);
|
|
27
19
|
});
|
|
28
|
-
context.RootBlocks.reset();
|
|
29
|
-
context.update();
|
|
30
|
-
});
|
|
31
|
-
return _SetState.apply(this, arguments);
|
|
20
|
+
context._internal.RootBlocks.reset();
|
|
21
|
+
context._internal.update();
|
|
32
22
|
}
|
|
33
|
-
|
|
34
|
-
var _default = SetState;
|
|
35
|
-
exports.default = _default;
|
|
23
|
+
export default SetState;
|
package/dist/actions/Throw.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.Throw = Throw;
|
|
7
|
-
exports.ThrowActionError = exports.default = void 0;
|
|
8
|
-
|
|
9
|
-
var _helpers = require("@lowdefy/helpers");
|
|
10
|
-
|
|
11
1
|
/*
|
|
12
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
13
3
|
|
|
@@ -22,46 +12,29 @@ var _helpers = require("@lowdefy/helpers");
|
|
|
22
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
23
13
|
See the License for the specific language governing permissions and
|
|
24
14
|
limitations under the License.
|
|
25
|
-
*/
|
|
26
|
-
class ThrowActionError extends Error {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
*/ import { type } from '@lowdefy/helpers';
|
|
16
|
+
let ThrowActionError = class ThrowActionError extends Error {
|
|
17
|
+
constructor(message, { blockId: blockId1 , context: context1 , metaData }){
|
|
18
|
+
super(message);
|
|
19
|
+
this.blockId = blockId1;
|
|
20
|
+
this.metaData = metaData;
|
|
21
|
+
this.name = 'ThrowError';
|
|
22
|
+
this.pageId = context1.pageId;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function Throw({ blockId , context , params ={
|
|
26
|
+
} }) {
|
|
27
|
+
if (params.throw === false || type.isNone(params.throw)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (params.throw === true) {
|
|
31
|
+
throw new ThrowActionError(params.message, {
|
|
32
|
+
blockId,
|
|
33
|
+
context,
|
|
34
|
+
metaData: params.metaData
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
throw new Error(`Invalid Throw, check action params. Received "${JSON.stringify(params)}".`);
|
|
40
38
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
function Throw(_ref2) {
|
|
45
|
-
var {
|
|
46
|
-
blockId,
|
|
47
|
-
context,
|
|
48
|
-
params = {}
|
|
49
|
-
} = _ref2;
|
|
50
|
-
|
|
51
|
-
if (params.throw === false || _helpers.type.isNone(params.throw)) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (params.throw === true) {
|
|
56
|
-
throw new ThrowActionError(params.message, {
|
|
57
|
-
blockId,
|
|
58
|
-
context,
|
|
59
|
-
metaData: params.metaData
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
throw new Error("Invalid Throw, check action params. Received \"".concat(JSON.stringify(params), "\"."));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
var _default = Throw;
|
|
67
|
-
exports.default = _default;
|
|
39
|
+
export default Throw;
|
|
40
|
+
export { Throw, ThrowActionError };
|
package/dist/actions/Validate.js
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
function Validate(
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function _Validate() {
|
|
21
|
-
_Validate = _asyncToGenerator(function* (_ref) {
|
|
22
|
-
var {
|
|
23
|
-
context,
|
|
24
|
-
params
|
|
25
|
-
} = _ref;
|
|
26
|
-
var validationErrors = context.RootBlocks.validate((0, _getBlockMatcher.default)(params));
|
|
27
|
-
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 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 getBlockMatcher from '../getBlockMatcher.js';
|
|
16
|
+
async function Validate({ context , params }) {
|
|
17
|
+
const validationErrors = context.RootBlocks.validate(getBlockMatcher(params));
|
|
28
18
|
if (validationErrors.length > 0) {
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
const error = new Error(`Your input has ${validationErrors.length} validation error${validationErrors.length !== 1 ? 's' : ''}.`);
|
|
20
|
+
throw error;
|
|
31
21
|
}
|
|
32
|
-
});
|
|
33
|
-
return _Validate.apply(this, arguments);
|
|
34
22
|
}
|
|
35
|
-
|
|
36
|
-
var _default = Validate;
|
|
37
|
-
exports.default = _default;
|
|
23
|
+
export default Validate;
|
package/dist/actions/Wait.js
CHANGED
|
@@ -1,34 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_Wait = _asyncToGenerator(function* (_ref) {
|
|
20
|
-
var {
|
|
21
|
-
params
|
|
22
|
-
} = _ref;
|
|
23
|
-
|
|
24
|
-
if (!_helpers.type.isInt(params.ms)) {
|
|
25
|
-
throw new Error("Wait action \"ms\" param should be an integer.");
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020-2021 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 } from '@lowdefy/helpers';
|
|
16
|
+
async function Wait({ params }) {
|
|
17
|
+
if (!type.isInt(params.ms)) {
|
|
18
|
+
throw new Error(`Wait action "ms" param should be an integer.`);
|
|
26
19
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
return _Wait.apply(this, arguments);
|
|
20
|
+
return new Promise((resolve)=>setTimeout(resolve, params.ms)
|
|
21
|
+
);
|
|
31
22
|
}
|
|
32
|
-
|
|
33
|
-
var _default = Wait;
|
|
34
|
-
exports.default = _default;
|
|
23
|
+
export default Wait;
|
package/dist/actions/index.js
CHANGED
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _CallMethod = _interopRequireDefault(require("./CallMethod"));
|
|
9
|
-
|
|
10
|
-
var _JsAction = _interopRequireDefault(require("./JsAction"));
|
|
11
|
-
|
|
12
|
-
var _Link = _interopRequireDefault(require("./Link"));
|
|
13
|
-
|
|
14
|
-
var _Login = _interopRequireDefault(require("./Login"));
|
|
15
|
-
|
|
16
|
-
var _Logout = _interopRequireDefault(require("./Logout"));
|
|
17
|
-
|
|
18
|
-
var _Message = _interopRequireDefault(require("./Message"));
|
|
19
|
-
|
|
20
|
-
var _Request = _interopRequireDefault(require("./Request"));
|
|
21
|
-
|
|
22
|
-
var _Reset = _interopRequireDefault(require("./Reset"));
|
|
23
|
-
|
|
24
|
-
var _ResetValidation = _interopRequireDefault(require("./ResetValidation"));
|
|
25
|
-
|
|
26
|
-
var _ScrollTo = _interopRequireDefault(require("./ScrollTo"));
|
|
27
|
-
|
|
28
|
-
var _SetGlobal = _interopRequireDefault(require("./SetGlobal"));
|
|
29
|
-
|
|
30
|
-
var _SetState = _interopRequireDefault(require("./SetState"));
|
|
31
|
-
|
|
32
|
-
var _Throw = _interopRequireDefault(require("./Throw"));
|
|
33
|
-
|
|
34
|
-
var _Validate = _interopRequireDefault(require("./Validate"));
|
|
35
|
-
|
|
36
|
-
var _Wait = _interopRequireDefault(require("./Wait"));
|
|
37
|
-
|
|
38
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
|
-
|
|
40
1
|
/*
|
|
41
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
42
3
|
|
|
@@ -51,22 +12,35 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
51
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
52
13
|
See the License for the specific language governing permissions and
|
|
53
14
|
limitations under the License.
|
|
54
|
-
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
15
|
+
*/ import CallMethod from './CallMethod.js';
|
|
16
|
+
import JsAction from './JsAction.js';
|
|
17
|
+
import Link from './Link.js';
|
|
18
|
+
import Login from './Login.js';
|
|
19
|
+
import Logout from './Logout.js';
|
|
20
|
+
import Message from './Message.js';
|
|
21
|
+
import Request from './Request.js';
|
|
22
|
+
import Reset from './Reset.js';
|
|
23
|
+
import ResetValidation from './ResetValidation.js';
|
|
24
|
+
import ScrollTo from './ScrollTo.js';
|
|
25
|
+
import SetGlobal from './SetGlobal.js';
|
|
26
|
+
import SetState from './SetState.js';
|
|
27
|
+
import Throw from './Throw.js';
|
|
28
|
+
import Validate from './Validate.js';
|
|
29
|
+
import Wait from './Wait.js';
|
|
30
|
+
export default {
|
|
31
|
+
CallMethod,
|
|
32
|
+
JsAction,
|
|
33
|
+
Link,
|
|
34
|
+
Login,
|
|
35
|
+
Logout,
|
|
36
|
+
Message,
|
|
37
|
+
Request,
|
|
38
|
+
Reset,
|
|
39
|
+
ResetValidation,
|
|
40
|
+
ScrollTo,
|
|
41
|
+
SetGlobal,
|
|
42
|
+
SetState,
|
|
43
|
+
Throw,
|
|
44
|
+
Validate,
|
|
45
|
+
Wait
|
|
71
46
|
};
|
|
72
|
-
exports.default = _default;
|
package/dist/createLink.js
CHANGED
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _helpers = require("@lowdefy/helpers");
|
|
9
|
-
|
|
10
|
-
var _engine = require("@lowdefy/engine");
|
|
11
|
-
|
|
12
1
|
/*
|
|
13
2
|
Copyright 2020-2021 Lowdefy, Inc
|
|
14
3
|
|
|
@@ -23,53 +12,34 @@ var _engine = require("@lowdefy/engine");
|
|
|
23
12
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
24
13
|
See the License for the specific language governing permissions and
|
|
25
14
|
limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
function createLink(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
15
|
+
*/ import { type, urlQuery as urlQueryFn } from '@lowdefy/helpers';
|
|
16
|
+
function createLink({ backLink , lowdefy , newOriginLink , sameOriginLink }) {
|
|
17
|
+
function link({ back , home , input , newTab , pageId , url , urlQuery }) {
|
|
18
|
+
let pathname = pageId;
|
|
19
|
+
if (back) {
|
|
20
|
+
return backLink();
|
|
21
|
+
}
|
|
22
|
+
const lowdefyUrlQuery = type.isNone(urlQuery) ? '' : `?${urlQueryFn.stringify(urlQuery)}`;
|
|
23
|
+
if (home) {
|
|
24
|
+
if (lowdefy.home.configured) {
|
|
25
|
+
pathname = '';
|
|
26
|
+
pageId = lowdefy.home.pageId;
|
|
27
|
+
} else {
|
|
28
|
+
pathname = lowdefy.home.pageId;
|
|
29
|
+
pageId = lowdefy.home.pageId;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (!type.isNone(pathname)) {
|
|
33
|
+
if (!type.isNone(input)) {
|
|
34
|
+
lowdefy.inputs[pageId] = input;
|
|
35
|
+
}
|
|
36
|
+
return sameOriginLink(`/${pathname}${lowdefyUrlQuery}`, newTab);
|
|
37
|
+
}
|
|
38
|
+
if (!type.isNone(url)) {
|
|
39
|
+
return newOriginLink(`${url}${lowdefyUrlQuery}`, newTab);
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`Invalid Link.`);
|
|
48
42
|
}
|
|
49
|
-
|
|
50
|
-
var lowdefyUrlQuery = _helpers.type.isNone(urlQuery) ? '' : "?".concat(_helpers.urlQuery.stringify(urlQuery));
|
|
51
|
-
if (home) pageId = lowdefy.homePageId;
|
|
52
|
-
|
|
53
|
-
if (pageId) {
|
|
54
|
-
if (!_helpers.type.isNone(input)) {
|
|
55
|
-
var nextContextId = (0, _engine.makeContextId)({
|
|
56
|
-
pageId,
|
|
57
|
-
urlQuery: urlQuery,
|
|
58
|
-
blockId: pageId
|
|
59
|
-
});
|
|
60
|
-
lowdefy.inputs[nextContextId] = input;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return sameOriginLink("/".concat(pageId).concat(lowdefyUrlQuery), newTab);
|
|
64
|
-
} else if (url) {
|
|
65
|
-
return newOriginLink("".concat(url).concat(lowdefyUrlQuery), newTab);
|
|
66
|
-
} else {
|
|
67
|
-
throw new Error("Invalid Link.");
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return link;
|
|
43
|
+
return link;
|
|
72
44
|
}
|
|
73
|
-
|
|
74
|
-
var _default = createLink;
|
|
75
|
-
exports.default = _default;
|
|
45
|
+
export default createLink;
|