@sd-angular/core 0.0.1003 → 0.0.1007

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.
Files changed (188) hide show
  1. package/autocomplete/sd-angular-core-autocomplete.metadata.json +1 -1
  2. package/autocomplete/src/lib/autocomplete.component.d.ts +9 -5
  3. package/bundles/sd-angular-core-api.umd.js +29 -12
  4. package/bundles/sd-angular-core-api.umd.js.map +1 -1
  5. package/bundles/sd-angular-core-api.umd.min.js +1 -1
  6. package/bundles/sd-angular-core-api.umd.min.js.map +1 -1
  7. package/bundles/sd-angular-core-autocomplete.umd.js +63 -41
  8. package/bundles/sd-angular-core-autocomplete.umd.js.map +1 -1
  9. package/bundles/sd-angular-core-autocomplete.umd.min.js +2 -2
  10. package/bundles/sd-angular-core-autocomplete.umd.min.js.map +1 -1
  11. package/bundles/sd-angular-core-button.umd.js +29 -12
  12. package/bundles/sd-angular-core-button.umd.js.map +1 -1
  13. package/bundles/sd-angular-core-button.umd.min.js +1 -1
  14. package/bundles/sd-angular-core-button.umd.min.js.map +1 -1
  15. package/bundles/sd-angular-core-cache.umd.js +29 -12
  16. package/bundles/sd-angular-core-cache.umd.js.map +1 -1
  17. package/bundles/sd-angular-core-cache.umd.min.js +2 -2
  18. package/bundles/sd-angular-core-cache.umd.min.js.map +1 -1
  19. package/bundles/sd-angular-core-chart.umd.js +29 -12
  20. package/bundles/sd-angular-core-chart.umd.js.map +1 -1
  21. package/bundles/sd-angular-core-chart.umd.min.js.map +1 -1
  22. package/bundles/sd-angular-core-checkbox.umd.js +29 -12
  23. package/bundles/sd-angular-core-checkbox.umd.js.map +1 -1
  24. package/bundles/sd-angular-core-checkbox.umd.min.js +1 -1
  25. package/bundles/sd-angular-core-checkbox.umd.min.js.map +1 -1
  26. package/bundles/sd-angular-core-chip.umd.js +29 -12
  27. package/bundles/sd-angular-core-chip.umd.js.map +1 -1
  28. package/bundles/sd-angular-core-chip.umd.min.js +1 -1
  29. package/bundles/sd-angular-core-chip.umd.min.js.map +1 -1
  30. package/bundles/sd-angular-core-comment.umd.js +446 -0
  31. package/bundles/sd-angular-core-comment.umd.js.map +1 -0
  32. package/bundles/sd-angular-core-comment.umd.min.js +16 -0
  33. package/bundles/sd-angular-core-comment.umd.min.js.map +1 -0
  34. package/bundles/sd-angular-core-common.umd.js +71 -16
  35. package/bundles/sd-angular-core-common.umd.js.map +1 -1
  36. package/bundles/sd-angular-core-common.umd.min.js +3 -2
  37. package/bundles/sd-angular-core-common.umd.min.js.map +1 -1
  38. package/bundles/sd-angular-core-date-range.umd.js +29 -12
  39. package/bundles/sd-angular-core-date-range.umd.js.map +1 -1
  40. package/bundles/sd-angular-core-date-range.umd.min.js +2 -2
  41. package/bundles/sd-angular-core-date-range.umd.min.js.map +1 -1
  42. package/bundles/sd-angular-core-date-time.umd.js +29 -12
  43. package/bundles/sd-angular-core-date-time.umd.js.map +1 -1
  44. package/bundles/sd-angular-core-date-time.umd.min.js +2 -2
  45. package/bundles/sd-angular-core-date-time.umd.min.js.map +1 -1
  46. package/bundles/sd-angular-core-editor.umd.js +29 -12
  47. package/bundles/sd-angular-core-editor.umd.js.map +1 -1
  48. package/bundles/sd-angular-core-editor.umd.min.js +1 -1
  49. package/bundles/sd-angular-core-editor.umd.min.js.map +1 -1
  50. package/bundles/sd-angular-core-excel.umd.js +29 -12
  51. package/bundles/sd-angular-core-excel.umd.js.map +1 -1
  52. package/bundles/sd-angular-core-excel.umd.min.js.map +1 -1
  53. package/bundles/sd-angular-core-export.umd.js +29 -12
  54. package/bundles/sd-angular-core-export.umd.js.map +1 -1
  55. package/bundles/sd-angular-core-export.umd.min.js +1 -1
  56. package/bundles/sd-angular-core-export.umd.min.js.map +1 -1
  57. package/bundles/sd-angular-core-grid-material.umd.js +54 -19
  58. package/bundles/sd-angular-core-grid-material.umd.js.map +1 -1
  59. package/bundles/sd-angular-core-grid-material.umd.min.js +2 -2
  60. package/bundles/sd-angular-core-grid-material.umd.min.js.map +1 -1
  61. package/bundles/sd-angular-core-grid.umd.js +29 -12
  62. package/bundles/sd-angular-core-grid.umd.js.map +1 -1
  63. package/bundles/sd-angular-core-grid.umd.min.js +1 -1
  64. package/bundles/sd-angular-core-grid.umd.min.js.map +1 -1
  65. package/bundles/sd-angular-core-input-currency.umd.js +29 -12
  66. package/bundles/sd-angular-core-input-currency.umd.js.map +1 -1
  67. package/bundles/sd-angular-core-input-currency.umd.min.js +2 -2
  68. package/bundles/sd-angular-core-input-currency.umd.min.js.map +1 -1
  69. package/bundles/sd-angular-core-input-dropdown.umd.js +29 -12
  70. package/bundles/sd-angular-core-input-dropdown.umd.js.map +1 -1
  71. package/bundles/sd-angular-core-input-dropdown.umd.min.js +1 -1
  72. package/bundles/sd-angular-core-input-dropdown.umd.min.js.map +1 -1
  73. package/bundles/sd-angular-core-input-upload-file.umd.js +29 -12
  74. package/bundles/sd-angular-core-input-upload-file.umd.js.map +1 -1
  75. package/bundles/sd-angular-core-input-upload-file.umd.min.js +2 -2
  76. package/bundles/sd-angular-core-input-upload-file.umd.min.js.map +1 -1
  77. package/bundles/sd-angular-core-input.umd.js +54 -17
  78. package/bundles/sd-angular-core-input.umd.js.map +1 -1
  79. package/bundles/sd-angular-core-input.umd.min.js +2 -2
  80. package/bundles/sd-angular-core-input.umd.min.js.map +1 -1
  81. package/bundles/sd-angular-core-konva.umd.js +29 -12
  82. package/bundles/sd-angular-core-konva.umd.js.map +1 -1
  83. package/bundles/sd-angular-core-konva.umd.min.js +1 -1
  84. package/bundles/sd-angular-core-konva.umd.min.js.map +1 -1
  85. package/bundles/sd-angular-core-radio.umd.js +29 -12
  86. package/bundles/sd-angular-core-radio.umd.js.map +1 -1
  87. package/bundles/sd-angular-core-radio.umd.min.js +1 -1
  88. package/bundles/sd-angular-core-radio.umd.min.js.map +1 -1
  89. package/bundles/sd-angular-core-select-editor.umd.js +29 -12
  90. package/bundles/sd-angular-core-select-editor.umd.js.map +1 -1
  91. package/bundles/sd-angular-core-select-editor.umd.min.js +2 -2
  92. package/bundles/sd-angular-core-select-editor.umd.min.js.map +1 -1
  93. package/bundles/sd-angular-core-select.umd.js +29 -12
  94. package/bundles/sd-angular-core-select.umd.js.map +1 -1
  95. package/bundles/sd-angular-core-select.umd.min.js +2 -2
  96. package/bundles/sd-angular-core-select.umd.min.js.map +1 -1
  97. package/bundles/sd-angular-core-setting.umd.js +29 -12
  98. package/bundles/sd-angular-core-setting.umd.js.map +1 -1
  99. package/bundles/sd-angular-core-setting.umd.min.js +1 -1
  100. package/bundles/sd-angular-core-setting.umd.min.js.map +1 -1
  101. package/bundles/sd-angular-core-side-drawer.umd.js +29 -12
  102. package/bundles/sd-angular-core-side-drawer.umd.js.map +1 -1
  103. package/bundles/sd-angular-core-side-drawer.umd.min.js +2 -2
  104. package/bundles/sd-angular-core-side-drawer.umd.min.js.map +1 -1
  105. package/bundles/sd-angular-core-switch.umd.js +29 -12
  106. package/bundles/sd-angular-core-switch.umd.js.map +1 -1
  107. package/bundles/sd-angular-core-switch.umd.min.js +2 -2
  108. package/bundles/sd-angular-core-switch.umd.min.js.map +1 -1
  109. package/bundles/sd-angular-core-tab-router.umd.js +29 -12
  110. package/bundles/sd-angular-core-tab-router.umd.js.map +1 -1
  111. package/bundles/sd-angular-core-tab-router.umd.min.js +2 -2
  112. package/bundles/sd-angular-core-tab-router.umd.min.js.map +1 -1
  113. package/bundles/sd-angular-core-textarea.umd.js +29 -12
  114. package/bundles/sd-angular-core-textarea.umd.js.map +1 -1
  115. package/bundles/sd-angular-core-textarea.umd.min.js +2 -2
  116. package/bundles/sd-angular-core-textarea.umd.min.js.map +1 -1
  117. package/bundles/sd-angular-core-time.umd.js +29 -12
  118. package/bundles/sd-angular-core-time.umd.js.map +1 -1
  119. package/bundles/sd-angular-core-time.umd.min.js +2 -2
  120. package/bundles/sd-angular-core-time.umd.min.js.map +1 -1
  121. package/bundles/sd-angular-core-upload-excel.umd.js +29 -12
  122. package/bundles/sd-angular-core-upload-excel.umd.js.map +1 -1
  123. package/bundles/sd-angular-core-upload-excel.umd.min.js +1 -1
  124. package/bundles/sd-angular-core-upload-excel.umd.min.js.map +1 -1
  125. package/bundles/sd-angular-core-upload-file.umd.js +29 -12
  126. package/bundles/sd-angular-core-upload-file.umd.js.map +1 -1
  127. package/bundles/sd-angular-core-upload-file.umd.min.js +2 -2
  128. package/bundles/sd-angular-core-upload-file.umd.min.js.map +1 -1
  129. package/bundles/sd-angular-core-utility.umd.js +29 -12
  130. package/bundles/sd-angular-core-utility.umd.js.map +1 -1
  131. package/bundles/sd-angular-core-utility.umd.min.js +1 -1
  132. package/bundles/sd-angular-core-utility.umd.min.js.map +1 -1
  133. package/bundles/sd-angular-core.umd.js +33 -16
  134. package/bundles/sd-angular-core.umd.js.map +1 -1
  135. package/bundles/sd-angular-core.umd.min.js +1 -1
  136. package/bundles/sd-angular-core.umd.min.js.map +1 -1
  137. package/comment/index.d.ts +1 -0
  138. package/comment/package.json +12 -0
  139. package/comment/sd-angular-core-comment.d.ts +4 -0
  140. package/comment/sd-angular-core-comment.metadata.json +1 -0
  141. package/comment/src/lib/comment.component.d.ts +17 -0
  142. package/comment/src/lib/comment.model.d.ts +21 -0
  143. package/comment/src/lib/comment.module.d.ts +2 -0
  144. package/comment/src/public-api.d.ts +3 -0
  145. package/common/sd-angular-core-common.metadata.json +1 -1
  146. package/common/src/lib/common.module.d.ts +2 -0
  147. package/common/src/lib/directives/view-def.directive.d.ts +5 -0
  148. package/common/src/public-api.d.ts +2 -0
  149. package/esm2015/autocomplete/src/lib/autocomplete.component.js +35 -26
  150. package/esm2015/autocomplete/src/lib/autocomplete.module.js +4 -2
  151. package/esm2015/comment/index.js +2 -0
  152. package/esm2015/comment/sd-angular-core-comment.js +5 -0
  153. package/esm2015/comment/src/lib/comment.component.js +60 -0
  154. package/esm2015/comment/src/lib/comment.model.js +2 -0
  155. package/esm2015/comment/src/lib/comment.module.js +37 -0
  156. package/esm2015/comment/src/public-api.js +7 -0
  157. package/esm2015/common/src/lib/common.module.js +20 -0
  158. package/esm2015/common/src/lib/directives/view-def.directive.js +16 -0
  159. package/esm2015/common/src/public-api.js +3 -1
  160. package/esm2015/grid-material/src/lib/components/quick-action/quick-action.component.js +7 -4
  161. package/esm2015/grid-material/src/lib/grid-material.component.js +13 -3
  162. package/esm2015/grid-material/src/lib/models/grid.model.js +1 -1
  163. package/esm2015/grid-material/src/lib/pipes/selection-disable.pipe.js +4 -2
  164. package/esm2015/grid-material/src/lib/pipes/selection-visible.pipe.js +5 -3
  165. package/esm2015/input/src/lib/input.component.js +23 -4
  166. package/esm2015/input/src/lib/input.module.js +6 -3
  167. package/esm2015/public-api.js +2 -1
  168. package/fesm2015/sd-angular-core-autocomplete.js +35 -26
  169. package/fesm2015/sd-angular-core-autocomplete.js.map +1 -1
  170. package/fesm2015/sd-angular-core-comment.js +106 -0
  171. package/fesm2015/sd-angular-core-comment.js.map +1 -0
  172. package/fesm2015/sd-angular-core-common.js +35 -1
  173. package/fesm2015/sd-angular-core-common.js.map +1 -1
  174. package/fesm2015/sd-angular-core-grid-material.js +24 -7
  175. package/fesm2015/sd-angular-core-grid-material.js.map +1 -1
  176. package/fesm2015/sd-angular-core-input.js +26 -6
  177. package/fesm2015/sd-angular-core-input.js.map +1 -1
  178. package/fesm2015/sd-angular-core.js +1 -0
  179. package/fesm2015/sd-angular-core.js.map +1 -1
  180. package/grid-material/sd-angular-core-grid-material.metadata.json +1 -1
  181. package/grid-material/src/lib/components/quick-action/quick-action.component.d.ts +2 -0
  182. package/grid-material/src/lib/grid-material.component.d.ts +1 -0
  183. package/grid-material/src/lib/models/grid.model.d.ts +1 -0
  184. package/input/sd-angular-core-input.metadata.json +1 -1
  185. package/input/src/lib/input.component.d.ts +5 -0
  186. package/package.json +1 -1
  187. package/public-api.d.ts +1 -0
  188. package/{sd-angular-core-0.0.1003.tgz → sd-angular-core-0.0.1007.tgz} +0 -0
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@sd-angular/core/typing"),require("@sd-angular/core/api"),require("uuid"),require("object-hash"),require("angular-csv-ext/dist/Angular-csv"),require("@sd-angular/core/notify")):"function"==typeof define&&define.amd?define("@sd-angular/core/export",["exports","@angular/core","@sd-angular/core/typing","@sd-angular/core/api","uuid","object-hash","angular-csv-ext/dist/Angular-csv","@sd-angular/core/notify"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["sd-angular"]=e["sd-angular"]||{},e["sd-angular"].core=e["sd-angular"].core||{},e["sd-angular"].core.export={}),e.ng.core,e["sd-angular"].core.typing,e["sd-angular"].core.api,e.uuid,e.hash,e.AngularCsv,e["sd-angular"].core.notify)}(this,(function(e,t,r,n,i,o,a,l){"use strict";function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=u(o),s={generateTemplate:"/excel/generateTemplate",uploadTemplate:"/excel/uploadTemplate",generateUploadTemplate:"/excel/generateUploadTemplate",export:"/excel/export",downloadByTemplate:"/excel/downloadByTemplate",filesInFolder:"/excel/filesInFolder",removeFile:"/excel/remove",sdExport:"/excel/sd-export",sdExportByTemplate:"/excel/sd-export-by-template"},f=new t.InjectionToken("export.configuration");function d(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{u(n.next(e))}catch(e){o(e)}}function l(e){try{u(n.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,l)}u((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function l(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}}Object.create;function h(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}var m,g;Object.create;function b(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}var x=function(){function e(e,t,r){var n=this;this.apiService=e,this.notifyService=t,this.configuration=r,m.set(this,(function(e,t){var r=c({folder:n.folder,userFolder:n.userFolder});return t?(r=c({folder:n.folder,group:t}),"dir1="+n.folder+"&dir2=G-"+r+"&dir3="+(e||"")):"dir1="+n.folder+"&dir2=U-"+r+"&dir3="+(e||"")})),this.generateTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i,o;return p(this,(function(a){switch(a.label){case 0:return t=this.configuration.firebaseUrl,r=""+t+s.generateTemplate,[4,this.apiService.post(r,e)];case 1:return n=a.sent(),i=n.filePath,o=n.fileName,[2,{filePath:i,fileName:o}]}}))}))},this.uploadTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i,o,a,l,u,c=this;return p(this,(function(f){switch(f.label){case 0:return t=e.key,r=e.group,n=e.validator,i=this.configuration.firebaseUrl,o=""+i+s.uploadTemplate+"?"+b(this,m).call(this,t,r),[4,this.apiService.uploadSingle(o,{extensions:["xlsx"],maxSizeInMb:.1,validator:n}).catch((function(e){throw c.notifyService.notify.warning(null==e?void 0:e.message),e}))];case 1:return a=f.sent(),l=a.filePath,u=a.fileName,[2,{filePath:l,fileName:u}]}}))}))},this.generateUploadTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i,o,a,l,u;return p(this,(function(c){switch(c.label){case 0:return t=e.key,r=e.template,n=e.group,i=this.configuration.firebaseUrl,o=""+i+s.generateUploadTemplate+"?"+b(this,m).call(this,t,n),[4,this.apiService.post(o,r)];case 1:return a=c.sent(),l=a.filePath,u=a.fileName,[2,{filePath:l,fileName:u}]}}))}))},this.removeFile=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i,o;return p(this,(function(a){switch(a.label){case 0:return t=e.key,r=e.group,n=e.fileName,i=this.configuration.firebaseUrl,o=""+i+s.removeFile+"?"+b(this,m).call(this,t,r)+"&name="+n,[4,this.apiService.post(o)];case 1:return a.sent(),[2]}}))}))},this.filesInFolder=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i,o,a;return p(this,(function(l){switch(l.label){case 0:return r=e.key,n=e.group,i=this.configuration.firebaseUrl,o=""+i+s.filesInFolder+"?"+b(this,m).call(this,r,n),[4,this.apiService.get(o)];case 1:return a=l.sent(),[2,(null===(t=a.files)||void 0===t?void 0:t.map((function(e){return{filePath:e.publicUrl,fileName:e.name}})))||[]]}}))}))},this.download=function(e,t){var r=document.createElement("a");r.download=(t||i.v4())+".xlsx",r.href=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)},this.exportByTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i,o,a,l,u;return p(this,(function(c){switch(c.label){case 0:return t=e.filePath,r=e.columns,n=e.items,i=e.fileName,o=this.configuration.firebaseUrl,a=""+o+s.sdExportByTemplate,[4,this.apiService.post(a,{filePath:t,columns:r,items:n,fileName:i},null,{responseType:"arraybuffer"})];case 1:return l=c.sent(),u=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"}),b(this,g).call(this,u,i),[2]}}))}))},this.export=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i;return p(this,(function(o){switch(o.label){case 0:return t=this.configuration.firebaseUrl,r=""+t+s.sdExport,[4,this.apiService.post(r,e,null,{responseType:"arraybuffer"})];case 1:return n=o.sent(),i=new Blob([n],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"}),b(this,g).call(this,i,null==e?void 0:e.fileName),[2]}}))}))},this.exportCSV=function(e){return d(n,void 0,void 0,(function(){var t,r,n,i,o,l,u,c,s,f;return p(this,(function(d){t=e.columns,r=e.items,n=e.fileName,i={fieldSeparator:",",quoteStrings:'"',decimalseparator:".",showLabels:!0,showTitle:!1,title:n||"CSV",useBom:!0,noDownload:!1,useHeader:!1,nullToEmptyString:!0},o={};try{for(l=h(t),u=l.next();!u.done;u=l.next())c=u.value,o[c.field]=c.title}catch(e){s={error:e}}finally{try{u&&!u.done&&(f=l.return)&&f.call(l)}finally{if(s)throw s.error}}return[2,new a.AngularCsv(y([o],r),(n||"CSV")+"_"+Date.toFormat(new Date,"yyyy-MM-dd-HH-mm-ss"),i)]}))}))},g.set(this,(function(e,t){void 0===t&&(t="Export");try{var r=window.URL.createObjectURL(e),n=document.createElement("a");t=t.replace(/.xlsx/i,""),void 0!==n.download&&(n.setAttribute("href",r),n.setAttribute("download",t+"_"+(new Date).toFormat("yyyy_MM_dd_HH_mm")),n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n))}catch(e){console.error("BlobToSaveAs error",e)}}))}return Object.defineProperty(e.prototype,"hasConfiguration",{get:function(){var e;return!!(null===(e=this.configuration)||void 0===e?void 0:e.firebaseUrl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"folder",{get:function(){var e=this.configuration.folder;return"string"==typeof e?e:e()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userFolder",{get:function(){var e=this.configuration.user;if(null==e?void 0:e.folder){var t=e.folder;return"string"==typeof t?t:t()}},enumerable:!1,configurable:!0}),e}();m=new WeakMap,g=new WeakMap,x.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new x(t.ɵɵinject(n.SdApiService),t.ɵɵinject(l.SdNotifyService),t.ɵɵinject(f,8))},token:x,providedIn:"root"}),x.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],x.ctorParameters=function(){return[{type:n.SdApiService},{type:l.SdNotifyService},{type:void 0,decorators:[{type:t.Inject,args:[f]},{type:t.Optional}]}]},e.API=s,e.EXPORT_CONFIG=f,e.SdExportService=x,Object.defineProperty(e,"__esModule",{value:!0})}));
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@sd-angular/core/typing"),require("@sd-angular/core/api"),require("uuid"),require("object-hash"),require("angular-csv-ext/dist/Angular-csv"),require("@sd-angular/core/notify")):"function"==typeof define&&define.amd?define("@sd-angular/core/export",["exports","@angular/core","@sd-angular/core/typing","@sd-angular/core/api","uuid","object-hash","angular-csv-ext/dist/Angular-csv","@sd-angular/core/notify"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self)["sd-angular"]=e["sd-angular"]||{},e["sd-angular"].core=e["sd-angular"].core||{},e["sd-angular"].core.export={}),e.ng.core,e["sd-angular"].core.typing,e["sd-angular"].core.api,e.uuid,e.hash,e.AngularCsv,e["sd-angular"].core.notify)}(this,(function(e,t,r,n,o,i,a,l){"use strict";function u(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var c=u(i),s={generateTemplate:"/excel/generateTemplate",uploadTemplate:"/excel/uploadTemplate",generateUploadTemplate:"/excel/generateUploadTemplate",export:"/excel/export",downloadByTemplate:"/excel/downloadByTemplate",filesInFolder:"/excel/filesInFolder",removeFile:"/excel/remove",sdExport:"/excel/sd-export",sdExportByTemplate:"/excel/sd-export-by-template"},f=new t.InjectionToken("export.configuration");function d(e,t,r,n){return new(r||(r=Promise))((function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function l(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,l)}u((n=n.apply(e,t||[])).next())}))}function p(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function l(i){return function(l){return function(i){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,l])}}}Object.create;function h(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,i=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=i.next()).done;)a.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return a}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(v(arguments[t]));return e}var m,b;Object.create;function g(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}var w=function(){function e(e,t,r){var n=this;this.apiService=e,this.notifyService=t,this.configuration=r,m.set(this,(function(e,t){var r=c({folder:n.folder,userFolder:n.userFolder});return t?(r=c({folder:n.folder,group:t}),"dir1="+n.folder+"&dir2=G-"+r+"&dir3="+(e||"")):"dir1="+n.folder+"&dir2=U-"+r+"&dir3="+(e||"")})),this.generateTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o,i;return p(this,(function(a){switch(a.label){case 0:return t=this.configuration.firebaseUrl,r=""+t+s.generateTemplate,[4,this.apiService.post(r,e)];case 1:return n=a.sent(),o=n.filePath,i=n.fileName,[2,{filePath:o,fileName:i}]}}))}))},this.uploadTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o,i,a,l,u,c=this;return p(this,(function(f){switch(f.label){case 0:return t=e.key,r=e.group,n=e.validator,o=this.configuration.firebaseUrl,i=""+o+s.uploadTemplate+"?"+g(this,m).call(this,t,r),[4,this.apiService.uploadSingle(i,{extensions:["xlsx"],maxSizeInMb:.1,validator:n}).catch((function(e){throw c.notifyService.notify.warning(null==e?void 0:e.message),e}))];case 1:return a=f.sent(),l=a.filePath,u=a.fileName,[2,{filePath:l,fileName:u}]}}))}))},this.generateUploadTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o,i,a,l,u;return p(this,(function(c){switch(c.label){case 0:return t=e.key,r=e.template,n=e.group,o=this.configuration.firebaseUrl,i=""+o+s.generateUploadTemplate+"?"+g(this,m).call(this,t,n),[4,this.apiService.post(i,r)];case 1:return a=c.sent(),l=a.filePath,u=a.fileName,[2,{filePath:l,fileName:u}]}}))}))},this.removeFile=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o,i;return p(this,(function(a){switch(a.label){case 0:return t=e.key,r=e.group,n=e.fileName,o=this.configuration.firebaseUrl,i=""+o+s.removeFile+"?"+g(this,m).call(this,t,r)+"&name="+n,[4,this.apiService.post(i)];case 1:return a.sent(),[2]}}))}))},this.filesInFolder=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o,i,a;return p(this,(function(l){switch(l.label){case 0:return r=e.key,n=e.group,o=this.configuration.firebaseUrl,i=""+o+s.filesInFolder+"?"+g(this,m).call(this,r,n),[4,this.apiService.get(i)];case 1:return a=l.sent(),[2,(null===(t=a.files)||void 0===t?void 0:t.map((function(e){return{filePath:e.publicUrl,fileName:e.name}})))||[]]}}))}))},this.download=function(e,t){var r=document.createElement("a");r.download=(t||o.v4())+".xlsx",r.href=e,document.body.appendChild(r),r.click(),document.body.removeChild(r)},this.exportByTemplate=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o,i,a,l,u;return p(this,(function(c){switch(c.label){case 0:return t=e.filePath,r=e.columns,n=e.items,o=e.fileName,i=this.configuration.firebaseUrl,a=""+i+s.sdExportByTemplate,[4,this.apiService.post(a,{filePath:t,columns:r,items:n,fileName:o},null,{responseType:"arraybuffer"})];case 1:return l=c.sent(),u=new Blob([l],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"}),g(this,b).call(this,u,o),[2]}}))}))},this.export=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o;return p(this,(function(i){switch(i.label){case 0:return t=this.configuration.firebaseUrl,r=""+t+s.sdExport,[4,this.apiService.post(r,e,null,{responseType:"arraybuffer"})];case 1:return n=i.sent(),o=new Blob([n],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,"}),g(this,b).call(this,o,null==e?void 0:e.fileName),[2]}}))}))},this.exportCSV=function(e){return d(n,void 0,void 0,(function(){var t,r,n,o,i,l,u,c,s,f;return p(this,(function(d){t=e.columns,r=e.items,n=e.fileName,o={fieldSeparator:",",quoteStrings:'"',decimalseparator:".",showLabels:!0,showTitle:!1,title:n||"CSV",useBom:!0,noDownload:!1,useHeader:!1,nullToEmptyString:!0},i={};try{for(l=h(t),u=l.next();!u.done;u=l.next())c=u.value,i[c.field]=c.title}catch(e){s={error:e}}finally{try{u&&!u.done&&(f=l.return)&&f.call(l)}finally{if(s)throw s.error}}return[2,new a.AngularCsv(y([i],r),(n||"CSV")+"_"+Date.toFormat(new Date,"yyyy-MM-dd-HH-mm-ss"),o)]}))}))},b.set(this,(function(e,t){void 0===t&&(t="Export");try{var r=window.URL.createObjectURL(e),n=document.createElement("a");t=t.replace(/.xlsx/i,""),void 0!==n.download&&(n.setAttribute("href",r),n.setAttribute("download",t+"_"+(new Date).toFormat("yyyy_MM_dd_HH_mm")),n.style.visibility="hidden",document.body.appendChild(n),n.click(),document.body.removeChild(n))}catch(e){console.error("BlobToSaveAs error",e)}}))}return Object.defineProperty(e.prototype,"hasConfiguration",{get:function(){var e;return!!(null===(e=this.configuration)||void 0===e?void 0:e.firebaseUrl)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"folder",{get:function(){var e=this.configuration.folder;return"string"==typeof e?e:e()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userFolder",{get:function(){var e=this.configuration.user;if(null==e?void 0:e.folder){var t=e.folder;return"string"==typeof t?t:t()}},enumerable:!1,configurable:!0}),e}();m=new WeakMap,b=new WeakMap,w.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new w(t.ɵɵinject(n.SdApiService),t.ɵɵinject(l.SdNotifyService),t.ɵɵinject(f,8))},token:w,providedIn:"root"}),w.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],w.ctorParameters=function(){return[{type:n.SdApiService},{type:l.SdNotifyService},{type:void 0,decorators:[{type:t.Inject,args:[f]},{type:t.Optional}]}]},e.API=s,e.EXPORT_CONFIG=f,e.SdExportService=w,Object.defineProperty(e,"__esModule",{value:!0})}));
2
2
  //# sourceMappingURL=sd-angular-core-export.umd.min.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../projects/sd-core/export/src/lib/export.model.ts","../../../../node_modules/tslib/tslib.es6.js","../../../../projects/sd-core/export/src/lib/export.service.ts"],"names":["API","generateTemplate","uploadTemplate","generateUploadTemplate","export","downloadByTemplate","filesInFolder","removeFile","sdExport","sdExportByTemplate","EXPORT_CONFIG","InjectionToken","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","this","n","v","op","TypeError","call","pop","length","push","Object","create","__values","o","s","m","i","__read","r","ar","error","__spread","arguments","concat","__classPrivateFieldGet","receiver","privateMap","has","get","SdExportService","apiService","notifyService","configuration","_this","_directory","set","key","group","hashedFolder","hash","folder","userFolder","template","firebaseUrl","url","post","_b","_c","filePath","fileName","args","validator","uploadSingle","extensions","maxSizeInMb","catch","err","notify","warning","message","res","_a","files","map","publicUrl","name","download","link","document","createElement","uuid.v4","href","appendChild","click","removeChild","exportByTemplate","columns","items","responseType","buffer","blob","Blob","type","_blobToSaveAs","option","exportCSV","options","fieldSeparator","quoteStrings","decimalseparator","showLabels","showTitle","title","useBom","noDownload","useHeader","nullToEmptyString","headerCSV","columns_1","columns_1_1","column","field","AngularCsv","Date","toFormat","window","URL","createObjectURL","replace","undefined","setAttribute","style","visibility","console","defineProperty","prototype","user","Injectable","providedIn","SdApiService","SdNotifyService","Inject","Optional"],"mappings":"koCA+EaA,EAAM,CACjBC,iBAAkB,0BAClBC,eAAgB,wBAChBC,uBAAwB,gCACxBC,OAAQ,gBACRC,mBAAoB,4BACpBC,cAAe,uBACfC,WAAY,gBACZC,SAAU,mBACVC,mBAAoB,gCAGTC,EAAgB,IAAIC,EAAAA,eAAqC,iCCxBtDC,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,IAAW,MAAOG,GAAKL,EAAOK,IACpF,SAASC,EAASJ,GAAS,IAAMC,EAAKN,EAAiB,MAAEK,IAAW,MAAOG,GAAKL,EAAOK,IACvF,SAASF,EAAKI,GAJlB,IAAeL,EAIaK,EAAOC,KAAOT,EAAQQ,EAAOL,QAJ1CA,EAIyDK,EAAOL,MAJhDA,aAAiBN,EAAIM,EAAQ,IAAIN,GAAE,SAAUG,GAAWA,EAAQG,OAITO,KAAKR,EAAWK,GAClGH,GAAMN,EAAYA,EAAUa,MAAMhB,EAASC,GAAc,KAAKS,oBAItDO,EAAYjB,EAASkB,GACjC,IAAsGC,EAAGC,EAAGC,EAAGC,EAA3GC,EAAI,CAAEC,MAAO,EAAGC,KAAM,WAAa,GAAW,EAAPJ,EAAE,GAAQ,MAAMA,EAAE,GAAI,OAAOA,EAAE,IAAOK,KAAM,GAAIC,IAAK,IAChG,OAAOL,EAAI,CAAEZ,KAAMkB,E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C,MAAMC,WAAa,SACxB5C,SAASlF,KAAKsF,YAAYL,GAC1BA,EAAKM,QACLL,SAASlF,KAAKwF,YAAYP,IAE5B,MAAOxF,GACPsI,QAAQ7F,MAAM,qBAAsBzC,cAtMxC+B,OAAAwG,eAAIrF,EAAAsF,UAAA,mBAAgB,KAApB,iBACE,SAA2B,QAAnBtD,EAAC5D,KAAK+B,qBAAa,IAAA6B,OAAA,EAAAA,EAAElB,8CAQ/BjC,OAAAwG,eAAYrF,EAAAsF,UAAA,SAAM,KAAlB,WACU,IAAA3E,EAAWvC,KAAK+B,cAAaQ,OACrC,MAAwB,iBAApB,EACKA,EAEFA,qCAGT9B,OAAAwG,eAAYrF,EAAAsF,UAAA,aAAU,KAAtB,WACU,IAAAC,EAASnH,KAAK+B,cAAaoF,KACnC,GAAKA,MAAAA,OAAI,EAAJA,EAAM5E,OAAX,CAGQ,IAAAA,EAAW4E,EAAI5E,OACvB,MAAwB,iBAApB,EACKA,EAEFA,gQA9BV6E,EAAAA,WAAUnE,KAAA,CAAC,CACVoE,WAAY,oDARLC,EAAAA,oBAKAC,EAAAA,gDAYJC,EAAAA,OAAMvE,KAAA,CAACrF,IAAa,CAAAqH,KAAGwC,EAAAA","sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\nexport interface ExportTemplate {\r\n fileName?: string;\r\n columns: ExportTempateColumn[];\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface ExportTempateColumn {\r\n field: string;\r\n title: string;\r\n required?: boolean;\r\n color?: string;\r\n width?: string;\r\n description?: string;\r\n}\r\n\r\nexport interface SdExportFile {\r\n fileName?: string;\r\n filePath?: string;\r\n}\r\n\r\nexport interface SdExportColumn {\r\n field: string;\r\n title: string;\r\n description?: string;\r\n width?: string;\r\n}\r\n\r\nexport interface IExportOption {\r\n columns: ExportTempateColumn[];\r\n items: any[];\r\n fileName?: string;\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface IBigExportRequest {\r\n filePath?: string;\r\n destination?: string;\r\n latestRow: number;\r\n columns: {\r\n field: string,\r\n title: string,\r\n description?: string,\r\n width?: string,\r\n }[];\r\n items: any[];\r\n}\r\n\r\nexport interface IBigExportResponse {\r\n filePath: string;\r\n destination: string;\r\n latestRow: number;\r\n}\r\n\r\nexport interface IExportConfiguration {\r\n firebaseUrl: string;\r\n folder: string | (() => string);\r\n token?: string;\r\n user?: {\r\n folder: string | (() => string);\r\n }\r\n groups?: {\r\n code: string;\r\n folder: string | (() => string);\r\n permission: GroupPermission | (() => GroupPermission);\r\n }[];\r\n}\r\n\r\nexport type GroupPermission = 'view' | 'add' | 'delete';\r\n\r\nexport const API = {\r\n generateTemplate: '/excel/generateTemplate',\r\n uploadTemplate: '/excel/uploadTemplate',\r\n generateUploadTemplate: '/excel/generateUploadTemplate',\r\n export: '/excel/export',\r\n downloadByTemplate: '/excel/downloadByTemplate',\r\n filesInFolder: '/excel/filesInFolder',\r\n removeFile: '/excel/remove',\r\n sdExport: '/excel/sd-export',\r\n sdExportByTemplate: '/excel/sd-export-by-template'\r\n};\r\n\r\nexport const EXPORT_CONFIG = new InjectionToken<IExportConfiguration>('export.configuration');\r\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { Optional } from '@angular/core';\r\nimport { Injectable, Inject } from '@angular/core';\r\nimport '@sd-angular/core/typing';\r\nimport { SdApiService } from '@sd-angular/core/api';\r\nimport * as uuid from 'uuid';\r\nimport * as hash from 'object-hash';\r\nimport { AngularCsv } from 'angular-csv-ext/dist/Angular-csv';\r\nimport { ExportTemplate, IExportConfiguration, EXPORT_CONFIG, IExportOption, API, SdExportFile } from './export.model';\r\nimport { SdNotifyService } from '@sd-angular/core/notify';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SdExportService {\r\n get hasConfiguration() {\r\n return !!this.configuration?.firebaseUrl;\r\n }\r\n constructor(\r\n private apiService: SdApiService,\r\n private notifyService: SdNotifyService,\r\n @Inject(EXPORT_CONFIG) @Optional() private configuration: IExportConfiguration) {\r\n }\r\n\r\n private get folder() {\r\n const { folder } = this.configuration;\r\n if (typeof (folder) === 'string') {\r\n return folder;\r\n }\r\n return folder();\r\n }\r\n\r\n private get userFolder() {\r\n const { user } = this.configuration;\r\n if (!user?.folder) {\r\n return;\r\n }\r\n const { folder } = user;\r\n if (typeof (folder) === 'string') {\r\n return folder;\r\n }\r\n return folder();\r\n }\r\n\r\n #directory = (key: string, group: string) => {\r\n let hashedFolder = hash({\r\n folder: this.folder,\r\n userFolder: this.userFolder\r\n });\r\n if (!group) {\r\n return `dir1=${this.folder}&dir2=U-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n hashedFolder = hash({\r\n folder: this.folder,\r\n group\r\n });\r\n return `dir1=${this.folder}&dir2=G-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n\r\n generateTemplate = async (template: ExportTemplate) => {\r\n const { firebaseUrl } = this.configuration;\r\n const { generateTemplate } = API;\r\n const url = `${firebaseUrl}${generateTemplate}`;\r\n const { filePath, fileName } = await this.apiService.post(url, template);\r\n return { filePath, fileName };\r\n }\r\n\r\n uploadTemplate = async (args: {\r\n key: string;\r\n group?: string;\r\n validator?: (fileName: string) => string\r\n }): Promise<SdExportFile> => {\r\n const { key, group, validator } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { uploadTemplate } = API;\r\n const url = `${firebaseUrl}${uploadTemplate}?${this.#directory(key, group)}`;\r\n const { filePath, fileName } = await this.apiService.uploadSingle(url, {\r\n extensions: ['xlsx'],\r\n maxSizeInMb: 0.1,\r\n validator\r\n }).catch((err: Error) => {\r\n this.notifyService.notify.warning(err?.message);\r\n throw err;\r\n });\r\n return {\r\n filePath,\r\n fileName,\r\n };\r\n }\r\n\r\n generateUploadTemplate = async (args: {\r\n key: string;\r\n template: ExportTemplate;\r\n group?: string;\r\n }) => {\r\n const { key, template, group } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { generateUploadTemplate } = API;\r\n const url = `${firebaseUrl}${generateUploadTemplate}?${this.#directory(key, group)}`;\r\n const { filePath, fileName } = await this.apiService.post(url, template);\r\n return { filePath, fileName };\r\n }\r\n\r\n removeFile = async (args: {\r\n key: string;\r\n group?: string;\r\n fileName?: string;\r\n }) => {\r\n const { key, group, fileName } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { removeFile } = API;\r\n const url = `${firebaseUrl}${removeFile}?${this.#directory(key, group)}&name=${fileName}`;\r\n await this.apiService.post(url);\r\n }\r\n\r\n filesInFolder = async (args: {\r\n key: string;\r\n group?: string;\r\n }): Promise<SdExportFile[]> => {\r\n interface FilesInFolderRes {\r\n directory: string;\r\n files: {\r\n publicUrl: string, fullPath: string, name: string\r\n }[];\r\n }\r\n const { key, group } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { filesInFolder } = API;\r\n const url = `${firebaseUrl}${filesInFolder}?${this.#directory(key, group)}`;\r\n const res = await this.apiService.get<FilesInFolderRes>(url);\r\n return res.files?.map(e => ({\r\n filePath: e.publicUrl,\r\n fileName: e.name\r\n })) || [];\r\n }\r\n\r\n download = (filePath: string, fileName?: string) => {\r\n const link: any = document.createElement('a');\r\n link.download = `${fileName || uuid.v4()}.xlsx`;\r\n link.href = filePath;\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n\r\n exportByTemplate = async (args: {\r\n filePath: string,\r\n columns: any[],\r\n items: any[],\r\n fileName?: string\r\n }) => {\r\n const { filePath, columns, items, fileName } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { sdExportByTemplate } = API;\r\n const url = `${firebaseUrl}${sdExportByTemplate}`;\r\n const buffer = await this.apiService.post(url, {\r\n filePath,\r\n columns,\r\n items,\r\n fileName\r\n }, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, fileName);\r\n }\r\n\r\n export = async (option: IExportOption) => {\r\n const { firebaseUrl } = this.configuration;\r\n const { sdExport } = API;\r\n const url = `${firebaseUrl}${sdExport}`;\r\n const buffer = await this.apiService.post(url, option, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, option?.fileName);\r\n }\r\n\r\n exportCSV = async (option: IExportOption) => {\r\n const { columns, items, fileName } = option;\r\n const options = {\r\n fieldSeparator: ',',\r\n quoteStrings: '\"',\r\n decimalseparator: '.',\r\n showLabels: true,\r\n showTitle: false,\r\n title: fileName || 'CSV',\r\n useBom: true,\r\n noDownload: false,\r\n useHeader: false,\r\n nullToEmptyString: true,\r\n };\r\n const headerCSV = {};\r\n for (const column of columns) {\r\n headerCSV[column.field] = column.title;\r\n }\r\n return new AngularCsv([...[headerCSV], ...items], `${fileName || 'CSV'}_${Date.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}`, options);\r\n }\r\n\r\n #blobToSaveAs = (blob: Blob, fileName: string = 'Export') => {\r\n try {\r\n const url = window.URL.createObjectURL(blob);\r\n const link = document.createElement('a');\r\n fileName = fileName.replace(/.xlsx/i, '');\r\n if (link.download !== undefined) { // feature detection\r\n link.setAttribute('href', url);\r\n link.setAttribute('download', `${fileName}_${new Date().toFormat('yyyy_MM_dd_HH_mm')}`);\r\n link.style.visibility = 'hidden';\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n } catch (e) {\r\n console.error('BlobToSaveAs error', e);\r\n }\r\n }\r\n}\r\n\r\nexport interface IExportInfo {\r\n data: any[];\r\n sheetName?: string;\r\n fileName?: string;\r\n}\r\n"]}
1
+ {"version":3,"sources":["../../../../projects/sd-core/export/src/lib/export.model.ts","../../../../node_modules/tslib/tslib.es6.js","../../../../projects/sd-core/export/src/lib/export.service.ts"],"names":["API","generateTemplate","uploadTemplate","generateUploadTemplate","export","downloadByTemplate","filesInFolder","removeFile","sdExport","sdExportByTemplate","EXPORT_CONFIG","InjectionToken","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","throw","return","Symbol","iterator","this","n","v","op","TypeError","call","pop","length","push","Object","create","__values","o","s","m","i","__read","r","ar","error","__spread","arguments","concat","__classPrivateFieldGet","receiver","state","kind","has","get","SdExportService","apiService","notifyService","configuration","_this","_directory","set","key","group","hashedFolder","hash","folder","userFolder","template","firebaseUrl","url","post","_b","_c","filePath","fileName","args","validator","uploadSingle","extensions","maxSizeInMb","catch","err","notify","warning","message","res","_a","files","map","publicUrl","name","download","link","document","createElement","uuid.v4","href","appendChild","click","removeChild","exportByTemplate","columns","items","responseType","buffer","blob","Blob","type","_blobToSaveAs","option","exportCSV","options","fieldSeparator","quoteStrings","decimalseparator","showLabels","showTitle","title","useBom","noDownload","useHeader","nullToEmptyString","headerCSV","columns_1","columns_1_1","column","field","AngularCsv","Date","toFormat","window","URL","createObjectURL","replace","undefined","setAttribute","style","visibility","console","defineProperty","prototype","user","Injectable","providedIn","SdApiService","SdNotifyService","Inject","Optional"],"mappings":"koCA+EaA,EAAM,CACjBC,iBAAkB,0BAClBC,eAAgB,wBAChBC,uBAAwB,gCACxBC,OAAQ,gBACRC,mBAAoB,4BACpBC,cAAe,uBACfC,WAAY,gBACZC,SAAU,mBACVC,mBAAoB,gCAGTC,EAAgB,IAAIC,EAAAA,eAAqC,iCCtBtDC,EAAUC,EAASC,EAAYC,EAAGC,GAE9C,OAAO,IAAKD,IAAMA,EAAIE,WAAU,SAAUC,EAASC,GAC/C,SAASC,EAAUC,GAAS,IAAMC,EAAKN,EAAUO,KAAKF,IA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,WACU,IAAAC,EAASpH,KAAKgC,cAAaoF,KACnC,GAAKA,MAAAA,OAAI,EAAJA,EAAM5E,OAAX,CAGQ,IAAAA,EAAW4E,EAAI5E,OACvB,MAAwB,iBAApB,EACKA,EAEFA,gQA9BV6E,EAAAA,WAAUnE,KAAA,CAAC,CACVoE,WAAY,oDARLC,EAAAA,oBAKAC,EAAAA,gDAYJC,EAAAA,OAAMvE,KAAA,CAACtF,IAAa,CAAAsH,KAAGwC,EAAAA","sourcesContent":["import { InjectionToken } from '@angular/core';\r\n\r\nexport interface ExportTemplate {\r\n fileName?: string;\r\n columns: ExportTempateColumn[];\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface ExportTempateColumn {\r\n field: string;\r\n title: string;\r\n required?: boolean;\r\n color?: string;\r\n width?: string;\r\n description?: string;\r\n}\r\n\r\nexport interface SdExportFile {\r\n fileName?: string;\r\n filePath?: string;\r\n}\r\n\r\nexport interface SdExportColumn {\r\n field: string;\r\n title: string;\r\n description?: string;\r\n width?: string;\r\n}\r\n\r\nexport interface IExportOption {\r\n columns: ExportTempateColumn[];\r\n items: any[];\r\n fileName?: string;\r\n sheets?: {\r\n name: string,\r\n items: any[],\r\n fields: string[]\r\n }[];\r\n}\r\n\r\nexport interface IBigExportRequest {\r\n filePath?: string;\r\n destination?: string;\r\n latestRow: number;\r\n columns: {\r\n field: string,\r\n title: string,\r\n description?: string,\r\n width?: string,\r\n }[];\r\n items: any[];\r\n}\r\n\r\nexport interface IBigExportResponse {\r\n filePath: string;\r\n destination: string;\r\n latestRow: number;\r\n}\r\n\r\nexport interface IExportConfiguration {\r\n firebaseUrl: string;\r\n folder: string | (() => string);\r\n token?: string;\r\n user?: {\r\n folder: string | (() => string);\r\n }\r\n groups?: {\r\n code: string;\r\n folder: string | (() => string);\r\n permission: GroupPermission | (() => GroupPermission);\r\n }[];\r\n}\r\n\r\nexport type GroupPermission = 'view' | 'add' | 'delete';\r\n\r\nexport const API = {\r\n generateTemplate: '/excel/generateTemplate',\r\n uploadTemplate: '/excel/uploadTemplate',\r\n generateUploadTemplate: '/excel/generateUploadTemplate',\r\n export: '/excel/export',\r\n downloadByTemplate: '/excel/downloadByTemplate',\r\n filesInFolder: '/excel/filesInFolder',\r\n removeFile: '/excel/remove',\r\n sdExport: '/excel/sd-export',\r\n sdExportByTemplate: '/excel/sd-export-by-template'\r\n};\r\n\r\nexport const EXPORT_CONFIG = new InjectionToken<IExportConfiguration>('export.configuration');\r\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import { Optional } from '@angular/core';\r\nimport { Injectable, Inject } from '@angular/core';\r\nimport '@sd-angular/core/typing';\r\nimport { SdApiService } from '@sd-angular/core/api';\r\nimport * as uuid from 'uuid';\r\nimport * as hash from 'object-hash';\r\nimport { AngularCsv } from 'angular-csv-ext/dist/Angular-csv';\r\nimport { ExportTemplate, IExportConfiguration, EXPORT_CONFIG, IExportOption, API, SdExportFile } from './export.model';\r\nimport { SdNotifyService } from '@sd-angular/core/notify';\r\n\r\n@Injectable({\r\n providedIn: 'root'\r\n})\r\nexport class SdExportService {\r\n get hasConfiguration() {\r\n return !!this.configuration?.firebaseUrl;\r\n }\r\n constructor(\r\n private apiService: SdApiService,\r\n private notifyService: SdNotifyService,\r\n @Inject(EXPORT_CONFIG) @Optional() private configuration: IExportConfiguration) {\r\n }\r\n\r\n private get folder() {\r\n const { folder } = this.configuration;\r\n if (typeof (folder) === 'string') {\r\n return folder;\r\n }\r\n return folder();\r\n }\r\n\r\n private get userFolder() {\r\n const { user } = this.configuration;\r\n if (!user?.folder) {\r\n return;\r\n }\r\n const { folder } = user;\r\n if (typeof (folder) === 'string') {\r\n return folder;\r\n }\r\n return folder();\r\n }\r\n\r\n #directory = (key: string, group: string) => {\r\n let hashedFolder = hash({\r\n folder: this.folder,\r\n userFolder: this.userFolder\r\n });\r\n if (!group) {\r\n return `dir1=${this.folder}&dir2=U-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n hashedFolder = hash({\r\n folder: this.folder,\r\n group\r\n });\r\n return `dir1=${this.folder}&dir2=G-${hashedFolder}&dir3=${key || ''}`;\r\n }\r\n\r\n generateTemplate = async (template: ExportTemplate) => {\r\n const { firebaseUrl } = this.configuration;\r\n const { generateTemplate } = API;\r\n const url = `${firebaseUrl}${generateTemplate}`;\r\n const { filePath, fileName } = await this.apiService.post(url, template);\r\n return { filePath, fileName };\r\n }\r\n\r\n uploadTemplate = async (args: {\r\n key: string;\r\n group?: string;\r\n validator?: (fileName: string) => string\r\n }): Promise<SdExportFile> => {\r\n const { key, group, validator } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { uploadTemplate } = API;\r\n const url = `${firebaseUrl}${uploadTemplate}?${this.#directory(key, group)}`;\r\n const { filePath, fileName } = await this.apiService.uploadSingle(url, {\r\n extensions: ['xlsx'],\r\n maxSizeInMb: 0.1,\r\n validator\r\n }).catch((err: Error) => {\r\n this.notifyService.notify.warning(err?.message);\r\n throw err;\r\n });\r\n return {\r\n filePath,\r\n fileName,\r\n };\r\n }\r\n\r\n generateUploadTemplate = async (args: {\r\n key: string;\r\n template: ExportTemplate;\r\n group?: string;\r\n }) => {\r\n const { key, template, group } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { generateUploadTemplate } = API;\r\n const url = `${firebaseUrl}${generateUploadTemplate}?${this.#directory(key, group)}`;\r\n const { filePath, fileName } = await this.apiService.post(url, template);\r\n return { filePath, fileName };\r\n }\r\n\r\n removeFile = async (args: {\r\n key: string;\r\n group?: string;\r\n fileName?: string;\r\n }) => {\r\n const { key, group, fileName } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { removeFile } = API;\r\n const url = `${firebaseUrl}${removeFile}?${this.#directory(key, group)}&name=${fileName}`;\r\n await this.apiService.post(url);\r\n }\r\n\r\n filesInFolder = async (args: {\r\n key: string;\r\n group?: string;\r\n }): Promise<SdExportFile[]> => {\r\n interface FilesInFolderRes {\r\n directory: string;\r\n files: {\r\n publicUrl: string, fullPath: string, name: string\r\n }[];\r\n }\r\n const { key, group } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { filesInFolder } = API;\r\n const url = `${firebaseUrl}${filesInFolder}?${this.#directory(key, group)}`;\r\n const res = await this.apiService.get<FilesInFolderRes>(url);\r\n return res.files?.map(e => ({\r\n filePath: e.publicUrl,\r\n fileName: e.name\r\n })) || [];\r\n }\r\n\r\n download = (filePath: string, fileName?: string) => {\r\n const link: any = document.createElement('a');\r\n link.download = `${fileName || uuid.v4()}.xlsx`;\r\n link.href = filePath;\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n\r\n exportByTemplate = async (args: {\r\n filePath: string,\r\n columns: any[],\r\n items: any[],\r\n fileName?: string\r\n }) => {\r\n const { filePath, columns, items, fileName } = args;\r\n const { firebaseUrl } = this.configuration;\r\n const { sdExportByTemplate } = API;\r\n const url = `${firebaseUrl}${sdExportByTemplate}`;\r\n const buffer = await this.apiService.post(url, {\r\n filePath,\r\n columns,\r\n items,\r\n fileName\r\n }, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, fileName);\r\n }\r\n\r\n export = async (option: IExportOption) => {\r\n const { firebaseUrl } = this.configuration;\r\n const { sdExport } = API;\r\n const url = `${firebaseUrl}${sdExport}`;\r\n const buffer = await this.apiService.post(url, option, null, {\r\n responseType: 'arraybuffer'\r\n });\r\n const blob = new Blob([buffer], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' });\r\n this.#blobToSaveAs(blob, option?.fileName);\r\n }\r\n\r\n exportCSV = async (option: IExportOption) => {\r\n const { columns, items, fileName } = option;\r\n const options = {\r\n fieldSeparator: ',',\r\n quoteStrings: '\"',\r\n decimalseparator: '.',\r\n showLabels: true,\r\n showTitle: false,\r\n title: fileName || 'CSV',\r\n useBom: true,\r\n noDownload: false,\r\n useHeader: false,\r\n nullToEmptyString: true,\r\n };\r\n const headerCSV = {};\r\n for (const column of columns) {\r\n headerCSV[column.field] = column.title;\r\n }\r\n return new AngularCsv([...[headerCSV], ...items], `${fileName || 'CSV'}_${Date.toFormat(new Date(), 'yyyy-MM-dd-HH-mm-ss')}`, options);\r\n }\r\n\r\n #blobToSaveAs = (blob: Blob, fileName: string = 'Export') => {\r\n try {\r\n const url = window.URL.createObjectURL(blob);\r\n const link = document.createElement('a');\r\n fileName = fileName.replace(/.xlsx/i, '');\r\n if (link.download !== undefined) { // feature detection\r\n link.setAttribute('href', url);\r\n link.setAttribute('download', `${fileName}_${new Date().toFormat('yyyy_MM_dd_HH_mm')}`);\r\n link.style.visibility = 'hidden';\r\n document.body.appendChild(link);\r\n link.click();\r\n document.body.removeChild(link);\r\n }\r\n } catch (e) {\r\n console.error('BlobToSaveAs error', e);\r\n }\r\n }\r\n}\r\n\r\nexport interface IExportInfo {\r\n data: any[];\r\n sheetName?: string;\r\n fileName?: string;\r\n}\r\n"]}
@@ -146,6 +146,8 @@
146
146
  return extendStatics(d, b);
147
147
  };
148
148
  function __extends(d, b) {
149
+ if (typeof b !== "function" && b !== null)
150
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
149
151
  extendStatics(d, b);
150
152
  function __() { this.constructor = d; }
151
153
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
@@ -331,11 +333,13 @@
331
333
  }
332
334
  return ar;
333
335
  }
336
+ /** @deprecated */
334
337
  function __spread() {
335
338
  for (var ar = [], i = 0; i < arguments.length; i++)
336
339
  ar = ar.concat(__read(arguments[i]));
337
340
  return ar;
338
341
  }
342
+ /** @deprecated */
339
343
  function __spreadArrays() {
340
344
  for (var s = 0, i = 0, il = arguments.length; i < il; i++)
341
345
  s += arguments[i].length;
@@ -344,7 +348,17 @@
344
348
  r[k] = a[j];
345
349
  return r;
346
350
  }
347
- ;
351
+ function __spreadArray(to, from, pack) {
352
+ if (pack || arguments.length === 2)
353
+ for (var i = 0, l = from.length, ar; i < l; i++) {
354
+ if (ar || !(i in from)) {
355
+ if (!ar)
356
+ ar = Array.prototype.slice.call(from, 0, i);
357
+ ar[i] = from[i];
358
+ }
359
+ }
360
+ return to.concat(ar || Array.prototype.slice.call(from));
361
+ }
348
362
  function __await(v) {
349
363
  return this instanceof __await ? (this.v = v, this) : new __await(v);
350
364
  }
@@ -409,18 +423,21 @@
409
423
  function __importDefault(mod) {
410
424
  return (mod && mod.__esModule) ? mod : { default: mod };
411
425
  }
412
- function __classPrivateFieldGet(receiver, privateMap) {
413
- if (!privateMap.has(receiver)) {
414
- throw new TypeError("attempted to get private field on non-instance");
415
- }
416
- return privateMap.get(receiver);
426
+ function __classPrivateFieldGet(receiver, state, kind, f) {
427
+ if (kind === "a" && !f)
428
+ throw new TypeError("Private accessor was defined without a getter");
429
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
430
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
431
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
417
432
  }
418
- function __classPrivateFieldSet(receiver, privateMap, value) {
419
- if (!privateMap.has(receiver)) {
420
- throw new TypeError("attempted to set private field on non-instance");
421
- }
422
- privateMap.set(receiver, value);
423
- return value;
433
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
434
+ if (kind === "m")
435
+ throw new TypeError("Private method is not writable");
436
+ if (kind === "a" && !f)
437
+ throw new TypeError("Private accessor was defined without a setter");
438
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
439
+ throw new TypeError("Cannot write private member to an object whose class did not declare it");
440
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
424
441
  }
425
442
 
426
443
  var DEFAULT_GRID_MATERIAL_CONFIG = {
@@ -2363,10 +2380,20 @@
2363
2380
  };
2364
2381
  this.onSelectAll = function () {
2365
2382
  var _a, _b, _c;
2366
- (_a = _this.items) === null || _a === void 0 ? void 0 : _a.forEach(function (e) { return e.isSelected = _this.isSelectAll; });
2383
+ (_a = _this.items) === null || _a === void 0 ? void 0 : _a.forEach(function (e) {
2384
+ if (e.selectable) {
2385
+ e.isSelected = _this.isSelectAll;
2386
+ }
2387
+ });
2367
2388
  (_c = (_b = _this.gridOption.selection) === null || _b === void 0 ? void 0 : _b.onSelectAll) === null || _c === void 0 ? void 0 : _c.call(_b, _this.items.filter(function (e) { return e.isSelected; }));
2368
2389
  __classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
2369
2390
  };
2391
+ this.onClearSelection = function () {
2392
+ var _a;
2393
+ _this.isSelectAll = false;
2394
+ (_a = _this.items) === null || _a === void 0 ? void 0 : _a.forEach(function (e) { return e.isSelected = false; });
2395
+ __classPrivateFieldGet(_this, _updateSelectedItems).call(_this);
2396
+ };
2370
2397
  _updateSelectedItems.set(this, function () {
2371
2398
  _this.selectedItems = _this.items.filter(function (item) { return item.isSelected; })
2372
2399
  .map(function (item) {
@@ -2643,7 +2670,7 @@
2643
2670
  SdGridMaterial.decorators = [
2644
2671
  { type: core.Component, args: [{
2645
2672
  selector: 'sd-grid-material',
2646
- template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <ng-container *ngIf=\"!gridOption.filter?.disabled\">\r\n <sd-grid-filter [filter]=\"gridOption?.filter\" [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\r\n </sd-grid-filter>\r\n </ng-container>\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"items\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <div *ngIf=\"sdSubInformation?.templateRef\" [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding\" mat-icon-button aria-label=\"Expand & Collapse\"\r\n (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\"></tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\" [class.selected]=\"row.isSelected\"\r\n [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"\r\n !gridOption.filter?.disabled && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault(true)\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [gridOption]=\"gridOption\" (export)=\"onExport($event)\"\r\n #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n</ng-container>\r\n<sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\"></sd-grid-quick-action>",
2673
+ template: "<ng-container *ngIf=\"gridConfigurationObserver | async as gridConfiguration\">\r\n <ng-container *ngIf=\"\r\n gridConfiguration\r\n | sdGridConfigurationResult\r\n : gridOption\r\n : sdSubInformation as configuration\r\n \">\r\n <ng-container *ngIf=\"!gridOption.filter?.disabled\">\r\n <sd-grid-filter [filter]=\"gridOption?.filter\" [columns]=\"configuration.firstColumns\" [filterDefs]=\"filterDefs\">\r\n </sd-grid-filter>\r\n </ng-container>\r\n <div class=\"c-container {{ gridOption?.style?.grid }}\" [ngClass]=\"{ 'mat-elevation-z2': gridOption?.shadow }\">\r\n <div class=\"c-loading\" *ngIf=\"isLoading\">\r\n <mat-spinner *ngIf=\"isLoading\"></mat-spinner>\r\n </div>\r\n <ng-container>\r\n <div class=\"c-table\" [ngStyle]=\"{\r\n 'max-height': gridOption?.maxHeight,\r\n 'min-height': gridOption?.minHeight\r\n }\">\r\n <table *ngIf=\"items?.length; else elseEmpty\" mat-table [dataSource]=\"items\" matSort\r\n [matSortDisabled]=\"!gridOption.sortable\" cdkDropList cdkDropListOrientation=\"horizontal\"\r\n [cdkDropListDisabled]=\"!gridOption.dropDragColumnEnable\"\r\n (cdkDropListDropped)=\"drop($event, configuration.displayedColumns)\" multiTemplateDataRows>\r\n <ng-container matColumnDef=\"sdSubInformation\" sticky>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\" [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <div *ngIf=\"sdSubInformation?.templateRef\" [@detailExpand]=\"item.isExpanded ? 'expanded' : 'collapsed'\">\r\n <ng-container *ngIf=\"item.isExpanded\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdSubInformation.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\" stickyEnd>\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td mat-cell *matCellDef=\"let element\">\r\n <button *ngIf=\"!element.isExpanding\" mat-icon-button aria-label=\"Expand & Collapse\"\r\n (click)=\"onExpand(element)\">\r\n <mat-icon *ngIf=\"!element.isExpanded\">expand_more</mat-icon>\r\n <mat-icon *ngIf=\"element.isExpanded\">expand_less</mat-icon>\r\n </button>\r\n <div *ngIf=\"element.isExpanding\" class=\"lds-ring\">\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n <div></div>\r\n </div>\r\n </td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"text-center px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <ng-container *ngIf=\"items | selectionVisibleSelectAll: gridOption?.selection | async\">\r\n <mat-checkbox *ngIf=\"!gridOption.selection?.single\" class=\"c-selection\" color=\"primary\"\r\n [(ngModel)]=\"isSelectAll\" (change)=\"onSelectAll()\">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </th>\r\n <td class=\"text-center px-15\" mat-cell *matCellDef=\"let item\" style=\"min-width: 50px; max-width: 50px\">\r\n <ng-container *ngIf=\"item | selectionVisible:gridOption?.selection\">\r\n <mat-checkbox class=\"c-selection\" color=\"primary\" [(ngModel)]=\"item.isSelected\"\r\n (change)=\"onSelect(item)\" [disabled]=\"\r\n selectedItems | selectionDisable: item:gridOption?.selection\r\n \">\r\n </mat-checkbox>\r\n </ng-container>\r\n\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 2px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0 position-relative\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-editor-validation [sdId]=\"item.sdId\" [item]=\"item\" [gridOption]=\"gridOption\">\r\n </sd-desktop-editor-validation>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">add</mat-icon>\r\n </button>\r\n </th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <ng-container *sdLet=\"item.editorStatus | sdEditorHandlerRow:item:gridOption as editorHandler\">\r\n <div *ngIf=\"editorHandler\" class=\"d-flex align-items-center justify-content-center\">\r\n <button *ngIf=\"editorHandler.editable\" class=\"mx-2\" (click)=\"onUpdate(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">edit</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.removable\" class=\"mx-2\" (click)=\"onRemove(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">delete</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.savable\" class=\"mx-2\" (click)=\"onSave(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">save</mat-icon>\r\n </button>\r\n <button *ngIf=\"editorHandler.cancelable\" class=\"mx-2\" (click)=\"onCancel(item)\" aria-hidden=\"true\"\r\n mat-icon-button>\r\n <mat-icon class=\"c-icon\">close</mat-icon>\r\n </button>\r\n </div>\r\n </ng-container>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8 py-8\" mat-header-cell *matHeaderCellDef style=\"width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n <td class=\"px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-command [commands]=\"gridOption.commands\" [item]=\"item\"></sd-desktop-command>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef cdkDrag class=\"px-8 py-8 c-th\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader && column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div aria-hidden=\"false\" role=\"presentation\" mat-sort-header [disabled]=\"\r\n !column.sortable || column.type === 'children-col'\r\n \" [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns; let i = index\"\r\n [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef mat-sort-header class=\"c-th px-8\"\r\n [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\" [value]=\"columnFilter[column.field]\"\r\n [columnFilter]=\"columnFilter\" [column]=\"column\" (filterChange)=\"onFilterChange()\">\r\n </sd-column-inline-filter>\r\n </div>\r\n </th>\r\n <td class=\"c-td px-8\" mat-cell *matCellDef=\"let item\">\r\n <sd-desktop-cell [sdId]=\"item.sdId\" [key]=\"key\" [value]=\"item[column.field]\" [column]=\"column\"\r\n [item]=\"item\" [idx]=\"i\" [cellDef]=\"cellDef\" [gridOption]=\"gridOption\">\r\n </sd-desktop-cell>\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef>\r\n <ng-container *ngIf=\"footerDef[column.field]\">\r\n <ng-container *ngTemplateOutlet=\"\r\n footerDef[column.field].templateRef;\r\n context: { items: items, column: column }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n </td>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\"></tr>\r\n <ng-container *ngIf=\"configuration.secondHeaders?.length\">\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n </ng-container>\r\n <tr mat-row *matRowDef=\"let row; columns: configuration.displayedColumns\" matRipple class=\"c-row\" [class.selected]=\"row.isSelected\"\r\n [style]=\"row | sdStyleRowCss:gridOption\"></tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdSubInformation']\" class=\"c-detail-row\"></tr>\r\n <ng-container *ngIf=\"hasFooter && configuration.displayedFooters?.length\">\r\n <tr mat-footer-row *matFooterRowDef=\"configuration.displayedFooters; sticky: true\"></tr>\r\n </ng-container>\r\n </table>\r\n <ng-template #elseEmpty>\r\n <table mat-table [dataSource]=\"[{}]\">\r\n <ng-container matColumnDef=\"sdSelection\" sticky>\r\n <th class=\"px-15\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditorValidation\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 4px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n </th>\r\n <td class=\"p-0\" mat-cell *matCellDef=\"let item\">\r\n </td>\r\n <td mat-footer-cell *matFooterCellDef></td>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEditor\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\">\r\n <button\r\n *ngIf=\"gridOption.editor?.addable && (!gridOption.editor.limit || gridOption.editor.limit > items.length)\"\r\n (click)=\"onCreate()\" aria-hidden=\"true\" mat-icon-button>\r\n <mat-icon class=\"c-icon\">add</mat-icon>\r\n </button>\r\n </th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdCommand\">\r\n <th class=\"px-8\" mat-header-cell *matHeaderCellDef style=\"min-width: 50px; max-width: 50px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdSubInformationAction\">\r\n <th class=\"p-0\" mat-header-cell *matHeaderCellDef style=\"width: 1px\"\r\n [attr.rowspan]=\"configuration.multipleHeader ? 2 : 1\"></th>\r\n </ng-container>\r\n <ng-container matColumnDef=\"sdEmpty\">\r\n <td class=\"c-empty\" mat-cell *matCellDef=\"let item\"\r\n [attr.colspan]=\"configuration.displayedColumns.length\">\r\n <ng-container *ngIf=\"sdEmptyData?.templateRef; else sdEmptyDataNoRef\">\r\n <ng-container *ngTemplateOutlet=\"\r\n sdEmptyData.templateRef;\r\n context: { item: item }\r\n \">\r\n </ng-container>\r\n </ng-container>\r\n <ng-template #sdEmptyDataNoRef>\r\n <mat-icon fontSet=\"material-icons-outlined\">leaderboard</mat-icon>\r\n </ng-template>\r\n </td>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.columns\" [matColumnDef]=\"column.field\"\r\n [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.firstColumns; let i = index\"\r\n [matColumnDef]=\"column.field\" [sticky]=\"configuration.fixedColumn[column.field]\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\"\r\n [ngStyle]=\"{ 'min-width': configuration.firstColumns[i].width }\" [attr.rowspan]=\"\r\n configuration.multipleHeader &&\r\n column.type !== 'children-col'\r\n ? 2\r\n : 1\r\n \" [attr.colspan]=\"\r\n column.type === 'children-col' ? column.children?.length : 1\r\n \">\r\n <div>\r\n <div [innerHTML]=\"configuration.firstColumns[i].titleHtml || configuration.firstColumns[i].title\">\r\n </div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <ng-container *ngFor=\"let column of configuration.secondColumns\" [matColumnDef]=\"column.field\">\r\n <th mat-header-cell *matHeaderCellDef class=\"c-th px-8 py-8\" [ngStyle]=\"{ 'min-width': column.width }\">\r\n <div>\r\n <div [innerHTML]=\"column.titleHtml || column.title\"></div>\r\n <sd-column-inline-filter *ngIf=\"gridOption.filter?.inlineColumn\"\r\n [value]=\"columnFilter[column.field]\" [columnFilter]=\"columnFilter\" [column]=\"column\"\r\n (filterChange)=\"onFilterChange()\"></sd-column-inline-filter>\r\n </div>\r\n </th>\r\n </ng-container>\r\n <tr class=\"c-first-header\" mat-header-row *matHeaderRowDef=\"configuration.firstHeaders; sticky: true\">\r\n </tr>\r\n <tr class=\"c-second-header\" mat-header-row *matHeaderRowDef=\"configuration.secondHeaders; sticky: true\">\r\n </tr>\r\n <tr mat-row *matRowDef=\"let row; columns: ['sdEmpty']\"></tr>\r\n </table>\r\n </ng-template>\r\n </div>\r\n </ng-container>\r\n <div class=\"c-paginator\">\r\n <div class=\"c-action\">\r\n <sd-button *ngIf=\"\r\n !gridOption.filter?.disabled && !gridOption.filter?.inlineColumn\r\n \" class=\"mr-10\" [title]=\"'Filter' | sdTranslate\" icon=\"filter_alt\" size=\"sm\" (action)=\"gridFilter.open()\"\r\n type=\"link\">\r\n </sd-button>\r\n <sd-button *ngIf=\"gridOption.reload?.visible\" class=\"mr-10\" [title]=\"'Reload' | sdTranslate\" icon=\"refresh\"\r\n size=\"sm\" (action)=\"reload()\" [disabled]=\"!items?.length\" type=\"link\">\r\n </sd-button>\r\n <ng-container *ngIf=\"gridOption.export?.visible && items?.length\">\r\n <ng-container *ngIf=\"isExporting; else unExporting\">\r\n <sd-button class=\"mr-10\" [loading]=\"isExporting\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\"\r\n size=\"sm\" type=\"link\">\r\n </sd-button>\r\n </ng-container>\r\n <ng-template #unExporting>\r\n <sd-button class=\"mr-10\" [title]=\"exportTitle | sdTranslate\" icon=\"get_app\" size=\"sm\"\r\n [matMenuTriggerFor]=\"menu\" type=\"link\">\r\n </sd-button>\r\n </ng-template>\r\n\r\n <mat-menu #menu=\"matMenu\">\r\n <button *ngIf=\"gridOption.export?.visibleExcel !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export excel\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.visibleCSV !== false\" mat-menu-item\r\n (click)=\"sdPopupExport.exportDefault(true)\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">file_download</mat-icon>\r\n <span> {{ \"Export CSV\" | sdTranslate }}</span>\r\n </button>\r\n <button *ngIf=\"gridOption.export?.key\" mat-menu-item (click)=\"sdPopupExport.open()\" type=\"button\">\r\n <mat-icon fontSet=\"material-icons-outlined\">settings</mat-icon>\r\n <span> {{ \"Configure\" | sdTranslate }}</span>\r\n </button>\r\n </mat-menu>\r\n </ng-container>\r\n <sd-button *ngIf=\"gridOption.config?.visible\" class=\"mr-10\" [title]=\"'Configure' | sdTranslate\"\r\n icon=\"settings\" size=\"sm\" (action)=\"popupGridConfiguration.open()\" type=\"link\">\r\n </sd-button>\r\n </div>\r\n <mat-paginator [class.d-none]=\"gridOption.paginate?.hidden\" [length]=\"total\"\r\n [pageSize]=\"gridOption.paginate?.pageSize\" [pageSizeOptions]=\"gridOption.paginate?.pages\"\r\n [showFirstLastButtons]=\"gridOption.paginate?.showFirstLastButtons\"></mat-paginator>\r\n </div>\r\n </div>\r\n <sd-popup-export *ngIf=\"gridOption.export?.visible\" [gridOption]=\"gridOption\" (export)=\"onExport($event)\"\r\n #sdPopupExport>\r\n </sd-popup-export>\r\n <sd-popup-grid-configuration [gridOption]=\"gridOption\" [key]=\"key\" #popupGridConfiguration>\r\n </sd-popup-grid-configuration>\r\n </ng-container>\r\n</ng-container>\r\n<sd-grid-quick-action [gridOption]=\"gridOption\" [selectedItems]=\"selectedItems\" (clear)=\"onClearSelection()\"></sd-grid-quick-action>",
2647
2674
  animations: [
2648
2675
  animations.trigger('detailExpand', [
2649
2676
  animations.state('collapsed', animations.style({ height: '0', minHeight: '0', visibility: 'hidden' })),
@@ -3482,9 +3509,11 @@
3482
3509
  var disabled = selection.disabled, actions = selection.actions;
3483
3510
  if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
3484
3511
  if (!disabled) {
3512
+ rowData.selectable = true;
3485
3513
  return false;
3486
3514
  }
3487
- return disabled(rowData, selectedItems);
3515
+ rowData.selectable = !disabled(rowData, selectedItems);
3516
+ return !rowData.selectable;
3488
3517
  }
3489
3518
  // Lọc các action theo selectedItems hiện tại
3490
3519
  var availableActions = actions.filter(function (action) {
@@ -4045,7 +4074,8 @@
4045
4074
  var actions = selection.actions;
4046
4075
  rowData.actions = rowData.actions || [];
4047
4076
  if (!(actions === null || actions === void 0 ? void 0 : actions.length)) {
4048
- return true;
4077
+ rowData.selectable = true;
4078
+ return rowData.selectable;
4049
4079
  }
4050
4080
  try {
4051
4081
  for (var actions_1 = __values(actions), actions_1_1 = actions_1.next(); !actions_1_1.done; actions_1_1 = actions_1.next()) {
@@ -4101,7 +4131,8 @@
4101
4131
  }
4102
4132
  finally { if (e_1) throw e_1.error; }
4103
4133
  }
4104
- return !!rowData.actions.length;
4134
+ rowData.selectable = !!rowData.actions.length;
4135
+ return rowData.selectable;
4105
4136
  };
4106
4137
  }
4107
4138
  return SdSelectionVisiblePipe;
@@ -4132,7 +4163,10 @@
4132
4163
 
4133
4164
  var SdGridQuickAction = /** @class */ (function () {
4134
4165
  function SdGridQuickAction() {
4166
+ var _this = this;
4167
+ this.clear = new core.EventEmitter();
4135
4168
  this.onClear = function () {
4169
+ _this.clear.emit();
4136
4170
  };
4137
4171
  }
4138
4172
  return SdGridQuickAction;
@@ -4140,7 +4174,7 @@
4140
4174
  SdGridQuickAction.decorators = [
4141
4175
  { type: core.Component, args: [{
4142
4176
  selector: 'sd-grid-quick-action',
4143
- template: "<sd-quick-action *ngIf=\"selectedItems | selectionActionFilter: gridOption?.selection?.actions as actions\"\r\n [isOpened]=\"actions?.length\">\r\n <div class=\"d-flex align-items-center\" sdMessage>\r\n <div class=\"c-bg-length\">\r\n <span class=\"c-length\">{{ selectedItems.length }}</span>\r\n </div>\r\n <div class=\"c-message\">{{ gridOption?.selection?.message || (\"selected items\" | sdTranslate) }}</div>\r\n </div>\r\n <div class=\"d-flex align-items-center mr-8\" sdAction>\r\n <ng-container *ngFor=\"let action of actions\">\r\n <sd-button *ngIf=\"action.click\" class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" (action)=\"action.click(selectedItems)\"></sd-button>\r\n <ng-container *ngIf=\"action.children?.length\">\r\n <sd-button class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon || 'more_vert'\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" [matMenuTriggerFor]=\"menu\">\r\n </sd-button>\r\n <mat-menu #menu=\"matMenu\">\r\n <span>\r\n <button *ngFor=\"let childAction of action.children\" mat-menu-item (click)=\"childAction.click(selectedItems)\"\r\n [disabled]=\"childAction.disabled\">\r\n <mat-icon [fontSet]=\"childAction.fontSet\" class=\"c-icon\">{{ childAction.icon }}\r\n </mat-icon>\r\n <span> {{ childAction.title }}</span>\r\n </button>\r\n </span>\r\n </mat-menu>\r\n </ng-container>\r\n </ng-container>\r\n <sd-button class=\"ml-5\" icon=\"close\" color=\"secondary\" type=\"outline\" size=\"sm\"\r\n (action)=\"onClear()\"></sd-button>\r\n </div>\r\n</sd-quick-action>",
4177
+ template: "<sd-quick-action *ngIf=\"selectedItems | selectionActionFilter: gridOption?.selection?.actions as actions\"\r\n [isOpened]=\"actions?.length\">\r\n <div class=\"d-flex align-items-center\" sdMessage>\r\n <div class=\"c-bg-length\">\r\n <span class=\"c-length\">{{ selectedItems.length }}</span>\r\n </div>\r\n <div class=\"c-message\">{{ gridOption?.selection?.message || (\"selected items\" | sdTranslate) }}</div>\r\n </div>\r\n <div class=\"d-flex align-items-center mr-8\" sdAction>\r\n <ng-container *ngFor=\"let action of actions\">\r\n <sd-button *ngIf=\"action.click\" class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" (action)=\"action.click(selectedItems)\"></sd-button>\r\n <ng-container *ngIf=\"action.children?.length\">\r\n <sd-button class=\"ml-5\" [tooltip]=\"action.tooltip\" [icon]=\"action.icon || 'more_vert'\"\r\n [color]=\"action.color || 'secondary'\" [type]=\"action.type || 'light'\" [fontSet]=\"action.fontSet\"\r\n [title]=\"action.title\" size=\"sm\" [matMenuTriggerFor]=\"menu\">\r\n </sd-button>\r\n <mat-menu #menu=\"matMenu\">\r\n <span>\r\n <button *ngFor=\"let childAction of action.children\" mat-menu-item (click)=\"childAction.click(selectedItems)\"\r\n [disabled]=\"childAction.disabled\">\r\n <mat-icon [fontSet]=\"childAction.fontSet\" class=\"c-icon\">{{ childAction.icon }}\r\n </mat-icon>\r\n <span> {{ childAction.title }}</span>\r\n </button>\r\n </span>\r\n </mat-menu>\r\n </ng-container>\r\n </ng-container>\r\n <sd-button class=\"ml-5\" icon=\"close\" color=\"secondary\" type=\"outline\" size=\"sm\"\r\n (action)=\"onClear()\" width=\"35px\"></sd-button>\r\n </div>\r\n</sd-quick-action>",
4144
4178
  changeDetection: core.ChangeDetectionStrategy.OnPush,
4145
4179
  styles: [".c-bg-length{align-items:flex-start;background:#2962ff;border-radius:4px 0 0 4px;display:flex;flex-direction:column;height:48px;left:0;padding:12px 8px;position:static;top:0;width:48px}.c-bg-length .c-length{color:#fff;font-size:16px;font-weight:500;height:24px;left:8px;line-height:24px;text-align:center;top:12px;width:32px}.c-bg-length .c-length,.c-message{font-family:Roboto;font-style:normal;position:static}.c-message{color:#000;font-size:14px;font-weight:400;height:20px;left:0;line-height:20px;margin:0 0 0 16px;min-width:200px;top:6px}"]
4146
4180
  },] }
@@ -4148,7 +4182,8 @@
4148
4182
  SdGridQuickAction.ctorParameters = function () { return []; };
4149
4183
  SdGridQuickAction.propDecorators = {
4150
4184
  gridOption: [{ type: core.Input }],
4151
- selectedItems: [{ type: core.Input }]
4185
+ selectedItems: [{ type: core.Input }],
4186
+ clear: [{ type: core.Output }]
4152
4187
  };
4153
4188
 
4154
4189
  var MatPaginatorIntlCro = /** @class */ (function (_super) {