
META-INF.resources.designer.js.legacy.utils.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.portal.workflow.kaleo.designer.web Show documentation
Show all versions of com.liferay.portal.workflow.kaleo.designer.web Show documentation
Liferay Portal Workflow Kaleo Designer Web
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
AUI.add(
'liferay-kaleo-designer-utils',
(A) => {
const AArray = A.Array;
const isArray = Array.isArray;
const STR_CDATA_CLOSE = ']]>';
const STR_CDATA_OPEN = ' {
const checked = item.get('checked');
const name = item.get('name');
const type = item.get('type');
let value = item.val();
if (name) {
if (!isArray(data[name])) {
data[name] = [];
}
if (type === 'checkbox') {
value = checked;
}
if (type === 'radio' && !checked) {
value = null;
}
if (type === 'select-multiple') {
value = [];
item.all('option:selected').each((option) => {
value.push({
notificationType: option.val(),
});
});
}
data[name].push(value);
}
});
}
return data;
};
KaleoDesignerUtils.serializeForm = serializeForm;
const uniformRandomInt = function (a, b) {
return parseInt(a + Math.random() * (b - a), 10) || 0;
};
KaleoDesignerUtils.uniformRandomInt = uniformRandomInt;
const previewBeforeRevert = function (_, renderUrl, actionUrl, title) {
const dialog = Liferay.Util.Window.getWindow({
dialog: {
destroyOnHide: true,
modal: true,
toolbars: {
footer: [
{
cssClass: 'btn btn-secondary',
discardDefaultButtonCssClasses: true,
label: Liferay.Language.get('cancel'),
on: {
click() {
dialog.destroy();
},
},
},
{
cssClass: 'btn btn-primary',
discardDefaultButtonCssClasses: true,
label: Liferay.Language.get('restore'),
on: {
click() {
window.location.assign(actionUrl);
},
},
},
],
header: [
{
cssClass: 'close',
discardDefaultButtonCssClasses: true,
labelHTML:
'',
on: {
click(event) {
dialog.destroy();
event.domEvent.stopPropagation();
},
},
},
],
},
},
title,
uri: renderUrl,
});
};
KaleoDesignerUtils.previewBeforeRevert = previewBeforeRevert;
Liferay.KaleoDesignerStrings = KaleoDesignerStrings;
Liferay.KaleoDesignerUtils = KaleoDesignerUtils;
},
'',
{}
);
© 2015 - 2025 Weber Informatics LLC | Privacy Policy