Skip to content

Commit

Permalink
FOS Release v21.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Raganitsch committed Mar 8, 2022
1 parent 550ff3c commit e0586a9
Show file tree
Hide file tree
Showing 8 changed files with 290 additions and 105 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MIT License
Copyright (c) 2021 FOS - FOEX Open Source
Copyright (c) 2022 FOS - FOEX Open Source

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## FOS - Message Actions

![](https://img.shields.io/badge/Plug--in_Type-Dynamic_Action-orange.svg) ![](https://img.shields.io/badge/APEX-19.2-success.svg) ![](https://img.shields.io/badge/APEX-20.1-success.svg) ![](https://img.shields.io/badge/APEX-20.2-success.svg)
![](https://img.shields.io/badge/Plug--in_Type-Dynamic_Action-orange.svg) ![](https://img.shields.io/badge/APEX-19.2-success.svg) ![](https://img.shields.io/badge/APEX-20.1-success.svg) ![](https://img.shields.io/badge/APEX-20.2-success.svg) ![](https://img.shields.io/badge/APEX-21.1-success.svg) ![](https://img.shields.io/badge/APEX-21.2-success.svg)

Show or hide success and error messages declaratively.
<h4>Free Plug-in under MIT License</h4>
Expand Down
304 changes: 206 additions & 98 deletions apex/com_fos_message_actions.sql

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion apexplugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"FOS - Message Actions"
,"version":"21.1.0"
,"version":"21.2.0"
,"description":"Show or hide success and error messages declaratively.\r\n\u003Ch4\u003EFree Plug-in under MIT License\u003C\/h4\u003E\r\n\u003Cp\u003E\r\nAll FOS plug-ins are released under MIT License, which essentially means it is free for everyone to use, no matter if commercial or private use. \r\n\u003C\/p\u003E\r\n\u003Ch4\u003EOverview\u003C\/h4\u003E\r\n\u003Cp\u003EThe \u003Cstrong\u003EFOS - Message Actions\u003C\/strong\u003E dynamic action plug-in is an easy and declarative way to deal with APEX success and error messages. It can show errors inline with fields and in notifications, as well as showing page level messages that look the same as regular APEX page notifications. Internally we use the same Javascript API that APEX provides to show these messages.\u003C\/p\u003E\r\n\u003Cp\u003EThe message can be a static string with optional page item substitutions, or derived from a Javascript expression or function.\u003C\/p\u003E\r\n\u003Cp\u003EYou also have control over how escaping should be performed on the message. Either entirely, or only for certain page items if your message contains HTML markup.\u003C\/p\u003E"
,"keywords":[
"message"
Expand Down Expand Up @@ -33,12 +33,15 @@
,"12.2.0.1"
,"18.0.0.0"
,"19.0.0.0"
,"21.0.0.0"
]
,"apex":{
"versions":[
"19.2.0"
,"20.1.0"
,"20.2.0"
,"21.1.0"
,"21.2.0"
]
,"plugin":{
"internalName":"COM.FOS.MESSAGE_ACTIONS"
Expand Down
13 changes: 12 additions & 1 deletion db/com_fos_message_actions.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,15 @@ as
-- success configuration
l_duration p_dynamic_action.attribute_09%type := p_dynamic_action.attribute_09;

-- message types to clear
l_clear_success boolean := instr(nvl(p_dynamic_action.attribute_12,' '), 'success') > 0;
l_clear_error boolean := instr(nvl(p_dynamic_action.attribute_12,' '), 'error' ) > 0;
l_hide_after pls_integer := p_dynamic_action.attribute_13;


begin
-- standard debugging intro, but only if necessary
if apex_application.g_debug
if apex_application.g_debug and substr(:DEBUG,6) >= 6
then
apex_plugin_util.debug_dynamic_action
( p_plugin => p_plugin
Expand Down Expand Up @@ -120,6 +126,11 @@ begin
when 'clear-errors' then
apex_json.write('actionType' , 'clearErrors');
apex_json.write('pageItems' , l_clear_items);
when 'clear-message' then
apex_json.write('actionType' , 'clearMessage');
apex_json.write('clearSuccess', l_clear_success);
apex_json.write('clearError' , l_clear_error);
apex_json.write('hideAfter' , l_hide_after * 1000);
end case;

apex_json.close_object;
Expand Down
65 changes: 64 additions & 1 deletion files/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@ FOS.message = FOS.message || {};
* @param {object} daContext Dynamic Action context as passed in by APEX
* @param {object} config Configuration object holding the message configuration
* @param {string} config.message String or JS function returning the message text
* @param {string} config.actionType One of: showPageSuccess|hidePageSuccess|showError|clearErrors
* @param {string} config.actionType One of: showPageSuccess|hidePageSuccess|showError|clearErrors|clearError
* @param {boolean} [config.escape] Whether to escape the message text
* @param {number} [config.config.duration] Amount of milliseconds after that the page success message should automatically be dismissed
* @param {string} [config.location] Where to display the error message, on page, inline, both
* @param {string} [config.pageItem] Name of the page item which the error message should be associated with
* @param {string} [config.pageItems] Name of the page items which the error message should be cleared for
* @param {boolean} config.clearSuccess Whether to auto-clear success messages
* @param {boolean} config.clearError Whether to auto-clear error messages
* @param {function} [initFn] Javascript Initialization Code Function, it can be undefined
*/
FOS.message.action = function (daContext, config, initFn) {
Expand Down Expand Up @@ -72,6 +74,9 @@ FOS.message.action = function (daContext, config, initFn) {
case 'clearErrors':
FOS.message.clearErrors(config.pageItems);
break;
case 'clearMessage':
FOS.message.clearMessage(config.clearSuccess, config.clearError, config.hideAfter);
break;
}
};

Expand Down Expand Up @@ -167,4 +172,62 @@ FOS.message.clearErrors = function (pageItems) {
}
};

FOS.message.clearMessage = function(clearSuccess, clearError, hideAfter){
const SUCCESS_SELECTOR = 'APEX_SUCCESS_MESSAGE';
const ERROR_SELECTOR = 'APEX_ERROR_MESSAGE';

const successEl = document.getElementById(SUCCESS_SELECTOR);
const errorEl = document.getElementById(ERROR_SELECTOR);

const VISIBLE_CLS = 'u-visible';
const HIDDEN_CLS = 'u-hidden';

apex.message.setThemeHooks({
beforeShow: function(msgType, msgEl){
console.log(msgEl);
if((clearSuccess && msgType == 'success') || (clearError && msgType === 'error')){
setTimeout(function(){
msgEl.removeClass(VISIBLE_CLS).addClass(HIDDEN_CLS);
}, hideAfter);
}
}
})

// const observerConfig = {
// attributes: true,
// attributeFilter: ['class'],
// childList: true,
// subtree: false
// };

// const callback = function(mutationsList, observer){
// console.log('mutationList', mutationsList);
// for(const mutation of mutationsList){
// if(mutation.type === 'childList'){
// if(mutation.addedNodes.length > 0){
// console.log('A Node has been added', mutation.addedNodes[0]);
// console.log(mutation);
// }

// if(mutation.removedNodes.length > 0){
// console.log('A Node has been removed', mutation.removedNodes[0]);
// console.log(mutation);
// }
// }
// }
// }

// const observer = new MutationObserver(callback);

// if(clearSuccess && successEl){
// observer.observe(successEl,observerConfig);
// }

// if(clearError && errorEl){
// observer.observe(errorEl,observerConfig);
// }

}



2 changes: 1 addition & 1 deletion files/js/script.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion files/js/script.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e0586a9

Please sign in to comment.