Skip to content

Commit 12d698a

Browse files
authored
Merge pull request #7 from mendix/release/4.2.0
[UIA-1142] Release/4.2.0
2 parents 39a61cb + 571cd84 commit 12d698a

File tree

377 files changed

+13432
-354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+13432
-354
lines changed

.gitignore

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
Source/.svn
2-
Source/GPUCache
3-
Source/modeler-merge-marker
4-
Source/.mendix-cache
5-
Source/*.mpr.lock
6-
Source/*.mpr.bak
7-
Source/*.mpr.left*
8-
Source/*.mpr.right*
9-
Source/.settings
10-
Source/deployment
11-
Source/theme-cache
12-
proxies
13-
target
14-
*.launch
15-
.classpath
16-
.project
1+
Source/.svn
2+
Source/GPUCache
3+
Source/modeler-merge-marker
4+
Source/.mendix-cache
5+
Source/*.mpr.lock
6+
Source/*.mpr.bak
7+
Source/*.mpr.left*
8+
Source/*.mpr.right*
9+
Source/.settings
10+
Source/deployment
11+
Source/theme-cache
12+
proxies
13+
target
14+
*.launch
15+
.classpath
16+
.project
1717
.vscode

LICENSE

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
MIT License
2-
3-
Copyright 2022 Mendix Technology B.V.
4-
5-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6-
7-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8-
1+
MIT License
2+
3+
Copyright 2022 Mendix Technology B.V.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
99
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Please see [Administration](https://docs.mendix.com/appstore/modules/administration/) in the Mendix documentation for details.
1+
Please see [Administration](https://docs.mendix.com/appstore/modules/administration/) in the Mendix documentation for details.

Source/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,5 @@
5151
/administrationmodule.mpr.bak
5252
/administrationmodule.mpr.lock
5353
/nativemobile/builds/
54+
.DS_Store
55+
/.svn/

Source/AdministrationModule.mpr

8.85 MB
Binary file not shown.

Source/javascriptsource/datawidgets/actions/Export_To_Excel.js

Lines changed: 47 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -26,54 +26,57 @@ export async function Export_To_Excel(datagridName, fileName, sheetName, include
2626
return false;
2727
}
2828

29-
return new Promise((resolve, reject) => {
30-
const stream =
31-
window[window.DATAGRID_DATA_EXPORT][datagridName].create();
29+
const REGISTRY_NAME = "com.mendix.widgets.web.datagrid.export";
30+
const registry = window[REGISTRY_NAME];
31+
const controller = registry.get(datagridName);
3232

33-
let worksheet;
34-
let headers;
35-
const streamOptions = { limit: chunkSize };
36-
stream.process((msg) => {
37-
if (!msg) {
38-
return;
39-
}
33+
if (controller === undefined) {
34+
return false;
35+
}
36+
37+
return new Promise((resolve) => {
38+
function handler(req) {
39+
let worksheet;
40+
let headers;
4041

41-
switch (msg.type) {
42-
case "columns":
43-
headers = msg.payload.map(column => column.name);
44-
if (includeColumnHeaders) {
45-
worksheet = utils.aoa_to_sheet([headers]);
46-
}
47-
break;
48-
case "data":
49-
if (worksheet === undefined) {
50-
worksheet = utils.aoa_to_sheet(msg.payload)
51-
} else {
52-
utils.sheet_add_aoa(worksheet, msg.payload, { origin: -1 });
53-
}
54-
break;
55-
case "end":
56-
if (worksheet) {
57-
// Set character width for each column
58-
// https://docs.sheetjs.com/docs/csf/sheet#worksheet-object
59-
worksheet["!cols"] = headers.map(header => ({
60-
wch: header.length + 10
61-
}));
62-
const workbook = utils.book_new();
63-
utils.book_append_sheet(workbook, worksheet, sheetName === "" ? "Data" : sheetName);
64-
writeFileXLSX(workbook, `${fileName}.xlsx`);
65-
resolve(true);
66-
} else {
67-
resolve(false);
68-
}
69-
break;
70-
case "aborted":
42+
req.on("headers", (hds) => {
43+
headers = hds.map(header => header.name);
44+
if (includeColumnHeaders) {
45+
worksheet = utils.aoa_to_sheet([headers]);
46+
}
47+
});
48+
49+
req.on("data", (data) => {
50+
if (worksheet === undefined) {
51+
worksheet = utils.aoa_to_sheet(data)
52+
} else {
53+
utils.sheet_add_aoa(worksheet, data, { origin: -1 });
54+
}
55+
});
56+
57+
req.on("end", () => {
58+
if (worksheet) {
59+
// Set character width for each column
60+
// https://docs.sheetjs.com/docs/csf/sheet#worksheet-object
61+
worksheet["!cols"] = headers.map(header => ({
62+
wch: header.length + 10
63+
}));
64+
const workbook = utils.book_new();
65+
utils.book_append_sheet(workbook, worksheet, sheetName === "" ? "Data" : sheetName);
66+
writeFileXLSX(workbook, `${fileName}.xlsx`);
67+
resolve(true);
68+
} else {
7169
resolve(false);
72-
break;
73-
}
74-
}, streamOptions);
70+
}
71+
});
72+
73+
req.on("abort", () => resolve(false));
74+
}
7575

76-
stream.start();
76+
controller.exportData(handler, {
77+
withHeaders: true,
78+
limit: chunkSize.toNumber()
79+
})
7780
});
7881
// END USER CODE
7982
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
import { Big } from "big.js";
9+
import "mx-global";
10+
11+
// BEGIN EXTRA CODE
12+
// END EXTRA CODE
13+
14+
/**
15+
* @param {string} targetName - Name of the widget for which filters should be reset. Valid targets are: Data grid 2, Gallery. You can find filter name in widget settings in the "Common" group (Properties>Common>Name).
16+
* @param {boolean} setToDefault - Set to default value. If true, filter will be set to its default value, otherwise it will be set to empty.
17+
* @returns {Promise.<void>}
18+
*/
19+
export async function Reset_All_Filters(targetName, setToDefault) {
20+
// BEGIN USER CODE
21+
const plugin = window["com.mendix.widgets.web.plugin.externalEvents"];
22+
if (plugin) {
23+
plugin.emit(targetName, "reset.filters", setToDefault);
24+
}
25+
// END USER CODE
26+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
import "mx-global";
9+
import { Big } from "big.js";
10+
11+
// BEGIN EXTRA CODE
12+
// END EXTRA CODE
13+
14+
/**
15+
* @param {string} targetName - Name of the filter to reset. Valid targets are: Number filter, Date filter, Text filter, Drop-down filter. You can find filter name in widget settings in the "Common" group (Properties>Common>Name).
16+
* @param {boolean} setToDefault - Set to default value. If true, filter will be set to its default value, otherwise it will be set to empty.
17+
* @returns {Promise.<void>}
18+
*/
19+
export async function Reset_Filter(targetName, setToDefault) {
20+
// BEGIN USER CODE
21+
const plugin = window["com.mendix.widgets.web.plugin.externalEvents"];
22+
if (plugin) {
23+
plugin.emit(targetName, "reset.value", setToDefault);
24+
}
25+
// END USER CODE
26+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
import "mx-global";
9+
import { Big } from "big.js";
10+
11+
// BEGIN EXTRA CODE
12+
// END EXTRA CODE
13+
14+
/**
15+
* @param {string} targetName - Name of the filter to set. Valid targets are: Number filter, Date filter, Text filter, Drop-down filter. You can find filter name in widget settings in the "Common" group (Properties>Common>Name).
16+
* @param {boolean} useDefaultValue - Determine the use of default value provided by the filter component itself.
17+
If true, "Value" section will be ignored
18+
* @param {"DataWidgets.Filter_Operators.contains"|"DataWidgets.Filter_Operators.startsWith"|"DataWidgets.Filter_Operators.endsWith"|"DataWidgets.Filter_Operators.between"|"DataWidgets.Filter_Operators.greater"|"DataWidgets.Filter_Operators.greaterEqual"|"DataWidgets.Filter_Operators.equal"|"DataWidgets.Filter_Operators.notEqual"|"DataWidgets.Filter_Operators.smaller"|"DataWidgets.Filter_Operators.smallerEqual"|"DataWidgets.Filter_Operators.empty"|"DataWidgets.Filter_Operators.notEmpty"} operators - Selected operators value. If filter has operators, this value will be applied.
19+
* @param {string} stringValue - Value set for dropdown filter or text filter. Choose empty if not use.
20+
* @param {Big} numberValue - Number value for number filter. Choose empty if not use.
21+
* @param {Date} dateTimeValue - Date time value for date filter, can also be use as "start date". Choose empty if not use.
22+
* @param {Date} dateTimeValue_2 - End date time value for range filter. Choose empty if not use.
23+
* @returns {Promise.<void>}
24+
*/
25+
export async function Set_Filter(targetName, useDefaultValue, operators, stringValue, numberValue, dateTimeValue, dateTimeValue_2) {
26+
// BEGIN USER CODE
27+
const plugin = window["com.mendix.widgets.web.plugin.externalEvents"];
28+
if (plugin) {
29+
plugin.emit(targetName, "set.value", useDefaultValue, {
30+
operators, stringValue, numberValue, dateTimeValue, dateTimeValue2: dateTimeValue_2
31+
});
32+
}
33+
// END USER CODE
34+
}

Source/javascriptsource/datawidgets/actions/xlsx-export-tools.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
import { Big } from "big.js";
9+
import { Base64 } from 'js-base64';
10+
11+
// BEGIN EXTRA CODE
12+
// END EXTRA CODE
13+
14+
/**
15+
* @param {string} base64
16+
* @returns {Promise.<string>}
17+
*/
18+
export async function Base64Decode(base64) {
19+
// BEGIN USER CODE
20+
return Base64.decode(base64);
21+
// END USER CODE
22+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
import { Big } from "big.js";
9+
import { Base64 } from 'js-base64';
10+
11+
// BEGIN EXTRA CODE
12+
// END EXTRA CODE
13+
14+
/**
15+
* @param {string} base64
16+
* @param {MxObject} image
17+
* @returns {Promise.<boolean>}
18+
*/
19+
export async function Base64DecodeToImage(base64, image) {
20+
// BEGIN USER CODE
21+
if (!base64) {
22+
throw new Error("base64 String should not be empty");
23+
}
24+
if (!image) {
25+
throw new Error("image should not be null");
26+
}
27+
const blob = new Blob([Base64.toUint8Array(base64)], { type: "image/png" });
28+
return new Promise((resolve, reject) => {
29+
mx.data.saveDocument(image.getGuid(), "camera image", {}, blob, () => resolve(true), reject);
30+
});
31+
// END USER CODE
32+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
import { Big } from "big.js";
9+
import { Base64 } from 'js-base64';
10+
11+
// BEGIN EXTRA CODE
12+
// END EXTRA CODE
13+
14+
/**
15+
* @param {string} stringToEncode
16+
* @returns {Promise.<string>}
17+
*/
18+
export async function Base64Encode(stringToEncode) {
19+
// BEGIN USER CODE
20+
return Base64.encode(stringToEncode);
21+
// END USER CODE
22+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
import { Big } from "big.js";
9+
10+
// BEGIN EXTRA CODE
11+
// END EXTRA CODE
12+
13+
/**
14+
* This action can be used to launch a phone app on the devices and initiate dialing of the specified phone number. The user has to confirm to initate the actual call.
15+
* @param {string} phoneNumber - This field is required.
16+
* @returns {Promise.<boolean>}
17+
*/
18+
export async function CallPhoneNumber(phoneNumber) {
19+
// BEGIN USER CODE
20+
if (!phoneNumber) {
21+
return Promise.reject(new Error("Input parameter 'Phone number' is required"));
22+
}
23+
const url = `tel:${encodeURI(phoneNumber)}`;
24+
// Native platform
25+
if (navigator && navigator.product === "ReactNative") {
26+
const Linking = require("react-native").Linking;
27+
return Linking.canOpenURL(url).then(supported => {
28+
if (!supported) {
29+
return false;
30+
}
31+
return Linking.openURL(url).then(() => true);
32+
});
33+
}
34+
// Hybrid platform
35+
if (window && window.cordova) {
36+
window.open(url, "_system");
37+
return Promise.resolve(true);
38+
}
39+
// Web platform
40+
if (window) {
41+
window.location.href = url;
42+
return Promise.resolve(true);
43+
}
44+
return Promise.resolve(false);
45+
// END USER CODE
46+
}

0 commit comments

Comments
 (0)