@progress/kendo-react-editor 9.4.0-develop.23 → 9.4.0-develop.3

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 (97) hide show
  1. package/Editor.js +1 -1
  2. package/Editor.mjs +1 -0
  3. package/NOTICE.txt +51 -40
  4. package/config/defaultStyles.js +1 -1
  5. package/config/defaultStyles.mjs +1 -0
  6. package/config/shortcuts.js +1 -1
  7. package/config/shortcuts.mjs +9 -8
  8. package/config/toolsSettings.js +1 -1
  9. package/config/toolsSettings.mjs +1 -0
  10. package/dialogs/FindReplace.js +1 -1
  11. package/dialogs/FindReplace.mjs +1 -0
  12. package/dialogs/index.js +1 -1
  13. package/dialogs/index.mjs +1 -0
  14. package/dialogs/insertImage.js +1 -1
  15. package/dialogs/insertImage.mjs +1 -0
  16. package/dialogs/insertLink.js +1 -1
  17. package/dialogs/insertLink.mjs +11 -10
  18. package/dialogs/viewHtml.js +1 -1
  19. package/dialogs/viewHtml.mjs +6 -5
  20. package/dist/cdn/js/kendo-react-editor.js +1 -8
  21. package/index.js +1 -2
  22. package/index.mjs +7 -7
  23. package/messages/index.js +1 -1
  24. package/messages/index.mjs +1 -0
  25. package/package-metadata.js +1 -1
  26. package/package-metadata.mjs +3 -2
  27. package/package.json +14 -14
  28. package/tools/align.js +1 -1
  29. package/tools/align.mjs +5 -4
  30. package/tools/applyColor.js +1 -1
  31. package/tools/applyColor.mjs +6 -5
  32. package/tools/cleanFormatting.js +1 -1
  33. package/tools/cleanFormatting.mjs +9 -8
  34. package/tools/findReplace.js +1 -1
  35. package/tools/findReplace.mjs +10 -9
  36. package/tools/fontStyle.js +1 -1
  37. package/tools/fontStyle.mjs +7 -6
  38. package/tools/formatBlock.js +1 -1
  39. package/tools/formatBlock.mjs +11 -10
  40. package/tools/history.js +1 -1
  41. package/tools/history.mjs +3 -2
  42. package/tools/indent.js +1 -1
  43. package/tools/indent.mjs +1 -0
  44. package/tools/index.js +1 -1
  45. package/tools/index.mjs +1 -0
  46. package/tools/inlineFormat.js +1 -1
  47. package/tools/inlineFormat.mjs +5 -4
  48. package/tools/insertImage.js +1 -1
  49. package/tools/insertImage.mjs +5 -4
  50. package/tools/insertLink.js +1 -1
  51. package/tools/insertLink.mjs +14 -13
  52. package/tools/insertTable/popup.js +1 -1
  53. package/tools/insertTable/popup.mjs +5 -4
  54. package/tools/insertTable/popupGrid.js +1 -1
  55. package/tools/insertTable/popupGrid.mjs +1 -0
  56. package/tools/insertTable/tool.js +1 -1
  57. package/tools/insertTable/tool.mjs +1 -0
  58. package/tools/lists-styled.js +1 -1
  59. package/tools/lists-styled.mjs +1 -0
  60. package/tools/lists.js +1 -1
  61. package/tools/lists.mjs +14 -13
  62. package/tools/outdent.js +1 -1
  63. package/tools/outdent.mjs +1 -0
  64. package/tools/pdf.js +1 -1
  65. package/tools/pdf.mjs +5 -4
  66. package/tools/print.js +1 -1
  67. package/tools/print.mjs +5 -4
  68. package/tools/proseMirrorTool.js +1 -1
  69. package/tools/proseMirrorTool.mjs +9 -8
  70. package/tools/selectAll.js +1 -1
  71. package/tools/selectAll.mjs +6 -5
  72. package/tools/table-wizard/cellPropsUtils.js +1 -1
  73. package/tools/table-wizard/cellPropsUtils.mjs +35 -34
  74. package/tools/table-wizard/tableCellProperties.js +1 -1
  75. package/tools/table-wizard/tableCellProperties.mjs +1 -0
  76. package/tools/table-wizard/tableProperties.js +1 -1
  77. package/tools/table-wizard/tableProperties.mjs +45 -44
  78. package/tools/table-wizard/tablePropsUtils.js +1 -1
  79. package/tools/table-wizard/tablePropsUtils.mjs +100 -99
  80. package/tools/table-wizard/utils.js +1 -1
  81. package/tools/table-wizard/utils.mjs +18 -17
  82. package/tools/tableEdit.js +1 -1
  83. package/tools/tableEdit.mjs +3 -2
  84. package/tools/unlink.js +1 -1
  85. package/tools/unlink.mjs +9 -8
  86. package/tools/utils.js +1 -1
  87. package/tools/utils.mjs +1 -0
  88. package/tools/viewHtml.js +1 -1
  89. package/tools/viewHtml.mjs +12 -11
  90. package/utils/browser-detection.js +1 -1
  91. package/utils/browser-detection.mjs +1 -0
  92. package/utils/controlled-value.js +1 -1
  93. package/utils/controlled-value.mjs +3 -2
  94. package/utils/index.js +1 -1
  95. package/utils/index.mjs +1 -0
  96. package/utils/props-key.js +1 -1
  97. package/utils/props-key.mjs +4 -3
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("@progress/kendo-react-buttons"),d=require("@progress/kendo-react-intl"),g=require("./utils.js"),f=require("../messages/index.js"),b=require("@progress/kendo-editor-common"),p=require("../config/toolsSettings.js");function m(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(e,o,n.get?n:{enumerable:!0,get:()=>t[o]})}}return e.default=t,Object.freeze(e)}const c=m(u),{selectAll:S}=p.EditorToolsSettings,q=t=>{const{view:e,render:o,settings:n=S,...l}=t,s=n.messages.title,i=c.useCallback(()=>{e&&(b.selectAll(e.state,e.dispatch),e.focus())},[e]),r=c.createElement(a.Button,{onClick:i,title:d.useLocalization().toLanguageString(s,f.messages[s]),...g.onDownPreventDefault,...n.props,...l});return o?o.call(void 0,r,{view:e}):r};exports.SelectAll=q;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("react"),a=require("@progress/kendo-react-buttons"),d=require("@progress/kendo-react-intl"),g=require("./utils.js"),f=require("../messages/index.js"),b=require("@progress/kendo-editor-common"),p=require("../config/toolsSettings.js");function m(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const n in t)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,o.get?o:{enumerable:!0,get:()=>t[n]})}}return e.default=t,Object.freeze(e)}const r=m(u),{selectAll:S}=p.EditorToolsSettings,q=t=>{const{view:e,render:n,settings:o=S,...l}=t,s=o.messages.title,i=r.useCallback(()=>{e&&(b.selectAll(e.state,e.dispatch),e.focus())},[e]),c=r.createElement(a.Button,{onClick:i,title:d.useLocalization().toLanguageString(s,f.messages[s]),...g.onDownPreventDefault,...o.props,...l});return n?n.call(void 0,c,{view:e}):c};exports.SelectAll=q;
@@ -5,7 +5,8 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- import * as l from "react";
8
+ "use client";
9
+ import * as r from "react";
9
10
  import { Button as m } from "@progress/kendo-react-buttons";
10
11
  import { useLocalization as a } from "@progress/kendo-react-intl";
11
12
  import { onDownPreventDefault as p } from "./utils.mjs";
@@ -13,19 +14,19 @@ import { messages as f } from "../messages/index.mjs";
13
14
  import { selectAll as u } from "@progress/kendo-editor-common";
14
15
  import { EditorToolsSettings as g } from "../config/toolsSettings.mjs";
15
16
  const { selectAll: d } = g, C = (i) => {
16
- const { view: t, render: o, settings: e = d, ...n } = i, s = e.messages.title, c = l.useCallback(() => {
17
+ const { view: t, render: e, settings: o = d, ...n } = i, s = o.messages.title, c = r.useCallback(() => {
17
18
  t && (u(t.state, t.dispatch), t.focus());
18
- }, [t]), r = /* @__PURE__ */ l.createElement(
19
+ }, [t]), l = /* @__PURE__ */ r.createElement(
19
20
  m,
20
21
  {
21
22
  onClick: c,
22
23
  title: a().toLanguageString(s, f[s]),
23
24
  ...p,
24
- ...e.props,
25
+ ...o.props,
25
26
  ...n
26
27
  }
27
28
  );
28
- return o ? o.call(void 0, r, { view: t }) : r;
29
+ return e ? e.call(void 0, l, { view: t }) : l;
29
30
  };
30
31
  export {
31
32
  C as SelectAll
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@progress/kendo-editor-common"),s=require("./utils.js"),N=require("../utils.js"),b="k-colgroup-data",x=(o,e,n)=>{const l={cellWidth:null,widthUnit:""},r=e.node,t=n.start(e.depth);if(!r.attrs[b])return l;const h=new Set;let i="";const y=w.htmlToFragment(r.attrs[b]).firstChild;return o.forEach(a=>{const u=r.resolve(a.pos-t),c=u.parent,C=u.index();let g=0;for(let f=0;f<=C;f++)g+=c.child(f).attrs.colspan;const d=y.children[g-1];d&&(i=d.style.width,h.add(i))}),h.size===1&&i&&(l.cellWidth=parseFloat(i)||null,l.widthUnit=s.getUnit(i)),l},v=(o,e,n)=>{const l={cellHeight:null,heightUnit:""},r=e.node,t=n.start(e.depth),h=new Set;let i="";return o.forEach(y=>{var c;const u=r.resolve(y.pos-t).parent;i=s.parseStyle(((c=u.attrs)==null?void 0:c.style)||"").height||"",h.add(i)}),h.size===1&&i&&(l.cellHeight=parseFloat(i)||null,l.heightUnit=s.getUnit(i)),l},p=(o,e)=>{const n=new Set;let l="";return o.forEach(r=>{var t;l=s.parseStyle(((t=r.node.attrs)==null?void 0:t.style)||"")[e]||"",n.add(l)}),n.size===1&&l?l:""},S=(o,e)=>{const n=new Set;let l="";return o.forEach(r=>{l=(r.node.attrs||{})[e]||"",n.add(l)}),n.size===1&&l?l:""},m={applyToAll:!1,cellWidth:null,widthUnit:"",cellHeight:null,heightUnit:"",alignment:{x:"",y:""},textControl:"",backgroundColor:void 0,cellPadding:null,borderWidth:null,borderColor:void 0,borderStyle:null,id:"",className:""},k=o=>{const e=s.selectedCells(o),n=o.selection.$from,l=e.length?N.parentNode(n,r=>r.type.spec.tableRole==="table"):null;return l?{...m,...x(e,l,n),...v(e,l,n),alignment:{x:p(e,"text-align"),y:p(e,"vertical-align")},textControl:p(e,"white-space"),backgroundColor:p(e,"background-color")||void 0,cellPadding:parseFloat(p(e,"padding"))||null,borderWidth:parseFloat(p(e,"border-width"))||null,borderColor:p(e,"border-color")||void 0,borderStyle:p(e,"border-style")||null,id:S(e,"id"),className:S(e,"class")}:m},W=(o,e,n)=>{const l=o.doc.resolve(e),r=l.parent,t=l.index();let h=0;for(let c=0;c<=t;c++)h+=r.child(c).attrs.colspan;const i=l.node(l.depth-1),y=l.posAtIndex(0,l.depth-1)-1;let a=i.attrs,u;if(a&&a[b]){const c=w.htmlToFragment(a[b]).firstChild;u=c.children[h-1],u.style.width=n,a={...a,[b]:c.outerHTML},o.setNodeMarkup(y,null,a)}else{let c=0;for(let d=0;d<r.childCount;d++)c+=r.child(d).attrs.colspan;const C=document.createElement("colgroup"),g=new Array(c);for(let d=0;d<c;d++)g[d]=document.createElement("col"),C.appendChild(g[d]);u=g[t],u.style.width=n,a={...a,[b]:"<colgroup>"+g.reduce((d,f)=>d+f.outerHTML,"")+"</colgroup>"},o.setNodeMarkup(y,null,a)}},P=(o,e,n)=>{const l=o.doc.resolve(e),r=l.parent,t=l.posAtIndex(0)-1;o.setNodeMarkup(t,null,s.setNodeStyle(r.attrs,"height",n))},U=(o,e,n)=>{n.forEach(({node:l,pos:r})=>{let t={...l.attrs};t=s.setNodeStyle(t,"border-color",e.borderColor||""),t=s.setNodeStyle(t,"border-style",e.borderStyle||""),t=s.setNodeStyle(t,"border-width",typeof e.borderWidth=="number"?e.borderWidth+"px":""),t=s.setNodeStyle(t,"padding",typeof e.cellPadding=="number"?e.cellPadding+"px":""),t=s.setNodeStyle(t,"background-color",e.backgroundColor||""),t=s.setNodeStyle(t,"text-align",e.alignment.x||""),t=s.setNodeStyle(t,"vertical-align",e.alignment.y||""),t=s.setNodeStyle(t,"white-space",e.textControl||""),t.id=e.id||null,t.class=e.className||null,o.setNodeMarkup(r,null,t),typeof e.cellWidth=="number"&&W(o,r,e.cellWidth+(e.widthUnit||"px")),typeof e.cellHeight=="number"&&P(o,r,e.cellHeight+(e.heightUnit||"px"))})},H=(o,e)=>{const n=o.tr,l=e.applyToAll?s.tableCells(o):s.selectedCells(o);return U(n,e,l),n};exports.applyCellsData=H;exports.cellsDefaultData=k;exports.initialCellData=m;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("@progress/kendo-editor-common"),s=require("./utils.js"),N=require("../utils.js"),b="k-colgroup-data",x=(o,e,n)=>{const l={cellWidth:null,widthUnit:""},r=e.node,t=n.start(e.depth);if(!r.attrs[b])return l;const h=new Set;let i="";const y=w.htmlToFragment(r.attrs[b]).firstChild;return o.forEach(a=>{const u=r.resolve(a.pos-t),c=u.parent,C=u.index();let g=0;for(let f=0;f<=C;f++)g+=c.child(f).attrs.colspan;const d=y.children[g-1];d&&(i=d.style.width,h.add(i))}),h.size===1&&i&&(l.cellWidth=parseFloat(i)||null,l.widthUnit=s.getUnit(i)),l},v=(o,e,n)=>{const l={cellHeight:null,heightUnit:""},r=e.node,t=n.start(e.depth),h=new Set;let i="";return o.forEach(y=>{var c;const u=r.resolve(y.pos-t).parent;i=s.parseStyle(((c=u.attrs)==null?void 0:c.style)||"").height||"",h.add(i)}),h.size===1&&i&&(l.cellHeight=parseFloat(i)||null,l.heightUnit=s.getUnit(i)),l},p=(o,e)=>{const n=new Set;let l="";return o.forEach(r=>{var t;l=s.parseStyle(((t=r.node.attrs)==null?void 0:t.style)||"")[e]||"",n.add(l)}),n.size===1&&l?l:""},S=(o,e)=>{const n=new Set;let l="";return o.forEach(r=>{l=(r.node.attrs||{})[e]||"",n.add(l)}),n.size===1&&l?l:""},m={applyToAll:!1,cellWidth:null,widthUnit:"",cellHeight:null,heightUnit:"",alignment:{x:"",y:""},textControl:"",backgroundColor:void 0,cellPadding:null,borderWidth:null,borderColor:void 0,borderStyle:null,id:"",className:""},k=o=>{const e=s.selectedCells(o),n=o.selection.$from,l=e.length?N.parentNode(n,r=>r.type.spec.tableRole==="table"):null;return l?{...m,...x(e,l,n),...v(e,l,n),alignment:{x:p(e,"text-align"),y:p(e,"vertical-align")},textControl:p(e,"white-space"),backgroundColor:p(e,"background-color")||void 0,cellPadding:parseFloat(p(e,"padding"))||null,borderWidth:parseFloat(p(e,"border-width"))||null,borderColor:p(e,"border-color")||void 0,borderStyle:p(e,"border-style")||null,id:S(e,"id"),className:S(e,"class")}:m},W=(o,e,n)=>{const l=o.doc.resolve(e),r=l.parent,t=l.index();let h=0;for(let c=0;c<=t;c++)h+=r.child(c).attrs.colspan;const i=l.node(l.depth-1),y=l.posAtIndex(0,l.depth-1)-1;let a=i.attrs,u;if(a&&a[b]){const c=w.htmlToFragment(a[b]).firstChild;u=c.children[h-1],u.style.width=n,a={...a,[b]:c.outerHTML},o.setNodeMarkup(y,null,a)}else{let c=0;for(let d=0;d<r.childCount;d++)c+=r.child(d).attrs.colspan;const C=document.createElement("colgroup"),g=new Array(c);for(let d=0;d<c;d++)g[d]=document.createElement("col"),C.appendChild(g[d]);u=g[t],u.style.width=n,a={...a,[b]:"<colgroup>"+g.reduce((d,f)=>d+f.outerHTML,"")+"</colgroup>"},o.setNodeMarkup(y,null,a)}},P=(o,e,n)=>{const l=o.doc.resolve(e),r=l.parent,t=l.posAtIndex(0)-1;o.setNodeMarkup(t,null,s.setNodeStyle(r.attrs,"height",n))},U=(o,e,n)=>{n.forEach(({node:l,pos:r})=>{let t={...l.attrs};t=s.setNodeStyle(t,"border-color",e.borderColor||""),t=s.setNodeStyle(t,"border-style",e.borderStyle||""),t=s.setNodeStyle(t,"border-width",typeof e.borderWidth=="number"?e.borderWidth+"px":""),t=s.setNodeStyle(t,"padding",typeof e.cellPadding=="number"?e.cellPadding+"px":""),t=s.setNodeStyle(t,"background-color",e.backgroundColor||""),t=s.setNodeStyle(t,"text-align",e.alignment.x||""),t=s.setNodeStyle(t,"vertical-align",e.alignment.y||""),t=s.setNodeStyle(t,"white-space",e.textControl||""),t.id=e.id||null,t.class=e.className||null,o.setNodeMarkup(r,null,t),typeof e.cellWidth=="number"&&W(o,r,e.cellWidth+(e.widthUnit||"px")),typeof e.cellHeight=="number"&&P(o,r,e.cellHeight+(e.heightUnit||"px"))})},H=(o,e)=>{const n=o.tr,l=e.applyToAll?s.tableCells(o):s.selectedCells(o);return U(n,e,l),n};exports.applyCellsData=H;exports.cellsDefaultData=k;exports.initialCellData=m;
@@ -5,51 +5,52 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
+ "use client";
8
9
  import { htmlToFragment as x } from "@progress/kendo-editor-common";
9
10
  import { selectedCells as v, tableCells as W, getUnit as N, parseStyle as S, setNodeStyle as u } from "./utils.mjs";
10
11
  import { parentNode as k } from "../utils.mjs";
11
- const f = "k-colgroup-data", H = (o, e, r) => {
12
+ const f = "k-colgroup-data", H = (o, e, n) => {
12
13
  const l = {
13
14
  cellWidth: null,
14
15
  widthUnit: ""
15
- }, n = e.node, t = r.start(e.depth);
16
- if (!n.attrs[f])
16
+ }, r = e.node, t = n.start(e.depth);
17
+ if (!r.attrs[f])
17
18
  return l;
18
19
  const h = /* @__PURE__ */ new Set();
19
20
  let s = "";
20
- const b = x(n.attrs[f]).firstChild;
21
+ const b = x(r.attrs[f]).firstChild;
21
22
  return o.forEach((d) => {
22
- const a = n.resolve(d.pos - t), c = a.parent, m = a.index();
23
+ const a = r.resolve(d.pos - t), c = a.parent, m = a.index();
23
24
  let g = 0;
24
25
  for (let y = 0; y <= m; y++)
25
26
  g += c.child(y).attrs.colspan;
26
27
  const i = b.children[g - 1];
27
28
  i && (s = i.style.width, h.add(s));
28
29
  }), h.size === 1 && s && (l.cellWidth = parseFloat(s) || null, l.widthUnit = N(s)), l;
29
- }, P = (o, e, r) => {
30
+ }, P = (o, e, n) => {
30
31
  const l = {
31
32
  cellHeight: null,
32
33
  heightUnit: ""
33
- }, n = e.node, t = r.start(e.depth), h = /* @__PURE__ */ new Set();
34
+ }, r = e.node, t = n.start(e.depth), h = /* @__PURE__ */ new Set();
34
35
  let s = "";
35
36
  return o.forEach((b) => {
36
37
  var c;
37
- const a = n.resolve(b.pos - t).parent;
38
+ const a = r.resolve(b.pos - t).parent;
38
39
  s = S(((c = a.attrs) == null ? void 0 : c.style) || "").height || "", h.add(s);
39
40
  }), h.size === 1 && s && (l.cellHeight = parseFloat(s) || null, l.heightUnit = N(s)), l;
40
41
  }, p = (o, e) => {
41
- const r = /* @__PURE__ */ new Set();
42
+ const n = /* @__PURE__ */ new Set();
42
43
  let l = "";
43
- return o.forEach((n) => {
44
+ return o.forEach((r) => {
44
45
  var t;
45
- l = S(((t = n.node.attrs) == null ? void 0 : t.style) || "")[e] || "", r.add(l);
46
- }), r.size === 1 && l ? l : "";
46
+ l = S(((t = r.node.attrs) == null ? void 0 : t.style) || "")[e] || "", n.add(l);
47
+ }), n.size === 1 && l ? l : "";
47
48
  }, w = (o, e) => {
48
- const r = /* @__PURE__ */ new Set();
49
+ const n = /* @__PURE__ */ new Set();
49
50
  let l = "";
50
- return o.forEach((n) => {
51
- l = (n.node.attrs || {})[e] || "", r.add(l);
52
- }), r.size === 1 && l ? l : "";
51
+ return o.forEach((r) => {
52
+ l = (r.node.attrs || {})[e] || "", n.add(l);
53
+ }), n.size === 1 && l ? l : "";
53
54
  }, C = {
54
55
  applyToAll: !1,
55
56
  cellWidth: null,
@@ -66,11 +67,11 @@ const f = "k-colgroup-data", H = (o, e, r) => {
66
67
  id: "",
67
68
  className: ""
68
69
  }, T = (o) => {
69
- const e = v(o), r = o.selection.$from, l = e.length ? k(r, (n) => n.type.spec.tableRole === "table") : null;
70
+ const e = v(o), n = o.selection.$from, l = e.length ? k(n, (r) => r.type.spec.tableRole === "table") : null;
70
71
  return l ? {
71
72
  ...C,
72
- ...H(e, l, r),
73
- ...P(e, l, r),
73
+ ...H(e, l, n),
74
+ ...P(e, l, n),
74
75
  alignment: { x: p(e, "text-align"), y: p(e, "vertical-align") },
75
76
  textControl: p(e, "white-space"),
76
77
  backgroundColor: p(e, "background-color") || void 0,
@@ -81,43 +82,43 @@ const f = "k-colgroup-data", H = (o, e, r) => {
81
82
  id: w(e, "id"),
82
83
  className: w(e, "class")
83
84
  } : C;
84
- }, U = (o, e, r) => {
85
- const l = o.doc.resolve(e), n = l.parent, t = l.index();
85
+ }, U = (o, e, n) => {
86
+ const l = o.doc.resolve(e), r = l.parent, t = l.index();
86
87
  let h = 0;
87
88
  for (let c = 0; c <= t; c++)
88
- h += n.child(c).attrs.colspan;
89
+ h += r.child(c).attrs.colspan;
89
90
  const s = l.node(l.depth - 1), b = l.posAtIndex(0, l.depth - 1) - 1;
90
91
  let d = s.attrs, a;
91
92
  if (d && d[f]) {
92
93
  const c = x(d[f]).firstChild;
93
- a = c.children[h - 1], a.style.width = r, d = { ...d, [f]: c.outerHTML }, o.setNodeMarkup(b, null, d);
94
+ a = c.children[h - 1], a.style.width = n, d = { ...d, [f]: c.outerHTML }, o.setNodeMarkup(b, null, d);
94
95
  } else {
95
96
  let c = 0;
96
- for (let i = 0; i < n.childCount; i++)
97
- c += n.child(i).attrs.colspan;
97
+ for (let i = 0; i < r.childCount; i++)
98
+ c += r.child(i).attrs.colspan;
98
99
  const m = document.createElement("colgroup"), g = new Array(c);
99
100
  for (let i = 0; i < c; i++)
100
101
  g[i] = document.createElement("col"), m.appendChild(g[i]);
101
- a = g[t], a.style.width = r, d = {
102
+ a = g[t], a.style.width = n, d = {
102
103
  ...d,
103
104
  [f]: "<colgroup>" + g.reduce((i, y) => i + y.outerHTML, "") + "</colgroup>"
104
105
  }, o.setNodeMarkup(b, null, d);
105
106
  }
106
- }, E = (o, e, r) => {
107
- const l = o.doc.resolve(e), n = l.parent, t = l.posAtIndex(0) - 1;
108
- o.setNodeMarkup(t, null, u(n.attrs, "height", r));
109
- }, $ = (o, e, r) => {
110
- r.forEach(({ node: l, pos: n }) => {
107
+ }, E = (o, e, n) => {
108
+ const l = o.doc.resolve(e), r = l.parent, t = l.posAtIndex(0) - 1;
109
+ o.setNodeMarkup(t, null, u(r.attrs, "height", n));
110
+ }, $ = (o, e, n) => {
111
+ n.forEach(({ node: l, pos: r }) => {
111
112
  let t = { ...l.attrs };
112
113
  t = u(t, "border-color", e.borderColor || ""), t = u(t, "border-style", e.borderStyle || ""), t = u(
113
114
  t,
114
115
  "border-width",
115
116
  typeof e.borderWidth == "number" ? e.borderWidth + "px" : ""
116
- ), t = u(t, "padding", typeof e.cellPadding == "number" ? e.cellPadding + "px" : ""), t = u(t, "background-color", e.backgroundColor || ""), t = u(t, "text-align", e.alignment.x || ""), t = u(t, "vertical-align", e.alignment.y || ""), t = u(t, "white-space", e.textControl || ""), t.id = e.id || null, t.class = e.className || null, o.setNodeMarkup(n, null, t), typeof e.cellWidth == "number" && U(o, n, e.cellWidth + (e.widthUnit || "px")), typeof e.cellHeight == "number" && E(o, n, e.cellHeight + (e.heightUnit || "px"));
117
+ ), t = u(t, "padding", typeof e.cellPadding == "number" ? e.cellPadding + "px" : ""), t = u(t, "background-color", e.backgroundColor || ""), t = u(t, "text-align", e.alignment.x || ""), t = u(t, "vertical-align", e.alignment.y || ""), t = u(t, "white-space", e.textControl || ""), t.id = e.id || null, t.class = e.className || null, o.setNodeMarkup(r, null, t), typeof e.cellWidth == "number" && U(o, r, e.cellWidth + (e.widthUnit || "px")), typeof e.cellHeight == "number" && E(o, r, e.cellHeight + (e.heightUnit || "px"));
117
118
  });
118
119
  }, z = (o, e) => {
119
- const r = o.tr, l = e.applyToAll ? W(o) : v(o);
120
- return $(r, e, l), r;
120
+ const n = o.tr, l = e.applyToAll ? W(o) : v(o);
121
+ return $(n, e, l), n;
121
122
  };
122
123
  export {
123
124
  z as applyCellsData,
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("react"),x=require("@progress/kendo-react-buttons"),c=require("@progress/kendo-react-inputs"),g=require("@progress/kendo-react-dropdowns"),X=require("@progress/kendo-react-dialogs"),n=require("@progress/kendo-svg-icons"),o=require("../utils.js"),ee=require("@progress/kendo-react-common"),te=require("@progress/kendo-react-intl"),t=require("../../messages/index.js"),le=require("./cellPropsUtils.js");function ye(r){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(l,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}return l.default=r,Object.freeze(l)}const e=ye(ke),be=r=>{const{view:l,...a}=r,[i,p]=e.useState(!1),f=te.useLocalization(),b=!!(l&&o.parentNode(l.state.selection.$from,m=>m.type.spec.tableRole==="table")),k=e.useCallback(()=>{p(!0)},[]),u=e.useCallback(()=>{p(!1),l==null||l.focus()},[l]),y=e.useCallback(m=>{if(l&&m){const d=le.applyCellsData(l.state,m);d.docChanged&&l.dispatch(d)}u()},[l,u]);return e.createElement(e.Fragment,null,e.createElement(x.Button,{type:"button",title:f.toLanguageString(t.keys.cellProperties,t.messages[t.keys.cellProperties]),icon:"table-cell-properties",svgIcon:n.tableCellPropertiesIcon,onClick:k,disabled:!b,...o.onDownPreventDefault,...a}),i&&l&&e.createElement(ve,{view:l,onCancel:u,onSave:y}))},Y=[{textKey:t.keys.cellPropertiesLeftTop,text:t.messages[t.keys.cellPropertiesLeftTop],icon:"table-align-top-left",svgIcon:n.tableAlignTopLeftIcon,value:{x:"left",y:"top"}},{textKey:t.keys.cellPropertiesCenterTop,text:t.messages[t.keys.cellPropertiesCenterTop],icon:"table-align-top-center",svgIcon:n.tableAlignTopCenterIcon,value:{x:"center",y:"top"}},{textKey:t.keys.cellPropertiesRightTop,text:t.messages[t.keys.cellPropertiesRightTop],icon:"table-align-top-right",svgIcon:n.tableAlignTopRightIcon,value:{x:"right",y:"top"}},{textKey:t.keys.cellPropertiesLeftMiddle,text:t.messages[t.keys.cellPropertiesLeftMiddle],icon:"table-align-middle-left",svgIcon:n.tableAlignMiddleLeftIcon,value:{x:"left",y:"middle"}},{textKey:t.keys.cellPropertiesCenterMiddle,text:t.messages[t.keys.cellPropertiesCenterMiddle],icon:"table-align-middle-center",svgIcon:n.tableAlignMiddleCenterIcon,value:{x:"center",y:"middle"}},{textKey:t.keys.cellPropertiesRightMiddle,text:t.messages[t.keys.cellPropertiesRightMiddle],icon:"table-align-middle-right",svgIcon:n.tableAlignMiddleRightIcon,value:{x:"right",y:"middle"}},{textKey:t.keys.cellPropertiesLeftBottom,text:t.messages[t.keys.cellPropertiesLeftBottom],icon:"table-align-bottom-left",svgIcon:n.tableAlignBottomLeftIcon,value:{x:"left",y:"bottom"}},{textKey:t.keys.cellPropertiesCenterBottom,text:t.messages[t.keys.cellPropertiesCenterBottom],icon:"table-align-bottom-center",svgIcon:n.tableAlignBottomCenterIcon,value:{x:"center",y:"bottom"}},{textKey:t.keys.cellPropertiesRightBottom,text:t.messages[t.keys.cellPropertiesRightBottom],icon:"table-align-bottom-right",svgIcon:n.tableAlignBottomRightIcon,value:{x:"right",y:"bottom"}},{textKey:t.keys.cellPropertiesNoAlignment,text:t.messages[t.keys.cellPropertiesNoAlignment],icon:"align-remove",svgIcon:n.tableAlignRemoveIcon,value:{x:"",y:""}}],Z=[{textKey:t.keys.cellPropertiesWrap,text:t.messages[t.keys.cellPropertiesWrap],value:"",icon:"text-wrap",svgIcon:n.textWrapIcon},{textKey:t.keys.cellPropertiesFitToCell,text:t.messages[t.keys.cellPropertiesFitToCell],value:"nowrap",icon:"parameter-string",svgIcon:n.parameterStringIcon}],P=(r,l)=>l?e.createElement(e.Fragment,null,e.createElement(c.InputPrefix,null,e.createElement(ee.IconWrap,{icon:l.svgIcon,name:l.icon})),r):r,E=(r,l)=>{const a=e.createElement(e.Fragment,null,e.createElement(c.InputPrefix,null,e.createElement(ee.IconWrap,{icon:l.dataItem.svgIcon,name:l.dataItem.icon})),r.props.children);return e.cloneElement(r,r.props,a)},ve=r=>{const l=e.useMemo(()=>le.cellsDefaultData(r.view.state),[r.view]),a=te.useLocalization(),i=e.useRef(null),p=l.applyToAll,f=e.useRef(null),b=l.cellWidth,k=e.useRef(null);l.widthUnit&&!o.units.includes(l.widthUnit)&&o.units.push(l.widthUnit);const u=l.widthUnit||"",y=e.useRef(null),m=l.cellHeight,d=e.useRef(null);l.heightUnit&&!o.units.includes(l.heightUnit)&&o.units.push(l.heightUnit);const ae=l.heightUnit||"",C=e.useRef(null),re=Y.find(s=>s.value.x!==void 0&&l.alignment&&s.value.x===l.alignment.x&&s.value.y===l.alignment.y)||null,N=e.useRef(null),se=Z.find(s=>s.value===l.textControl),S=e.useRef(null),oe=l.backgroundColor,v=e.useRef(null),ne=l.cellPadding,h=e.useRef(null),ce=l.borderWidth,I=e.useRef(null),ie=l.borderColor,w=e.useRef(null),me=o.borderStyles.find(s=>s.value===l.borderStyle),R=e.useRef(null),ue=l.id,L=e.useRef(null),de=l.className,ge=e.useCallback(()=>{var D,T,A,B,W,K,U,V,M,q,z,F,H,O,j,_,$,G,J,Q;const s={applyToAll:!!((T=(D=i.current)==null?void 0:D.element)!=null&&T.checked),cellWidth:((A=f.current)==null?void 0:A.value)||null,widthUnit:((B=k.current)==null?void 0:B.value)||"",cellHeight:((W=y.current)==null?void 0:W.value)||null,heightUnit:((K=d.current)==null?void 0:K.value)||"",alignment:(V=(U=C.current)==null?void 0:U.value)==null?void 0:V.value,textControl:(q=(M=N.current)==null?void 0:M.value)==null?void 0:q.value,backgroundColor:(z=S.current)==null?void 0:z.value,cellPadding:typeof((F=v.current)==null?void 0:F.value)=="number"?(H=v.current)==null?void 0:H.value:null,borderWidth:typeof((O=h.current)==null?void 0:O.value)=="number"?(j=h.current)==null?void 0:j.value:null,borderColor:(_=I.current)==null?void 0:_.value,borderStyle:((G=($=w.current)==null?void 0:$.value)==null?void 0:G.value)||null,id:String(((J=R.current)==null?void 0:J.value)||""),className:String(((Q=L.current)==null?void 0:Q.value)||"")};r.onSave.call(void 0,s)},[r.onSave]),pe=e.createElement("div",{className:"k-form k-form-md"},e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("div",{className:"k-form-layout k-d-grid k-grid-cols-4 k-gap-x-4"},e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("div",{className:"k-form-field-wrap"},e.createElement("span",{className:"k-checkbox-wrap"},e.createElement(c.Checkbox,{ref:i,defaultChecked:p})),e.createElement("label",{className:"k-checkbox-label"},a.toLanguageString(t.keys.cellPropertiesApplyToAllCells,t.messages[t.keys.cellPropertiesApplyToAllCells])))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesWidth,t.messages[t.keys.cellPropertiesWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:f,defaultValue:b,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}),e.createElement("div",{className:"k-form-hint"},a.toLanguageString(t.keys.cellPropertiesApplyToColumn,t.messages[t.keys.cellPropertiesApplyToColumn])))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.AutoComplete,{ref:k,defaultValue:u,data:o.units,popupSettings:o.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesHeight,t.messages[t.keys.cellPropertiesHeight])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:y,defaultValue:m,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}),e.createElement("div",{className:"k-form-hint"},a.toLanguageString(t.keys.cellPropertiesApplyToRow,t.messages[t.keys.cellPropertiesApplyToRow])))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.AutoComplete,{ref:d,defaultValue:ae,data:o.units,popupSettings:o.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesAlignment,t.messages[t.keys.cellPropertiesAlignment])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.DropDownList,{ref:C,defaultValue:re,data:Y.map(s=>({...s,text:a.toLanguageString(s.textKey,s.text)})),textField:"text",dataItemKey:"text",popupSettings:o.popupSettings,valueRender:P,itemRender:E}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesTextControl,t.messages[t.keys.cellPropertiesTextControl])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.DropDownList,{ref:N,defaultValue:se,data:Z.map(s=>({...s,text:a.toLanguageString(s.textKey,s.text)})),textField:"text",dataItemKey:"value",popupSettings:o.popupSettings,valueRender:P,itemRender:E}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesCellPadding,t.messages[t.keys.cellPropertiesCellPadding])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:v,defaultValue:ne,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBackground,t.messages[t.keys.cellPropertiesBackground])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.ColorPicker,{ref:S,defaultValue:oe}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBorderWidth,t.messages[t.keys.cellPropertiesBorderWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:h,defaultValue:ce,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBorderColor,t.messages[t.keys.cellPropertiesBorderColor])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.ColorPicker,{ref:I,defaultValue:ie}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBorderStyle,t.messages[t.keys.cellPropertiesBorderStyle])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.DropDownList,{ref:w,defaultValue:me,popupSettings:o.popupSettings,data:o.borderStyles,textField:"text",dataItemKey:"value"}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesId,t.messages[t.keys.cellPropertiesId])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.TextBox,{ref:R,defaultValue:ue}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesCssClass,t.messages[t.keys.cellPropertiesCssClass])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.TextBox,{ref:L,defaultValue:de})))))),fe=[e.createElement(x.Button,{themeColor:"primary",key:"save",onClick:ge},a.toLanguageString(t.keys.cellPropertiesSave,t.messages[t.keys.cellPropertiesSave])),e.createElement(x.Button,{onClick:r.onCancel,key:"cancel"},a.toLanguageString(t.keys.cellPropertiesCancel,t.messages[t.keys.cellPropertiesCancel]))];return e.createElement(X.Window,{className:"k-editor-window k-editor-table-wizard-window",title:a.toLanguageString(t.keys.cellProperties,t.messages[t.keys.cellProperties]),onClose:r.onCancel,key:"dialog",style:{userSelect:"none"},width:408,height:587,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},pe,e.createElement(X.WindowActionsBar,{layout:"start"},...fe))};exports.TableCellProperties=be;exports.itemRenderWithIcon=E;exports.valueRenderWithIcon=P;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ke=require("react"),x=require("@progress/kendo-react-buttons"),c=require("@progress/kendo-react-inputs"),g=require("@progress/kendo-react-dropdowns"),X=require("@progress/kendo-react-dialogs"),o=require("@progress/kendo-svg-icons"),n=require("../utils.js"),ee=require("@progress/kendo-react-common"),te=require("@progress/kendo-react-intl"),t=require("../../messages/index.js"),le=require("./cellPropsUtils.js");function ye(r){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const i=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(l,a,i.get?i:{enumerable:!0,get:()=>r[a]})}}return l.default=r,Object.freeze(l)}const e=ye(ke),be=r=>{const{view:l,...a}=r,[i,p]=e.useState(!1),f=te.useLocalization(),b=!!(l&&n.parentNode(l.state.selection.$from,m=>m.type.spec.tableRole==="table")),k=e.useCallback(()=>{p(!0)},[]),u=e.useCallback(()=>{p(!1),l==null||l.focus()},[l]),y=e.useCallback(m=>{if(l&&m){const d=le.applyCellsData(l.state,m);d.docChanged&&l.dispatch(d)}u()},[l,u]);return e.createElement(e.Fragment,null,e.createElement(x.Button,{type:"button",title:f.toLanguageString(t.keys.cellProperties,t.messages[t.keys.cellProperties]),icon:"table-cell-properties",svgIcon:o.tableCellPropertiesIcon,onClick:k,disabled:!b,...n.onDownPreventDefault,...a}),i&&l&&e.createElement(ve,{view:l,onCancel:u,onSave:y}))},Y=[{textKey:t.keys.cellPropertiesLeftTop,text:t.messages[t.keys.cellPropertiesLeftTop],icon:"table-align-top-left",svgIcon:o.tableAlignTopLeftIcon,value:{x:"left",y:"top"}},{textKey:t.keys.cellPropertiesCenterTop,text:t.messages[t.keys.cellPropertiesCenterTop],icon:"table-align-top-center",svgIcon:o.tableAlignTopCenterIcon,value:{x:"center",y:"top"}},{textKey:t.keys.cellPropertiesRightTop,text:t.messages[t.keys.cellPropertiesRightTop],icon:"table-align-top-right",svgIcon:o.tableAlignTopRightIcon,value:{x:"right",y:"top"}},{textKey:t.keys.cellPropertiesLeftMiddle,text:t.messages[t.keys.cellPropertiesLeftMiddle],icon:"table-align-middle-left",svgIcon:o.tableAlignMiddleLeftIcon,value:{x:"left",y:"middle"}},{textKey:t.keys.cellPropertiesCenterMiddle,text:t.messages[t.keys.cellPropertiesCenterMiddle],icon:"table-align-middle-center",svgIcon:o.tableAlignMiddleCenterIcon,value:{x:"center",y:"middle"}},{textKey:t.keys.cellPropertiesRightMiddle,text:t.messages[t.keys.cellPropertiesRightMiddle],icon:"table-align-middle-right",svgIcon:o.tableAlignMiddleRightIcon,value:{x:"right",y:"middle"}},{textKey:t.keys.cellPropertiesLeftBottom,text:t.messages[t.keys.cellPropertiesLeftBottom],icon:"table-align-bottom-left",svgIcon:o.tableAlignBottomLeftIcon,value:{x:"left",y:"bottom"}},{textKey:t.keys.cellPropertiesCenterBottom,text:t.messages[t.keys.cellPropertiesCenterBottom],icon:"table-align-bottom-center",svgIcon:o.tableAlignBottomCenterIcon,value:{x:"center",y:"bottom"}},{textKey:t.keys.cellPropertiesRightBottom,text:t.messages[t.keys.cellPropertiesRightBottom],icon:"table-align-bottom-right",svgIcon:o.tableAlignBottomRightIcon,value:{x:"right",y:"bottom"}},{textKey:t.keys.cellPropertiesNoAlignment,text:t.messages[t.keys.cellPropertiesNoAlignment],icon:"align-remove",svgIcon:o.tableAlignRemoveIcon,value:{x:"",y:""}}],Z=[{textKey:t.keys.cellPropertiesWrap,text:t.messages[t.keys.cellPropertiesWrap],value:"",icon:"text-wrap",svgIcon:o.textWrapIcon},{textKey:t.keys.cellPropertiesFitToCell,text:t.messages[t.keys.cellPropertiesFitToCell],value:"nowrap",icon:"parameter-string",svgIcon:o.parameterStringIcon}],P=(r,l)=>l?e.createElement(e.Fragment,null,e.createElement(c.InputPrefix,null,e.createElement(ee.IconWrap,{icon:l.svgIcon,name:l.icon})),r):r,E=(r,l)=>{const a=e.createElement(e.Fragment,null,e.createElement(c.InputPrefix,null,e.createElement(ee.IconWrap,{icon:l.dataItem.svgIcon,name:l.dataItem.icon})),r.props.children);return e.cloneElement(r,r.props,a)},ve=r=>{const l=e.useMemo(()=>le.cellsDefaultData(r.view.state),[r.view]),a=te.useLocalization(),i=e.useRef(null),p=l.applyToAll,f=e.useRef(null),b=l.cellWidth,k=e.useRef(null);l.widthUnit&&!n.units.includes(l.widthUnit)&&n.units.push(l.widthUnit);const u=l.widthUnit||"",y=e.useRef(null),m=l.cellHeight,d=e.useRef(null);l.heightUnit&&!n.units.includes(l.heightUnit)&&n.units.push(l.heightUnit);const ae=l.heightUnit||"",C=e.useRef(null),re=Y.find(s=>s.value.x!==void 0&&l.alignment&&s.value.x===l.alignment.x&&s.value.y===l.alignment.y)||null,N=e.useRef(null),se=Z.find(s=>s.value===l.textControl),S=e.useRef(null),ne=l.backgroundColor,v=e.useRef(null),oe=l.cellPadding,h=e.useRef(null),ce=l.borderWidth,I=e.useRef(null),ie=l.borderColor,w=e.useRef(null),me=n.borderStyles.find(s=>s.value===l.borderStyle),R=e.useRef(null),ue=l.id,L=e.useRef(null),de=l.className,ge=e.useCallback(()=>{var D,T,A,B,W,K,U,V,M,q,z,F,H,O,j,_,$,G,J,Q;const s={applyToAll:!!((T=(D=i.current)==null?void 0:D.element)!=null&&T.checked),cellWidth:((A=f.current)==null?void 0:A.value)||null,widthUnit:((B=k.current)==null?void 0:B.value)||"",cellHeight:((W=y.current)==null?void 0:W.value)||null,heightUnit:((K=d.current)==null?void 0:K.value)||"",alignment:(V=(U=C.current)==null?void 0:U.value)==null?void 0:V.value,textControl:(q=(M=N.current)==null?void 0:M.value)==null?void 0:q.value,backgroundColor:(z=S.current)==null?void 0:z.value,cellPadding:typeof((F=v.current)==null?void 0:F.value)=="number"?(H=v.current)==null?void 0:H.value:null,borderWidth:typeof((O=h.current)==null?void 0:O.value)=="number"?(j=h.current)==null?void 0:j.value:null,borderColor:(_=I.current)==null?void 0:_.value,borderStyle:((G=($=w.current)==null?void 0:$.value)==null?void 0:G.value)||null,id:String(((J=R.current)==null?void 0:J.value)||""),className:String(((Q=L.current)==null?void 0:Q.value)||"")};r.onSave.call(void 0,s)},[r.onSave]),pe=e.createElement("div",{className:"k-form k-form-md"},e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("div",{className:"k-form-layout k-d-grid k-grid-cols-4 k-gap-x-4"},e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("div",{className:"k-form-field-wrap"},e.createElement("span",{className:"k-checkbox-wrap"},e.createElement(c.Checkbox,{ref:i,defaultChecked:p})),e.createElement("label",{className:"k-checkbox-label"},a.toLanguageString(t.keys.cellPropertiesApplyToAllCells,t.messages[t.keys.cellPropertiesApplyToAllCells])))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesWidth,t.messages[t.keys.cellPropertiesWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:f,defaultValue:b,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}),e.createElement("div",{className:"k-form-hint"},a.toLanguageString(t.keys.cellPropertiesApplyToColumn,t.messages[t.keys.cellPropertiesApplyToColumn])))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.AutoComplete,{ref:k,defaultValue:u,data:n.units,popupSettings:n.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesHeight,t.messages[t.keys.cellPropertiesHeight])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:y,defaultValue:m,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}),e.createElement("div",{className:"k-form-hint"},a.toLanguageString(t.keys.cellPropertiesApplyToRow,t.messages[t.keys.cellPropertiesApplyToRow])))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.AutoComplete,{ref:d,defaultValue:ae,data:n.units,popupSettings:n.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesAlignment,t.messages[t.keys.cellPropertiesAlignment])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.DropDownList,{ref:C,defaultValue:re,data:Y.map(s=>({...s,text:a.toLanguageString(s.textKey,s.text)})),textField:"text",dataItemKey:"text",popupSettings:n.popupSettings,valueRender:P,itemRender:E}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesTextControl,t.messages[t.keys.cellPropertiesTextControl])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.DropDownList,{ref:N,defaultValue:se,data:Z.map(s=>({...s,text:a.toLanguageString(s.textKey,s.text)})),textField:"text",dataItemKey:"value",popupSettings:n.popupSettings,valueRender:P,itemRender:E}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesCellPadding,t.messages[t.keys.cellPropertiesCellPadding])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:v,defaultValue:oe,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBackground,t.messages[t.keys.cellPropertiesBackground])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.ColorPicker,{ref:S,defaultValue:ne}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBorderWidth,t.messages[t.keys.cellPropertiesBorderWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.NumericTextBox,{ref:h,defaultValue:ce,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBorderColor,t.messages[t.keys.cellPropertiesBorderColor])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.ColorPicker,{ref:I,defaultValue:ie}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesBorderStyle,t.messages[t.keys.cellPropertiesBorderStyle])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(g.DropDownList,{ref:w,defaultValue:me,popupSettings:n.popupSettings,data:n.borderStyles,textField:"text",dataItemKey:"value"}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesId,t.messages[t.keys.cellPropertiesId])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.TextBox,{ref:R,defaultValue:ue}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.cellPropertiesCssClass,t.messages[t.keys.cellPropertiesCssClass])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(c.TextBox,{ref:L,defaultValue:de})))))),fe=[e.createElement(x.Button,{themeColor:"primary",key:"save",onClick:ge},a.toLanguageString(t.keys.cellPropertiesSave,t.messages[t.keys.cellPropertiesSave])),e.createElement(x.Button,{onClick:r.onCancel,key:"cancel"},a.toLanguageString(t.keys.cellPropertiesCancel,t.messages[t.keys.cellPropertiesCancel]))];return e.createElement(X.Window,{className:"k-editor-window k-editor-table-wizard-window",title:a.toLanguageString(t.keys.cellProperties,t.messages[t.keys.cellProperties]),onClose:r.onCancel,key:"dialog",style:{userSelect:"none"},width:408,height:587,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},pe,e.createElement(X.WindowActionsBar,{layout:"start"},...fe))};exports.TableCellProperties=be;exports.itemRenderWithIcon=E;exports.valueRenderWithIcon=P;
@@ -5,6 +5,7 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
+ "use client";
8
9
  import * as e from "react";
9
10
  import { Button as x } from "@progress/kendo-react-buttons";
10
11
  import { Checkbox as Ee, NumericTextBox as k, ColorPicker as X, TextBox as Y, InputPrefix as re } from "@progress/kendo-react-inputs";
@@ -5,4 +5,4 @@
5
5
  * Licensed under commercial license. See LICENSE.md in the package root for more information
6
6
  *-------------------------------------------------------------------------------------------
7
7
  */
8
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const be=require("react"),A=require("@progress/kendo-react-buttons"),n=require("@progress/kendo-react-inputs"),m=require("@progress/kendo-react-dropdowns"),oe=require("@progress/kendo-react-dialogs"),L=require("@progress/kendo-react-layout"),i=require("@progress/kendo-svg-icons"),o=require("../utils.js"),u=require("./tableCellProperties.js"),ue=require("@progress/kendo-react-intl"),t=require("../../messages/index.js"),E=require("./tablePropsUtils.js");function ve(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const g=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(s,a,g.get?g:{enumerable:!0,get:()=>r[a]})}}return s.default=r,Object.freeze(s)}const e=ve(be),ye=r=>{const{view:s,...a}=r,g=ue.useLocalization(),[P,f]=e.useState(!1),b=!!(s&&o.parentNode(s.state.selection.$from,c=>c.type.spec.tableRole==="table")),v=e.useCallback(()=>{f(!0)},[]),d=e.useCallback(()=>{f(!1),s==null||s.focus()},[s]),k=e.useCallback(c=>{if(s&&c){const p=E.applyTableData(s.state,c);p&&s.dispatch(p)}d()},[s,d]);return e.createElement(e.Fragment,null,e.createElement(A.Button,{type:"button",title:g.toLanguageString(t.keys.tableProperties,t.messages[t.keys.tableProperties]),icon:"table-properties",svgIcon:i.tablePropertiesIcon,onClick:v,disabled:!b,...o.onDownPreventDefault,...a}),P&&e.createElement(Ee,{onClose:d,onSave:k,view:s}))},y=[{textKey:t.keys.tablePropertiesAlignLeft,text:t.messages[t.keys.tablePropertiesAlignLeft],value:"left",icon:"table-align-middle-left",svgIcon:i.tableAlignMiddleLeftIcon},{textKey:t.keys.tablePropertiesAlignCenter,text:t.messages[t.keys.tablePropertiesAlignCenter],value:"center",icon:"table-align-middle-center",svgIcon:i.tableAlignMiddleCenterIcon},{textKey:t.keys.tablePropertiesAlignRight,text:t.messages[t.keys.tablePropertiesAlignRight],value:"right",icon:"table-align-middle-right",svgIcon:i.tableAlignMiddleRightIcon},{textKey:t.keys.tablePropertiesNoAlignment,text:t.messages[t.keys.tablePropertiesNoAlignment],value:"",icon:"align-remove",svgIcon:i.tableAlignRemoveIcon}],ie=[{textKey:t.keys.tablePropertiesLeft,text:t.messages[t.keys.tablePropertiesLeft],value:"left",style:{},icon:"table-position-left",svgIcon:i.tablePositionStartIcon},{textKey:t.keys.tablePropertiesCenter,text:t.messages[t.keys.tablePropertiesCenter],value:"center",style:{},icon:"table-position-center",svgIcon:i.tablePositionCenterIcon},{textKey:t.keys.tablePropertiesRight,text:t.messages[t.keys.tablePropertiesRight],value:"right",style:{},icon:"table-position-right",svgIcon:i.tablePositionEndIcon}].map(r=>({...r,style:E.tablePositionStyles[r.value]})),ce=[{textKey:t.keys.tablePropertiesTop,text:t.messages[t.keys.tablePropertiesTop],value:"top",icon:"position-top",svgIcon:i.positionTopIcon},{textKey:t.keys.tablePropertiesBottom,text:t.messages[t.keys.tablePropertiesBottom],value:"bottom",icon:"position-bottom",svgIcon:i.positionBottomIcon}],me=[{textKey:t.keys.tablePropertiesNone,text:t.messages[t.keys.tablePropertiesNone],value:"none"},{textKey:t.keys.tablePropertiesUsingScopeAttribute,text:t.messages[t.keys.tablePropertiesUsingScopeAttribute],value:"scope"},{textKey:t.keys.tablePropertiesUsingIdAttributes,text:t.messages[t.keys.tablePropertiesUsingIdAttributes],value:"id"}],Ee=r=>{const s=e.useMemo(()=>{const l=r.view&&r.view.state;return l?E.tableDefaultData(l):E.initialTableData},[r.view]),a=ue.useLocalization(),[g,P]=e.useState(0),f=e.useCallback(l=>{P(l.selected)},[]),b=e.useRef(null),v=e.useRef(null),d=e.useRef(null),k=e.useRef(null),c=e.useRef(null),p=e.useRef(null),N=e.useRef(null),I=e.useRef(null),B=e.useRef(null),T=e.useRef(null),S=e.useRef(null),x=e.useRef(null),D=e.useRef(null),K=e.useRef(null),V=e.useRef(null),W=e.useRef(null),z=e.useRef(null),q=e.useRef(null),H=e.useRef(null),U=e.useRef(null),h=e.useRef(null),w=e.useRef(null),R=e.useRef(null),de=e.useCallback(()=>{var C,F,M,O,j,_,G,$,J,Q,X,Y,Z,ee,te,ae,le,se,re,ne;const l={rows:((C=b.current)==null?void 0:C.value)||0,columns:((F=v.current)==null?void 0:F.value)||0,width:d.current?d.current.value:null,height:k.current?k.current.value:null,cellSpacing:c.current?c.current.value:null,cellPadding:p.current?p.current.value:null,borderWidth:N.current?N.current.value:null,widthUnit:((M=I.current)==null?void 0:M.value)||"",heightUnit:((O=B.current)==null?void 0:O.value)||"",position:((_=(j=T.current)==null?void 0:j.value)==null?void 0:_.value)||null,textAlign:(G=S.current)!=null&&G.value?S.current.value.value:null,borderStyle:($=x.current)!=null&&$.value?x.current.value.value:null,backgroundColor:(J=D.current)==null?void 0:J.value,borderColor:(Q=K.current)==null?void 0:Q.value,collapseBorders:!!((Y=(X=V.current)==null?void 0:X.element)!=null&&Y.checked),id:String(((Z=W.current)==null?void 0:Z.value)||""),className:String(((ee=z.current)==null?void 0:ee.value)||""),caption:String(((te=q.current)==null?void 0:te.value)||""),headerRows:((ae=H.current)==null?void 0:ae.value)||0,headerColumns:((le=U.current)==null?void 0:le.value)||0,captionAlignment:(se=h.current)!=null&&se.value?h.current.value.value:null,captionPosition:(re=w.current)!=null&&re.value?w.current.value.value:null,associateHeaders:(ne=R.current)!=null&&ne.value?R.current.value.value:"none"};r.onSave.call(void 0,l)},[r.onSave]),ge=e.createElement("div",{className:"k-form k-form-md"},e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("div",{className:"k-form-layout k-d-grid k-grid-cols-4 k-gap-x-4"},e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesRows,t.messages[t.keys.tablePropertiesRows])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:b,defaultValue:s.rows,min:1}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesColumns,t.messages[t.keys.tablePropertiesColumns])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:v,defaultValue:s.columns,min:1}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesWidth,t.messages[t.keys.tablePropertiesWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:d,defaultValue:s.width,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.AutoComplete,{ref:I,defaultValue:s.widthUnit,data:o.units,popupSettings:o.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesHeight,t.messages[t.keys.tablePropertiesHeight])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:k,defaultValue:s.height,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.AutoComplete,{ref:B,defaultValue:s.heightUnit,data:o.units.filter(l=>l!=="%"),popupSettings:o.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesPosition,t.messages[t.keys.tablePropertiesPosition])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:T,defaultValue:ie.find(l=>l.value===s.position),popupSettings:o.popupSettings,data:ie.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),textField:"text",dataItemKey:"value",valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesAlignment,t.messages[t.keys.tablePropertiesAlignment])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:S,defaultValue:y.find(l=>l.value===s.textAlign),data:y.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),textField:"text",dataItemKey:"value",popupSettings:o.popupSettings,valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCellSpacing,t.messages[t.keys.tablePropertiesCellSpacing])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:c,defaultValue:s.cellSpacing,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto]),min:0}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCellPadding,t.messages[t.keys.tablePropertiesCellPadding])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:p,defaultValue:s.cellPadding,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto]),min:0}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesTableBackground,t.messages[t.keys.tablePropertiesTableBackground])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.ColorPicker,{ref:D,defaultValue:s.backgroundColor}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesBorderWidth,t.messages[t.keys.tablePropertiesBorderWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:N,defaultValue:s.borderWidth,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesBorderColor,t.messages[t.keys.tablePropertiesBorderColor])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.ColorPicker,{ref:K,defaultValue:s.borderColor}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesBorderStyle,t.messages[t.keys.tablePropertiesBorderStyle])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:x,defaultValue:o.borderStyles.find(l=>l.value===s.borderStyle),popupSettings:o.popupSettings,data:o.borderStyles.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),textField:"text",dataItemKey:"value"}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.Checkbox,{ref:V,className:"k-checkbox-wrap",label:a.toLanguageString(t.keys.tablePropertiesCollapseBorders,t.messages[t.keys.tablePropertiesCollapseBorders]),defaultChecked:s.collapseBorders})))))),pe=e.createElement("div",{className:"k-form k-form-md"},e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("div",{className:"k-form-layout k-d-grid"},e.createElement("div",{className:"k-form-field"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesId,t.messages[t.keys.tablePropertiesId])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.TextBox,{ref:W,defaultValue:s.id}))),e.createElement("div",{className:"k-form-field"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCssClass,t.messages[t.keys.tablePropertiesCssClass])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.TextBox,{ref:z,defaultValue:s.className}))),e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("legend",{className:"k-form-legend"},a.toLanguageString(t.keys.tablePropertiesAccessibility,t.messages[t.keys.tablePropertiesAccessibility])),e.createElement("div",{className:"k-d-grid k-grid-cols-4 k-gap-x-4"},e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCaption,t.messages[t.keys.tablePropertiesCaption])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.TextBox,{ref:q,defaultValue:s.caption}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCaptionPosition,t.messages[t.keys.tablePropertiesCaptionPosition])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:w,defaultValue:ce.find(l=>l.value===s.captionPosition),data:ce.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),popupSettings:o.popupSettings,textField:"text",dataItemKey:"value",valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCaptionAlignment,t.messages[t.keys.tablePropertiesCaptionAlignment])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:h,defaultValue:y.find(l=>l.value===s.captionAlignment),data:y.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),popupSettings:o.popupSettings,textField:"text",dataItemKey:"value",valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesHeaderRows,t.messages[t.keys.tablePropertiesHeaderRows])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:H,defaultValue:s.headerRows,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesHeaderCols,t.messages[t.keys.tablePropertiesHeaderCols])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:U,defaultValue:s.headerColumns,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesAssociateHeaders,t.messages[t.keys.tablePropertiesAssociateHeaders])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:R,defaultValue:me.find(l=>l.value===s.associateHeaders),data:me.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),popupSettings:o.popupSettings,textField:"text",dataItemKey:"value"})))))))),ke=e.createElement(L.TabStrip,{selected:g,onSelect:f,animation:!1,keepTabsMounted:!0},e.createElement(L.TabStripTab,{title:a.toLanguageString(t.keys.tablePropertiesGeneral,t.messages[t.keys.tablePropertiesGeneral])},ge),e.createElement(L.TabStripTab,{title:a.toLanguageString(t.keys.tablePropertiesAdvanced,t.messages[t.keys.tablePropertiesAdvanced])},pe)),fe=[e.createElement(A.Button,{themeColor:"primary",key:"save",onClick:de},a.toLanguageString(t.keys.tablePropertiesSave,t.messages[t.keys.tablePropertiesSave])),e.createElement(A.Button,{onClick:r.onClose,key:"cancel"},a.toLanguageString(t.keys.tablePropertiesCancel,t.messages[t.keys.tablePropertiesCancel]))];return e.createElement(oe.Window,{className:"k-editor-window k-editor-table-wizard-window",title:a.toLanguageString(t.keys.tableProperties,t.messages[t.keys.tableProperties]),onClose:r.onClose,key:"dialog",style:{userSelect:"none"},width:480,height:630,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},ke,e.createElement(oe.WindowActionsBar,{layout:"start"},...fe))};exports.TableProperties=ye;
8
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const be=require("react"),A=require("@progress/kendo-react-buttons"),n=require("@progress/kendo-react-inputs"),m=require("@progress/kendo-react-dropdowns"),oe=require("@progress/kendo-react-dialogs"),L=require("@progress/kendo-react-layout"),i=require("@progress/kendo-svg-icons"),o=require("../utils.js"),u=require("./tableCellProperties.js"),ue=require("@progress/kendo-react-intl"),t=require("../../messages/index.js"),E=require("./tablePropsUtils.js");function ve(r){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const a in r)if(a!=="default"){const g=Object.getOwnPropertyDescriptor(r,a);Object.defineProperty(s,a,g.get?g:{enumerable:!0,get:()=>r[a]})}}return s.default=r,Object.freeze(s)}const e=ve(be),ye=r=>{const{view:s,...a}=r,g=ue.useLocalization(),[P,f]=e.useState(!1),b=!!(s&&o.parentNode(s.state.selection.$from,c=>c.type.spec.tableRole==="table")),v=e.useCallback(()=>{f(!0)},[]),d=e.useCallback(()=>{f(!1),s==null||s.focus()},[s]),k=e.useCallback(c=>{if(s&&c){const p=E.applyTableData(s.state,c);p&&s.dispatch(p)}d()},[s,d]);return e.createElement(e.Fragment,null,e.createElement(A.Button,{type:"button",title:g.toLanguageString(t.keys.tableProperties,t.messages[t.keys.tableProperties]),icon:"table-properties",svgIcon:i.tablePropertiesIcon,onClick:v,disabled:!b,...o.onDownPreventDefault,...a}),P&&e.createElement(Ee,{onClose:d,onSave:k,view:s}))},y=[{textKey:t.keys.tablePropertiesAlignLeft,text:t.messages[t.keys.tablePropertiesAlignLeft],value:"left",icon:"table-align-middle-left",svgIcon:i.tableAlignMiddleLeftIcon},{textKey:t.keys.tablePropertiesAlignCenter,text:t.messages[t.keys.tablePropertiesAlignCenter],value:"center",icon:"table-align-middle-center",svgIcon:i.tableAlignMiddleCenterIcon},{textKey:t.keys.tablePropertiesAlignRight,text:t.messages[t.keys.tablePropertiesAlignRight],value:"right",icon:"table-align-middle-right",svgIcon:i.tableAlignMiddleRightIcon},{textKey:t.keys.tablePropertiesNoAlignment,text:t.messages[t.keys.tablePropertiesNoAlignment],value:"",icon:"align-remove",svgIcon:i.tableAlignRemoveIcon}],ie=[{textKey:t.keys.tablePropertiesLeft,text:t.messages[t.keys.tablePropertiesLeft],value:"left",style:{},icon:"table-position-left",svgIcon:i.tablePositionStartIcon},{textKey:t.keys.tablePropertiesCenter,text:t.messages[t.keys.tablePropertiesCenter],value:"center",style:{},icon:"table-position-center",svgIcon:i.tablePositionCenterIcon},{textKey:t.keys.tablePropertiesRight,text:t.messages[t.keys.tablePropertiesRight],value:"right",style:{},icon:"table-position-right",svgIcon:i.tablePositionEndIcon}].map(r=>({...r,style:E.tablePositionStyles[r.value]})),ce=[{textKey:t.keys.tablePropertiesTop,text:t.messages[t.keys.tablePropertiesTop],value:"top",icon:"position-top",svgIcon:i.positionTopIcon},{textKey:t.keys.tablePropertiesBottom,text:t.messages[t.keys.tablePropertiesBottom],value:"bottom",icon:"position-bottom",svgIcon:i.positionBottomIcon}],me=[{textKey:t.keys.tablePropertiesNone,text:t.messages[t.keys.tablePropertiesNone],value:"none"},{textKey:t.keys.tablePropertiesUsingScopeAttribute,text:t.messages[t.keys.tablePropertiesUsingScopeAttribute],value:"scope"},{textKey:t.keys.tablePropertiesUsingIdAttributes,text:t.messages[t.keys.tablePropertiesUsingIdAttributes],value:"id"}],Ee=r=>{const s=e.useMemo(()=>{const l=r.view&&r.view.state;return l?E.tableDefaultData(l):E.initialTableData},[r.view]),a=ue.useLocalization(),[g,P]=e.useState(0),f=e.useCallback(l=>{P(l.selected)},[]),b=e.useRef(null),v=e.useRef(null),d=e.useRef(null),k=e.useRef(null),c=e.useRef(null),p=e.useRef(null),N=e.useRef(null),I=e.useRef(null),B=e.useRef(null),T=e.useRef(null),S=e.useRef(null),x=e.useRef(null),D=e.useRef(null),K=e.useRef(null),V=e.useRef(null),W=e.useRef(null),z=e.useRef(null),q=e.useRef(null),H=e.useRef(null),U=e.useRef(null),h=e.useRef(null),w=e.useRef(null),R=e.useRef(null),de=e.useCallback(()=>{var C,F,M,O,j,_,G,$,J,Q,X,Y,Z,ee,te,ae,le,se,re,ne;const l={rows:((C=b.current)==null?void 0:C.value)||0,columns:((F=v.current)==null?void 0:F.value)||0,width:d.current?d.current.value:null,height:k.current?k.current.value:null,cellSpacing:c.current?c.current.value:null,cellPadding:p.current?p.current.value:null,borderWidth:N.current?N.current.value:null,widthUnit:((M=I.current)==null?void 0:M.value)||"",heightUnit:((O=B.current)==null?void 0:O.value)||"",position:((_=(j=T.current)==null?void 0:j.value)==null?void 0:_.value)||null,textAlign:(G=S.current)!=null&&G.value?S.current.value.value:null,borderStyle:($=x.current)!=null&&$.value?x.current.value.value:null,backgroundColor:(J=D.current)==null?void 0:J.value,borderColor:(Q=K.current)==null?void 0:Q.value,collapseBorders:!!((Y=(X=V.current)==null?void 0:X.element)!=null&&Y.checked),id:String(((Z=W.current)==null?void 0:Z.value)||""),className:String(((ee=z.current)==null?void 0:ee.value)||""),caption:String(((te=q.current)==null?void 0:te.value)||""),headerRows:((ae=H.current)==null?void 0:ae.value)||0,headerColumns:((le=U.current)==null?void 0:le.value)||0,captionAlignment:(se=h.current)!=null&&se.value?h.current.value.value:null,captionPosition:(re=w.current)!=null&&re.value?w.current.value.value:null,associateHeaders:(ne=R.current)!=null&&ne.value?R.current.value.value:"none"};r.onSave.call(void 0,l)},[r.onSave]),ge=e.createElement("div",{className:"k-form k-form-md"},e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("div",{className:"k-form-layout k-d-grid k-grid-cols-4 k-gap-x-4"},e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesRows,t.messages[t.keys.tablePropertiesRows])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:b,defaultValue:s.rows,min:1}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesColumns,t.messages[t.keys.tablePropertiesColumns])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:v,defaultValue:s.columns,min:1}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesWidth,t.messages[t.keys.tablePropertiesWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:d,defaultValue:s.width,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.AutoComplete,{ref:I,defaultValue:s.widthUnit,data:o.units,popupSettings:o.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesHeight,t.messages[t.keys.tablePropertiesHeight])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:k,defaultValue:s.height,min:0,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto])}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"}," "),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.AutoComplete,{ref:B,defaultValue:s.heightUnit,data:o.units.filter(l=>l!=="%"),popupSettings:o.popupSettings}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesPosition,t.messages[t.keys.tablePropertiesPosition])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:T,defaultValue:ie.find(l=>l.value===s.position),popupSettings:o.popupSettings,data:ie.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),textField:"text",dataItemKey:"value",valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesAlignment,t.messages[t.keys.tablePropertiesAlignment])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:S,defaultValue:y.find(l=>l.value===s.textAlign),data:y.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),textField:"text",dataItemKey:"value",popupSettings:o.popupSettings,valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCellSpacing,t.messages[t.keys.tablePropertiesCellSpacing])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:c,defaultValue:s.cellSpacing,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto]),min:0}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCellPadding,t.messages[t.keys.tablePropertiesCellPadding])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:p,defaultValue:s.cellPadding,placeholder:a.toLanguageString(t.keys.sizeAuto,t.messages[t.keys.sizeAuto]),min:0}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesTableBackground,t.messages[t.keys.tablePropertiesTableBackground])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.ColorPicker,{ref:D,defaultValue:s.backgroundColor}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesBorderWidth,t.messages[t.keys.tablePropertiesBorderWidth])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:N,defaultValue:s.borderWidth,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesBorderColor,t.messages[t.keys.tablePropertiesBorderColor])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.ColorPicker,{ref:K,defaultValue:s.borderColor}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesBorderStyle,t.messages[t.keys.tablePropertiesBorderStyle])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:x,defaultValue:o.borderStyles.find(l=>l.value===s.borderStyle),popupSettings:o.popupSettings,data:o.borderStyles.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),textField:"text",dataItemKey:"value"}))),e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.Checkbox,{ref:V,className:"k-checkbox-wrap",label:a.toLanguageString(t.keys.tablePropertiesCollapseBorders,t.messages[t.keys.tablePropertiesCollapseBorders]),defaultChecked:s.collapseBorders})))))),pe=e.createElement("div",{className:"k-form k-form-md"},e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("div",{className:"k-form-layout k-d-grid"},e.createElement("div",{className:"k-form-field"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesId,t.messages[t.keys.tablePropertiesId])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.TextBox,{ref:W,defaultValue:s.id}))),e.createElement("div",{className:"k-form-field"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCssClass,t.messages[t.keys.tablePropertiesCssClass])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.TextBox,{ref:z,defaultValue:s.className}))),e.createElement("fieldset",{className:"k-form-fieldset"},e.createElement("legend",{className:"k-form-legend"},a.toLanguageString(t.keys.tablePropertiesAccessibility,t.messages[t.keys.tablePropertiesAccessibility])),e.createElement("div",{className:"k-d-grid k-grid-cols-4 k-gap-x-4"},e.createElement("div",{className:"k-form-field k-col-span-full"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCaption,t.messages[t.keys.tablePropertiesCaption])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.TextBox,{ref:q,defaultValue:s.caption}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCaptionPosition,t.messages[t.keys.tablePropertiesCaptionPosition])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:w,defaultValue:ce.find(l=>l.value===s.captionPosition),data:ce.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),popupSettings:o.popupSettings,textField:"text",dataItemKey:"value",valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesCaptionAlignment,t.messages[t.keys.tablePropertiesCaptionAlignment])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:h,defaultValue:y.find(l=>l.value===s.captionAlignment),data:y.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),popupSettings:o.popupSettings,textField:"text",dataItemKey:"value",valueRender:u.valueRenderWithIcon,itemRender:u.itemRenderWithIcon}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesHeaderRows,t.messages[t.keys.tablePropertiesHeaderRows])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:H,defaultValue:s.headerRows,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-1"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesHeaderCols,t.messages[t.keys.tablePropertiesHeaderCols])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(n.NumericTextBox,{ref:U,defaultValue:s.headerColumns,min:0}))),e.createElement("div",{className:"k-form-field k-col-span-2"},e.createElement("label",{className:"k-label k-form-label"},a.toLanguageString(t.keys.tablePropertiesAssociateHeaders,t.messages[t.keys.tablePropertiesAssociateHeaders])),e.createElement("div",{className:"k-form-field-wrap"},e.createElement(m.DropDownList,{ref:R,defaultValue:me.find(l=>l.value===s.associateHeaders),data:me.map(l=>({...l,text:a.toLanguageString(l.textKey,l.text)})),popupSettings:o.popupSettings,textField:"text",dataItemKey:"value"})))))))),ke=e.createElement(L.TabStrip,{selected:g,onSelect:f,animation:!1,keepTabsMounted:!0},e.createElement(L.TabStripTab,{title:a.toLanguageString(t.keys.tablePropertiesGeneral,t.messages[t.keys.tablePropertiesGeneral])},ge),e.createElement(L.TabStripTab,{title:a.toLanguageString(t.keys.tablePropertiesAdvanced,t.messages[t.keys.tablePropertiesAdvanced])},pe)),fe=[e.createElement(A.Button,{themeColor:"primary",key:"save",onClick:de},a.toLanguageString(t.keys.tablePropertiesSave,t.messages[t.keys.tablePropertiesSave])),e.createElement(A.Button,{onClick:r.onClose,key:"cancel"},a.toLanguageString(t.keys.tablePropertiesCancel,t.messages[t.keys.tablePropertiesCancel]))];return e.createElement(oe.Window,{className:"k-editor-window k-editor-table-wizard-window",title:a.toLanguageString(t.keys.tableProperties,t.messages[t.keys.tableProperties]),onClose:r.onClose,key:"dialog",style:{userSelect:"none"},width:480,height:630,modal:!0,minimizeButton:()=>null,maximizeButton:()=>null,resizable:!1},ke,e.createElement(oe.WindowActionsBar,{layout:"start"},...fe))};exports.TableProperties=ye;