ode-ngjs-front 1.4.19 → 1.4.20

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rss-widget.widget.d.ts","sourceRoot":"","sources":["../../../../src/ts/widgets/rss-widget/rss-widget.widget.ts"],"names":[],"mappings":"AA+OA,eAAO,MAAM,aAAa,uBAAuB,CAAC"}
1
+ {"version":3,"file":"rss-widget.widget.d.ts","sourceRoot":"","sources":["../../../../src/ts/widgets/rss-widget/rss-widget.widget.ts"],"names":[],"mappings":"AA8QA,eAAO,MAAM,aAAa,uBAAuB,CAAC"}
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-ngjs-front 04/12/2025 18:31:47
1
+ ode-ngjs-front 15/12/2025 15:32:29
@@ -1,2 +1,2 @@
1
- "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[390],{4643:(e,t,i)=>{i.d(t,{Z:()=>n});const n=' <div class="widget-rss"> <div class="widget-header"> <div class="subtitle"><i18n>rss-widget.widget.title</i18n></div> <div class="widget-options"> <div class="tools"> <a href="#" class="tool tool-option" i18n-title="rss-widget.widget.channel.config" ng-if="ctrl.canAddFeed" ng-click="ctrl.display.edition = true"> <i class="fas fa-cog"></i> </a> </div> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-click="ctrl.display.edition = true" ng-if="ctrl.channel===undefined || ctrl.channel.feeds.length === 0"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class="widget-empty-message link" ng-if="ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class="rss-feed" ng-if="ctrl.feeds !== undefined" ng-repeat="feed in ctrl.feeds track by $index"> <div class="feed-title" ng-click="ctrl.showOrHideFeed($index)">[[feed.title]]</div> <ul class="list" ng-show="ctrl.display.selectedFeed === [[$index]]"> <li class="item link" ng-repeat="item in feed.Items track by $index"> <a href="[[item.link]]" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':item.link} })"> <div class="title">[[item.title]]</div> <div class="meta">[[ctrl.formatDate(item.pubDate)]]</div> <div class="meta" ng-bind-html="item.description"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible="ctrl.display.edition" on-close="ctrl.display.edition = false" dnd-nodrag> <ode-modal-title> <i18n ng-if="!ctrl.display.feedEdition">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if="ctrl.display.feedEdition">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if="!ctrl.display.feedEdition"> <p ng-if="ctrl.channel.feeds.length === 0"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class="table table-hover" ng-if="ctrl.channel.feeds.length > 0"> <thead> <tr class="bg-secondary text-light"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class="c-pointer" ng-repeat="feed in ctrl.channel.feeds track by $index" ng-class="{ \'table-active\' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }"> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click="ctrl.removeFeed($index)"> <button type="button" class="btn-close" aria-label="Close"></button> </td> </tr> </tbody> </table> </div> <form autocomplete="off" id="formFeedEdition" ng-if="ctrl.display.feedEdition"> <div class="form-group row"> <label for="inputFeedTitle" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.title.placeholder" id="inputFeedTitle" class="form-control" ng-model="ctrl.selectedFeed.title"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedUrl" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.url.placeholder" id="inputFeedUrl" class="form-control" ng-model="ctrl.selectedFeed.link"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedShow" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class="col-sm-8"> <select id="inputFeedShow" class="form-control" ng-options="n for n in ctrl.showValues" ng-model="ctrl.selectedFeed.show"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if="!ctrl.display.feedEdition && ctrl.canAddFeed"> <button class="btn btn-primary" ng-click="ctrl.openFeedEdition()" translate content="rss-widget.widget.channel.feed.add"></button> </div> <div ng-if="ctrl.display.feedEdition"> <button form="formFeedEdition" type="reset" class="btn btn-light" ng-click="ctrl.closeFeedEdition()"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form="formFeedEdition" type="submit" class="btn btn-primary" ng-click="ctrl.saveFeed()"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>'},7377:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var d=n(i(4202)),l=i(9419),s=function(){function e(){this.channel=void 0,this.feeds=[],this.totalFeeds=10,this.defaultShow=3,this.showValues=[1,2,3,4,5,6,7,8,9,10],this.display={edition:!1,feedEdition:!1,selectedFeed:0}}return e.prototype.initFeeds=function(){var e=this;return void 0===this.channel?(0,l.http)().get("/rss/channels").then(function(t){return t&&t.length>0?e.channel=t[0]:e.channel={feeds:[]},e.loadFeeds(0)}).catch(function(t){console.warn("[widget.rss] failed to initFeeds: ",t),e.channel={feeds:[]}}):this.loadFeeds(0)},e.prototype.loadFeeds=function(e){var t=this;return this.feeds=[],Promise.all(this.channel.feeds.map(function(i){var n=i.title;return null!==i.link&&""!==i.link?(0,l.http)().get("/rss/feed/items?url="+encodeURIComponent(i.link)+"&force="+e).then(function(e){"object"!=typeof e||e.title||(e.title=n),200===e.status&&t.feeds.length<t.totalFeeds&&(void 0!==e.Items&&null!=i.show&&e.Items.length>i.show&&(e.Items=e.Items.slice(0,i.show)),t.feeds.push(e))}).catch(function(e){console.warn("[widget.rss] failed to loadFeeds: ",e)}):Promise.resolve()})).then(function(e){})},Object.defineProperty(e.prototype,"canAddFeed",{get:function(){var e=$(window).width();return this.channel&&this.channel.feeds.length<this.totalFeeds&&("number"!=typeof e||e>=992)},enumerable:!1,configurable:!0}),e.prototype.openFeedEdition=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds?(this.selectedFeed=d.default.copy(this.channel.feeds[e]),this.selectedFeedIndex=e):(this.selectedFeed={title:"",link:"",show:3},this.selectedFeedIndex=-1),this.display.feedEdition=!0},e.prototype.closeFeedEdition=function(){this.display.feedEdition=!1,this.selectedFeed=void 0,this.selectedFeedIndex=void 0},e.prototype.removeFeed=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds&&(this.channel.feeds.splice(e,1),this.saveChannel())},e.prototype.validFeed=function(e){return e&&e.title&&""!==e.title.trim()&&e.link&&""!==e.link.trim()},e.prototype.saveFeed=function(){"number"==typeof this.selectedFeedIndex&&this.validFeed(this.selectedFeed)&&this.selectedFeed&&(this.selectedFeedIndex>=0&&this.selectedFeedIndex<this.totalFeeds?this.channel.feeds[this.selectedFeedIndex]=this.selectedFeed:this.channel.feeds.push(this.selectedFeed),this.saveChannel()),this.closeFeedEdition()},e.prototype.saveChannel=function(){this.channel._id?this.editChannel():this.createChannel()},e.prototype.createChannel=function(){var e=this;this.channel?(0,l.http)().postJson("/rss/channel",this.channel).then(function(t){e.channel._id=t._id,e.loadFeeds(0)}):console.log("createChannel : channel is undefined")},e.prototype.editChannel=function(){var e=this;this.channel&&this.channel._id?(0,l.http)().putJson("/rss/channel/"+this.channel._id,{feeds:this.channel.feeds}).then(function(t){e.loadFeeds(0)}):console.log("editChannel : channel is undefined")},e.prototype.showOrHideFeed=function(e){this.display.selectedFeed===e?this.display.selectedFeed=void 0:this.display.selectedFeed=e},e.prototype.formatDate=function(e){return("number"==typeof e?l.L10n.unix(e):l.L10n.moment(e,void 0,"en")).locale("fr").format("dddd DD MMMM YYYY HH:mm")},e}(),o=function(){function e(){this.restrict="E",this.template=i(4643).Z,this.controller=[s],this.controllerAs="ctrl",this.require=["odeRssWidget"]}return e.prototype.link=function(e,t,i,n){var d=n?n[0]:null;d&&(d.initFeeds().then(function(){e.$apply()}),e.trackEvent=function(e,t){var i;void 0===t.bubbles&&(t.bubbles=!0);var n=null;t&&"string"==typeof(null===(i=t.detail)||void 0===i?void 0:i.open)&&(n=new CustomEvent(l.TrackedActionFromWidget.rss,t)),n&&e.currentTarget&&e.currentTarget.dispatchEvent(n)})},e}();(0,l.notif)().onLangReady().promise.then(function(e){(0,l.conf)().Platform.idiom.addKeys(i(2546))}),t.odeModuleName="odeRssWidgetModule",d.default.module(t.odeModuleName,[]).directive("odeRssWidget",function(){return new o})},2546:e=>{e.exports=JSON.parse('{"rss-widget.widget.channel.config":"Configurer","rss-widget.widget.channel.feed.add":"Ajouter un flux","rss-widget.widget.channel.feed.cancel":"Retour","rss-widget.widget.channel.feed.edit":"Edition d\'un flux","rss-widget.widget.channel.feed.list":"Liste des flux","rss-widget.widget.channel.feed.no.result":"Aucun résultat","rss-widget.widget.channel.feed.read.more":"Voir plus","rss-widget.widget.channel.feed.remove":"Supprimer le flux","rss-widget.widget.channel.feed.save":"Enregistrer","rss-widget.widget.channel.feed.show":"Nombre d\'articles à afficher","rss-widget.widget.channel.feed.title":"Titre","rss-widget.widget.channel.feed.title.placeholder":"Saisissez le titre du nouveau flux RSS","rss-widget.widget.channel.feed.update":"Actualiser","rss-widget.widget.channel.feed.url":"Adresse du flux","rss-widget.widget.channel.feed.url.placeholder":"Saisissez l\'Url du nouveau flux RSS","rss-widget.widget.channel.refresh":"Rafraîchir","rss-widget.widget.channel.undefined":"Aucun flux configuré","rss-widget.widget.empty.info":"Ajoutez un flux RSS pour voir vos derniers articles","rss-widget.widget.title":"RSS"}')}}]);
1
+ "use strict";(self.webpackChunkode_ngjs_front=self.webpackChunkode_ngjs_front||[]).push([[390],{4643:(e,t,i)=>{i.d(t,{Z:()=>n});const n=' <div class="widget-rss"> <div class="widget-header"> <div class="subtitle"><i18n>rss-widget.widget.title</i18n></div> <div class="widget-options"> <div class="tools"> <a href="#" class="tool tool-option" i18n-title="rss-widget.widget.channel.config" ng-if="ctrl.canAddFeed" ng-click="ctrl.display.edition = true"> <i class="fas fa-cog"></i> </a> </div> <div class="widget-handle" title="Déplacer le widget"><i class="fas fa-grip-vertical" aria-hidden="true"></i></div> </div> </div> <div class="widget-body" dnd-nodrag> <div class="widget-empty-message link" ng-click="ctrl.display.edition = true" ng-if="ctrl.channel===undefined || ctrl.channel.feeds.length === 0"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class="widget-empty-message link" ng-if="ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class="rss-feed" ng-if="ctrl.feeds !== undefined" ng-repeat="feed in ctrl.feeds track by $index"> <div class="feed-title" ng-click="ctrl.showOrHideFeed($index)">[[feed.title]]</div> <ul class="list" ng-show="ctrl.display.selectedFeed === [[$index]]"> <li class="item link" ng-repeat="item in feed.Items track by $index"> <a href="[[item.link]]" target="_blank" rel="noopener" ng-click="trackEvent($event, {detail:{\'open\':item.link} })"> <div class="title">[[item.title]]</div> <div class="meta">[[ctrl.formatDate(item.pubDate)]]</div> <div class="meta" ng-bind-html="item.description"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible="ctrl.display.edition" on-close="ctrl.display.edition = false" dnd-nodrag> <ode-modal-title> <i18n ng-if="!ctrl.display.feedEdition">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if="ctrl.display.feedEdition">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if="!ctrl.display.feedEdition"> <p ng-if="ctrl.channel.feeds.length === 0"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class="table table-hover" ng-if="ctrl.channel.feeds.length > 0"> <thead> <tr class="bg-secondary text-light"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class="c-pointer" ng-repeat="feed in ctrl.channel.feeds track by $index" ng-class="{ \'table-active\' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }"> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click="ctrl.openFeedEdition($index)">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click="ctrl.removeFeed($index)"> <button type="button" class="btn-close" aria-label="Close"></button> </td> </tr> </tbody> </table> </div> <form autocomplete="off" id="formFeedEdition" ng-if="ctrl.display.feedEdition"> <div class="form-group row"> <label for="inputFeedTitle" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.title.placeholder" id="inputFeedTitle" class="form-control" ng-model="ctrl.selectedFeed.title"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedUrl" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class="col-sm-8"> <input type="text" i18n-placeholder="rss-widget.widget.channel.feed.url.placeholder" id="inputFeedUrl" class="form-control" ng-model="ctrl.selectedFeed.link"/> </div> </div> <div class="form-group row mt-3"> <label for="inputFeedShow" class="col-sm-4 col-form-label"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class="col-sm-8"> <select id="inputFeedShow" class="form-control" ng-options="n for n in ctrl.showValues" ng-model="ctrl.selectedFeed.show"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if="!ctrl.display.feedEdition && ctrl.canAddFeed"> <button class="btn btn-primary" ng-click="ctrl.openFeedEdition()" translate content="rss-widget.widget.channel.feed.add"></button> </div> <div ng-if="ctrl.display.feedEdition"> <button form="formFeedEdition" type="reset" class="btn btn-light" ng-click="ctrl.closeFeedEdition()"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form="formFeedEdition" type="submit" class="btn btn-primary" ng-click="ctrl.saveFeed()"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>'},7377:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.odeModuleName=void 0;var d=n(i(4202)),s=i(9419),l=function(){function e(){this.channel=void 0,this.feeds=[],this.totalFeeds=10,this.defaultShow=3,this.showValues=[1,2,3,4,5,6,7,8,9,10],this.display={edition:!1,feedEdition:!1,selectedFeed:0}}return e.prototype.initFeeds=function(){var e=this;return void 0===this.channel?(0,s.http)().get("/rss/channels").then(function(t){return t&&t.length>0?e.channel=t[0]:e.channel={feeds:[]},e.loadFeeds(0)}).catch(function(t){console.warn("[widget.rss] failed to initFeeds: ",t),e.channel={feeds:[]}}):this.loadFeeds(0)},e.prototype.loadFeeds=function(e){var t=this;return this.feeds=[],Promise.all(this.channel.feeds.map(function(i){var n=i.title;return null!==i.link&&""!==i.link?(0,s.http)().get("/rss/feed/items?url="+encodeURIComponent(i.link)+"&force="+e).then(function(e){"object"!=typeof e||e.title||(e.title=n),200===e.status&&t.feeds.length<t.totalFeeds&&(void 0!==e.Items&&null!=i.show&&e.Items.length>i.show&&(e.Items=e.Items.slice(0,i.show)),t.feeds.push(e))}).catch(function(e){console.warn("[widget.rss] failed to loadFeeds: ",e)}):Promise.resolve()})).then(function(e){})},Object.defineProperty(e.prototype,"canAddFeed",{get:function(){var e=$(window).width();return this.channel&&this.channel.feeds.length<this.totalFeeds&&("number"!=typeof e||e>=992)},enumerable:!1,configurable:!0}),e.prototype.openFeedEdition=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds?(this.selectedFeed=d.default.copy(this.channel.feeds[e]),this.selectedFeedIndex=e):(this.selectedFeed={title:"",link:"",show:3},this.selectedFeedIndex=-1),this.display.feedEdition=!0},e.prototype.closeFeedEdition=function(){this.display.feedEdition=!1,this.selectedFeed=void 0,this.selectedFeedIndex=void 0},e.prototype.removeFeed=function(e){"number"==typeof e&&e>=0&&e<this.totalFeeds&&(this.channel.feeds.splice(e,1),this.saveChannel())},e.prototype.validFeed=function(e){var t;if(!e||"string"!=typeof e.title||!e.title.trim()||"string"!=typeof e.link||!e.link.trim())return!1;var i=e.link.trim();try{var n=new URL(i);if(!["http:","https:"].includes(n.protocol))return!1;var d=n.pathname.toLowerCase(),s=[".rss",".xml",".rdf",".atom",".feed"].some(function(e){return d.endsWith(e)}),l=!(null!==(t=d.split("/").pop())&&void 0!==t?t:"").includes(".");return s||l}catch(e){return!1}},e.prototype.saveFeed=function(){"number"==typeof this.selectedFeedIndex&&this.validFeed(this.selectedFeed)&&this.selectedFeed&&(this.selectedFeedIndex>=0&&this.selectedFeedIndex<this.totalFeeds?this.channel.feeds[this.selectedFeedIndex]=this.selectedFeed:this.channel.feeds.push(this.selectedFeed),this.saveChannel()),this.closeFeedEdition()},e.prototype.saveChannel=function(){this.channel._id?this.editChannel():this.createChannel()},e.prototype.createChannel=function(){var e=this;this.channel?(0,s.http)().postJson("/rss/channel",this.channel).then(function(t){e.channel._id=t._id,e.loadFeeds(0)}):console.log("createChannel : channel is undefined")},e.prototype.editChannel=function(){var e=this;this.channel&&this.channel._id?(0,s.http)().putJson("/rss/channel/"+this.channel._id,{feeds:this.channel.feeds}).then(function(t){e.loadFeeds(0)}):console.log("editChannel : channel is undefined")},e.prototype.showOrHideFeed=function(e){this.display.selectedFeed===e?this.display.selectedFeed=void 0:this.display.selectedFeed=e},e.prototype.formatDate=function(e){return("number"==typeof e?s.L10n.unix(e):s.L10n.moment(e,void 0,"en")).locale("fr").format("dddd DD MMMM YYYY HH:mm")},e}(),o=function(){function e(){this.restrict="E",this.template=i(4643).Z,this.controller=[l],this.controllerAs="ctrl",this.require=["odeRssWidget"]}return e.prototype.link=function(e,t,i,n){var d=n?n[0]:null;d&&(d.initFeeds().then(function(){e.$apply()}),e.trackEvent=function(e,t){var i;void 0===t.bubbles&&(t.bubbles=!0);var n=null;t&&"string"==typeof(null===(i=t.detail)||void 0===i?void 0:i.open)&&(n=new CustomEvent(s.TrackedActionFromWidget.rss,t)),n&&e.currentTarget&&e.currentTarget.dispatchEvent(n)})},e}();(0,s.notif)().onLangReady().promise.then(function(e){(0,s.conf)().Platform.idiom.addKeys(i(2546))}),t.odeModuleName="odeRssWidgetModule",d.default.module(t.odeModuleName,[]).directive("odeRssWidget",function(){return new o})},2546:e=>{e.exports=JSON.parse('{"rss-widget.widget.channel.config":"Configurer","rss-widget.widget.channel.feed.add":"Ajouter un flux","rss-widget.widget.channel.feed.cancel":"Retour","rss-widget.widget.channel.feed.edit":"Edition d\'un flux","rss-widget.widget.channel.feed.list":"Liste des flux","rss-widget.widget.channel.feed.no.result":"Aucun résultat","rss-widget.widget.channel.feed.read.more":"Voir plus","rss-widget.widget.channel.feed.remove":"Supprimer le flux","rss-widget.widget.channel.feed.save":"Enregistrer","rss-widget.widget.channel.feed.show":"Nombre d\'articles à afficher","rss-widget.widget.channel.feed.title":"Titre","rss-widget.widget.channel.feed.title.placeholder":"Saisissez le titre du nouveau flux RSS","rss-widget.widget.channel.feed.update":"Actualiser","rss-widget.widget.channel.feed.url":"Adresse du flux","rss-widget.widget.channel.feed.url.placeholder":"Saisissez l\'Url du nouveau flux RSS","rss-widget.widget.channel.refresh":"Rafraîchir","rss-widget.widget.channel.undefined":"Aucun flux configuré","rss-widget.widget.empty.info":"Ajoutez un flux RSS pour voir vos derniers articles","rss-widget.widget.title":"RSS"}')}}]);
2
2
  //# sourceMappingURL=rss-widget.widget.js.map
@@ -1 +1 @@
1
- {"version":3,"file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,IAAIG,YAAa,EAAAC,wBAAwBC,IAAKP,IAEnDE,GAASjE,EAAEuE,eACdvE,EAAEuE,cAAcC,cAAcP,EAEhC,EACD,EACD,EA9BA,IAsCA,IAAAQ,SAAQC,cAAcC,QAAQhF,KAAM,SAAAiF,IAEzB,IAAAC,QAAOC,SAASC,MAAMC,QAAS,EAAQ,MAElD,GAIa,EAAAC,cAAgB,qBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,eAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \" <div class=\\\"widget-rss\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>rss-widget.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"tools\\\"> <a href=\\\"#\\\" class=\\\"tool tool-option\\\" i18n-title=\\\"rss-widget.widget.channel.config\\\" ng-if=\\\"ctrl.canAddFeed\\\" ng-click=\\\"ctrl.display.edition = true\\\"> <i class=\\\"fas fa-cog\\\"></i> </a> </div> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message link\\\" ng-click=\\\"ctrl.display.edition = true\\\" ng-if=\\\"ctrl.channel===undefined || ctrl.channel.feeds.length === 0\\\"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class=\\\"widget-empty-message link\\\" ng-if=\\\"ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0\\\"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class=\\\"rss-feed\\\" ng-if=\\\"ctrl.feeds !== undefined\\\" ng-repeat=\\\"feed in ctrl.feeds track by $index\\\"> <div class=\\\"feed-title\\\" ng-click=\\\"ctrl.showOrHideFeed($index)\\\">[[feed.title]]</div> <ul class=\\\"list\\\" ng-show=\\\"ctrl.display.selectedFeed === [[$index]]\\\"> <li class=\\\"item link\\\" ng-repeat=\\\"item in feed.Items track by $index\\\"> <a href=\\\"[[item.link]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':item.link} })\\\"> <div class=\\\"title\\\">[[item.title]]</div> <div class=\\\"meta\\\">[[ctrl.formatDate(item.pubDate)]]</div> <div class=\\\"meta\\\" ng-bind-html=\\\"item.description\\\"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible=\\\"ctrl.display.edition\\\" on-close=\\\"ctrl.display.edition = false\\\" dnd-nodrag> <ode-modal-title> <i18n ng-if=\\\"!ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if=\\\"ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if=\\\"!ctrl.display.feedEdition\\\"> <p ng-if=\\\"ctrl.channel.feeds.length === 0\\\"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class=\\\"table table-hover\\\" ng-if=\\\"ctrl.channel.feeds.length > 0\\\"> <thead> <tr class=\\\"bg-secondary text-light\\\"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class=\\\"c-pointer\\\" ng-repeat=\\\"feed in ctrl.channel.feeds track by $index\\\" ng-class=\\\"{ 'table-active' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }\\\"> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click=\\\"ctrl.removeFeed($index)\\\"> <button type=\\\"button\\\" class=\\\"btn-close\\\" aria-label=\\\"Close\\\"></button> </td> </tr> </tbody> </table> </div> <form autocomplete=\\\"off\\\" id=\\\"formFeedEdition\\\" ng-if=\\\"ctrl.display.feedEdition\\\"> <div class=\\\"form-group row\\\"> <label for=\\\"inputFeedTitle\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.title.placeholder\\\" id=\\\"inputFeedTitle\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.title\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedUrl\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.url.placeholder\\\" id=\\\"inputFeedUrl\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.link\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedShow\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class=\\\"col-sm-8\\\"> <select id=\\\"inputFeedShow\\\" class=\\\"form-control\\\" ng-options=\\\"n for n in ctrl.showValues\\\" ng-model=\\\"ctrl.selectedFeed.show\\\"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if=\\\"!ctrl.display.feedEdition && ctrl.canAddFeed\\\"> <button class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.openFeedEdition()\\\" translate content=\\\"rss-widget.widget.channel.feed.add\\\"></button> </div> <div ng-if=\\\"ctrl.display.feedEdition\\\"> <button form=\\\"formFeedEdition\\\" type=\\\"reset\\\" class=\\\"btn btn-light\\\" ng-click=\\\"ctrl.closeFeedEdition()\\\"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form=\\\"formFeedEdition\\\" type=\\\"submit\\\" class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.saveFeed()\\\"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { L10n, conf, notif, http, TrackedAction, TrackedScope, TrackedActionFromWidget } from \"../../utils\";\n\ntype Feed = {title:string, link:string, show?:number};\ntype Channel = {\n\t_id?:string;\n\tfeeds: Array<Feed>;\n\towner?: {\n\t userId: string;\n\t displayName: string;\n\t};\n\tcreated?: {\n\t \"$date\": number\n\t};\n\tmodified?: {\n\t \"$date\": number\n\t};\n}\ntype RssContent = {\n\ttitle: string;\n\tlink: string;\n\tdescription: string;\n\tpubDate: string;\n}\ntype FeedContent = RssContent & {\n\tlanguage: string;\n\tItems: Array<RssContent>;\n\tstatus: number;\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tchannel:Channel = undefined as unknown as Channel;\n\tfeeds:Feed[] = [];\n\tselectedFeed?:Feed;\n\tselectedFeedIndex?:number;\n\ttotalFeeds = 10; // limit of feeds\n\tdefaultShow = 3; // limit of article by feeds\n\tshowValues = [1,2,3,4,5,6,7,8,9,10];\n\tdisplay:{\n\t\tedition:boolean;\n\t\tfeedEdition:boolean;\n\t\tselectedFeed?:number;\n\t} = {\n\t\tedition: false,\n\t\tfeedEdition: false,\n\t\tselectedFeed: 0\n\t};\n\n\tinitFeeds():Promise<void> {\n\t\tif(this.channel === undefined){\n\t\t\treturn http().get<Channel[]>('/rss/channels')\n\t\t\t.then( channels => {\n\t\t\t\tif(channels && channels.length > 0) {\n\t\t\t\t\tthis.channel = channels[0];\n\t\t\t\t} else {\n\t\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t\t}\n\t\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t\t})\n\t\t\t.catch( e => {\n\t\t\t\tconsole.warn(\"[widget.rss] failed to initFeeds: \", e)\n\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t});\n\t\t} else {\n\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t}\n\t}\n\n\tprivate loadFeeds( force:number ):Promise<void> {\n\t\tthis.feeds = [];\n\t\treturn Promise.all( this.channel.feeds.map( feed => {\n\t\t\tconst mytitle = feed.title;\n\t\t\tif(feed.link !== null && feed.link !== \"\"){\n\t\t\t\treturn http().get<FeedContent>('/rss/feed/items?url=' + encodeURIComponent(feed.link) + '&force=' + force)\n\t\t\t\t.then( result => {\n\t\t\t\t\tif(typeof result===\"object\" && !result.title) result.title = mytitle;\n\t\t\t\t\tif(result.status===200 && this.feeds.length < this.totalFeeds){\n\t\t\t\t\t\tif(result.Items !== undefined && feed.show != undefined && result.Items.length > feed.show){\n\t\t\t\t\t\t\tresult.Items = result.Items.slice(0, feed.show);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.feeds.push(result);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch( e => {\n\t\t\t\t\tconsole.warn(\"[widget.rss] failed to loadFeeds: \", e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn Promise.resolve();\n\t\t\t}\n\t\t}))\n\t\t.then( results => {} );\n\t};\n\n\tpublic get canAddFeed():boolean {\n\t\tconst ww = $(window).width();\n\t\treturn (this.channel && this.channel.feeds.length < this.totalFeeds) && (typeof ww!==\"number\" || ww >= 992);\n\t}\n\t\n\topenFeedEdition(index:number) {\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.selectedFeed = angular.copy(this.channel.feeds[index]);\n\t\t\tthis.selectedFeedIndex = index;\n\t\t}else{\n\t\t\tthis.selectedFeed = {title:\"\", link:\"\", show:3};\n\t\t\tthis.selectedFeedIndex = -1;\n\t\t}\n\t\tthis.display.feedEdition = true;\n\t}\n\t\n\tcloseFeedEdition() {\n\t\tthis.display.feedEdition = false;\n\t\tthis.selectedFeed = undefined;\n\t\tthis.selectedFeedIndex = undefined;\n\t}\n\t\n\tremoveFeed(index:number){\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.channel.feeds.splice(index, 1);\n\t\t\tthis.saveChannel();\n\t\t}\n\t}\n\n\tvalidFeed( feed?:Feed ){\n\t\treturn (feed && feed.title && feed.title.trim()!==\"\" && feed.link && feed.link.trim()!==\"\");\n\t}\n\t\n\tsaveFeed(){\n\t\tif(typeof this.selectedFeedIndex===\"number\" && this.validFeed(this.selectedFeed)){\n\t\t\tif( this.selectedFeed ) {\n\t\t\t\tif(this.selectedFeedIndex >= 0 && this.selectedFeedIndex < this.totalFeeds){\n\t\t\t\t\tthis.channel.feeds[this.selectedFeedIndex] = this.selectedFeed;\n\t\t\t\t}else{\n\t\t\t\t\tthis.channel.feeds.push(this.selectedFeed);\n\t\t\t\t}\n\t\t\t\tthis.saveChannel();\n\t\t\t}\n\t\t}\n\t\tthis.closeFeedEdition();\n\t}\n\n\tsaveChannel(){\n\t\tif(this.channel._id) {\n\t\t\tthis.editChannel();\n\t\t}\n\t\telse{\n\t\t\tthis.createChannel();\n\t\t}\n\t}\n\n\tcreateChannel() {\n\t\tif(this.channel){\n\t\t\thttp().postJson('/rss/channel', this.channel)\n\t\t\t.then( response => {\n\t\t\t\tthis.channel._id = response._id;\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"createChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\teditChannel() {\n\t\tif(this.channel && this.channel._id){\n\t\t\thttp().putJson('/rss/channel/' + this.channel._id, {feeds: this.channel.feeds})\n\t\t\t.then( response => {\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"editChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\tshowOrHideFeed( index:number ){\n\t\tif(this.display.selectedFeed === index){\n\t\t\tthis.display.selectedFeed = undefined;\n\t\t} else {\n\t\t\tthis.display.selectedFeed = index;\n\t\t}\n\t}\n\t\n\tformatDate( date:any ){\n\t\tvar momentDate;\n\t\tif (typeof date === \"number\"){\n\t\t\tmomentDate = L10n.unix(date);\n\t\t} else {\n\t\t\tmomentDate = L10n.moment(date, undefined, 'en');\n\t\t}\n\t\treturn momentDate.locale('fr').format('dddd DD MMMM YYYY HH:mm');\n\t};\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./rss-widget.widget.html').default;\n\tcontroller = [Controller];\n\tcontrollerAs = 'ctrl';\n require = ['odeRssWidget'];\n\n link(scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]): void {\n const ctrl:Controller|null = controllers ? controllers[0] as Controller : null;\n\t\tif( ! ctrl ) return;\n\n\t\t// init channel & feeds\n\t\tctrl.initFeeds().then( () => {\n\t\t\tscope.$apply();\n\t\t});\n\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && typeof p.detail?.open==='string' ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.rss, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The rss-widget widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeRssWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeRssWidget\", DirectiveFactory );\n"],"names":["channel","undefined","feeds","totalFeeds","defaultShow","showValues","display","edition","feedEdition","selectedFeed","initFeeds","this","http","get","then","channels","length","loadFeeds","catch","e","console","warn","force","Promise","all","map","feed","mytitle","title","link","encodeURIComponent","result","status","Items","show","slice","push","resolve","results","ww","$","window","width","openFeedEdition","index","copy","selectedFeedIndex","closeFeedEdition","removeFeed","splice","saveChannel","validFeed","trim","saveFeed","_id","editChannel","createChannel","postJson","response","log","putJson","showOrHideFeed","formatDate","date","L10n","unix","moment","locale","format","restrict","template","controller","Controller","controllerAs","require","scope","elem","attrs","controllers","ctrl","$apply","trackEvent","p","bubbles","event","detail","open","CustomEvent","TrackedActionFromWidget","rss","currentTarget","dispatchEvent","notif","onLangReady","promise","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
1
+ {"version":3,"file":"widgets/rss-widget/rss-widget.widget.js","mappings":"gIAGA,QAFW,63I,mLCDX,iBACA,UA8BA,0BACC,KAAAA,aAAkBC,EAClB,KAAAC,MAAe,GAGf,KAAAC,WAAa,GACb,KAAAC,YAAc,EACd,KAAAC,WAAa,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAChC,KAAAC,QAII,CACHC,SAAS,EACTC,aAAa,EACbC,aAAc,EA+KhB,QA5KC,YAAAC,UAAA,sBACC,YAAoBT,IAAjBU,KAAKX,SACA,IAAAY,QAAOC,IAAe,iBAC5BC,KAAM,SAAAC,GAMN,OALGA,GAAYA,EAASC,OAAS,EAChC,EAAKhB,QAAUe,EAAS,GAExB,EAAKf,QAAU,CAACE,MAAM,IAEhB,EAAKe,UAAU,EACvB,GACCC,MAAO,SAAAC,GACPC,QAAQC,KAAK,qCAAsCF,GACnD,EAAKnB,QAAU,CAACE,MAAM,GACvB,GAEOS,KAAKM,UAAU,EAExB,EAEQ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D,GAIa,EAAAC,cAAgB,qBAC7B,UAAQC,OAAQ,EAAAD,cAAe,IAAIE,UAAW,eAd9C,WACC,OAAO,IAAIC,CACZ,E","sources":["webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.html","webpack://ode-ngjs-front/./src/ts/widgets/rss-widget/rss-widget.widget.ts"],"sourcesContent":["// Module\nvar code = \" <div class=\\\"widget-rss\\\"> <div class=\\\"widget-header\\\"> <div class=\\\"subtitle\\\"><i18n>rss-widget.widget.title</i18n></div> <div class=\\\"widget-options\\\"> <div class=\\\"tools\\\"> <a href=\\\"#\\\" class=\\\"tool tool-option\\\" i18n-title=\\\"rss-widget.widget.channel.config\\\" ng-if=\\\"ctrl.canAddFeed\\\" ng-click=\\\"ctrl.display.edition = true\\\"> <i class=\\\"fas fa-cog\\\"></i> </a> </div> <div class=\\\"widget-handle\\\" title=\\\"Déplacer le widget\\\"><i class=\\\"fas fa-grip-vertical\\\" aria-hidden=\\\"true\\\"></i></div> </div> </div> <div class=\\\"widget-body\\\" dnd-nodrag> <div class=\\\"widget-empty-message link\\\" ng-click=\\\"ctrl.display.edition = true\\\" ng-if=\\\"ctrl.channel===undefined || ctrl.channel.feeds.length === 0\\\"> <i18n>rss-widget.widget.empty.info</i18n> </div> <div class=\\\"widget-empty-message link\\\" ng-if=\\\"ctrl.channel && ctrl.channel.feeds.length > 0 && ctrl.feeds.length === 0\\\"> <i18n>rss-widget.widget.channel.feed.no.result</i18n> </div> <div class=\\\"rss-feed\\\" ng-if=\\\"ctrl.feeds !== undefined\\\" ng-repeat=\\\"feed in ctrl.feeds track by $index\\\"> <div class=\\\"feed-title\\\" ng-click=\\\"ctrl.showOrHideFeed($index)\\\">[[feed.title]]</div> <ul class=\\\"list\\\" ng-show=\\\"ctrl.display.selectedFeed === [[$index]]\\\"> <li class=\\\"item link\\\" ng-repeat=\\\"item in feed.Items track by $index\\\"> <a href=\\\"[[item.link]]\\\" target=\\\"_blank\\\" rel=\\\"noopener\\\" ng-click=\\\"trackEvent($event, {detail:{'open':item.link} })\\\"> <div class=\\\"title\\\">[[item.title]]</div> <div class=\\\"meta\\\">[[ctrl.formatDate(item.pubDate)]]</div> <div class=\\\"meta\\\" ng-bind-html=\\\"item.description\\\"></div> </a> </li> </ul> </div> </div> </div> <ode-modal visible=\\\"ctrl.display.edition\\\" on-close=\\\"ctrl.display.edition = false\\\" dnd-nodrag> <ode-modal-title> <i18n ng-if=\\\"!ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.list</i18n> <i18n ng-if=\\\"ctrl.display.feedEdition\\\">rss-widget.widget.channel.feed.edit</i18n> </ode-modal-title> <ode-modal-body> <div ng-if=\\\"!ctrl.display.feedEdition\\\"> <p ng-if=\\\"ctrl.channel.feeds.length === 0\\\"><i18n>rss-widget.widget.channel.undefined</i18n></p> <table class=\\\"table table-hover\\\" ng-if=\\\"ctrl.channel.feeds.length > 0\\\"> <thead> <tr class=\\\"bg-secondary text-light\\\"> <th><i18n>rss-widget.widget.channel.feed.title</i18n></th> <th><i18n>rss-widget.widget.channel.feed.show</i18n></th> <th></th> </tr> </thead> <tbody> <tr class=\\\"c-pointer\\\" ng-repeat=\\\"feed in ctrl.channel.feeds track by $index\\\" ng-class=\\\"{ 'table-active' : ctrl.display.feedEdition && $index === ctrl.selectedFeedIndex }\\\"> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].title]]</td> <td ng-click=\\\"ctrl.openFeedEdition($index)\\\">[[ctrl.channel.feeds[$index].show]]</td> <td ng-click=\\\"ctrl.removeFeed($index)\\\"> <button type=\\\"button\\\" class=\\\"btn-close\\\" aria-label=\\\"Close\\\"></button> </td> </tr> </tbody> </table> </div> <form autocomplete=\\\"off\\\" id=\\\"formFeedEdition\\\" ng-if=\\\"ctrl.display.feedEdition\\\"> <div class=\\\"form-group row\\\"> <label for=\\\"inputFeedTitle\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.title</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.title.placeholder\\\" id=\\\"inputFeedTitle\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.title\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedUrl\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.url</i18n></label> <div class=\\\"col-sm-8\\\"> <input type=\\\"text\\\" i18n-placeholder=\\\"rss-widget.widget.channel.feed.url.placeholder\\\" id=\\\"inputFeedUrl\\\" class=\\\"form-control\\\" ng-model=\\\"ctrl.selectedFeed.link\\\"/> </div> </div> <div class=\\\"form-group row mt-3\\\"> <label for=\\\"inputFeedShow\\\" class=\\\"col-sm-4 col-form-label\\\"><i18n>rss-widget.widget.channel.feed.show</i18n></label> <div class=\\\"col-sm-8\\\"> <select id=\\\"inputFeedShow\\\" class=\\\"form-control\\\" ng-options=\\\"n for n in ctrl.showValues\\\" ng-model=\\\"ctrl.selectedFeed.show\\\"></select> </div> </div> </form> </ode-modal-body> <ode-modal-footer> <div ng-if=\\\"!ctrl.display.feedEdition && ctrl.canAddFeed\\\"> <button class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.openFeedEdition()\\\" translate content=\\\"rss-widget.widget.channel.feed.add\\\"></button> </div> <div ng-if=\\\"ctrl.display.feedEdition\\\"> <button form=\\\"formFeedEdition\\\" type=\\\"reset\\\" class=\\\"btn btn-light\\\" ng-click=\\\"ctrl.closeFeedEdition()\\\"> <i18n>rss-widget.widget.channel.feed.cancel</i18n> </button> <button form=\\\"formFeedEdition\\\" type=\\\"submit\\\" class=\\\"btn btn-primary\\\" ng-click=\\\"ctrl.saveFeed()\\\"> <i18n>rss-widget.widget.channel.feed.save</i18n> </button> </div> </ode-modal-footer> </ode-modal>\";\n// Exports\nexport default code;","import angular, { IAttributes, IController, IDirective, IScope } from \"angular\";\nimport { L10n, conf, notif, http, TrackedAction, TrackedScope, TrackedActionFromWidget } from \"../../utils\";\n\ntype Feed = {title:string, link:string, show?:number};\ntype Channel = {\n\t_id?:string;\n\tfeeds: Array<Feed>;\n\towner?: {\n\t userId: string;\n\t displayName: string;\n\t};\n\tcreated?: {\n\t \"$date\": number\n\t};\n\tmodified?: {\n\t \"$date\": number\n\t};\n}\ntype RssContent = {\n\ttitle: string;\n\tlink: string;\n\tdescription: string;\n\tpubDate: string;\n}\ntype FeedContent = RssContent & {\n\tlanguage: string;\n\tItems: Array<RssContent>;\n\tstatus: number;\n}\n\n/* Controller for the directive */\nclass Controller implements IController {\n\tchannel:Channel = undefined as unknown as Channel;\n\tfeeds:Feed[] = [];\n\tselectedFeed?:Feed;\n\tselectedFeedIndex?:number;\n\ttotalFeeds = 10; // limit of feeds\n\tdefaultShow = 3; // limit of article by feeds\n\tshowValues = [1,2,3,4,5,6,7,8,9,10];\n\tdisplay:{\n\t\tedition:boolean;\n\t\tfeedEdition:boolean;\n\t\tselectedFeed?:number;\n\t} = {\n\t\tedition: false,\n\t\tfeedEdition: false,\n\t\tselectedFeed: 0\n\t};\n\n\tinitFeeds():Promise<void> {\n\t\tif(this.channel === undefined){\n\t\t\treturn http().get<Channel[]>('/rss/channels')\n\t\t\t.then( channels => {\n\t\t\t\tif(channels && channels.length > 0) {\n\t\t\t\t\tthis.channel = channels[0];\n\t\t\t\t} else {\n\t\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t\t}\n\t\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t\t})\n\t\t\t.catch( e => {\n\t\t\t\tconsole.warn(\"[widget.rss] failed to initFeeds: \", e)\n\t\t\t\tthis.channel = {feeds:[]};\n\t\t\t});\n\t\t} else {\n\t\t\treturn this.loadFeeds(0); // 0 : default, from the cache\n\t\t}\n\t}\n\n\tprivate loadFeeds( force:number ):Promise<void> {\n\t\tthis.feeds = [];\n\t\treturn Promise.all( this.channel.feeds.map( feed => {\n\t\t\tconst mytitle = feed.title;\n\t\t\tif(feed.link !== null && feed.link !== \"\"){\n\t\t\t\treturn http().get<FeedContent>('/rss/feed/items?url=' + encodeURIComponent(feed.link) + '&force=' + force)\n\t\t\t\t.then( result => {\n\t\t\t\t\tif(typeof result===\"object\" && !result.title) result.title = mytitle;\n\t\t\t\t\tif(result.status===200 && this.feeds.length < this.totalFeeds){\n\t\t\t\t\t\tif(result.Items !== undefined && feed.show != undefined && result.Items.length > feed.show){\n\t\t\t\t\t\t\tresult.Items = result.Items.slice(0, feed.show);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthis.feeds.push(result);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.catch( e => {\n\t\t\t\t\tconsole.warn(\"[widget.rss] failed to loadFeeds: \", e);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn Promise.resolve();\n\t\t\t}\n\t\t}))\n\t\t.then( results => {} );\n\t};\n\n\tpublic get canAddFeed():boolean {\n\t\tconst ww = $(window).width();\n\t\treturn (this.channel && this.channel.feeds.length < this.totalFeeds) && (typeof ww!==\"number\" || ww >= 992);\n\t}\n\t\n\topenFeedEdition(index:number) {\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.selectedFeed = angular.copy(this.channel.feeds[index]);\n\t\t\tthis.selectedFeedIndex = index;\n\t\t}else{\n\t\t\tthis.selectedFeed = {title:\"\", link:\"\", show:3};\n\t\t\tthis.selectedFeedIndex = -1;\n\t\t}\n\t\tthis.display.feedEdition = true;\n\t}\n\t\n\tcloseFeedEdition() {\n\t\tthis.display.feedEdition = false;\n\t\tthis.selectedFeed = undefined;\n\t\tthis.selectedFeedIndex = undefined;\n\t}\n\t\n\tremoveFeed(index:number){\n\t\tif(typeof index===\"number\" && index >= 0 && index < this.totalFeeds){\n\t\t\tthis.channel.feeds.splice(index, 1);\n\t\t\tthis.saveChannel();\n\t\t}\n\t}\n\n\tvalidFeed( feed?:Feed ):boolean {\n\t if (!feed || \n\t typeof feed.title !== 'string' || !feed.title.trim() || \n\t typeof feed.link !== 'string' || !feed.link.trim()) {\n\t return false;\n\t }\n\n\t const urlString = feed.link.trim();\n\n\t try {\n\t const urlToCheck = new URL(urlString);\n\n\t // Check protocol\n\t if (!['http:', 'https:'].includes(urlToCheck.protocol)) {\n\t return false;\n\t }\n\n\t const pathname = urlToCheck.pathname.toLowerCase();\n\n\t // Check authorized extensions\n\t const validExtensions = ['.rss', '.xml', '.rdf', '.atom', '.feed']; \n\n\t const hasValidExtension = validExtensions.some(ext => pathname.endsWith(ext));\n\n\t // No extension is valid too\n\t\t\tconst lastSegment = pathname.split('/').pop() ?? '';\n\t\t\tconst hasNoExtension = !lastSegment.includes('.');\n\n\t return hasValidExtension || hasNoExtension;\n\n\t } catch (e) {\n\t return false; // URL not authorized\n\t }\t\n\t}\n\t\n\tsaveFeed(){\n\t\tif(typeof this.selectedFeedIndex===\"number\" && this.validFeed(this.selectedFeed)){\n\t\t\tif( this.selectedFeed ) {\n\t\t\t\tif(this.selectedFeedIndex >= 0 && this.selectedFeedIndex < this.totalFeeds){\n\t\t\t\t\tthis.channel.feeds[this.selectedFeedIndex] = this.selectedFeed;\n\t\t\t\t}else{\n\t\t\t\t\tthis.channel.feeds.push(this.selectedFeed);\n\t\t\t\t}\n\t\t\t\tthis.saveChannel();\n\t\t\t}\n\t\t}\n\t\tthis.closeFeedEdition();\n\t}\n\n\tsaveChannel(){\n\t\tif(this.channel._id) {\n\t\t\tthis.editChannel();\n\t\t}\n\t\telse{\n\t\t\tthis.createChannel();\n\t\t}\n\t}\n\n\tcreateChannel() {\n\t\tif(this.channel){\n\t\t\thttp().postJson('/rss/channel', this.channel)\n\t\t\t.then( response => {\n\t\t\t\tthis.channel._id = response._id;\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"createChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\teditChannel() {\n\t\tif(this.channel && this.channel._id){\n\t\t\thttp().putJson('/rss/channel/' + this.channel._id, {feeds: this.channel.feeds})\n\t\t\t.then( response => {\n\t\t\t\tthis.loadFeeds(0); // 0 : default, from the cache\n\t\t\t});\n\t\t} else {\n\t\t\tconsole.log(\"editChannel : channel is undefined\");\n\t\t}\n\t}\n\t\n\tshowOrHideFeed( index:number ){\n\t\tif(this.display.selectedFeed === index){\n\t\t\tthis.display.selectedFeed = undefined;\n\t\t} else {\n\t\t\tthis.display.selectedFeed = index;\n\t\t}\n\t}\n\t\n\tformatDate( date:any ){\n\t\tvar momentDate;\n\t\tif (typeof date === \"number\"){\n\t\t\tmomentDate = L10n.unix(date);\n\t\t} else {\n\t\t\tmomentDate = L10n.moment(date, undefined, 'en');\n\t\t}\n\t\treturn momentDate.locale('fr').format('dddd DD MMMM YYYY HH:mm');\n\t};\n}\n\n/* Directive */\nclass Directive implements IDirective<TrackedScope,JQLite,IAttributes,IController[]> {\n restrict = 'E';\n\ttemplate = require('./rss-widget.widget.html').default;\n\tcontroller = [Controller];\n\tcontrollerAs = 'ctrl';\n require = ['odeRssWidget'];\n\n link(scope:TrackedScope, elem:JQLite, attrs:IAttributes, controllers?:IController[]): void {\n const ctrl:Controller|null = controllers ? controllers[0] as Controller : null;\n\t\tif( ! ctrl ) return;\n\n\t\t// init channel & feeds\n\t\tctrl.initFeeds().then( () => {\n\t\t\tscope.$apply();\n\t\t});\n\n\t\t// Give an opportunity to track some events from outside of this widget.\n\t\tscope.trackEvent = (e:Event, p:CustomEventInit<TrackedAction>) => {\n\t\t\t// Allow events to bubble up.\n\t\t\tif(typeof p.bubbles === \"undefined\") p.bubbles = true;\n\n\t\t\tlet event = null;\n\t\t\tif( p && typeof p.detail?.open==='string' ) {\n\t\t\t\tevent = new CustomEvent( TrackedActionFromWidget.rss, p );\n\t\t\t}\n\t\t\tif( event && e.currentTarget ) {\n\t\t\t\te.currentTarget.dispatchEvent(event);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/** The rss-widget widget. */\nfunction DirectiveFactory() {\n\treturn new Directive();\n}\n\n// Preload translations\nnotif().onLangReady().promise.then( lang => {\n\tswitch( lang ) {\n\t\tdefault:\tconf().Platform.idiom.addKeys( require('./i18n/fr.json') ); break;\n\t}\n});\n\n// THIS ANGULAR MODULE WILL BE DYNAMICALLY ADDED TO THE APPLICATION.\n// RESPECT THE NAMING CONVENTION BY EXPORTING THE MODULE NAME :\nexport const odeModuleName = \"odeRssWidgetModule\";\nangular.module( odeModuleName, []).directive( \"odeRssWidget\", DirectiveFactory );\n"],"names":["channel","undefined","feeds","totalFeeds","defaultShow","showValues","display","edition","feedEdition","selectedFeed","initFeeds","this","http","get","then","channels","length","loadFeeds","catch","e","console","warn","force","Promise","all","map","feed","mytitle","title","link","encodeURIComponent","result","status","Items","show","slice","push","resolve","results","ww","$","window","width","openFeedEdition","index","copy","selectedFeedIndex","closeFeedEdition","removeFeed","splice","saveChannel","validFeed","trim","urlString","urlToCheck","URL","includes","protocol","pathname","toLowerCase","hasValidExtension","some","ext","endsWith","hasNoExtension","split","pop","saveFeed","_id","editChannel","createChannel","postJson","response","log","putJson","showOrHideFeed","formatDate","date","L10n","unix","moment","locale","format","restrict","template","controller","Controller","controllerAs","require","scope","elem","attrs","controllers","ctrl","$apply","trackEvent","p","bubbles","event","detail","open","CustomEvent","TrackedActionFromWidget","rss","currentTarget","dispatchEvent","notif","onLangReady","promise","lang","conf","Platform","idiom","addKeys","odeModuleName","module","directive","Directive"],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-ngjs-front",
3
- "version": "1.4.19",
3
+ "version": "1.4.20",
4
4
  "description": "Open Digital Education Frontend Framework",
5
5
  "homepage": "https://github.com/opendigitaleducation/ode-ngjs-front#readme",
6
6
  "bugs": {