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,75 @@
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/converters/table-cell-refresh-post-fixer
8
+ */
9
+
10
+ import { isSingleParagraphWithoutAttributes } from './downcast';
11
+
12
+ /**
13
+ * Injects a table cell post-fixer into the model which marks the table cell in the differ to have it re-rendered.
14
+ *
15
+ * Model `paragraph` inside a table cell can be rendered as `<span>` or `<p>`. It is rendered as `<span>` if this is the only block
16
+ * element in that table cell and it does not have any attributes. It is rendered as `<p>` otherwise.
17
+ *
18
+ * When table cell content changes, for example a second `paragraph` element is added, we need to ensure that the first `paragraph` is
19
+ * re-rendered so it changes from `<span>` to `<p>`. The easiest way to do it is to re-render the entire table cell.
20
+ *
21
+ * @param {module:engine/model/model~Model} model
22
+ * @param {module:engine/conversion/mapper~Mapper} mapper
23
+ */
24
+ export default function injectTableCellRefreshPostFixer( model, mapper ) {
25
+ model.document.registerPostFixer( () => tableCellRefreshPostFixer( model.document.differ, mapper ) );
26
+ }
27
+
28
+ function tableCellRefreshPostFixer( differ, mapper ) {
29
+ // Stores cells to be refreshed, so the table cell will be refreshed once for multiple changes.
30
+
31
+ // 1. Gather all changes inside table cell.
32
+ const cellsToCheck = new Set();
33
+
34
+ for ( const change of differ.getChanges() ) {
35
+ const parent = change.type == 'attribute' ? change.range.start.parent : change.position.parent;
36
+
37
+ if ( parent.is( 'element', 'tableCell' ) ) {
38
+ cellsToCheck.add( parent );
39
+ }
40
+ }
41
+
42
+ // @if CK_DEBUG_TABLE // console.log( `Post-fixing table: Checking table cell to refresh (${ cellsToCheck.size }).` );
43
+ // @if CK_DEBUG_TABLE // let paragraphsRefreshed = 0;
44
+
45
+ for ( const tableCell of cellsToCheck.values() ) {
46
+ for ( const paragraph of [ ...tableCell.getChildren() ].filter( child => shouldRefresh( child, mapper ) ) ) {
47
+ // @if CK_DEBUG_TABLE // console.log( `Post-fixing table: refreshing paragraph in table cell (${++paragraphsRefreshed}).` );
48
+ differ.refreshItem( paragraph );
49
+ }
50
+ }
51
+
52
+ // Always return false to prevent the refresh post-fixer from re-running on the same set of changes and going into an infinite loop.
53
+ // This "post-fixer" does not change the model structure so there shouldn't be need to run other post-fixers again.
54
+ // See https://github.com/ckeditor/ckeditor5/issues/1936 & https://github.com/ckeditor/ckeditor5/issues/8200.
55
+ return false;
56
+ }
57
+
58
+ // Check if given model element needs refreshing.
59
+ //
60
+ // @param {module:engine/model/element~Element} modelElement
61
+ // @param {module:engine/conversion/mapper~Mapper} mapper
62
+ // @returns {Boolean}
63
+ function shouldRefresh( child, mapper ) {
64
+ if ( !child.is( 'element', 'paragraph' ) ) {
65
+ return false;
66
+ }
67
+
68
+ const viewElement = mapper.toViewElement( child );
69
+
70
+ if ( !viewElement ) {
71
+ return false;
72
+ }
73
+
74
+ return isSingleParagraphWithoutAttributes( child ) !== viewElement.is( 'element', 'span' );
75
+ }
@@ -0,0 +1,55 @@
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/converters/table-heading-rows-refresh-post-fixer
8
+ */
9
+
10
+ /**
11
+ * Injects a table post-fixer into the model which marks the table in the differ to have it re-rendered.
12
+ *
13
+ * Table heading rows are represented in the model by a `headingRows` attribute. However, in the view, it's represented as separate
14
+ * sections of the table (`<thead>` or `<tbody>`) and changing `headingRows` attribute requires moving table rows between two sections.
15
+ * This causes problems with structural changes in a table (like adding and removing rows) thus atomic converters cannot be used.
16
+ *
17
+ * When table `headingRows` attribute changes, the entire table is re-rendered.
18
+ *
19
+ * @param {module:engine/model/model~Model} model
20
+ */
21
+ export default function injectTableHeadingRowsRefreshPostFixer( model ) {
22
+ model.document.registerPostFixer( () => tableHeadingRowsRefreshPostFixer( model ) );
23
+ }
24
+
25
+ function tableHeadingRowsRefreshPostFixer( model ) {
26
+ const differ = model.document.differ;
27
+
28
+ // Stores tables to be refreshed so the table will be refreshed once for multiple changes.
29
+ const tablesToRefresh = new Set();
30
+
31
+ for ( const change of differ.getChanges() ) {
32
+ if ( change.type != 'attribute' ) {
33
+ continue;
34
+ }
35
+
36
+ const element = change.range.start.nodeAfter;
37
+
38
+ if ( element && element.is( 'element', 'table' ) && change.attributeKey == 'headingRows' ) {
39
+ tablesToRefresh.add( element );
40
+ }
41
+ }
42
+
43
+ if ( tablesToRefresh.size ) {
44
+ // @if CK_DEBUG_TABLE // console.log( `Post-fixing table: refreshing heading rows (${ tablesToRefresh.size }).` );
45
+
46
+ for ( const table of tablesToRefresh.values() ) {
47
+ // Should be handled by a `triggerBy` configuration. See: https://github.com/ckeditor/ckeditor5/issues/8138.
48
+ differ.refreshItem( table );
49
+ }
50
+
51
+ return true;
52
+ }
53
+
54
+ return false;
55
+ }
@@ -0,0 +1,399 @@
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/converters/table-layout-post-fixer
8
+ */
9
+
10
+ import TableWalker from './../tablewalker';
11
+ import { createEmptyTableCell, updateNumericAttribute } from '../utils/common';
12
+
13
+ /**
14
+ * Injects a table layout post-fixer into the model.
15
+ *
16
+ * The role of the table layout post-fixer is to ensure that the table rows have the correct structure
17
+ * after a {@link module:engine/model/model~Model#change `change()`} block was executed.
18
+ *
19
+ * The correct structure means that:
20
+ *
21
+ * * All table rows have the same size.
22
+ * * None of the table cells extend vertically beyond their section (either header or body).
23
+ * * A table cell has always at least one element as a child.
24
+ *
25
+ * If the table structure is not correct, the post-fixer will automatically correct it in two steps:
26
+ *
27
+ * 1. It will clip table cells that extend beyond their section.
28
+ * 2. It will add empty table cells to the rows that are narrower than the widest table row.
29
+ *
30
+ * ## Clipping overlapping table cells
31
+ *
32
+ * Such situation may occur when pasting a table (or a part of a table) to the editor from external sources.
33
+ *
34
+ * For example, see the following table which has a cell (FOO) with the rowspan attribute (2):
35
+ *
36
+ * <table headingRows="1">
37
+ * <tableRow>
38
+ * <tableCell rowspan="2"><paragraph>FOO</paragraph></tableCell>
39
+ * <tableCell colspan="2"><paragraph>BAR</paragraph></tableCell>
40
+ * </tableRow>
41
+ * <tableRow>
42
+ * <tableCell><paragraph>BAZ</paragraph></tableCell>
43
+ * <tableCell><paragraph>XYZ</paragraph></tableCell>
44
+ * </tableRow>
45
+ * </table>
46
+ *
47
+ * It will be rendered in the view as:
48
+ *
49
+ * <table>
50
+ * <thead>
51
+ * <tr>
52
+ * <td rowspan="2">FOO</td>
53
+ * <td colspan="2">BAR</td>
54
+ * </tr>
55
+ * </thead>
56
+ * <tbody>
57
+ * <tr>
58
+ * <td>BAZ</td>
59
+ * <td>XYZ</td>
60
+ * </tr>
61
+ * </tbody>
62
+ * </table>
63
+ *
64
+ * In the above example the table will be rendered as a table with two rows: one in the header and second one in the body.
65
+ * The table cell (FOO) cannot span over multiple rows as it would extend from the header to the body section.
66
+ * The `rowspan` attribute must be changed to (1). The value (1) is the default value of the `rowspan` attribute
67
+ * so the `rowspan` attribute will be removed from the model.
68
+ *
69
+ * The table cell with BAZ in the content will be in the first column of the table.
70
+ *
71
+ * ## Adding missing table cells
72
+ *
73
+ * The table post-fixer will insert empty table cells to equalize table row sizes (the number of columns).
74
+ * The size of a table row is calculated by counting column spans of table cells, both horizontal (from the same row) and
75
+ * vertical (from the rows above).
76
+ *
77
+ * In the above example, the table row in the body section of the table is narrower then the row from the header: it has two cells
78
+ * with the default colspan (1). The header row has one cell with colspan (1) and the second with colspan (2).
79
+ * The table cell (FOO) does not extend beyond the head section (and as such will be fixed in the first step of this post-fixer).
80
+ * The post-fixer will add a missing table cell to the row in the body section of the table.
81
+ *
82
+ * The table from the above example will be fixed and rendered to the view as below:
83
+ *
84
+ * <table>
85
+ * <thead>
86
+ * <tr>
87
+ * <td rowspan="2">FOO</td>
88
+ * <td colspan="2">BAR</td>
89
+ * </tr>
90
+ * </thead>
91
+ * <tbody>
92
+ * <tr>
93
+ * <td>BAZ</td>
94
+ * <td>XYZ</td>
95
+ * </tr>
96
+ * </tbody>
97
+ * </table>
98
+ *
99
+ * ## Collaboration and undo - Expectations vs post-fixer results
100
+ *
101
+ * The table post-fixer only ensures proper structure without a deeper analysis of the nature of the change. As such, it might lead
102
+ * to a structure which was not intended by the user. In particular, it will also fix undo steps (in conjunction with collaboration)
103
+ * in which the editor content might not return to the original state.
104
+ *
105
+ * This will usually happen when one or more users change the size of the table.
106
+ *
107
+ * As an example see the table below:
108
+ *
109
+ * <table>
110
+ * <tbody>
111
+ * <tr>
112
+ * <td>11</td>
113
+ * <td>12</td>
114
+ * </tr>
115
+ * <tr>
116
+ * <td>21</td>
117
+ * <td>22</td>
118
+ * </tr>
119
+ * </tbody>
120
+ * </table>
121
+ *
122
+ * and the user actions:
123
+ *
124
+ * 1. Both users have a table with two rows and two columns.
125
+ * 2. User A adds a column at the end of the table. This will insert empty table cells to two rows.
126
+ * 3. User B adds a row at the end of the table. This will insert a row with two empty table cells.
127
+ * 4. Both users will have a table as below:
128
+ *
129
+ *
130
+ * <table>
131
+ * <tbody>
132
+ * <tr>
133
+ * <td>11</td>
134
+ * <td>12</td>
135
+ * <td>(empty, inserted by A)</td>
136
+ * </tr>
137
+ * <tr>
138
+ * <td>21</td>
139
+ * <td>22</td>
140
+ * <td>(empty, inserted by A)</td>
141
+ * </tr>
142
+ * <tr>
143
+ * <td>(empty, inserted by B)</td>
144
+ * <td>(empty, inserted by B)</td>
145
+ * </tr>
146
+ * </tbody>
147
+ * </table>
148
+ *
149
+ * The last row is shorter then others so the table post-fixer will add an empty row to the last row:
150
+ *
151
+ * <table>
152
+ * <tbody>
153
+ * <tr>
154
+ * <td>11</td>
155
+ * <td>12</td>
156
+ * <td>(empty, inserted by A)</td>
157
+ * </tr>
158
+ * <tr>
159
+ * <td>21</td>
160
+ * <td>22</td>
161
+ * <td>(empty, inserted by A)</td>
162
+ * </tr>
163
+ * <tr>
164
+ * <td>(empty, inserted by B)</td>
165
+ * <td>(empty, inserted by B)</td>
166
+ * <td>(empty, inserted by the post-fixer)</td>
167
+ * </tr>
168
+ * </tbody>
169
+ * </table>
170
+ *
171
+ * Unfortunately undo does not know the nature of the changes and depending on which user applies the post-fixer changes, undoing them
172
+ * might lead to a broken table. If User B undoes inserting the column to the table, the undo engine will undo only the operations of
173
+ * inserting empty cells to rows from the initial table state (row 1 and 2) but the cell in the post-fixed row will remain:
174
+ *
175
+ * <table>
176
+ * <tbody>
177
+ * <tr>
178
+ * <td>11</td>
179
+ * <td>12</td>
180
+ * </tr>
181
+ * <tr>
182
+ * <td>21</td>
183
+ * <td>22</td>
184
+ * </tr>
185
+ * <tr>
186
+ * <td>(empty, inserted by B)</td>
187
+ * <td>(empty, inserted by B)</td>
188
+ * <td>(empty, inserted by a post-fixer)</td>
189
+ * </tr>
190
+ * </tbody>
191
+ * </table>
192
+ *
193
+ * After undo, the table post-fixer will detect that two rows are shorter than others and will fix the table to:
194
+ *
195
+ * <table>
196
+ * <tbody>
197
+ * <tr>
198
+ * <td>11</td>
199
+ * <td>12</td>
200
+ * <td>(empty, inserted by a post-fixer after undo)</td>
201
+ * </tr>
202
+ * <tr>
203
+ * <td>21</td>
204
+ * <td>22</td>
205
+ * <td>(empty, inserted by a post-fixer after undo)</td>
206
+ * </tr>
207
+ * <tr>
208
+ * <td>(empty, inserted by B)</td>
209
+ * <td>(empty, inserted by B)</td>
210
+ * <td>(empty, inserted by a post-fixer)</td>
211
+ * </tr>
212
+ * </tbody>
213
+ * </table>
214
+ * @param {module:engine/model/model~Model} model
215
+ */
216
+ export default function injectTableLayoutPostFixer( model ) {
217
+ model.document.registerPostFixer( writer => tableLayoutPostFixer( writer, model ) );
218
+ }
219
+
220
+ // The table layout post-fixer.
221
+ //
222
+ // @param {module:engine/model/writer~Writer} writer
223
+ // @param {module:engine/model/model~Model} model
224
+ function tableLayoutPostFixer( writer, model ) {
225
+ const changes = model.document.differ.getChanges();
226
+
227
+ let wasFixed = false;
228
+
229
+ // Do not analyze the same table more then once - may happen for multiple changes in the same table.
230
+ const analyzedTables = new Set();
231
+
232
+ for ( const entry of changes ) {
233
+ let table;
234
+
235
+ if ( entry.name == 'table' && entry.type == 'insert' ) {
236
+ table = entry.position.nodeAfter;
237
+ }
238
+
239
+ // Fix table on adding/removing table cells and rows.
240
+ if ( entry.name == 'tableRow' || entry.name == 'tableCell' ) {
241
+ table = entry.position.findAncestor( 'table' );
242
+ }
243
+
244
+ // Fix table on any table's attribute change - including attributes of table cells.
245
+ if ( isTableAttributeEntry( entry ) ) {
246
+ table = entry.range.start.findAncestor( 'table' );
247
+ }
248
+
249
+ if ( table && !analyzedTables.has( table ) ) {
250
+ // Step 1: correct rowspans of table cells if necessary.
251
+ // The wasFixed flag should be true if any of tables in batch was fixed - might be more then one.
252
+ wasFixed = fixTableCellsRowspan( table, writer ) || wasFixed;
253
+ // Step 2: fix table rows sizes.
254
+ wasFixed = fixTableRowsSizes( table, writer ) || wasFixed;
255
+
256
+ analyzedTables.add( table );
257
+ }
258
+ }
259
+
260
+ return wasFixed;
261
+ }
262
+
263
+ // Fixes the invalid value of the `rowspan` attribute because a table cell cannot vertically extend beyond the table section it belongs to.
264
+ //
265
+ // @param {module:engine/model/element~Element} table
266
+ // @param {module:engine/model/writer~Writer} writer
267
+ // @returns {Boolean} Returns `true` if the table was fixed.
268
+ function fixTableCellsRowspan( table, writer ) {
269
+ let wasFixed = false;
270
+
271
+ const cellsToTrim = findCellsToTrim( table );
272
+
273
+ if ( cellsToTrim.length ) {
274
+ // @if CK_DEBUG_TABLE // console.log( `Post-fixing table: trimming cells row-spans (${ cellsToTrim.length }).` );
275
+
276
+ wasFixed = true;
277
+
278
+ for ( const data of cellsToTrim ) {
279
+ updateNumericAttribute( 'rowspan', data.rowspan, data.cell, writer, 1 );
280
+ }
281
+ }
282
+
283
+ return wasFixed;
284
+ }
285
+
286
+ // Makes all table rows in a table the same size.
287
+ //
288
+ // @param {module:engine/model/element~Element} table
289
+ // @param {module:engine/model/writer~Writer} writer
290
+ // @returns {Boolean} Returns `true` if the table was fixed.
291
+ function fixTableRowsSizes( table, writer ) {
292
+ let wasFixed = false;
293
+
294
+ const rowsLengths = getRowsLengths( table );
295
+ const rowsToRemove = [];
296
+
297
+ // Find empty rows.
298
+ for ( const [ rowIndex, size ] of rowsLengths.entries() ) {
299
+ if ( !size ) {
300
+ rowsToRemove.push( rowIndex );
301
+ }
302
+ }
303
+
304
+ // Remove empty rows.
305
+ if ( rowsToRemove.length ) {
306
+ // @if CK_DEBUG_TABLE // console.log( `Post-fixing table: remove empty rows (${ rowsToRemove.length }).` );
307
+
308
+ wasFixed = true;
309
+
310
+ for ( const rowIndex of rowsToRemove.reverse() ) {
311
+ writer.remove( table.getChild( rowIndex ) );
312
+ rowsLengths.splice( rowIndex, 1 );
313
+ }
314
+ }
315
+
316
+ // Verify if all the rows have the same number of columns.
317
+ const tableSize = rowsLengths[ 0 ];
318
+ const isValid = rowsLengths.every( length => length === tableSize );
319
+
320
+ if ( !isValid ) {
321
+ // @if CK_DEBUG_TABLE // console.log( 'Post-fixing table: adding missing cells.' );
322
+
323
+ // Find the maximum number of columns.
324
+ const maxColumns = rowsLengths.reduce( ( prev, current ) => current > prev ? current : prev, 0 );
325
+
326
+ for ( const [ rowIndex, size ] of rowsLengths.entries() ) {
327
+ const columnsToInsert = maxColumns - size;
328
+
329
+ if ( columnsToInsert ) {
330
+ for ( let i = 0; i < columnsToInsert; i++ ) {
331
+ createEmptyTableCell( writer, writer.createPositionAt( table.getChild( rowIndex ), 'end' ) );
332
+ }
333
+
334
+ wasFixed = true;
335
+ }
336
+ }
337
+ }
338
+
339
+ return wasFixed;
340
+ }
341
+
342
+ // Searches for table cells that extend beyond the table section to which they belong to. It will return an array of objects
343
+ // that stores table cells to be trimmed and the correct value of the `rowspan` attribute to set.
344
+ //
345
+ // @param {module:engine/model/element~Element} table
346
+ // @returns {Array.<{{cell, rowspan}}>}
347
+ function findCellsToTrim( table ) {
348
+ const headingRows = parseInt( table.getAttribute( 'headingRows' ) || 0 );
349
+ const maxRows = table.childCount;
350
+
351
+ const cellsToTrim = [];
352
+
353
+ for ( const { row, cell, cellHeight } of new TableWalker( table ) ) {
354
+ // Skip cells that do not expand over its row.
355
+ if ( cellHeight < 2 ) {
356
+ continue;
357
+ }
358
+
359
+ const isInHeader = row < headingRows;
360
+
361
+ // Row limit is either end of header section or whole table as table body is after the header.
362
+ const rowLimit = isInHeader ? headingRows : maxRows;
363
+
364
+ // If table cell expands over its limit reduce it height to proper value.
365
+ if ( row + cellHeight > rowLimit ) {
366
+ const newRowspan = rowLimit - row;
367
+
368
+ cellsToTrim.push( { cell, rowspan: newRowspan } );
369
+ }
370
+ }
371
+
372
+ return cellsToTrim;
373
+ }
374
+
375
+ // Returns an array with lengths of rows assigned to the corresponding row index.
376
+ //
377
+ // @param {module:engine/model/element~Element} table
378
+ // @returns {Array.<Number>}
379
+ function getRowsLengths( table ) {
380
+ // TableWalker will not provide items for the empty rows, we need to pre-fill this array.
381
+ const lengths = new Array( table.childCount ).fill( 0 );
382
+
383
+ for ( const { row } of new TableWalker( table, { includeAllSlots: true } ) ) {
384
+ lengths[ row ]++;
385
+ }
386
+
387
+ return lengths;
388
+ }
389
+
390
+ // Checks if the differ entry for an attribute change is one of the table's attributes.
391
+ //
392
+ // @param entry
393
+ // @returns {Boolean}
394
+ function isTableAttributeEntry( entry ) {
395
+ const isAttributeType = entry.type === 'attribute';
396
+ const key = entry.attributeKey;
397
+
398
+ return isAttributeType && ( key === 'headingRows' || key === 'colspan' || key === 'rowspan' );
399
+ }
@@ -0,0 +1,126 @@
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/converters/tableproperites
8
+ */
9
+
10
+ /**
11
+ * Conversion helper for upcasting attributes using normalized styles.
12
+ *
13
+ * @param {module:engine/conversion/conversion~Conversion} conversion
14
+ * @param {String} modelElement
15
+ * @param {String} modelAttribute
16
+ * @param {String} styleName
17
+ */
18
+ export function upcastStyleToAttribute( conversion, modelElement, modelAttribute, styleName ) {
19
+ conversion.for( 'upcast' ).attributeToAttribute( {
20
+ view: {
21
+ styles: {
22
+ [ styleName ]: /[\s\S]+/
23
+ }
24
+ },
25
+ model: {
26
+ name: modelElement,
27
+ key: modelAttribute,
28
+ value: viewElement => viewElement.getNormalizedStyle( styleName )
29
+ }
30
+ } );
31
+ }
32
+
33
+ /**
34
+ * Conversion helper for upcasting border styles for view elements.
35
+ *
36
+ * @param {module:engine/conversion/conversion~Conversion} conversion
37
+ * @param {String} viewElementName
38
+ */
39
+ export function upcastBorderStyles( conversion, viewElementName ) {
40
+ conversion.for( 'upcast' ).add( dispatcher => dispatcher.on( 'element:' + viewElementName, ( evt, data, conversionApi ) => {
41
+ // If the element was not converted by element-to-element converter,
42
+ // we should not try to convert the style. See #8393.
43
+ if ( !data.modelRange ) {
44
+ return;
45
+ }
46
+
47
+ // TODO: this is counter-intuitive: ie.: if only `border-top` is defined then `hasStyle( 'border' )` also returns true.
48
+ // TODO: this might needs to be fixed in styles normalizer.
49
+ const stylesToConsume = [
50
+ 'border-top',
51
+ 'border-right',
52
+ 'border-bottom',
53
+ 'border-left'
54
+ ].filter( styleName => data.viewItem.hasStyle( styleName ) );
55
+
56
+ if ( !stylesToConsume.length ) {
57
+ return;
58
+ }
59
+
60
+ const matcherPattern = {
61
+ styles: stylesToConsume
62
+ };
63
+
64
+ // Try to consume appropriate values from consumable values list.
65
+ if ( !conversionApi.consumable.test( data.viewItem, matcherPattern ) ) {
66
+ return;
67
+ }
68
+
69
+ const modelElement = [ ...data.modelRange.getItems( { shallow: true } ) ].pop();
70
+
71
+ conversionApi.consumable.consume( data.viewItem, matcherPattern );
72
+
73
+ conversionApi.writer.setAttribute( 'borderStyle', data.viewItem.getNormalizedStyle( 'border-style' ), modelElement );
74
+ conversionApi.writer.setAttribute( 'borderColor', data.viewItem.getNormalizedStyle( 'border-color' ), modelElement );
75
+ conversionApi.writer.setAttribute( 'borderWidth', data.viewItem.getNormalizedStyle( 'border-width' ), modelElement );
76
+ } ) );
77
+ }
78
+
79
+ /**
80
+ * Conversion helper for downcasting an attribute to a style.
81
+ *
82
+ * @param {module:engine/conversion/conversion~Conversion} conversion
83
+ * @param {String} modelElement
84
+ * @param {String} modelAttribute
85
+ * @param {String} styleName
86
+ */
87
+ export function downcastAttributeToStyle( conversion, modelElement, modelAttribute, styleName ) {
88
+ conversion.for( 'downcast' ).attributeToAttribute( {
89
+ model: {
90
+ name: modelElement,
91
+ key: modelAttribute
92
+ },
93
+ view: modelAttributeValue => ( {
94
+ key: 'style',
95
+ value: {
96
+ [ styleName ]: modelAttributeValue
97
+ }
98
+ } )
99
+ } );
100
+ }
101
+
102
+ /**
103
+ * Conversion helper for downcasting attributes from the model table to a view table (not to `<figure>`).
104
+ *
105
+ * @param {module:engine/conversion/conversion~Conversion} conversion
106
+ * @param {String} modelAttribute
107
+ * @param {String} styleName
108
+ */
109
+ export function downcastTableAttribute( conversion, modelAttribute, styleName ) {
110
+ conversion.for( 'downcast' ).add( dispatcher => dispatcher.on( `attribute:${ modelAttribute }:table`, ( evt, data, conversionApi ) => {
111
+ const { item, attributeNewValue } = data;
112
+ const { mapper, writer } = conversionApi;
113
+
114
+ if ( !conversionApi.consumable.consume( data.item, evt.name ) ) {
115
+ return;
116
+ }
117
+
118
+ const table = [ ...mapper.toViewElement( item ).getChildren() ].find( child => child.is( 'element', 'table' ) );
119
+
120
+ if ( attributeNewValue ) {
121
+ writer.setStyle( styleName, attributeNewValue, table );
122
+ } else {
123
+ writer.removeStyle( styleName, table );
124
+ }
125
+ } ) );
126
+ }