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.
- package/README.md +5 -1
- package/bundles/qms-angular.umd.js +6943 -219
- package/bundles/qms-angular.umd.js.map +1 -1
- package/esm2015/lib/components/badges/qms-badges.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner/qms-banner.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner-confirm/qms-banner-confirm.component.js +1 -1
- package/esm2015/lib/components/banner/qms-banner-loading/qms-banner-loading.component.js +1 -1
- package/esm2015/lib/components/button/button-toggle.js +1 -1
- package/esm2015/lib/components/button/button.js +3 -3
- package/esm2015/lib/components/comment/comment.js +6 -3
- package/esm2015/lib/components/dialog/dialog.js +2 -2
- package/esm2015/lib/components/list/list.js +2 -2
- package/esm2015/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.js +3 -3
- package/esm2015/lib/components/qms-paginator/qms-paginator.component.js +16 -7
- package/esm2015/lib/components/related/content/related-content.component.js +2 -2
- package/esm2015/lib/components/related/list-other-related/list-related.component.js +1 -1
- package/esm2015/lib/components/related/risk/list/list.component.js +1 -1
- package/esm2015/lib/components/related/risk/result/result.component.js +1 -1
- package/esm2015/lib/components/rich-text/rich-text.js +1 -1
- package/esm2015/lib/components/table/table-action.js +2 -2
- package/esm2015/lib/components/table/table.module.js +4 -4
- package/esm2015/lib/components/tooltip/tooltip.js +1 -1
- package/esm2015/lib/components/tree/tree.component.js +1 -1
- package/esm2015/lib/components/treeNew/tree.component.js +18 -2
- package/esm2015/lib/directives/file-upload/file-upload-multiple-selector.directive.js +3 -1
- package/esm2015/lib/directives/file-upload/file-upload-selector.directive.js +3 -1
- package/esm2015/lib/directives/file-upload/file-upload.directive.js +1 -1
- package/esm2015/lib/directives/text-truncate/text-truncate.directive.js +58 -0
- package/esm2015/lib/model/en.js +63 -2
- package/esm2015/lib/model/no.js +63 -2
- package/esm2015/lib/qms-angular.module.js +4 -1
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/halo.function.js +87 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.js +3767 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/selection.function.js +56 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.js +1003 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.js +302 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.js +320 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.js +69 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.js +412 -0
- package/esm2015/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.js +80 -0
- package/esm2015/lib/qms-ckeditor-components/common/functions/common.function.js +34 -1
- package/esm2015/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/common/module/confirm/qms-ckeditor-confirm.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-about/qms-ckeditor-about.component.js +1 -1
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/qms-ckeditor-bpmn.component.js +2 -2
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-bpmn/save-template/save-template.component.js +2 -2
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.js +317 -0
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-imagemap/qms-ckeditor-imagemap.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/attachments/link-attachment.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-link/qms-ckeditor-link.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-load-template/qms-ckeditor-load-template.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-relation/qmsckeditor-related.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-template/qms-ckeditor-template.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/components/qms-ckeditor-tooltip/qms-ckeditor-tooltip.component.js +3 -3
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.component.js +35 -3
- package/esm2015/lib/qms-ckeditor-components/qms-ckeditor.module.js +4 -2
- package/esm2015/public-api.js +8 -1
- package/esm2015/qms-angular.js +2 -1
- package/fesm2015/qms-angular.js +6882 -213
- package/fesm2015/qms-angular.js.map +1 -1
- package/lib/components/comment/comment.d.ts +1 -0
- package/lib/components/qms-paginator/qms-paginator.component.d.ts +1 -0
- package/lib/components/treeNew/tree.component.d.ts +1 -0
- package/lib/directives/text-truncate/text-truncate.directive.d.ts +15 -0
- package/lib/model/en.d.ts +61 -0
- package/lib/model/no.d.ts +61 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/halo.function.d.ts +37 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/inspector.function.d.ts +7 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/selection.function.d.ts +39 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/stencil.function.d.ts +11 -0
- package/lib/qms-ckeditor-components/common/flowchart/config/toolbar.function.d.ts +224 -0
- package/lib/qms-ckeditor-components/common/flowchart/models/app-shapes.d.ts +58 -0
- package/lib/qms-ckeditor-components/common/flowchart/service/keyboard-service.d.ts +16 -0
- package/lib/qms-ckeditor-components/common/flowchart/service/kitchensink-service.d.ts +56 -0
- package/lib/qms-ckeditor-components/common/flowchart/themes/theme-picker.d.ts +35 -0
- package/lib/qms-ckeditor-components/common/functions/common.function.d.ts +12 -0
- package/lib/qms-ckeditor-components/common/models/qms-ckeditor-save-as-template.model.d.ts +2 -0
- package/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.d.ts +41 -0
- package/lib/qms-ckeditor-components/qms-ckeditor.component.d.ts +4 -0
- package/lib.theme.scss +179 -0
- package/package.json +1 -1
- package/public-api.d.ts +7 -0
- package/qms-angular.d.ts +1 -0
- package/qms-angular.metadata.json +1 -1
- package/src/assets/fonts/Material/flUhRq6tzZclQEJ-Vdg-IuiaDsNc.woff2 +0 -0
- package/src/assets/fonts/Material/gok-H7zzDkdnRel8-DQ6KAXJ69wP1tGnf4ZGhUce.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFUZ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVZ0b.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFVp0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFW50bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWJ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWZ0bbck.woff2 +0 -0
- package/src/assets/fonts/OpenSans/mem8YaGs126MiZpBA-UFWp0bbck.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCFPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCGPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCHPrEHJA.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCIPrE.woff2 +0 -0
- package/src/assets/fonts/Raleway/1Ptxg8zYS_SKggPN4iEgvnHyvveLxVvaorCMPrEHJA.woff2 +0 -0
- package/src/assets/jointjs/images/delete-icon-modern.png +0 -0
- package/src/assets/jointjs/images/reset-icon-modern.png +0 -0
- package/src/assets/jointjs/images/save-icon-modern.png +0 -0
- package/src/assets/jointjs/images/to-front-icon-modern.png +0 -0
- package/src/assets/jointjs/images/toback-icon-modern.png +0 -0
- package/src/assets/jointjs/images/toolbar-icons-material.png +0 -0
- package/src/assets/jointjs/images/toolbar-icons-modern.png +0 -0
- package/src/assets/jointjs/scss/rappid.scss +326 -0
- package/src/assets/jointjs/scss/theme-picker.scss +22 -0
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/ckeditor.js.map +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ar.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/az.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/bg.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ca.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/cs.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/da.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/de-ch.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/de.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/el.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/en-au.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/en-gb.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/eo.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/es.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/et.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/eu.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fa.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/fr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/gl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/he.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/hu.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/id.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/it.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ja.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/km.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/kn.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ko.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ku.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/lt.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/lv.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/nb.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ne.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/nl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/no.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/pl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/pt-br.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/pt.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ro.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ru.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sl.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sq.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sr-latn.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/sv.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/th.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/tk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/tr.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/ug.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/uk.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/vi.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/zh-cn.js +1 -1
- package/src/assets/qms-ckeditor-plugin/build/translations/zh.js +1 -1
- package/src/assets/qms-ckeditor-plugin/package-lock.json +12632 -345
- package/src/assets/qms-ckeditor-plugin/package.json +0 -2
- package/src/assets/qms-ckeditor-plugin/src/ckeditor.js +8 -8
- package/src/assets/qms-ckeditor-plugin/src/plugins/common/qmsCKEditorService.js +9 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/flowchartdialogcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/flowchart/qmsCKEditorFlowchartPlugin.js +30 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/heading.js +119 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingbuttonsui.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingcommand.js +96 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingediting.js +163 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/headingui.js +115 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/index.js +22 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/heading.css +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading1.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading2.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading3.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading4.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading5.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/theme/icons/heading6.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/title.js +598 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/heading/utils.js +42 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertcolumncommand.js +83 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/insertrowcommand.js +82 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/inserttablecommand.js +76 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellcommand.js +272 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/mergecellscommand.js +122 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removecolumncommand.js +122 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/removerowcommand.js +97 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectcolumncommand.js +63 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/selectrowcommand.js +56 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheadercolumncommand.js +95 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/setheaderrowcommand.js +105 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/commands/splitcellcommand.js +68 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/downcast.js +529 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-paragraph-post-fixer.js +136 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-cell-refresh-post-fixer.js +75 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-heading-rows-refresh-post-fixer.js +55 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/table-layout-post-fixer.js +399 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/tableproperties.js +126 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/converters/upcasttable.js +211 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/index.js +42 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/table.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbackgroundcolorcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellbordercolorcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderstylecommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellborderwidthcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellheightcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellhorizontalalignmentcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpaddingcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellpropertycommand.js +110 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellverticalalignmentcommand.js +43 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/commands/tablecellwidthcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesediting.js +204 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/tablecellpropertiesui.js +401 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties/ui/tablecellpropertiesview.js +829 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablecellproperties.js +80 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableclipboard.js +586 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableediting.js +160 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablekeyboard.js +343 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse/mouseeventsobserver.js +72 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablemouse.js +218 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablealignmentcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebackgroundcolorcommand.js +35 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablebordercolorcommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderstylecommand.js +47 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableborderwidthcommand.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tableheightcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablepropertycommand.js +98 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/commands/tablewidthcommand.js +51 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesediting.js +182 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/tablepropertiesui.js +397 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties/ui/tablepropertiesview.js +714 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableproperties.js +81 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableselection.js +357 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tabletoolbar.js +111 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableui.js +359 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tableutils.js +909 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/tablewalker.js +538 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/colorinput.css +39 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/form.css +11 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/formrow.css +23 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-cell-properties.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-column.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-merge-cell.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-properties.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table-row.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/icons/table.svg +1 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/inserttable.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/snippet.css +3876 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/table.css +67 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecaption.css +53 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tablecellproperties.css +28 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableediting.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableform.css +59 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableproperties.css +18 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/theme/tableselection.css +10 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/colorinputview.js +343 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/formrowview.js +103 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/ui/inserttableview.js +222 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/common.js +57 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/selection.js +276 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/structure.js +543 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/table-properties.js +66 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/contextualballoon.js +130 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/table-properties.js +397 -0
- package/src/assets/qms-ckeditor-plugin/src/plugins/table/utils/ui/widget.js +62 -0
- package/src/assets/qms-ckeditor-plugin/src/themes/icons/flowchart.svg +507 -0
- package/src/lib/components/comment/comment.scss +1 -0
- package/src/lib/components/qms-navigation-drawer/qms-navigation-drawer.component.scss +1 -0
- package/src/lib/components/qms-paginator/qms-paginator.component.scss +4 -1
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon1.svg +1 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon2.svg +6 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon3.svg +11 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/image-icon4.svg +8 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-female.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/member-male.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/no-color-icon.svg +72 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-material.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/toolbar-icons-modern.png +0 -0
- package/src/lib/qms-ckeditor-components/common/flowchart/assets/transparent-icon.svg +50 -0
- package/src/lib/qms-ckeditor-components/components/qms-ckeditor-flowchart/qms-ckeditor-flowchart.component.scss +68 -0
- package/src/lib/qms-ckeditor-components/styles/_modules.scss +9 -0
- package/src/themes/core/_mat-icon.scss +60 -60
- package/src/themes/core/_table.scss +72 -4
- package/src/themes/core/_typography.scss +108 -108
@@ -0,0 +1,543 @@
|
|
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/utils/structure
|
8
|
+
*/
|
9
|
+
|
10
|
+
import TableWalker from '../tablewalker';
|
11
|
+
import { createEmptyTableCell, updateNumericAttribute } from './common';
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Returns a cropped table according to given dimensions.
|
15
|
+
|
16
|
+
* To return a cropped table that starts at first row and first column and end in third row and column:
|
17
|
+
*
|
18
|
+
* const croppedTable = cropTableToDimensions( table, {
|
19
|
+
* startRow: 1,
|
20
|
+
* endRow: 1,
|
21
|
+
* startColumn: 3,
|
22
|
+
* endColumn: 3
|
23
|
+
* }, writer );
|
24
|
+
*
|
25
|
+
* Calling the code above for the table below:
|
26
|
+
*
|
27
|
+
* 0 1 2 3 4 0 1 2
|
28
|
+
* ┌───┬───┬───┬───┬───┐
|
29
|
+
* 0 │ a │ b │ c │ d │ e │
|
30
|
+
* ├───┴───┤ ├───┴───┤ ┌───┬───┬───┐
|
31
|
+
* 1 │ f │ │ g │ │ │ │ g │ 0
|
32
|
+
* ├───┬───┴───┼───┬───┤ will return: ├───┴───┼───┤
|
33
|
+
* 2 │ h │ i │ j │ k │ │ i │ j │ 1
|
34
|
+
* ├───┤ ├───┤ │ │ ├───┤
|
35
|
+
* 3 │ l │ │ m │ │ │ │ m │ 2
|
36
|
+
* ├───┼───┬───┤ ├───┤ └───────┴───┘
|
37
|
+
* 4 │ n │ o │ p │ │ q │
|
38
|
+
* └───┴───┴───┴───┴───┘
|
39
|
+
*
|
40
|
+
* @param {module:engine/model/element~Element} sourceTable
|
41
|
+
* @param {Object} cropDimensions
|
42
|
+
* @param {Number} cropDimensions.startRow
|
43
|
+
* @param {Number} cropDimensions.startColumn
|
44
|
+
* @param {Number} cropDimensions.endRow
|
45
|
+
* @param {Number} cropDimensions.endColumn
|
46
|
+
* @param {module:engine/model/writer~Writer} writer
|
47
|
+
* @returns {module:engine/model/element~Element}
|
48
|
+
*/
|
49
|
+
export function cropTableToDimensions( sourceTable, cropDimensions, writer ) {
|
50
|
+
const { startRow, startColumn, endRow, endColumn } = cropDimensions;
|
51
|
+
|
52
|
+
// Create empty table with empty rows equal to crop height.
|
53
|
+
const croppedTable = writer.createElement( 'table' );
|
54
|
+
const cropHeight = endRow - startRow + 1;
|
55
|
+
|
56
|
+
for ( let i = 0; i < cropHeight; i++ ) {
|
57
|
+
writer.insertElement( 'tableRow', croppedTable, 'end' );
|
58
|
+
}
|
59
|
+
|
60
|
+
const tableMap = [ ...new TableWalker( sourceTable, { startRow, endRow, startColumn, endColumn, includeAllSlots: true } ) ];
|
61
|
+
|
62
|
+
// Iterate over source table slots (including empty - spanned - ones).
|
63
|
+
for ( const { row: sourceRow, column: sourceColumn, cell: tableCell, isAnchor, cellAnchorRow, cellAnchorColumn } of tableMap ) {
|
64
|
+
// Row index in cropped table.
|
65
|
+
const rowInCroppedTable = sourceRow - startRow;
|
66
|
+
const row = croppedTable.getChild( rowInCroppedTable );
|
67
|
+
|
68
|
+
// For empty slots: fill the gap with empty table cell.
|
69
|
+
if ( !isAnchor ) {
|
70
|
+
// But fill the gap only if the spanning cell is anchored outside cropped area.
|
71
|
+
// In the table from method jsdoc those cells are: "c" & "f".
|
72
|
+
if ( cellAnchorRow < startRow || cellAnchorColumn < startColumn ) {
|
73
|
+
createEmptyTableCell( writer, writer.createPositionAt( row, 'end' ) );
|
74
|
+
}
|
75
|
+
}
|
76
|
+
// Otherwise clone the cell with all children and trim if it exceeds cropped area.
|
77
|
+
else {
|
78
|
+
const tableCellCopy = writer.cloneElement( tableCell );
|
79
|
+
|
80
|
+
writer.append( tableCellCopy, row );
|
81
|
+
|
82
|
+
// Trim table if it exceeds cropped area.
|
83
|
+
// In the table from method jsdoc those cells are: "g" & "m".
|
84
|
+
trimTableCellIfNeeded( tableCellCopy, sourceRow, sourceColumn, endRow, endColumn, writer );
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
// Adjust heading rows & columns in cropped table if crop selection includes headings parts.
|
89
|
+
addHeadingsToCroppedTable( croppedTable, sourceTable, startRow, startColumn, writer );
|
90
|
+
|
91
|
+
return croppedTable;
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Returns slot info of cells that starts above and overlaps a given row.
|
96
|
+
*
|
97
|
+
* In a table below, passing `overlapRow = 3`
|
98
|
+
*
|
99
|
+
* ┌───┬───┬───┬───┬───┐
|
100
|
+
* 0 │ a │ b │ c │ d │ e │
|
101
|
+
* │ ├───┼───┼───┼───┤
|
102
|
+
* 1 │ │ f │ g │ h │ i │
|
103
|
+
* ├───┤ ├───┼───┤ │
|
104
|
+
* 2 │ j │ │ k │ l │ │
|
105
|
+
* │ │ │ ├───┼───┤
|
106
|
+
* 3 │ │ │ │ m │ n │ <- overlap row to check
|
107
|
+
* ├───┼───┤ │ ├───│
|
108
|
+
* 4 │ o │ p │ │ │ q │
|
109
|
+
* └───┴───┴───┴───┴───┘
|
110
|
+
*
|
111
|
+
* will return slot info for cells: "j", "f", "k".
|
112
|
+
*
|
113
|
+
* @param {module:engine/model/element~Element} table The table to check.
|
114
|
+
* @param {Number} overlapRow The index of the row to check.
|
115
|
+
* @param {Number} [startRow=0] A row to start analysis. Use it when it is known that the cells above that row will not overlap.
|
116
|
+
* @returns {Array.<module:table/tablewalker~TableSlot>}
|
117
|
+
*/
|
118
|
+
export function getVerticallyOverlappingCells( table, overlapRow, startRow = 0 ) {
|
119
|
+
const cells = [];
|
120
|
+
|
121
|
+
const tableWalker = new TableWalker( table, { startRow, endRow: overlapRow - 1 } );
|
122
|
+
|
123
|
+
for ( const slotInfo of tableWalker ) {
|
124
|
+
const { row, cellHeight } = slotInfo;
|
125
|
+
const cellEndRow = row + cellHeight - 1;
|
126
|
+
|
127
|
+
if ( row < overlapRow && overlapRow <= cellEndRow ) {
|
128
|
+
cells.push( slotInfo );
|
129
|
+
}
|
130
|
+
}
|
131
|
+
|
132
|
+
return cells;
|
133
|
+
}
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Splits the table cell horizontally.
|
137
|
+
*
|
138
|
+
* @param {module:engine/model/element~Element} tableCell
|
139
|
+
* @param {Number} splitRow
|
140
|
+
* @param {module:engine/model/writer~Writer} writer
|
141
|
+
* @returns {module:engine/model/element~Element} Created table cell.
|
142
|
+
*/
|
143
|
+
export function splitHorizontally( tableCell, splitRow, writer ) {
|
144
|
+
const tableRow = tableCell.parent;
|
145
|
+
const table = tableRow.parent;
|
146
|
+
const rowIndex = tableRow.index;
|
147
|
+
|
148
|
+
const rowspan = parseInt( tableCell.getAttribute( 'rowspan' ) );
|
149
|
+
const newRowspan = splitRow - rowIndex;
|
150
|
+
|
151
|
+
const newCellAttributes = {};
|
152
|
+
const newCellRowSpan = rowspan - newRowspan;
|
153
|
+
|
154
|
+
if ( newCellRowSpan > 1 ) {
|
155
|
+
newCellAttributes.rowspan = newCellRowSpan;
|
156
|
+
}
|
157
|
+
|
158
|
+
const colspan = parseInt( tableCell.getAttribute( 'colspan' ) || 1 );
|
159
|
+
|
160
|
+
if ( colspan > 1 ) {
|
161
|
+
newCellAttributes.colspan = colspan;
|
162
|
+
}
|
163
|
+
|
164
|
+
const startRow = rowIndex;
|
165
|
+
const endRow = startRow + newRowspan;
|
166
|
+
const tableMap = [ ...new TableWalker( table, { startRow, endRow, includeAllSlots: true } ) ];
|
167
|
+
|
168
|
+
let newCell = null;
|
169
|
+
let columnIndex;
|
170
|
+
|
171
|
+
for ( const tableSlot of tableMap ) {
|
172
|
+
const { row, column, cell } = tableSlot;
|
173
|
+
|
174
|
+
if ( cell === tableCell && columnIndex === undefined ) {
|
175
|
+
columnIndex = column;
|
176
|
+
}
|
177
|
+
|
178
|
+
if ( columnIndex !== undefined && columnIndex === column && row === endRow ) {
|
179
|
+
newCell = createEmptyTableCell( writer, tableSlot.getPositionBefore(), newCellAttributes );
|
180
|
+
}
|
181
|
+
}
|
182
|
+
|
183
|
+
// Update the rowspan attribute after updating table.
|
184
|
+
updateNumericAttribute( 'rowspan', newRowspan, tableCell, writer );
|
185
|
+
|
186
|
+
return newCell;
|
187
|
+
}
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Returns slot info of cells that starts before and overlaps a given column.
|
191
|
+
*
|
192
|
+
* In a table below, passing `overlapColumn = 3`
|
193
|
+
*
|
194
|
+
* 0 1 2 3 4
|
195
|
+
* ┌───────┬───────┬───┐
|
196
|
+
* │ a │ b │ c │
|
197
|
+
* │───┬───┴───────┼───┤
|
198
|
+
* │ d │ e │ f │
|
199
|
+
* ├───┼───┬───────┴───┤
|
200
|
+
* │ g │ h │ i │
|
201
|
+
* ├───┼───┼───┬───────┤
|
202
|
+
* │ j │ k │ l │ m │
|
203
|
+
* ├───┼───┴───┼───┬───┤
|
204
|
+
* │ n │ o │ p │ q │
|
205
|
+
* └───┴───────┴───┴───┘
|
206
|
+
* ^
|
207
|
+
* Overlap column to check
|
208
|
+
*
|
209
|
+
* will return slot info for cells: "b", "e", "i".
|
210
|
+
*
|
211
|
+
* @param {module:engine/model/element~Element} table The table to check.
|
212
|
+
* @param {Number} overlapColumn The index of the column to check.
|
213
|
+
* @returns {Array.<module:table/tablewalker~TableSlot>}
|
214
|
+
*/
|
215
|
+
export function getHorizontallyOverlappingCells( table, overlapColumn ) {
|
216
|
+
const cellsToSplit = [];
|
217
|
+
|
218
|
+
const tableWalker = new TableWalker( table );
|
219
|
+
|
220
|
+
for ( const slotInfo of tableWalker ) {
|
221
|
+
const { column, cellWidth } = slotInfo;
|
222
|
+
const cellEndColumn = column + cellWidth - 1;
|
223
|
+
|
224
|
+
if ( column < overlapColumn && overlapColumn <= cellEndColumn ) {
|
225
|
+
cellsToSplit.push( slotInfo );
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
return cellsToSplit;
|
230
|
+
}
|
231
|
+
|
232
|
+
/**
|
233
|
+
* Splits the table cell vertically.
|
234
|
+
*
|
235
|
+
* @param {module:engine/model/element~Element} tableCell
|
236
|
+
* @param {Number} columnIndex The table cell column index.
|
237
|
+
* @param {Number} splitColumn The index of column to split cell on.
|
238
|
+
* @param {module:engine/model/writer~Writer} writer
|
239
|
+
* @returns {module:engine/model/element~Element} Created table cell.
|
240
|
+
*/
|
241
|
+
export function splitVertically( tableCell, columnIndex, splitColumn, writer ) {
|
242
|
+
const colspan = parseInt( tableCell.getAttribute( 'colspan' ) );
|
243
|
+
const newColspan = splitColumn - columnIndex;
|
244
|
+
|
245
|
+
const newCellAttributes = {};
|
246
|
+
const newCellColSpan = colspan - newColspan;
|
247
|
+
|
248
|
+
if ( newCellColSpan > 1 ) {
|
249
|
+
newCellAttributes.colspan = newCellColSpan;
|
250
|
+
}
|
251
|
+
|
252
|
+
const rowspan = parseInt( tableCell.getAttribute( 'rowspan' ) || 1 );
|
253
|
+
|
254
|
+
if ( rowspan > 1 ) {
|
255
|
+
newCellAttributes.rowspan = rowspan;
|
256
|
+
}
|
257
|
+
|
258
|
+
const newCell = createEmptyTableCell( writer, writer.createPositionAfter( tableCell ), newCellAttributes );
|
259
|
+
|
260
|
+
// Update the colspan attribute after updating table.
|
261
|
+
updateNumericAttribute( 'colspan', newColspan, tableCell, writer );
|
262
|
+
|
263
|
+
return newCell;
|
264
|
+
}
|
265
|
+
|
266
|
+
/**
|
267
|
+
* Adjusts table cell dimensions to not exceed limit row and column.
|
268
|
+
*
|
269
|
+
* If table cell width (or height) covers a column (or row) that is after a limit column (or row)
|
270
|
+
* this method will trim "colspan" (or "rowspan") attribute so the table cell will fit in a defined limits.
|
271
|
+
*
|
272
|
+
* @param {module:engine/model/element~Element} tableCell
|
273
|
+
* @param {Number} cellRow
|
274
|
+
* @param {Number} cellColumn
|
275
|
+
* @param {Number} limitRow
|
276
|
+
* @param {Number} limitColumn
|
277
|
+
* @param {module:engine/model/writer~Writer} writer
|
278
|
+
*/
|
279
|
+
export function trimTableCellIfNeeded( tableCell, cellRow, cellColumn, limitRow, limitColumn, writer ) {
|
280
|
+
const colspan = parseInt( tableCell.getAttribute( 'colspan' ) || 1 );
|
281
|
+
const rowspan = parseInt( tableCell.getAttribute( 'rowspan' ) || 1 );
|
282
|
+
|
283
|
+
const endColumn = cellColumn + colspan - 1;
|
284
|
+
|
285
|
+
if ( endColumn > limitColumn ) {
|
286
|
+
const trimmedSpan = limitColumn - cellColumn + 1;
|
287
|
+
|
288
|
+
updateNumericAttribute( 'colspan', trimmedSpan, tableCell, writer, 1 );
|
289
|
+
}
|
290
|
+
|
291
|
+
const endRow = cellRow + rowspan - 1;
|
292
|
+
|
293
|
+
if ( endRow > limitRow ) {
|
294
|
+
const trimmedSpan = limitRow - cellRow + 1;
|
295
|
+
|
296
|
+
updateNumericAttribute( 'rowspan', trimmedSpan, tableCell, writer, 1 );
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
// Sets proper heading attributes to a cropped table.
|
301
|
+
function addHeadingsToCroppedTable( croppedTable, sourceTable, startRow, startColumn, writer ) {
|
302
|
+
const headingRows = parseInt( sourceTable.getAttribute( 'headingRows' ) || 0 );
|
303
|
+
|
304
|
+
if ( headingRows > 0 ) {
|
305
|
+
const headingRowsInCrop = headingRows - startRow;
|
306
|
+
updateNumericAttribute( 'headingRows', headingRowsInCrop, croppedTable, writer, 0 );
|
307
|
+
}
|
308
|
+
|
309
|
+
const headingColumns = parseInt( sourceTable.getAttribute( 'headingColumns' ) || 0 );
|
310
|
+
|
311
|
+
if ( headingColumns > 0 ) {
|
312
|
+
const headingColumnsInCrop = headingColumns - startColumn;
|
313
|
+
updateNumericAttribute( 'headingColumns', headingColumnsInCrop, croppedTable, writer, 0 );
|
314
|
+
}
|
315
|
+
}
|
316
|
+
|
317
|
+
/**
|
318
|
+
* Removes columns that have no cells anchored.
|
319
|
+
*
|
320
|
+
* In table below:
|
321
|
+
*
|
322
|
+
* +----+----+----+----+----+----+----+
|
323
|
+
* | 00 | 01 | 03 | 04 | 06 |
|
324
|
+
* +----+----+----+----+ +----+
|
325
|
+
* | 10 | 11 | 13 | | 16 |
|
326
|
+
* +----+----+----+----+----+----+----+
|
327
|
+
* | 20 | 21 | 23 | 24 | 26 |
|
328
|
+
* +----+----+----+----+----+----+----+
|
329
|
+
* ^--- empty ---^
|
330
|
+
*
|
331
|
+
* Will remove columns 2 and 5.
|
332
|
+
*
|
333
|
+
* **Note:** This is a low-level helper method for clearing invalid model state when doing table modifications.
|
334
|
+
* To remove a column from a table use {@link module:table/tableutils~TableUtils#removeColumns `TableUtils.removeColumns()`}.
|
335
|
+
*
|
336
|
+
* @protected
|
337
|
+
* @param {module:engine/model/element~Element} table
|
338
|
+
* @param {module:table/tableutils~TableUtils} tableUtils
|
339
|
+
* @returns {Boolean} True if removed some columns.
|
340
|
+
*/
|
341
|
+
export function removeEmptyColumns( table, tableUtils ) {
|
342
|
+
const width = tableUtils.getColumns( table );
|
343
|
+
const columnsMap = new Array( width ).fill( 0 );
|
344
|
+
|
345
|
+
for ( const { column } of new TableWalker( table ) ) {
|
346
|
+
columnsMap[ column ]++;
|
347
|
+
}
|
348
|
+
|
349
|
+
const emptyColumns = columnsMap.reduce( ( result, cellsCount, column ) => {
|
350
|
+
return cellsCount ? result : [ ...result, column ];
|
351
|
+
}, [] );
|
352
|
+
|
353
|
+
if ( emptyColumns.length > 0 ) {
|
354
|
+
// Remove only last empty column because it will recurrently trigger removing empty rows.
|
355
|
+
const emptyColumn = emptyColumns[ emptyColumns.length - 1 ];
|
356
|
+
|
357
|
+
// @if CK_DEBUG_TABLE // console.log( `Removing empty column: ${ emptyColumn }.` );
|
358
|
+
tableUtils.removeColumns( table, { at: emptyColumn } );
|
359
|
+
|
360
|
+
return true;
|
361
|
+
}
|
362
|
+
|
363
|
+
return false;
|
364
|
+
}
|
365
|
+
|
366
|
+
/**
|
367
|
+
* Removes rows that have no cells anchored.
|
368
|
+
*
|
369
|
+
* In table below:
|
370
|
+
*
|
371
|
+
* +----+----+----+
|
372
|
+
* | 00 | 01 | 02 |
|
373
|
+
* +----+----+----+
|
374
|
+
* | 10 | 11 | 12 |
|
375
|
+
* + + + +
|
376
|
+
* | | | | <-- empty
|
377
|
+
* +----+----+----+
|
378
|
+
* | 30 | 31 | 32 |
|
379
|
+
* +----+----+----+
|
380
|
+
* | 40 | 42 |
|
381
|
+
* + + +
|
382
|
+
* | | | <-- empty
|
383
|
+
* +----+----+----+
|
384
|
+
* | 60 | 61 | 62 |
|
385
|
+
* +----+----+----+
|
386
|
+
*
|
387
|
+
* Will remove rows 2 and 5.
|
388
|
+
*
|
389
|
+
* **Note:** This is a low-level helper method for clearing invalid model state when doing table modifications.
|
390
|
+
* To remove a row from a table use {@link module:table/tableutils~TableUtils#removeRows `TableUtils.removeRows()`}.
|
391
|
+
*
|
392
|
+
* @protected
|
393
|
+
* @param {module:engine/model/element~Element} table
|
394
|
+
* @param {module:table/tableutils~TableUtils} tableUtils
|
395
|
+
* @returns {Boolean} True if removed some rows.
|
396
|
+
*/
|
397
|
+
export function removeEmptyRows( table, tableUtils ) {
|
398
|
+
const emptyRows = [];
|
399
|
+
|
400
|
+
for ( let rowIndex = 0; rowIndex < table.childCount; rowIndex++ ) {
|
401
|
+
const tableRow = table.getChild( rowIndex );
|
402
|
+
|
403
|
+
if ( tableRow.isEmpty ) {
|
404
|
+
emptyRows.push( rowIndex );
|
405
|
+
}
|
406
|
+
}
|
407
|
+
|
408
|
+
if ( emptyRows.length > 0 ) {
|
409
|
+
// Remove only last empty row because it will recurrently trigger removing empty columns.
|
410
|
+
const emptyRow = emptyRows[ emptyRows.length - 1 ];
|
411
|
+
|
412
|
+
// @if CK_DEBUG_TABLE // console.log( `Removing empty row: ${ emptyRow }.` );
|
413
|
+
tableUtils.removeRows( table, { at: emptyRow } );
|
414
|
+
|
415
|
+
return true;
|
416
|
+
}
|
417
|
+
|
418
|
+
return false;
|
419
|
+
}
|
420
|
+
|
421
|
+
/**
|
422
|
+
* Removes rows and columns that have no cells anchored.
|
423
|
+
*
|
424
|
+
* In table below:
|
425
|
+
*
|
426
|
+
* +----+----+----+----+
|
427
|
+
* | 00 | 02 |
|
428
|
+
* +----+----+ +
|
429
|
+
* | 10 | |
|
430
|
+
* +----+----+----+----+
|
431
|
+
* | 20 | 22 | 23 |
|
432
|
+
* + + + +
|
433
|
+
* | | | | <-- empty row
|
434
|
+
* +----+----+----+----+
|
435
|
+
* ^--- empty column
|
436
|
+
*
|
437
|
+
* Will remove row 3 and column 1.
|
438
|
+
*
|
439
|
+
* **Note:** This is a low-level helper method for clearing invalid model state when doing table modifications.
|
440
|
+
* To remove a rows from a table use {@link module:table/tableutils~TableUtils#removeRows `TableUtils.removeRows()`} and
|
441
|
+
* {@link module:table/tableutils~TableUtils#removeColumns `TableUtils.removeColumns()`} to remove a column.
|
442
|
+
*
|
443
|
+
* @protected
|
444
|
+
* @param {module:engine/model/element~Element} table
|
445
|
+
* @param {module:table/tableutils~TableUtils} tableUtils
|
446
|
+
*/
|
447
|
+
export function removeEmptyRowsColumns( table, tableUtils ) {
|
448
|
+
const removedColumns = removeEmptyColumns( table, tableUtils );
|
449
|
+
|
450
|
+
// If there was some columns removed then cleaning empty rows was already triggered.
|
451
|
+
if ( !removedColumns ) {
|
452
|
+
removeEmptyRows( table, tableUtils );
|
453
|
+
}
|
454
|
+
}
|
455
|
+
|
456
|
+
/**
|
457
|
+
* Returns adjusted last row index if selection covers part of a row with empty slots (spanned by other cells).
|
458
|
+
* The `dimensions.lastRow` is equal to last row index but selection might be bigger.
|
459
|
+
*
|
460
|
+
* This happens *only* on rectangular selection so we analyze a case like this:
|
461
|
+
*
|
462
|
+
* +---+---+---+---+
|
463
|
+
* 0 | a | b | c | d |
|
464
|
+
* + + +---+---+
|
465
|
+
* 1 | | e | f | g |
|
466
|
+
* + +---+ +---+
|
467
|
+
* 2 | | h | | i | <- last row, each cell has rowspan = 2,
|
468
|
+
* + + + + + so we need to return 3, not 2
|
469
|
+
* 3 | | | | |
|
470
|
+
* +---+---+---+---+
|
471
|
+
*
|
472
|
+
* @param {module:engine/model/element~Element} table
|
473
|
+
* @param {Object} dimensions
|
474
|
+
* @param {Number} dimensions.firstRow
|
475
|
+
* @param {Number} dimensions.firstColumn
|
476
|
+
* @param {Number} dimensions.lastRow
|
477
|
+
* @param {Number} dimensions.lastColumn
|
478
|
+
* @returns {Number} Adjusted last row index.
|
479
|
+
*/
|
480
|
+
export function adjustLastRowIndex( table, dimensions ) {
|
481
|
+
const lastRowMap = Array.from( new TableWalker( table, {
|
482
|
+
startColumn: dimensions.firstColumn,
|
483
|
+
endColumn: dimensions.lastColumn,
|
484
|
+
row: dimensions.lastRow
|
485
|
+
} ) );
|
486
|
+
|
487
|
+
const everyCellHasSingleRowspan = lastRowMap.every( ( { cellHeight } ) => cellHeight === 1 );
|
488
|
+
|
489
|
+
// It is a "flat" row, so the last row index is OK.
|
490
|
+
if ( everyCellHasSingleRowspan ) {
|
491
|
+
return dimensions.lastRow;
|
492
|
+
}
|
493
|
+
|
494
|
+
// Otherwise get any cell's rowspan and adjust the last row index.
|
495
|
+
const rowspanAdjustment = lastRowMap[ 0 ].cellHeight - 1;
|
496
|
+
return dimensions.lastRow + rowspanAdjustment;
|
497
|
+
}
|
498
|
+
|
499
|
+
/**
|
500
|
+
* Returns adjusted last column index if selection covers part of a column with empty slots (spanned by other cells).
|
501
|
+
* The `dimensions.lastColumn` is equal to last column index but selection might be bigger.
|
502
|
+
*
|
503
|
+
* This happens *only* on rectangular selection so we analyze a case like this:
|
504
|
+
*
|
505
|
+
* 0 1 2 3
|
506
|
+
* +---+---+---+---+
|
507
|
+
* | a |
|
508
|
+
* +---+---+---+---+
|
509
|
+
* | b | c | d |
|
510
|
+
* +---+---+---+---+
|
511
|
+
* | e | f |
|
512
|
+
* +---+---+---+---+
|
513
|
+
* | g | h |
|
514
|
+
* +---+---+---+---+
|
515
|
+
* ^
|
516
|
+
* last column, each cell has colspan = 2, so we need to return 3, not 2
|
517
|
+
*
|
518
|
+
* @param {module:engine/model/element~Element} table
|
519
|
+
* @param {Object} dimensions
|
520
|
+
* @param {Number} dimensions.firstRow
|
521
|
+
* @param {Number} dimensions.firstColumn
|
522
|
+
* @param {Number} dimensions.lastRow
|
523
|
+
* @param {Number} dimensions.lastColumn
|
524
|
+
* @returns {Number} Adjusted last column index.
|
525
|
+
*/
|
526
|
+
export function adjustLastColumnIndex( table, dimensions ) {
|
527
|
+
const lastColumnMap = Array.from( new TableWalker( table, {
|
528
|
+
startRow: dimensions.firstRow,
|
529
|
+
endRow: dimensions.lastRow,
|
530
|
+
column: dimensions.lastColumn
|
531
|
+
} ) );
|
532
|
+
|
533
|
+
const everyCellHasSingleColspan = lastColumnMap.every( ( { cellWidth } ) => cellWidth === 1 );
|
534
|
+
|
535
|
+
// It is a "flat" column, so the last column index is OK.
|
536
|
+
if ( everyCellHasSingleColspan ) {
|
537
|
+
return dimensions.lastColumn;
|
538
|
+
}
|
539
|
+
|
540
|
+
// Otherwise get any cell's colspan and adjust the last column index.
|
541
|
+
const colspanAdjustment = lastColumnMap[ 0 ].cellWidth - 1;
|
542
|
+
return dimensions.lastColumn + colspanAdjustment;
|
543
|
+
}
|
@@ -0,0 +1,66 @@
|
|
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/utils/table-properties
|
8
|
+
*/
|
9
|
+
|
10
|
+
import { isObject } from 'lodash-es';
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Returns a string if all four values of box sides are equal.
|
14
|
+
*
|
15
|
+
* If a string is passed, it is treated as a single value (pass-through).
|
16
|
+
*
|
17
|
+
* // Returns 'foo':
|
18
|
+
* getSingleValue( { top: 'foo', right: 'foo', bottom: 'foo', left: 'foo' } );
|
19
|
+
* getSingleValue( 'foo' );
|
20
|
+
*
|
21
|
+
* // Returns undefined:
|
22
|
+
* getSingleValue( { top: 'foo', right: 'foo', bottom: 'bar', left: 'foo' } );
|
23
|
+
* getSingleValue( { top: 'foo', right: 'foo' } );
|
24
|
+
*
|
25
|
+
* @param objectOrString
|
26
|
+
* @returns {module:engine/view/stylesmap~BoxSides|String}
|
27
|
+
*/
|
28
|
+
export function getSingleValue( objectOrString ) {
|
29
|
+
if ( !objectOrString || !isObject( objectOrString ) ) {
|
30
|
+
return objectOrString;
|
31
|
+
}
|
32
|
+
|
33
|
+
const { top, right, bottom, left } = objectOrString;
|
34
|
+
|
35
|
+
if ( top == right && right == bottom && bottom == left ) {
|
36
|
+
return top;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Adds a unit to a value if the value is a number or a string representing a number.
|
42
|
+
*
|
43
|
+
* **Note**: It does nothing to non-numeric values.
|
44
|
+
*
|
45
|
+
* getSingleValue( 25, 'px' ); // '25px'
|
46
|
+
* getSingleValue( 25, 'em' ); // '25em'
|
47
|
+
* getSingleValue( '25em', 'px' ); // '25em'
|
48
|
+
* getSingleValue( 'foo', 'px' ); // 'foo'
|
49
|
+
*
|
50
|
+
* @param {*} value
|
51
|
+
* @param {String} defaultUnit A default unit added to a numeric value.
|
52
|
+
* @returns {String|*}
|
53
|
+
*/
|
54
|
+
export function addDefaultUnitToNumericValue( value, defaultUnit ) {
|
55
|
+
const numericValue = parseFloat( value );
|
56
|
+
|
57
|
+
if ( Number.isNaN( numericValue ) ) {
|
58
|
+
return value;
|
59
|
+
}
|
60
|
+
|
61
|
+
if ( String( numericValue ) !== String( value ) ) {
|
62
|
+
return value;
|
63
|
+
}
|
64
|
+
|
65
|
+
return `${ numericValue }${ defaultUnit }`;
|
66
|
+
}
|