@unvired/turboforms-embed-sdk 1.0.39 → 1.0.42
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/unvired-form-sdk.html +151 -1
- package/dist/unvired-forms-sdk.js +9 -17
- package/package.json +1 -1
|
@@ -60754,7 +60754,7 @@ window.CommentOnBack = CommentOnBack;
|
|
|
60754
60754
|
|
|
60755
60755
|
|
|
60756
60756
|
<div id="sticky-footer">
|
|
60757
|
-
<div class="build-version">SDK v1.0.
|
|
60757
|
+
<div class="build-version">SDK v1.0.42</div>
|
|
60758
60758
|
<div class="relative-position">
|
|
60759
60759
|
<button id="unvired-more-btn" class="ui button primary dataGrid-addRow" onclick="toggleTooltip()">
|
|
60760
60760
|
<i class="icon options"></i>
|
|
@@ -60914,6 +60914,156 @@ window.CommentOnBack = CommentOnBack;
|
|
|
60914
60914
|
</script>
|
|
60915
60915
|
</body>
|
|
60916
60916
|
<script>
|
|
60917
|
+
window.RenderNativeForm = function(payload) {
|
|
60918
|
+
const {
|
|
60919
|
+
type, template, formPreviousData, mode,
|
|
60920
|
+
platform, language, translations,
|
|
60921
|
+
environmentVariable, themeData,
|
|
60922
|
+
userData, controlData, showBackButton, showMoreButton,
|
|
60923
|
+
privateExternal, permission, attachmentfileKeys, commentsData, vobArr,
|
|
60924
|
+
userList
|
|
60925
|
+
} = payload;
|
|
60926
|
+
|
|
60927
|
+
const backBtn = document.getElementById('form-back-btn');
|
|
60928
|
+
if (backBtn) {
|
|
60929
|
+
if (showBackButton === true) {
|
|
60930
|
+
backBtn.style.display = 'inline-block';
|
|
60931
|
+
} else {
|
|
60932
|
+
backBtn.style.display = 'none';
|
|
60933
|
+
}
|
|
60934
|
+
}
|
|
60935
|
+
|
|
60936
|
+
const moreBtn = document.getElementById('unvired-more-btn');
|
|
60937
|
+
if (moreBtn) {
|
|
60938
|
+
if (showMoreButton === false) {
|
|
60939
|
+
moreBtn.style.display = 'none';
|
|
60940
|
+
}
|
|
60941
|
+
}
|
|
60942
|
+
|
|
60943
|
+
const commentsHeader = document.getElementById("comments-header");
|
|
60944
|
+
if (commentsHeader) {
|
|
60945
|
+
commentsHeader.style.display = "none";
|
|
60946
|
+
}
|
|
60947
|
+
|
|
60948
|
+
if (platform === "web") {
|
|
60949
|
+
window.platform.isBrowser = true;
|
|
60950
|
+
window.platform.isAndroid = false;
|
|
60951
|
+
window.platform.iosPlatform = false;
|
|
60952
|
+
} else if (platform === "android") {
|
|
60953
|
+
window.platform.isBrowser = false;
|
|
60954
|
+
window.platform.isAndroid = true;
|
|
60955
|
+
window.platform.iosPlatform = false;
|
|
60956
|
+
} else if (platform === "ios") {
|
|
60957
|
+
window.platform.isBrowser = false;
|
|
60958
|
+
window.platform.isAndroid = false;
|
|
60959
|
+
window.platform.iosPlatform = true;
|
|
60960
|
+
}
|
|
60961
|
+
|
|
60962
|
+
let envData = {};
|
|
60963
|
+
if (environmentVariable?.length > 0) {
|
|
60964
|
+
for (let obj of environmentVariable) {
|
|
60965
|
+
for (let key in obj) {
|
|
60966
|
+
envData[key] = obj[key];
|
|
60967
|
+
}
|
|
60968
|
+
}
|
|
60969
|
+
}
|
|
60970
|
+
|
|
60971
|
+
if (Object.keys(envData).length > 0) {
|
|
60972
|
+
window.env = envData;
|
|
60973
|
+
}
|
|
60974
|
+
|
|
60975
|
+
const wrapper = document.getElementById('formio-wrapper');
|
|
60976
|
+
const body = document.getElementById('main-body');
|
|
60977
|
+
const stickyFooter = document.getElementById('sticky-footer');
|
|
60978
|
+
|
|
60979
|
+
if (wrapper) {
|
|
60980
|
+
wrapper.classList.remove('pdf-mode', 'print-mode');
|
|
60981
|
+
if (mode === 'pdf' || mode === 'print') {
|
|
60982
|
+
wrapper.classList.add(`${mode}-mode`);
|
|
60983
|
+
}
|
|
60984
|
+
}
|
|
60985
|
+
if (body) {
|
|
60986
|
+
body.classList.remove('pdf-mode', 'print-mode');
|
|
60987
|
+
if (mode === 'pdf' || mode === 'print') {
|
|
60988
|
+
body.classList.add(`${mode}-mode`);
|
|
60989
|
+
}
|
|
60990
|
+
}
|
|
60991
|
+
if (stickyFooter) {
|
|
60992
|
+
if (mode === 'pdf' || mode === 'print') {
|
|
60993
|
+
stickyFooter.style.display = 'none';
|
|
60994
|
+
} else {
|
|
60995
|
+
stickyFooter.style.display = 'flex';
|
|
60996
|
+
}
|
|
60997
|
+
}
|
|
60998
|
+
|
|
60999
|
+
if (type === "LOAD_FORM_TEMPLATE") {
|
|
61000
|
+
const sdkLoader = document.getElementById('sdk-form-loader');
|
|
61001
|
+
const showLoader = payload.showLoader !== false;
|
|
61002
|
+
|
|
61003
|
+
if (showLoader && sdkLoader) {
|
|
61004
|
+
sdkLoader.classList.remove('hidden');
|
|
61005
|
+
}
|
|
61006
|
+
|
|
61007
|
+
if (language) window.FORMIO_LANGUAGE = language;
|
|
61008
|
+
if (translations) window.FORMIO_I18N = translations;
|
|
61009
|
+
if (userData) {
|
|
61010
|
+
window.form = window.form || {};
|
|
61011
|
+
Object.assign(window.form, userData);
|
|
61012
|
+
}
|
|
61013
|
+
|
|
61014
|
+
window.FORM_TEMPLATE = template;
|
|
61015
|
+
window.FORM_PREVIOUS_DATA = formPreviousData;
|
|
61016
|
+
window.FORM_MODE = mode;
|
|
61017
|
+
window.FORM_COMMENTS_DATA = commentsData || [];
|
|
61018
|
+
window.FORM_VOB_ARR = vobArr || [];
|
|
61019
|
+
window.FORM_USERS_LIST = userList || [];
|
|
61020
|
+
|
|
61021
|
+
window.FORM_PLATFORM = platform;
|
|
61022
|
+
window.FORM_LANGUAGE = language;
|
|
61023
|
+
window.FORM_TRASLATIONS = translations;
|
|
61024
|
+
window.FORM_ENV = environmentVariable;
|
|
61025
|
+
window.FORM_THEME_DATA = themeData;
|
|
61026
|
+
window.FORM_USER_DATA = userData;
|
|
61027
|
+
window.FORM_CONTROL_DATA = controlData;
|
|
61028
|
+
window.FORM_PRIVATE_EXTERNAL = privateExternal;
|
|
61029
|
+
window.FORM_PERMISSION = permission;
|
|
61030
|
+
window.FORM_ATTACHMENT_FILE_KEYS = attachmentfileKeys;
|
|
61031
|
+
|
|
61032
|
+
if (typeof window.loadRNform === "function") {
|
|
61033
|
+
window.loadRNform(
|
|
61034
|
+
template,
|
|
61035
|
+
formPreviousData,
|
|
61036
|
+
themeData,
|
|
61037
|
+
mode,
|
|
61038
|
+
language,
|
|
61039
|
+
translations,
|
|
61040
|
+
controlData,
|
|
61041
|
+
privateExternal,
|
|
61042
|
+
permission,
|
|
61043
|
+
attachmentfileKeys
|
|
61044
|
+
);
|
|
61045
|
+
} else {
|
|
61046
|
+
console.error("window.loadRNform is not defined");
|
|
61047
|
+
}
|
|
61048
|
+
}
|
|
61049
|
+
};
|
|
61050
|
+
|
|
61051
|
+
window.addEventListener("message", (event) => {
|
|
61052
|
+
let data;
|
|
61053
|
+
try {
|
|
61054
|
+
data = typeof event.data === 'string' ? JSON.parse(event.data) : event.data;
|
|
61055
|
+
} catch(e) {
|
|
61056
|
+
data = event.data;
|
|
61057
|
+
}
|
|
61058
|
+
|
|
61059
|
+
if (data && data.type === "LOAD_FORM_TEMPLATE") {
|
|
61060
|
+
window.RenderNativeForm(data);
|
|
61061
|
+
} else if (data && data.type === "SET_IMAGE_DATA") {
|
|
61062
|
+
if (typeof window.setImageData === "function") {
|
|
61063
|
+
window.setImageData(data.imageData, data.controlId, data.fileName);
|
|
61064
|
+
}
|
|
61065
|
+
}
|
|
61066
|
+
});
|
|
60917
61067
|
</script>
|
|
60918
61068
|
|
|
60919
61069
|
</html>
|
|
@@ -8,11 +8,10 @@ function attachNestedFormsToMainForm(obj, nestedFormArr, _isRecursive = false) {
|
|
|
8
8
|
if (typeof obj[key] === "object") {
|
|
9
9
|
attachNestedFormsToMainForm(obj[key], nestedFormArr, true);
|
|
10
10
|
} else if (key === "nestedFormComponenttype" && obj["nestedFormComponenttype"] === "smartNestedForm") {
|
|
11
|
-
const selNestedFormVersion = obj.selNestedFormVersion;
|
|
12
11
|
const selectedNestedFormId = obj.selectedNestedFormId;
|
|
13
|
-
if (
|
|
12
|
+
if (selectedNestedFormId) {
|
|
14
13
|
const fDesign = nestedFormArr.filter(
|
|
15
|
-
(item) => item.formId == selectedNestedFormId
|
|
14
|
+
(item) => item.formId == selectedNestedFormId
|
|
16
15
|
);
|
|
17
16
|
if (fDesign.length > 0) {
|
|
18
17
|
try {
|
|
@@ -92,30 +91,23 @@ function validateNestedForms(formJson, nestedFormArr) {
|
|
|
92
91
|
let error = null;
|
|
93
92
|
let hasNestedFormComponent = false;
|
|
94
93
|
walkComponents(formJson == null ? void 0 : formJson.components, (comp) => {
|
|
95
|
-
if (comp.selectedNestedFormId && comp.
|
|
94
|
+
if (comp.selectedNestedFormId && comp.nestedFormComponenttype === "smartNestedForm") {
|
|
96
95
|
hasNestedFormComponent = true;
|
|
97
96
|
if (!Array.isArray(nestedFormArr) || nestedFormArr.length === 0) {
|
|
98
|
-
error = "Nested Form Data must be a non-empty array when a component with selectedNestedFormId
|
|
97
|
+
error = "Nested Form Data must be a non-empty array when a component with selectedNestedFormId and nestedFormComponenttype='smartNestedForm' is present in the form.";
|
|
99
98
|
return;
|
|
100
99
|
}
|
|
101
100
|
const found = nestedFormArr.find(
|
|
102
|
-
(nf) => nf.formId == comp.selectedNestedFormId
|
|
101
|
+
(nf) => nf.formId == comp.selectedNestedFormId
|
|
103
102
|
);
|
|
104
103
|
if (!found) {
|
|
105
|
-
|
|
106
|
-
(nf) => nf.formId == comp.selectedNestedFormId
|
|
107
|
-
);
|
|
108
|
-
if (idMatch) {
|
|
109
|
-
error = `Version is wrong for selectedNestedFormId: ${comp.selectedNestedFormId}. Expected version: ${idMatch.version}, got: ${comp.selNestedFormVersion}`;
|
|
110
|
-
} else {
|
|
111
|
-
error = `ID is wrong. No nested form found for selectedNestedFormId: ${comp.selectedNestedFormId}`;
|
|
112
|
-
}
|
|
104
|
+
error = `ID is wrong. No nested form found for selectedNestedFormId: ${comp.selectedNestedFormId}`;
|
|
113
105
|
}
|
|
114
106
|
}
|
|
115
107
|
});
|
|
116
108
|
if (Array.isArray(nestedFormArr) && nestedFormArr.length > 0) {
|
|
117
109
|
if (!hasNestedFormComponent) {
|
|
118
|
-
error = "Nested Form Data is provided but no component with selectedNestedFormId
|
|
110
|
+
error = "Nested Form Data is provided but no component with selectedNestedFormId and nestedFormComponenttype='smartNestedForm' exists in the form.";
|
|
119
111
|
return error;
|
|
120
112
|
}
|
|
121
113
|
}
|
|
@@ -27948,7 +27940,7 @@ select.ui.dropdown {
|
|
|
27948
27940
|
<div id="formio-cmt" style="margin-bottom: 20px;"></div>
|
|
27949
27941
|
</div>
|
|
27950
27942
|
<div id="sticky-footer">
|
|
27951
|
-
<div class="build-version">SDK v1.0.
|
|
27943
|
+
<div class="build-version">SDK v1.0.42</div>
|
|
27952
27944
|
<button class="ui button primary dataGrid-addRow" id="saveBtn" disabled="true" onclick="FormOnSave()">
|
|
27953
27945
|
<i class="icon save large"></i>Save
|
|
27954
27946
|
</button>
|
|
@@ -68631,7 +68623,7 @@ window.deleteAppDocument = async function(id) {
|
|
|
68631
68623
|
window.getAllDocuments = getAllDocuments;
|
|
68632
68624
|
window.hasDocuments = hasDocuments;
|
|
68633
68625
|
function getBuildVersion() {
|
|
68634
|
-
return "1.0.
|
|
68626
|
+
return "1.0.42";
|
|
68635
68627
|
}
|
|
68636
68628
|
export {
|
|
68637
68629
|
getBuildVersion,
|
package/package.json
CHANGED