qms-angular 1.0.86 → 1.0.89

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 (289) hide show
  1. package/README.md +5 -1
  2. package/bundles/qms-angular.umd.js +6943 -219
  3. package/bundles/qms-angular.umd.js.map +1 -1
  4. package/esm2015/lib/components/badges/qms-badges.component.js +1 -1
  5. package/esm2015/lib/components/banner/qms-banner/qms-banner.component.js +1 -1
  6. package/esm2015/lib/components/banner/qms-banner-confirm/qms-banner-confirm.component.js +1 -1
  7. package/esm2015/lib/components/banner/qms-banner-loading/qms-banner-loading.component.js +1 -1
  8. package/esm2015/lib/components/button/button-toggle.js +1 -1
  9. package/esm2015/lib/components/button/button.js +3 -3
  10. package/esm2015/lib/components/comment/comment.js +6 -3
  11. package/esm2015/lib/components/dialog/dialog.js +2 -2
  12. package/esm2015/lib/components/list/list.js +2 -2
  13. package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +3 -3
  14. package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +16 -7
  15. package/esm2015/lib/components/related/content/related-content.component.js +2 -2
  16. package/esm2015/lib/components/related/list-other-related/list-related.component.js +1 -1
  17. package/esm2015/lib/components/related/risk/list/list.component.js +1 -1
  18. package/esm2015/lib/components/related/risk/result/result.component.js +1 -1
  19. package/esm2015/lib/components/rich-text/rich-text.js +1 -1
  20. package/esm2015/lib/components/table/table-action.js +2 -2
  21. package/esm2015/lib/components/table/table.module.js +4 -4
  22. package/esm2015/lib/components/tooltip/tooltip.js +1 -1
  23. package/esm2015/lib/components/tree/tree.component.js +1 -1
  24. package/esm2015/lib/components/treeNew/tree.component.js +18 -2
  25. package/esm2015/lib/directives/file-upload/file-upload-multiple-selector.directive.js +3 -1
  26. package/esm2015/lib/directives/file-upload/file-upload-selector.directive.js +3 -1
  27. package/esm2015/lib/directives/file-upload/file-upload.directive.js +1 -1
  28. package/esm2015/lib/directives/text-truncate/text-truncate.directive.js +58 -0
  29. package/esm2015/lib/model/en.js +63 -2
  30. package/esm2015/lib/model/no.js +63 -2
  31. package/esm2015/lib/qms-angular.module.js +4 -1
  32. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/halo.function.js +87 -0
  33. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.js +3767 -0
  34. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/selection.function.js +56 -0
  35. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.js +1003 -0
  36. package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.js +302 -0
  37. package/esm2015/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.js +320 -0
  38. package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.js +69 -0
  39. package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.js +412 -0
  40. package/esm2015/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.js +80 -0
  41. package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +34 -1
  42. package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.js +1 -1
  43. package/esm2015/lib/qms-ckeditor-components/common/module/confirm/qms-ckeditor-confirm.component.js +3 -3
  44. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +1 -1
  45. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +2 -2
  46. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.js +2 -2
  47. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.js +317 -0
  48. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +3 -3
  49. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/attachments/link-attachment.component.js +3 -3
  50. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +3 -3
  51. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-load-template/qms-ckeditor-load-template.component.js +3 -3
  52. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-relation/qmsckeditor-related.component.js +3 -3
  53. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-template/qms-ckeditor-template.component.js +3 -3
  54. package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +3 -3
  55. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +35 -3
  56. package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +4 -2
  57. package/esm2015/public-api.js +8 -1
  58. package/esm2015/qms-angular.js +2 -1
  59. package/fesm2015/qms-angular.js +6882 -213
  60. package/fesm2015/qms-angular.js.map +1 -1
  61. package/lib/components/comment/comment.d.ts +1 -0
  62. package/lib/components/qms-paginator/qms-paginator.component.d.ts +1 -0
  63. package/lib/components/treeNew/tree.component.d.ts +1 -0
  64. package/lib/directives/text-truncate/text-truncate.directive.d.ts +15 -0
  65. package/lib/model/en.d.ts +61 -0
  66. package/lib/model/no.d.ts +61 -0
  67. package/lib/qms-ckeditor-components/common/flowchart/config/halo.function.d.ts +37 -0
  68. package/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.d.ts +7 -0
  69. package/lib/qms-ckeditor-components/common/flowchart/config/selection.function.d.ts +39 -0
  70. package/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.d.ts +11 -0
  71. package/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.d.ts +224 -0
  72. package/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.d.ts +58 -0
  73. package/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.d.ts +16 -0
  74. package/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.d.ts +56 -0
  75. package/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.d.ts +35 -0
  76. package/lib/qms-ckeditor-components/common/functions/common.function.d.ts +12 -0
  77. package/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.d.ts +2 -0
  78. package/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.d.ts +41 -0
  79. package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +4 -0
  80. package/lib.theme.scss +179 -0
  81. package/package.json +1 -1
  82. package/public-api.d.ts +7 -0
  83. package/qms-angular.d.ts +1 -0
  84. package/qms-angular.metadata.json +1 -1
  85. package/src/assets/fonts/Material/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 +0 -0
  86. package/src/assets/fonts/Material/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUce.woff2 +0 -0
  87. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFUZ0bbck.woff2 +0 -0
  88. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVZ0b.woff2 +0 -0
  89. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVp0bbck.woff2 +0 -0
  90. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFW50bbck.woff2 +0 -0
  91. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWJ0bbck.woff2 +0 -0
  92. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWZ0bbck.woff2 +0 -0
  93. package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWp0bbck.woff2 +0 -0
  94. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCFPrEHJA.woff2 +0 -0
  95. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCGPrEHJA.woff2 +0 -0
  96. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCHPrEHJA.woff2 +0 -0
  97. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrE.woff2 +0 -0
  98. package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCMPrEHJA.woff2 +0 -0
  99. package/src/assets/jointjs/images/delete-icon-modern.png +0 -0
  100. package/src/assets/jointjs/images/reset-icon-modern.png +0 -0
  101. package/src/assets/jointjs/images/save-icon-modern.png +0 -0
  102. package/src/assets/jointjs/images/to-front-icon-modern.png +0 -0
  103. package/src/assets/jointjs/images/toback-icon-modern.png +0 -0
  104. package/src/assets/jointjs/images/toolbar-icons-material.png +0 -0
  105. package/src/assets/jointjs/images/toolbar-icons-modern.png +0 -0
  106. package/src/assets/jointjs/scss/rappid.scss +326 -0
  107. package/src/assets/jointjs/scss/theme-picker.scss +22 -0
  108. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
  109. package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
  110. package/src/assets/qms-ckeditor-plugin/build/translations/ar.js +1 -1
  111. package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
  112. package/src/assets/qms-ckeditor-plugin/build/translations/bg.js +1 -1
  113. package/src/assets/qms-ckeditor-plugin/build/translations/ca.js +1 -1
  114. package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
  115. package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
  116. package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
  117. package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
  118. package/src/assets/qms-ckeditor-plugin/build/translations/el.js +1 -1
  119. package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
  120. package/src/assets/qms-ckeditor-plugin/build/translations/en-gb.js +1 -1
  121. package/src/assets/qms-ckeditor-plugin/build/translations/eo.js +1 -1
  122. package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
  123. package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
  124. package/src/assets/qms-ckeditor-plugin/build/translations/eu.js +1 -1
  125. package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
  126. package/src/assets/qms-ckeditor-plugin/build/translations/fi.js +1 -1
  127. package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
  128. package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
  129. package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
  130. package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
  131. package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
  132. package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
  133. package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
  134. package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
  135. package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
  136. package/src/assets/qms-ckeditor-plugin/build/translations/km.js +1 -1
  137. package/src/assets/qms-ckeditor-plugin/build/translations/kn.js +1 -1
  138. package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
  139. package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
  140. package/src/assets/qms-ckeditor-plugin/build/translations/lt.js +1 -1
  141. package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
  142. package/src/assets/qms-ckeditor-plugin/build/translations/nb.js +1 -1
  143. package/src/assets/qms-ckeditor-plugin/build/translations/ne.js +1 -1
  144. package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
  145. package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
  146. package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
  147. package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
  148. package/src/assets/qms-ckeditor-plugin/build/translations/pt.js +1 -1
  149. package/src/assets/qms-ckeditor-plugin/build/translations/ro.js +1 -1
  150. package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
  151. package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
  152. package/src/assets/qms-ckeditor-plugin/build/translations/sl.js +1 -1
  153. package/src/assets/qms-ckeditor-plugin/build/translations/sq.js +1 -1
  154. package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
  155. package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
  156. package/src/assets/qms-ckeditor-plugin/build/translations/sv.js +1 -1
  157. package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
  158. package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
  159. package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
  160. package/src/assets/qms-ckeditor-plugin/build/translations/ug.js +1 -1
  161. package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
  162. package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
  163. package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
  164. package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
  165. package/src/assets/qms-ckeditor-plugin/package-lock.json +12632 -345
  166. package/src/assets/qms-ckeditor-plugin/package.json +0 -2
  167. package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +8 -8
  168. package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +9 -0
  169. package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/flowchartdialogcommand.js +47 -0
  170. package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/qmsCKEditorFlowchartPlugin.js +30 -0
  171. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/heading.js +119 -0
  172. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingbuttonsui.js +103 -0
  173. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingcommand.js +96 -0
  174. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingediting.js +163 -0
  175. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +115 -0
  176. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/index.js +22 -0
  177. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/heading.css +35 -0
  178. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading1.svg +1 -0
  179. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading2.svg +1 -0
  180. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading3.svg +1 -0
  181. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading4.svg +1 -0
  182. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading5.svg +1 -0
  183. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading6.svg +1 -0
  184. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/title.js +598 -0
  185. package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +42 -0
  186. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertcolumncommand.js +83 -0
  187. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertrowcommand.js +82 -0
  188. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/inserttablecommand.js +76 -0
  189. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellcommand.js +272 -0
  190. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellscommand.js +122 -0
  191. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removecolumncommand.js +122 -0
  192. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removerowcommand.js +97 -0
  193. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectcolumncommand.js +63 -0
  194. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectrowcommand.js +56 -0
  195. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheadercolumncommand.js +95 -0
  196. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheaderrowcommand.js +105 -0
  197. package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/splitcellcommand.js +68 -0
  198. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/downcast.js +529 -0
  199. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-paragraph-post-fixer.js +136 -0
  200. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-refresh-post-fixer.js +75 -0
  201. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-heading-rows-refresh-post-fixer.js +55 -0
  202. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-layout-post-fixer.js +399 -0
  203. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/tableproperties.js +126 -0
  204. package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/upcasttable.js +211 -0
  205. package/src/assets/qms-ckeditor-plugin/src/plugins/table/index.js +42 -0
  206. package/src/assets/qms-ckeditor-plugin/src/plugins/table/table.js +103 -0
  207. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +35 -0
  208. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbordercolorcommand.js +47 -0
  209. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderstylecommand.js +47 -0
  210. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderwidthcommand.js +62 -0
  211. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellheightcommand.js +51 -0
  212. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +35 -0
  213. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpaddingcommand.js +62 -0
  214. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpropertycommand.js +110 -0
  215. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellverticalalignmentcommand.js +43 -0
  216. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellwidthcommand.js +51 -0
  217. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesediting.js +204 -0
  218. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesui.js +401 -0
  219. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/ui/tablecellpropertiesview.js +829 -0
  220. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties.js +80 -0
  221. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableclipboard.js +586 -0
  222. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableediting.js +160 -0
  223. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablekeyboard.js +343 -0
  224. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse/mouseeventsobserver.js +72 -0
  225. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse.js +218 -0
  226. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablealignmentcommand.js +35 -0
  227. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebackgroundcolorcommand.js +35 -0
  228. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebordercolorcommand.js +47 -0
  229. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderstylecommand.js +47 -0
  230. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderwidthcommand.js +62 -0
  231. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableheightcommand.js +51 -0
  232. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablepropertycommand.js +98 -0
  233. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablewidthcommand.js +51 -0
  234. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesediting.js +182 -0
  235. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesui.js +397 -0
  236. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/ui/tablepropertiesview.js +714 -0
  237. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties.js +81 -0
  238. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableselection.js +357 -0
  239. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tabletoolbar.js +111 -0
  240. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableui.js +359 -0
  241. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableutils.js +909 -0
  242. package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablewalker.js +538 -0
  243. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/colorinput.css +39 -0
  244. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/form.css +11 -0
  245. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/formrow.css +23 -0
  246. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-cell-properties.svg +1 -0
  247. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-column.svg +1 -0
  248. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-merge-cell.svg +1 -0
  249. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-properties.svg +1 -0
  250. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-row.svg +1 -0
  251. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table.svg +1 -0
  252. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/inserttable.css +10 -0
  253. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/snippet.css +3876 -0
  254. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/table.css +67 -0
  255. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecaption.css +53 -0
  256. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecellproperties.css +28 -0
  257. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableediting.css +10 -0
  258. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableform.css +59 -0
  259. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableproperties.css +18 -0
  260. package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableselection.css +10 -0
  261. package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/colorinputview.js +343 -0
  262. package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/formrowview.js +103 -0
  263. package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/inserttableview.js +222 -0
  264. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/common.js +57 -0
  265. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/selection.js +276 -0
  266. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/structure.js +543 -0
  267. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/table-properties.js +66 -0
  268. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/contextualballoon.js +130 -0
  269. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/table-properties.js +397 -0
  270. package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/widget.js +62 -0
  271. package/src/assets/qms-ckeditor-plugin/src/themes/icons/flowchart.svg +507 -0
  272. package/src/lib/components/comment/comment.scss +1 -0
  273. package/src/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.scss +1 -0
  274. package/src/lib/components/qms-paginator/qms-paginator.component.scss +4 -1
  275. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon1.svg +1 -0
  276. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon2.svg +6 -0
  277. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon3.svg +11 -0
  278. package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon4.svg +8 -0
  279. package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-female.png +0 -0
  280. package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-male.png +0 -0
  281. package/src/lib/qms-ckeditor-components/common/flowchart/assets/no-color-icon.svg +72 -0
  282. package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-material.png +0 -0
  283. package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-modern.png +0 -0
  284. package/src/lib/qms-ckeditor-components/common/flowchart/assets/transparent-icon.svg +50 -0
  285. package/src/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.scss +68 -0
  286. package/src/lib/qms-ckeditor-components/styles/_modules.scss +9 -0
  287. package/src/themes/core/_mat-icon.scss +60 -60
  288. package/src/themes/core/_table.scss +72 -4
  289. package/src/themes/core/_typography.scss +108 -108
@@ -0,0 +1,80 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module table/tablecellproperties
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+ import TableCellPropertiesUI from './tablecellproperties/tablecellpropertiesui';
12
+ import TableCellPropertiesEditing from './tablecellproperties/tablecellpropertiesediting';
13
+
14
+ /**
15
+ * The table cell properties feature. Enables support for setting properties of table cells (size, border, background, etc.).
16
+ *
17
+ * Read more in the {@glink features/table#table-and-cell-styling-tools Table and cell styling tools} section.
18
+ * See also the {@link module:table/tableproperties~TableProperties} plugin.
19
+ *
20
+ * This is a "glue" plugin that loads the
21
+ * {@link module:table/tablecellproperties/tablecellpropertiesediting~TableCellPropertiesEditing table cell properties editing feature} and
22
+ * the {@link module:table/tablecellproperties/tablecellpropertiesui~TableCellPropertiesUI table cell properties UI feature}.
23
+ *
24
+ * @extends module:core/plugin~Plugin
25
+ */
26
+ export default class TableCellProperties extends Plugin {
27
+ /**
28
+ * @inheritDoc
29
+ */
30
+ static get pluginName() {
31
+ return 'TableCellProperties';
32
+ }
33
+
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static get requires() {
38
+ return [ TableCellPropertiesEditing, TableCellPropertiesUI ];
39
+ }
40
+ }
41
+
42
+ /**
43
+ * The configuration of the table cell properties user interface (balloon). It allows to define:
44
+ *
45
+ * * The color palette for the cell border color style field (`tableCellProperties.borderColors`),
46
+ * * The color palette for the cell background style field (`tableCellProperties.backgroundColors`).
47
+ *
48
+ * const tableConfig = {
49
+ * tableCellProperties: {
50
+ * borderColors: [
51
+ * {
52
+ * color: 'hsl(0, 0%, 90%)',
53
+ * label: 'Light grey'
54
+ * },
55
+ * // ...
56
+ * ],
57
+ * backgroundColors: [
58
+ * {
59
+ * color: 'hsl(120, 75%, 60%)',
60
+ * label: 'Green'
61
+ * },
62
+ * // ...
63
+ * ]
64
+ * }
65
+ * };
66
+ *
67
+ * **Note**: The configurations do not impact the data loaded into the editor,
68
+ * i.e. they do not limit or filter the colors in the data. They are used only in the user interface
69
+ * allowing users to pick colors in a more convenient way.
70
+ *
71
+ * The default color palettes for the cell background and the cell border are the same
72
+ * ({@link module:table/utils/ui/table-properties~defaultColors check out their content}).
73
+ *
74
+ * Both color palette configurations must follow the
75
+ * {@link module:table/table~TableColorConfig table color configuration format}.
76
+ *
77
+ * Read more about configuring the table feature in {@link module:table/table~TableConfig}.
78
+ *
79
+ * @member {Object} module:table/table~TableConfig#tableCellProperties
80
+ */
@@ -0,0 +1,586 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module table/tableclipboard
8
+ */
9
+
10
+ import { Plugin } from 'ckeditor5/src/core';
11
+
12
+ import TableSelection from './tableselection';
13
+ import TableWalker from './tablewalker';
14
+ import TableUtils from './tableutils';
15
+ import { getColumnIndexes, getRowIndexes, getSelectionAffectedTableCells, isSelectionRectangular, sortRanges } from './utils/selection';
16
+ import {
17
+ cropTableToDimensions,
18
+ getHorizontallyOverlappingCells,
19
+ getVerticallyOverlappingCells,
20
+ removeEmptyRowsColumns,
21
+ splitHorizontally,
22
+ splitVertically,
23
+ trimTableCellIfNeeded,
24
+ adjustLastRowIndex,
25
+ adjustLastColumnIndex
26
+ } from './utils/structure';
27
+
28
+ /**
29
+ * This plugin adds support for copying/cutting/pasting fragments of tables.
30
+ * It is loaded automatically by the {@link module:table/table~Table} plugin.
31
+ *
32
+ * @extends module:core/plugin~Plugin
33
+ */
34
+ export default class TableClipboard extends Plugin {
35
+ /**
36
+ * @inheritDoc
37
+ */
38
+ static get pluginName() {
39
+ return 'TableClipboard';
40
+ }
41
+
42
+ /**
43
+ * @inheritDoc
44
+ */
45
+ static get requires() {
46
+ return [ TableSelection, TableUtils ];
47
+ }
48
+
49
+ /**
50
+ * @inheritDoc
51
+ */
52
+ init() {
53
+ const editor = this.editor;
54
+ const viewDocument = editor.editing.view.document;
55
+
56
+ this.listenTo( viewDocument, 'copy', ( evt, data ) => this._onCopyCut( evt, data ) );
57
+ this.listenTo( viewDocument, 'cut', ( evt, data ) => this._onCopyCut( evt, data ) );
58
+ this.listenTo( editor.model, 'insertContent', ( evt, args ) => this._onInsertContent( evt, ...args ), { priority: 'high' } );
59
+
60
+ this.decorate( '_replaceTableSlotCell' );
61
+ }
62
+
63
+ /**
64
+ * Copies table content to a clipboard on "copy" & "cut" events.
65
+ *
66
+ * @private
67
+ * @param {module:utils/eventinfo~EventInfo} evt An object containing information about the handled event.
68
+ * @param {Object} data Clipboard event data.
69
+ */
70
+ _onCopyCut( evt, data ) {
71
+ const tableSelection = this.editor.plugins.get( TableSelection );
72
+
73
+ if ( !tableSelection.getSelectedTableCells() ) {
74
+ return;
75
+ }
76
+
77
+ if ( evt.name == 'cut' && this.editor.isReadOnly ) {
78
+ return;
79
+ }
80
+
81
+ data.preventDefault();
82
+ evt.stop();
83
+
84
+ const dataController = this.editor.data;
85
+ const viewDocument = this.editor.editing.view.document;
86
+
87
+ const content = dataController.toView( tableSelection.getSelectionAsFragment() );
88
+
89
+ viewDocument.fire( 'clipboardOutput', {
90
+ dataTransfer: data.dataTransfer,
91
+ content,
92
+ method: evt.name
93
+ } );
94
+ }
95
+
96
+ /**
97
+ * Overrides default {@link module:engine/model/model~Model#insertContent `model.insertContent()`} method to handle pasting table inside
98
+ * selected table fragment.
99
+ *
100
+ * Depending on selected table fragment:
101
+ * - If a selected table fragment is smaller than paste table it will crop pasted table to match dimensions.
102
+ * - If dimensions are equal it will replace selected table fragment with a pasted table contents.
103
+ *
104
+ * @private
105
+ * @param evt
106
+ * @param {module:engine/model/documentfragment~DocumentFragment|module:engine/model/item~Item} content The content to insert.
107
+ * @param {module:engine/model/selection~Selectable} [selectable=model.document.selection]
108
+ * The selection into which the content should be inserted. If not provided the current model document selection will be used.
109
+ */
110
+ _onInsertContent( evt, content, selectable ) {
111
+ if ( selectable && !selectable.is( 'documentSelection' ) ) {
112
+ return;
113
+ }
114
+
115
+ const model = this.editor.model;
116
+ const tableUtils = this.editor.plugins.get( TableUtils );
117
+
118
+ // We might need to crop table before inserting so reference might change.
119
+ let pastedTable = getTableIfOnlyTableInContent( content, model );
120
+
121
+ if ( !pastedTable ) {
122
+ return;
123
+ }
124
+
125
+ const selectedTableCells = getSelectionAffectedTableCells( model.document.selection );
126
+
127
+ if ( !selectedTableCells.length ) {
128
+ removeEmptyRowsColumns( pastedTable, tableUtils );
129
+
130
+ return;
131
+ }
132
+
133
+ // Override default model.insertContent() handling at this point.
134
+ evt.stop();
135
+
136
+ model.change( writer => {
137
+ const pastedDimensions = {
138
+ width: tableUtils.getColumns( pastedTable ),
139
+ height: tableUtils.getRows( pastedTable )
140
+ };
141
+
142
+ // Prepare the table for pasting.
143
+ const selection = prepareTableForPasting( selectedTableCells, pastedDimensions, writer, tableUtils );
144
+
145
+ // Beyond this point we operate on a fixed content table with rectangular selection and proper last row/column values.
146
+
147
+ const selectionHeight = selection.lastRow - selection.firstRow + 1;
148
+ const selectionWidth = selection.lastColumn - selection.firstColumn + 1;
149
+
150
+ // Crop pasted table if:
151
+ // - Pasted table dimensions exceeds selection area.
152
+ // - Pasted table has broken layout (ie some cells sticks out by the table dimensions established by the first and last row).
153
+ //
154
+ // Note: The table dimensions are established by the width of the first row and the total number of rows.
155
+ // It is possible to programmatically create a table that has rows which would have cells anchored beyond first row width but
156
+ // such table will not be created by other editing solutions.
157
+ const cropDimensions = {
158
+ startRow: 0,
159
+ startColumn: 0,
160
+ endRow: Math.min( selectionHeight, pastedDimensions.height ) - 1,
161
+ endColumn: Math.min( selectionWidth, pastedDimensions.width ) - 1
162
+ };
163
+
164
+ pastedTable = cropTableToDimensions( pastedTable, cropDimensions, writer );
165
+
166
+ // Content table to which we insert a pasted table.
167
+ const selectedTable = selectedTableCells[ 0 ].findAncestor( 'table' );
168
+
169
+ const cellsToSelect = this._replaceSelectedCellsWithPasted( pastedTable, pastedDimensions, selectedTable, selection, writer );
170
+
171
+ if ( this.editor.plugins.get( 'TableSelection' ).isEnabled ) {
172
+ // Selection ranges must be sorted because the first and last selection ranges are considered
173
+ // as anchor/focus cell ranges for multi-cell selection.
174
+ const selectionRanges = sortRanges( cellsToSelect.map( cell => writer.createRangeOn( cell ) ) );
175
+
176
+ writer.setSelection( selectionRanges );
177
+ } else {
178
+ // Set selection inside first cell if multi-cell selection is disabled.
179
+ writer.setSelection( cellsToSelect[ 0 ], 0 );
180
+ }
181
+ } );
182
+ }
183
+
184
+ /**
185
+ * Replaces the part of selectedTable with pastedTable.
186
+ *
187
+ * @private
188
+ * @param {module:engine/model/element~Element} pastedTable
189
+ * @param {Object} pastedDimensions
190
+ * @param {Number} pastedDimensions.height
191
+ * @param {Number} pastedDimensions.width
192
+ * @param {module:engine/model/element~Element} selectedTable
193
+ * @param {Object} selection
194
+ * @param {Number} selection.firstColumn
195
+ * @param {Number} selection.firstRow
196
+ * @param {Number} selection.lastColumn
197
+ * @param {Number} selection.lastRow
198
+ * @param {module:engine/model/writer~Writer} writer
199
+ * @returns {Array.<module:engine/model/element~Element>}
200
+ */
201
+ _replaceSelectedCellsWithPasted( pastedTable, pastedDimensions, selectedTable, selection, writer ) {
202
+ const { width: pastedWidth, height: pastedHeight } = pastedDimensions;
203
+
204
+ // Holds two-dimensional array that is addressed by [ row ][ column ] that stores cells anchored at given location.
205
+ const pastedTableLocationMap = createLocationMap( pastedTable, pastedWidth, pastedHeight );
206
+
207
+ const selectedTableMap = [ ...new TableWalker( selectedTable, {
208
+ startRow: selection.firstRow,
209
+ endRow: selection.lastRow,
210
+ startColumn: selection.firstColumn,
211
+ endColumn: selection.lastColumn,
212
+ includeAllSlots: true
213
+ } ) ];
214
+
215
+ // Selection must be set to pasted cells (some might be removed or new created).
216
+ const cellsToSelect = [];
217
+
218
+ // Store next cell insert position.
219
+ let insertPosition;
220
+
221
+ // Content table replace cells algorithm iterates over a selected table fragment and:
222
+ //
223
+ // - Removes existing table cells at current slot (location).
224
+ // - Inserts cell from a pasted table for a matched slots.
225
+ //
226
+ // This ensures proper table geometry after the paste
227
+ for ( const tableSlot of selectedTableMap ) {
228
+ const { row, column } = tableSlot;
229
+
230
+ // Save the insert position for current row start.
231
+ if ( column === selection.firstColumn ) {
232
+ insertPosition = tableSlot.getPositionBefore();
233
+ }
234
+
235
+ // Map current table slot location to an pasted table slot location.
236
+ const pastedRow = row - selection.firstRow;
237
+ const pastedColumn = column - selection.firstColumn;
238
+ const pastedCell = pastedTableLocationMap[ pastedRow % pastedHeight ][ pastedColumn % pastedWidth ];
239
+
240
+ // Clone cell to insert (to duplicate its attributes and children).
241
+ // Cloning is required to support repeating pasted table content when inserting to a bigger selection.
242
+ const cellToInsert = pastedCell ? writer.cloneElement( pastedCell ) : null;
243
+
244
+ // Replace the cell from the current slot with new table cell.
245
+ const newTableCell = this._replaceTableSlotCell( tableSlot, cellToInsert, insertPosition, writer );
246
+
247
+ // The cell was only removed.
248
+ if ( !newTableCell ) {
249
+ continue;
250
+ }
251
+
252
+ // Trim the cell if it's row/col-spans would exceed selection area.
253
+ trimTableCellIfNeeded( newTableCell, row, column, selection.lastRow, selection.lastColumn, writer );
254
+
255
+ cellsToSelect.push( newTableCell );
256
+
257
+ insertPosition = writer.createPositionAfter( newTableCell );
258
+ }
259
+
260
+ // If there are any headings, all the cells that overlap from heading must be splitted.
261
+ const headingRows = parseInt( selectedTable.getAttribute( 'headingRows' ) || 0 );
262
+ const headingColumns = parseInt( selectedTable.getAttribute( 'headingColumns' ) || 0 );
263
+
264
+ const areHeadingRowsIntersectingSelection = selection.firstRow < headingRows && headingRows <= selection.lastRow;
265
+ const areHeadingColumnsIntersectingSelection = selection.firstColumn < headingColumns && headingColumns <= selection.lastColumn;
266
+
267
+ if ( areHeadingRowsIntersectingSelection ) {
268
+ const columnsLimit = { first: selection.firstColumn, last: selection.lastColumn };
269
+ const newCells = doHorizontalSplit( selectedTable, headingRows, columnsLimit, writer, selection.firstRow );
270
+
271
+ cellsToSelect.push( ...newCells );
272
+ }
273
+
274
+ if ( areHeadingColumnsIntersectingSelection ) {
275
+ const rowsLimit = { first: selection.firstRow, last: selection.lastRow };
276
+ const newCells = doVerticalSplit( selectedTable, headingColumns, rowsLimit, writer );
277
+
278
+ cellsToSelect.push( ...newCells );
279
+ }
280
+
281
+ return cellsToSelect;
282
+ }
283
+
284
+ /**
285
+ * Replaces a single table slot.
286
+ *
287
+ * @private
288
+ * @param {module:table/tablewalker~TableSlot} tableSlot
289
+ * @param {module:engine/model/element~Element} cellToInsert
290
+ * @param {module:engine/model/position~Position} insertPosition
291
+ * @param {module:engine/model/writer~Writer} writer
292
+ * @returns {module:engine/model/element~Element|null} Inserted table cell or null if slot should remain empty.
293
+ */
294
+ _replaceTableSlotCell( tableSlot, cellToInsert, insertPosition, writer ) {
295
+ const { cell, isAnchor } = tableSlot;
296
+
297
+ // If the slot is occupied by a cell in a selected table - remove it.
298
+ // The slot of this cell will be either:
299
+ // - Replaced by a pasted table cell.
300
+ // - Spanned by a previously pasted table cell.
301
+ if ( isAnchor ) {
302
+ writer.remove( cell );
303
+ }
304
+
305
+ // There is no cell to insert (might be spanned by other cell in a pasted table) - advance to the next content table slot.
306
+ if ( !cellToInsert ) {
307
+ return null;
308
+ }
309
+
310
+ writer.insert( cellToInsert, insertPosition );
311
+
312
+ return cellToInsert;
313
+ }
314
+ }
315
+
316
+ /**
317
+ * Extract table for pasting into table.
318
+ *
319
+ * @private
320
+ * @param {module:engine/model/documentfragment~DocumentFragment|module:engine/model/item~Item} content The content to insert.
321
+ * @param {module:engine/model/model~Model} model The editor model.
322
+ * @returns {module:engine/model/element~Element|null}
323
+ */
324
+ export function getTableIfOnlyTableInContent( content, model ) {
325
+ if ( !content.is( 'documentFragment' ) && !content.is( 'element' ) ) {
326
+ return null;
327
+ }
328
+
329
+ // Table passed directly.
330
+ if ( content.is( 'element', 'table' ) ) {
331
+ return content;
332
+ }
333
+
334
+ // We do not support mixed content when pasting table into table.
335
+ // See: https://github.com/ckeditor/ckeditor5/issues/6817.
336
+ if ( content.childCount == 1 && content.getChild( 0 ).is( 'element', 'table' ) ) {
337
+ return content.getChild( 0 );
338
+ }
339
+
340
+ // If there are only whitespaces around a table then use that table for pasting.
341
+
342
+ const contentRange = model.createRangeIn( content );
343
+
344
+ for ( const element of contentRange.getItems() ) {
345
+ if ( element.is( 'element', 'table' ) ) {
346
+ // Stop checking if there is some content before table.
347
+ const rangeBefore = model.createRange( contentRange.start, model.createPositionBefore( element ) );
348
+
349
+ if ( model.hasContent( rangeBefore, { ignoreWhitespaces: true } ) ) {
350
+ return null;
351
+ }
352
+
353
+ // Stop checking if there is some content after table.
354
+ const rangeAfter = model.createRange( model.createPositionAfter( element ), contentRange.end );
355
+
356
+ if ( model.hasContent( rangeAfter, { ignoreWhitespaces: true } ) ) {
357
+ return null;
358
+ }
359
+
360
+ // There wasn't any content neither before nor after.
361
+ return element;
362
+ }
363
+ }
364
+
365
+ return null;
366
+ }
367
+
368
+ // Prepares a table for pasting and returns adjusted selection dimensions.
369
+ //
370
+ // @param {Array.<module:engine/model/element~Element>} selectedTableCells
371
+ // @param {Object} pastedDimensions
372
+ // @param {Number} pastedDimensions.height
373
+ // @param {Number} pastedDimensions.width
374
+ // @param {module:engine/model/writer~Writer} writer
375
+ // @param {module:table/tableutils~TableUtils} tableUtils
376
+ // @returns {Object} selection
377
+ // @returns {Number} selection.firstColumn
378
+ // @returns {Number} selection.firstRow
379
+ // @returns {Number} selection.lastColumn
380
+ // @returns {Number} selection.lastRow
381
+ function prepareTableForPasting( selectedTableCells, pastedDimensions, writer, tableUtils ) {
382
+ const selectedTable = selectedTableCells[ 0 ].findAncestor( 'table' );
383
+
384
+ const columnIndexes = getColumnIndexes( selectedTableCells );
385
+ const rowIndexes = getRowIndexes( selectedTableCells );
386
+
387
+ const selection = {
388
+ firstColumn: columnIndexes.first,
389
+ lastColumn: columnIndexes.last,
390
+ firstRow: rowIndexes.first,
391
+ lastRow: rowIndexes.last
392
+ };
393
+
394
+ // Single cell selected - expand selection to pasted table dimensions.
395
+ const shouldExpandSelection = selectedTableCells.length === 1;
396
+
397
+ if ( shouldExpandSelection ) {
398
+ selection.lastRow += pastedDimensions.height - 1;
399
+ selection.lastColumn += pastedDimensions.width - 1;
400
+
401
+ expandTableSize( selectedTable, selection.lastRow + 1, selection.lastColumn + 1, tableUtils );
402
+ }
403
+
404
+ // In case of expanding selection we do not reset the selection so in this case we will always try to fix selection
405
+ // like in the case of a non-rectangular area. This might be fixed by re-setting selected cells array but this shortcut is safe.
406
+ if ( shouldExpandSelection || !isSelectionRectangular( selectedTableCells, tableUtils ) ) {
407
+ // For a non-rectangular selection (ie in which some cells sticks out from a virtual selection rectangle) we need to create
408
+ // a table layout that has a rectangular selection. This will split cells so the selection become rectangular.
409
+ // Beyond this point we will operate on fixed content table.
410
+ splitCellsToRectangularSelection( selectedTable, selection, writer );
411
+ }
412
+ // However a selected table fragment might be invalid if examined alone. Ie such table fragment:
413
+ //
414
+ // +---+---+---+---+
415
+ // 0 | a | b | c | d |
416
+ // + + +---+---+
417
+ // 1 | | e | f | g |
418
+ // + +---+ +---+
419
+ // 2 | | h | | i | <- last row, each cell has rowspan = 2,
420
+ // + + + + + so we need to return 3, not 2
421
+ // 3 | | | | |
422
+ // +---+---+---+---+
423
+ //
424
+ // is invalid as the cells "h" and "i" have rowspans.
425
+ // This case needs only adjusting the selection dimension as the rest of the algorithm operates on empty slots also.
426
+ else {
427
+ selection.lastRow = adjustLastRowIndex( selectedTable, selection );
428
+ selection.lastColumn = adjustLastColumnIndex( selectedTable, selection );
429
+ }
430
+
431
+ return selection;
432
+ }
433
+
434
+ // Expand table (in place) to expected size.
435
+ function expandTableSize( table, expectedHeight, expectedWidth, tableUtils ) {
436
+ const tableWidth = tableUtils.getColumns( table );
437
+ const tableHeight = tableUtils.getRows( table );
438
+
439
+ if ( expectedWidth > tableWidth ) {
440
+ tableUtils.insertColumns( table, {
441
+ at: tableWidth,
442
+ columns: expectedWidth - tableWidth
443
+ } );
444
+ }
445
+
446
+ if ( expectedHeight > tableHeight ) {
447
+ tableUtils.insertRows( table, {
448
+ at: tableHeight,
449
+ rows: expectedHeight - tableHeight
450
+ } );
451
+ }
452
+ }
453
+
454
+ // Returns two-dimensional array that is addressed by [ row ][ column ] that stores cells anchored at given location.
455
+ //
456
+ // At given row & column location it might be one of:
457
+ //
458
+ // * cell - cell from pasted table anchored at this location.
459
+ // * null - if no cell is anchored at this location.
460
+ //
461
+ // For instance, from a table below:
462
+ //
463
+ // +----+----+----+----+
464
+ // | 00 | 01 | 02 | 03 |
465
+ // + +----+----+----+
466
+ // | | 11 | 13 |
467
+ // +----+ +----+
468
+ // | 20 | | 23 |
469
+ // +----+----+----+----+
470
+ //
471
+ // The method will return an array (numbers represents cell element):
472
+ //
473
+ // const map = [
474
+ // [ '00', '01', '02', '03' ],
475
+ // [ null, '11', null, '13' ],
476
+ // [ '20', null, null, '23' ]
477
+ // ]
478
+ //
479
+ // This allows for a quick access to table at give row & column. For instance to access table cell "13" from pasted table call:
480
+ //
481
+ // const cell = map[ 1 ][ 3 ]
482
+ //
483
+ function createLocationMap( table, width, height ) {
484
+ // Create height x width (row x column) two-dimensional table to store cells.
485
+ const map = new Array( height ).fill( null )
486
+ .map( () => new Array( width ).fill( null ) );
487
+
488
+ for ( const { column, row, cell } of new TableWalker( table ) ) {
489
+ map[ row ][ column ] = cell;
490
+ }
491
+
492
+ return map;
493
+ }
494
+
495
+ // Make selected cells rectangular by splitting the cells that stand out from a rectangular selection.
496
+ //
497
+ // In the table below a selection is shown with "::" and slots with anchor cells are named.
498
+ //
499
+ // +----+----+----+----+----+ +----+----+----+----+----+
500
+ // | 00 | 01 | 02 | 03 | | 00 | 01 | 02 | 03 |
501
+ // + +----+ +----+----+ | ::::::::::::::::----+
502
+ // | | 11 | | 13 | 14 | | ::11 | | 13:: 14 | <- first row
503
+ // +----+----+ + +----+ +----::---| | ::----+
504
+ // | 20 | 21 | | | 24 | select cells: | 20 ::21 | | :: 24 |
505
+ // +----+----+ +----+----+ 11 -> 33 +----::---| |---::----+
506
+ // | 30 | | 33 | 34 | | 30 :: | | 33:: 34 | <- last row
507
+ // + + +----+ + | :::::::::::::::: +
508
+ // | | | 43 | | | | | 43 | |
509
+ // +----+----+----+----+----+ +----+----+----+----+----+
510
+ // ^ ^
511
+ // first & last columns
512
+ //
513
+ // Will update table to:
514
+ //
515
+ // +----+----+----+----+----+
516
+ // | 00 | 01 | 02 | 03 |
517
+ // + +----+----+----+----+
518
+ // | | 11 | | 13 | 14 |
519
+ // +----+----+ + +----+
520
+ // | 20 | 21 | | | 24 |
521
+ // +----+----+ +----+----+
522
+ // | 30 | | | 33 | 34 |
523
+ // + +----+----+----+ +
524
+ // | | | | 43 | |
525
+ // +----+----+----+----+----+
526
+ //
527
+ // In th example above:
528
+ // - Cell "02" which have `rowspan = 4` must be trimmed at first and at after last row.
529
+ // - Cell "03" which have `rowspan = 2` and `colspan = 2` must be trimmed at first column and after last row.
530
+ // - Cells "00", "03" & "30" which cannot be cut by this algorithm as they are outside the trimmed area.
531
+ // - Cell "13" cannot be cut as it is inside the trimmed area.
532
+ function splitCellsToRectangularSelection( table, dimensions, writer ) {
533
+ const { firstRow, lastRow, firstColumn, lastColumn } = dimensions;
534
+
535
+ const rowIndexes = { first: firstRow, last: lastRow };
536
+ const columnIndexes = { first: firstColumn, last: lastColumn };
537
+
538
+ // 1. Split cells vertically in two steps as first step might create cells that needs to split again.
539
+ doVerticalSplit( table, firstColumn, rowIndexes, writer );
540
+ doVerticalSplit( table, lastColumn + 1, rowIndexes, writer );
541
+
542
+ // 2. Split cells horizontally in two steps as first step might create cells that needs to split again.
543
+ doHorizontalSplit( table, firstRow, columnIndexes, writer );
544
+ doHorizontalSplit( table, lastRow + 1, columnIndexes, writer, firstRow );
545
+ }
546
+
547
+ function doHorizontalSplit( table, splitRow, limitColumns, writer, startRow = 0 ) {
548
+ // If selection starts at first row then no split is needed.
549
+ if ( splitRow < 1 ) {
550
+ return;
551
+ }
552
+
553
+ const overlappingCells = getVerticallyOverlappingCells( table, splitRow, startRow );
554
+
555
+ // Filter out cells that are not touching insides of the rectangular selection.
556
+ const cellsToSplit = overlappingCells.filter( ( { column, cellWidth } ) => isAffectedBySelection( column, cellWidth, limitColumns ) );
557
+
558
+ return cellsToSplit.map( ( { cell } ) => splitHorizontally( cell, splitRow, writer ) );
559
+ }
560
+
561
+ function doVerticalSplit( table, splitColumn, limitRows, writer ) {
562
+ // If selection starts at first column then no split is needed.
563
+ if ( splitColumn < 1 ) {
564
+ return;
565
+ }
566
+
567
+ const overlappingCells = getHorizontallyOverlappingCells( table, splitColumn );
568
+
569
+ // Filter out cells that are not touching insides of the rectangular selection.
570
+ const cellsToSplit = overlappingCells.filter( ( { row, cellHeight } ) => isAffectedBySelection( row, cellHeight, limitRows ) );
571
+
572
+ return cellsToSplit.map( ( { cell, column } ) => splitVertically( cell, column, splitColumn, writer ) );
573
+ }
574
+
575
+ // Checks if cell at given row (column) is affected by a rectangular selection defined by first/last column (row).
576
+ //
577
+ // The same check is used for row as for column.
578
+ function isAffectedBySelection( index, span, limit ) {
579
+ const endIndex = index + span - 1;
580
+ const { first, last } = limit;
581
+
582
+ const isInsideSelection = index >= first && index <= last;
583
+ const overlapsSelectionFromOutside = index < first && endIndex >= first;
584
+
585
+ return isInsideSelection || overlapsSelectionFromOutside;
586
+ }