itmar-block-packages 2.1.2 → 3.0.2

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 (218) hide show
  1. package/README.md +18 -4
  2. package/build/cjs/AnimationBlock.js +61 -92
  3. package/build/cjs/AnimationBlock.js.map +1 -1
  4. package/build/cjs/BlockEditWrapper.js +3 -10
  5. package/build/cjs/BlockEditWrapper.js.map +1 -1
  6. package/build/cjs/BlockPlace.js +277 -482
  7. package/build/cjs/BlockPlace.js.map +1 -1
  8. package/build/cjs/BrockInserter.js +195 -191
  9. package/build/cjs/BrockInserter.js.map +1 -1
  10. package/build/cjs/DateElm.js +254 -281
  11. package/build/cjs/DateElm.js.map +1 -1
  12. package/build/cjs/DraggableBox.js +99 -129
  13. package/build/cjs/DraggableBox.js.map +1 -1
  14. package/build/cjs/GridControls.js +292 -392
  15. package/build/cjs/GridControls.js.map +1 -1
  16. package/build/cjs/IconSelectControl.js +65 -156
  17. package/build/cjs/IconSelectControl.js.map +1 -1
  18. package/build/cjs/JapaneseHolidays.js +67 -76
  19. package/build/cjs/JapaneseHolidays.js.map +1 -1
  20. package/build/cjs/MasonryControl.js +95 -100
  21. package/build/cjs/MasonryControl.js.map +1 -1
  22. package/build/cjs/PseudoElm.js +37 -50
  23. package/build/cjs/PseudoElm.js.map +1 -1
  24. package/build/cjs/ShadowStyle.js +216 -430
  25. package/build/cjs/ShadowStyle.js.map +1 -1
  26. package/build/cjs/SwiperControl.js +240 -241
  27. package/build/cjs/SwiperControl.js.map +1 -1
  28. package/build/cjs/ToggleElement.js +17 -9
  29. package/build/cjs/ToggleElement.js.map +1 -1
  30. package/build/cjs/TypographyControls.js +73 -139
  31. package/build/cjs/TypographyControls.js.map +1 -1
  32. package/build/cjs/UpdateAllPostsBlockAttributes.js +102 -119
  33. package/build/cjs/UpdateAllPostsBlockAttributes.js.map +1 -1
  34. package/build/cjs/ZipAddress.js +27 -23
  35. package/build/cjs/ZipAddress.js.map +1 -1
  36. package/build/cjs/blockStore.js +42 -47
  37. package/build/cjs/blockStore.js.map +1 -1
  38. package/build/cjs/cssPropertes.js +165 -117
  39. package/build/cjs/cssPropertes.js.map +1 -1
  40. package/build/cjs/customHooks.js +277 -0
  41. package/build/cjs/customHooks.js.map +1 -0
  42. package/build/cjs/formatCreate.js +115 -145
  43. package/build/cjs/formatCreate.js.map +1 -1
  44. package/build/cjs/hslToRgb.js +112 -116
  45. package/build/cjs/hslToRgb.js.map +1 -1
  46. package/build/cjs/index.js +15 -11
  47. package/build/cjs/index.js.map +1 -1
  48. package/build/cjs/mediaUpload.js +95 -158
  49. package/build/cjs/mediaUpload.js.map +1 -1
  50. package/build/cjs/node_modules/swiper/shared/ssr-window.esm.js +144 -0
  51. package/build/cjs/node_modules/swiper/shared/ssr-window.esm.js.map +1 -0
  52. package/build/cjs/node_modules/swiper/shared/swiper-core.js +3925 -0
  53. package/build/cjs/node_modules/swiper/shared/swiper-core.js.map +1 -0
  54. package/build/cjs/node_modules/swiper/shared/utils.js +294 -0
  55. package/build/cjs/node_modules/swiper/shared/utils.js.map +1 -0
  56. package/build/cjs/pickupStore.js +56 -54
  57. package/build/cjs/pickupStore.js.map +1 -1
  58. package/build/cjs/shopfiApi.js +127 -138
  59. package/build/cjs/shopfiApi.js.map +1 -1
  60. package/build/cjs/types/AnimationBlock.d.ts +22 -0
  61. package/build/cjs/types/BlockEditWrapper.d.ts +7 -0
  62. package/build/cjs/types/BlockPlace.d.ts +49 -0
  63. package/build/cjs/types/BrockInserter.d.ts +6 -0
  64. package/build/cjs/types/DateElm.d.ts +69 -0
  65. package/build/cjs/types/DraggableBox.d.ts +19 -0
  66. package/build/cjs/types/GridControls.d.ts +27 -0
  67. package/build/cjs/types/IconSelectControl.d.ts +17 -0
  68. package/build/cjs/types/JapaneseHolidays.d.ts +6 -0
  69. package/build/cjs/types/MasonryControl.d.ts +35 -0
  70. package/build/cjs/types/PseudoElm.d.ts +11 -0
  71. package/build/cjs/types/ShadowStyle.d.ts +33 -0
  72. package/build/cjs/types/SwiperControl.d.ts +12 -0
  73. package/build/cjs/types/ToggleElement.d.ts +13 -0
  74. package/build/cjs/types/TypographyControls.d.ts +17 -0
  75. package/build/cjs/types/UpdateAllPostsBlockAttributes.d.ts +10 -0
  76. package/build/cjs/types/ZipAddress.d.ts +18 -0
  77. package/build/cjs/types/blockStore.d.ts +15 -0
  78. package/build/cjs/types/cssPropertes.d.ts +53 -0
  79. package/build/cjs/types/customHooks.d.ts +11 -0
  80. package/build/cjs/types/formatCreate.d.ts +18 -0
  81. package/build/cjs/types/hslToRgb.d.ts +23 -0
  82. package/build/cjs/types/index.d.ts +31 -0
  83. package/build/cjs/types/mediaUpload.d.ts +29 -0
  84. package/build/cjs/types/pickupStore.d.ts +39 -0
  85. package/build/cjs/types/shopfiApi.d.ts +18 -0
  86. package/build/cjs/types/validationCheck.d.ts +5 -0
  87. package/build/cjs/types/wordpressApi.d.ts +99 -0
  88. package/build/cjs/validationCheck.js +15 -9
  89. package/build/cjs/validationCheck.js.map +1 -1
  90. package/build/cjs/wordpressApi.js +364 -576
  91. package/build/cjs/wordpressApi.js.map +1 -1
  92. package/build/esm/AnimationBlock.d.ts +22 -0
  93. package/build/esm/AnimationBlock.js +61 -92
  94. package/build/esm/AnimationBlock.js.map +1 -1
  95. package/build/esm/BlockEditWrapper.d.ts +7 -0
  96. package/build/esm/BlockEditWrapper.js +4 -11
  97. package/build/esm/BlockEditWrapper.js.map +1 -1
  98. package/build/esm/BlockPlace.d.ts +49 -0
  99. package/build/esm/BlockPlace.js +279 -484
  100. package/build/esm/BlockPlace.js.map +1 -1
  101. package/build/esm/BrockInserter.d.ts +6 -0
  102. package/build/esm/BrockInserter.js +195 -191
  103. package/build/esm/BrockInserter.js.map +1 -1
  104. package/build/esm/DateElm.d.ts +69 -0
  105. package/build/esm/DateElm.js +254 -281
  106. package/build/esm/DateElm.js.map +1 -1
  107. package/build/esm/DraggableBox.d.ts +19 -0
  108. package/build/esm/DraggableBox.js +99 -129
  109. package/build/esm/DraggableBox.js.map +1 -1
  110. package/build/esm/GridControls.d.ts +27 -0
  111. package/build/esm/GridControls.js +294 -394
  112. package/build/esm/GridControls.js.map +1 -1
  113. package/build/esm/IconSelectControl.d.ts +17 -0
  114. package/build/esm/IconSelectControl.js +65 -156
  115. package/build/esm/IconSelectControl.js.map +1 -1
  116. package/build/esm/JapaneseHolidays.d.ts +6 -0
  117. package/build/esm/JapaneseHolidays.js +67 -76
  118. package/build/esm/JapaneseHolidays.js.map +1 -1
  119. package/build/esm/MasonryControl.d.ts +35 -0
  120. package/build/esm/MasonryControl.js +95 -100
  121. package/build/esm/MasonryControl.js.map +1 -1
  122. package/build/esm/PseudoElm.d.ts +11 -0
  123. package/build/esm/PseudoElm.js +37 -50
  124. package/build/esm/PseudoElm.js.map +1 -1
  125. package/build/esm/ShadowStyle.d.ts +33 -0
  126. package/build/esm/ShadowStyle.js +217 -431
  127. package/build/esm/ShadowStyle.js.map +1 -1
  128. package/build/esm/SwiperControl.d.ts +12 -0
  129. package/build/esm/SwiperControl.js +240 -241
  130. package/build/esm/SwiperControl.js.map +1 -1
  131. package/build/esm/ToggleElement.d.ts +13 -0
  132. package/build/esm/ToggleElement.js +17 -9
  133. package/build/esm/ToggleElement.js.map +1 -1
  134. package/build/esm/TypographyControls.d.ts +17 -0
  135. package/build/esm/TypographyControls.js +73 -139
  136. package/build/esm/TypographyControls.js.map +1 -1
  137. package/build/esm/UpdateAllPostsBlockAttributes.d.ts +10 -0
  138. package/build/esm/UpdateAllPostsBlockAttributes.js +103 -120
  139. package/build/esm/UpdateAllPostsBlockAttributes.js.map +1 -1
  140. package/build/esm/ZipAddress.d.ts +18 -0
  141. package/build/esm/ZipAddress.js +27 -23
  142. package/build/esm/ZipAddress.js.map +1 -1
  143. package/build/esm/blockStore.d.ts +15 -0
  144. package/build/esm/blockStore.js +42 -47
  145. package/build/esm/blockStore.js.map +1 -1
  146. package/build/esm/cssPropertes.d.ts +53 -0
  147. package/build/esm/cssPropertes.js +165 -117
  148. package/build/esm/cssPropertes.js.map +1 -1
  149. package/build/esm/customHooks.d.ts +11 -0
  150. package/build/esm/customHooks.js +267 -0
  151. package/build/esm/customHooks.js.map +1 -0
  152. package/build/esm/formatCreate.d.ts +18 -0
  153. package/build/esm/formatCreate.js +115 -145
  154. package/build/esm/formatCreate.js.map +1 -1
  155. package/build/esm/hslToRgb.d.ts +23 -0
  156. package/build/esm/hslToRgb.js +112 -116
  157. package/build/esm/hslToRgb.js.map +1 -1
  158. package/build/esm/index.d.ts +27 -0
  159. package/build/esm/index.js +8 -1
  160. package/build/esm/index.js.map +1 -1
  161. package/build/esm/mediaUpload.d.ts +29 -0
  162. package/build/esm/mediaUpload.js +95 -158
  163. package/build/esm/mediaUpload.js.map +1 -1
  164. package/build/esm/node_modules/swiper/shared/ssr-window.esm.js +141 -0
  165. package/build/esm/node_modules/swiper/shared/ssr-window.esm.js.map +1 -0
  166. package/build/esm/node_modules/swiper/shared/swiper-core.js +3922 -0
  167. package/build/esm/node_modules/swiper/shared/swiper-core.js.map +1 -0
  168. package/build/esm/node_modules/swiper/shared/utils.js +274 -0
  169. package/build/esm/node_modules/swiper/shared/utils.js.map +1 -0
  170. package/build/esm/pickupStore.d.ts +39 -0
  171. package/build/esm/pickupStore.js +56 -54
  172. package/build/esm/pickupStore.js.map +1 -1
  173. package/build/esm/shopfiApi.d.ts +18 -0
  174. package/build/esm/shopfiApi.js +127 -138
  175. package/build/esm/shopfiApi.js.map +1 -1
  176. package/build/esm/types/AnimationBlock.d.ts +22 -0
  177. package/build/esm/types/BlockEditWrapper.d.ts +7 -0
  178. package/build/esm/types/BlockPlace.d.ts +49 -0
  179. package/build/esm/types/BrockInserter.d.ts +6 -0
  180. package/build/esm/types/DateElm.d.ts +69 -0
  181. package/build/esm/types/DraggableBox.d.ts +19 -0
  182. package/build/esm/types/GridControls.d.ts +27 -0
  183. package/build/esm/types/IconSelectControl.d.ts +17 -0
  184. package/build/esm/types/JapaneseHolidays.d.ts +6 -0
  185. package/build/esm/types/MasonryControl.d.ts +35 -0
  186. package/build/esm/types/PseudoElm.d.ts +11 -0
  187. package/build/esm/types/ShadowStyle.d.ts +33 -0
  188. package/build/esm/types/SwiperControl.d.ts +12 -0
  189. package/build/esm/types/ToggleElement.d.ts +13 -0
  190. package/build/esm/types/TypographyControls.d.ts +17 -0
  191. package/build/esm/types/UpdateAllPostsBlockAttributes.d.ts +10 -0
  192. package/build/esm/types/ZipAddress.d.ts +18 -0
  193. package/build/esm/types/blockStore.d.ts +15 -0
  194. package/build/esm/types/cssPropertes.d.ts +53 -0
  195. package/build/esm/types/customHooks.d.ts +11 -0
  196. package/build/esm/types/formatCreate.d.ts +18 -0
  197. package/build/esm/types/hslToRgb.d.ts +23 -0
  198. package/build/esm/types/index.d.ts +31 -0
  199. package/build/esm/types/mediaUpload.d.ts +29 -0
  200. package/build/esm/types/pickupStore.d.ts +39 -0
  201. package/build/esm/types/shopfiApi.d.ts +18 -0
  202. package/build/esm/types/validationCheck.d.ts +5 -0
  203. package/build/esm/types/wordpressApi.d.ts +99 -0
  204. package/build/esm/validationCheck.d.ts +5 -0
  205. package/build/esm/validationCheck.js +15 -9
  206. package/build/esm/validationCheck.js.map +1 -1
  207. package/build/esm/wordpressApi.d.ts +99 -0
  208. package/build/esm/wordpressApi.js +365 -577
  209. package/build/esm/wordpressApi.js.map +1 -1
  210. package/package.json +29 -7
  211. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -117
  212. package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  213. package/build/cjs/customFooks.js +0 -300
  214. package/build/cjs/customFooks.js.map +0 -1
  215. package/build/esm/_virtual/_rollupPluginBabelHelpers.js +0 -107
  216. package/build/esm/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
  217. package/build/esm/customFooks.js +0 -290
  218. package/build/esm/customFooks.js.map +0 -1
@@ -2,419 +2,319 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js');
5
+ var element = require('@wordpress/element');
6
6
  var components = require('@wordpress/components');
7
7
  var data = require('@wordpress/data');
8
- var element = require('@wordpress/element');
9
8
  var i18n = require('@wordpress/i18n');
10
9
  var icons = require('@wordpress/icons');
11
10
 
12
11
  //上よせアイコン
13
- var upper = /*#__PURE__*/React.createElement(components.Icon, {
14
- icon: icons.justifyLeft,
15
- className: "rotate-icon"
16
- });
12
+ const upper = element.createElement(components.Icon, { icon: icons.justifyLeft, className: "rotate-icon" });
17
13
  //中央よせのアイコン
18
- var middle = /*#__PURE__*/React.createElement(components.Icon, {
19
- icon: icons.justifyCenter,
20
- className: "rotate-icon"
21
- });
14
+ const middle = element.createElement(components.Icon, { icon: icons.justifyCenter, className: "rotate-icon" });
22
15
  //下よせのアイコン
23
- var lower = /*#__PURE__*/React.createElement(components.Icon, {
24
- icon: icons.justifyRight,
25
- className: "rotate-icon"
26
- });
16
+ const lower = element.createElement(components.Icon, { icon: icons.justifyRight, className: "rotate-icon" });
27
17
  // アイコンと文字列キーのマッピングを作成
28
- var alignIconMap = {
29
- left: icons.justifyLeft,
30
- center: icons.justifyCenter,
31
- right: icons.justifyRight,
32
- upper: upper,
33
- middle: middle,
34
- lower: lower
18
+ const alignIconMap = {
19
+ left: icons.justifyLeft,
20
+ center: icons.justifyCenter,
21
+ right: icons.justifyRight,
22
+ upper: upper,
23
+ middle: middle,
24
+ lower: lower,
35
25
  };
36
- var units = [{
37
- value: "px",
38
- label: "px"
39
- }, {
40
- value: "em",
41
- label: "em"
42
- }, {
43
- value: "rem",
44
- label: "rem"
45
- }];
46
- var initializeUnitArray = (rowUnit, length) => {
47
- if (!Array.isArray(rowUnit)) {
48
- // rowUnit が配列ではない(undefined を含む)場合、全て "1fr" で埋めた配列を返す
49
- return Array(length).fill("1fr");
50
- }
51
- return Array.from({
52
- length
53
- }, (_, i) => rowUnit[i] || "1fr");
26
+ const units = [
27
+ { value: "px", label: "px" },
28
+ { value: "em", label: "em" },
29
+ { value: "rem", label: "rem" },
30
+ ];
31
+ const initializeUnitArray = (rowUnit, length) => {
32
+ if (!Array.isArray(rowUnit)) {
33
+ // rowUnit が配列ではない(undefined を含む)場合、全て "1fr" で埋めた配列を返す
34
+ return Array(length).fill("1fr");
35
+ }
36
+ return Array.from({ length }, (_, i) => rowUnit[i] || "1fr");
54
37
  };
55
-
56
- //r,cで与えられた座標がgridElmsのどの要素に含まれているかを返す
57
- var findElementInGrid = (gridElms, r, c) => {
58
- for (var i = 0; i < gridElms.length; i++) {
59
- var {
60
- startCell,
61
- endCell
62
- } = gridElms[i];
63
- // 各座標の最小値と最大値を決定
64
- var minRow = Math.min(startCell === null || startCell === void 0 ? void 0 : startCell.rowInx, endCell === null || endCell === void 0 ? void 0 : endCell.rowInx);
65
- var maxRow = Math.max(startCell === null || startCell === void 0 ? void 0 : startCell.rowInx, endCell === null || endCell === void 0 ? void 0 : endCell.rowInx);
66
- var minCol = Math.min(startCell === null || startCell === void 0 ? void 0 : startCell.colInx, endCell === null || endCell === void 0 ? void 0 : endCell.colInx);
67
- var maxCol = Math.max(startCell === null || startCell === void 0 ? void 0 : startCell.colInx, endCell === null || endCell === void 0 ? void 0 : endCell.colInx);
68
-
69
- // 座標が範囲内にあるかどうかをチェック
70
- if (r >= minRow && r <= maxRow && c >= minCol && c <= maxCol) {
71
- return {
72
- index: i,
73
- elm: gridElms[i]
74
- };
38
+ const findElementInGrid = (gridElms, r, c) => {
39
+ for (let i = 0; i < gridElms.length; i++) {
40
+ const { startCell, endCell } = gridElms[i];
41
+ // 各座標の最小値と最大値を決定
42
+ const minRow = Math.min(startCell?.rowInx, endCell?.rowInx);
43
+ const maxRow = Math.max(startCell?.rowInx, endCell?.rowInx);
44
+ const minCol = Math.min(startCell?.colInx, endCell?.colInx);
45
+ const maxCol = Math.max(startCell?.colInx, endCell?.colInx);
46
+ // 座標が範囲内にあるかどうかをチェック
47
+ if (r >= minRow && r <= maxRow && c >= minCol && c <= maxCol) {
48
+ return { index: i, elm: gridElms[i] };
49
+ }
75
50
  }
76
- }
77
- return null;
51
+ return null;
78
52
  };
79
-
80
- //親にイベントを伝播させないラッパー
81
- var StopPropagationWrapper = _ref => {
82
- var {
83
- children
84
- } = _ref;
85
- var handleClick = event => {
86
- // イベントの伝播を阻止
87
- event.stopPropagation();
88
- };
89
- return /*#__PURE__*/React.createElement("div", {
90
- className: "itmar_event_stopper",
91
- onClick: handleClick
92
- }, children);
53
+ const StopPropagationWrapper = ({ children }) => {
54
+ const handleClick = (event) => {
55
+ // イベントの伝播を阻止
56
+ event.stopPropagation();
57
+ };
58
+ return (element.createElement("div", { className: "itmar_event_stopper", onClick: handleClick }, children));
93
59
  };
94
- var GridControls = _ref2 => {
95
- var {
96
- attributes,
97
- clientId,
98
- onChange: _onChange
99
- } = _ref2;
100
- var {
101
- gridElms,
102
- rowNum,
103
- colNum,
104
- rowGap,
105
- colGap,
106
- rowUnit,
107
- colUnit
108
- } = attributes;
109
-
110
- //コンポーネント内の行列情報
111
- var [rowCount, setRowCount] = element.useState(rowNum);
112
- var [colCount, setColCount] = element.useState(colNum);
113
-
114
- //マウント時検出用フラグ
115
- var firstFlgRef = element.useRef(true);
116
-
117
- //グリッドの配置指定用テーブル要素
118
- var renderRows = () => {
119
- //セルが埋まっているかどうかの判定配列
120
-
121
- var occupied = new Array(rowCount).fill(0).map(() => new Array(colCount).fill(false));
122
- var rows = [];
123
- // 列単位入力行を追加
124
- var headerCells = [/*#__PURE__*/React.createElement("th", {
125
- key: "header-corner"
126
- })]; // 左上の角の空白セル
127
- var _loop = function _loop(c) {
128
- headerCells.push(/*#__PURE__*/React.createElement("th", {
129
- key: "header-".concat(c)
130
- }, /*#__PURE__*/React.createElement(components.__experimentalInputControl, {
131
- value: colUnit ? colUnit[c] : "",
132
- type: "text",
133
- isPressEnterToChange: true,
134
- onChange: newValue => {
135
- var newArray = [...colUnit.slice(0, c), newValue, ...colUnit.slice(c + 1)];
136
- setUnitColArray(newArray);
60
+ const GridControls = ({ attributes, clientId, onChange, }) => {
61
+ const { gridElms, rowNum, colNum, rowGap, colGap, rowUnit, colUnit } = attributes;
62
+ //コンポーネント内の行列情報
63
+ const [rowCount, setRowCount] = element.useState(rowNum);
64
+ const [colCount, setColCount] = element.useState(colNum);
65
+ //マウント時検出用フラグ
66
+ const firstFlgRef = element.useRef(true);
67
+ //グリッドの配置指定用テーブル要素
68
+ const renderRows = () => {
69
+ //セルが埋まっているかどうかの判定配列
70
+ const occupied = new Array(rowCount)
71
+ .fill(0)
72
+ .map(() => new Array(colCount).fill(false));
73
+ let rows = [];
74
+ // 列単位入力行を追加
75
+ let headerCells = [element.createElement("th", { key: "header-corner" })]; // 左上の角の空白セル
76
+ for (let c = 0; c < colCount; c++) {
77
+ headerCells.push(element.createElement("th", { key: `header-${c}` },
78
+ element.createElement(components.__experimentalInputControl, { value: colUnit ? colUnit[c] : "", type: "text", isPressEnterToChange: true, onChange: (newValue) => {
79
+ // 2. newValue が undefined の可能性を考慮してガードを入れる
80
+ const safeValue = newValue ?? "";
81
+ const newArray = [
82
+ ...colUnit.slice(0, c),
83
+ safeValue,
84
+ ...colUnit.slice(c + 1),
85
+ ];
86
+ setUnitColArray(newArray);
87
+ } })));
88
+ }
89
+ rows.push(element.createElement("tr", { key: "header-row" }, headerCells));
90
+ // 各行とセルの生成
91
+ for (let r = 0; r < rowCount; r++) {
92
+ let cells = [];
93
+ // 行行単位入力を追加
94
+ cells.push(element.createElement("th", { key: `row-header-${r}` },
95
+ element.createElement(components.__experimentalInputControl, { value: rowUnit ? rowUnit[r] : "", type: "text", isPressEnterToChange: true, onChange: (newValue) => {
96
+ // newValue が undefined の可能性を考慮してガードを入れる
97
+ const safeValue = newValue ?? "";
98
+ const newArray = [
99
+ ...rowUnit.slice(0, r),
100
+ safeValue,
101
+ ...rowUnit.slice(r + 1),
102
+ ];
103
+ setUnitRowArray(newArray);
104
+ } })));
105
+ // 各行に対するセルを生成
106
+ for (let c = 0; c < colCount; c++) {
107
+ if (occupied[r][c]) {
108
+ continue; // このセルは既に占められているのでスキップ
109
+ }
110
+ //複数のセルを占める設定があればセルの結合オブジェクトを生成
111
+ const setElm = findElementInGrid(gridElms, r, c);
112
+ const rowSpanValue = setElm
113
+ ? Math.abs(setElm.elm.startCell.rowInx - setElm.elm.endCell.rowInx)
114
+ : 0;
115
+ const colSpanValue = setElm
116
+ ? Math.abs(setElm.elm.startCell.colInx - setElm.elm.endCell.colInx)
117
+ : 0;
118
+ const cellSpan = {
119
+ ...(rowSpanValue !== 0 && { rowspan: rowSpanValue + 1 }),
120
+ ...(colSpanValue !== 0 && { colspan: colSpanValue + 1 }),
121
+ };
122
+ // 占められるセルの位置を記録
123
+ for (let i = 0; i <= rowSpanValue; i++) {
124
+ for (let j = 0; j <= colSpanValue; j++) {
125
+ if (r + i < rowCount && c + j < colCount) {
126
+ occupied[r + i][c + j] = true;
127
+ }
128
+ }
129
+ }
130
+ //セルを生成
131
+ cells.push(element.createElement("td", { key: `cell-${r}-${c}`, ...cellSpan, className: isCellSelected(r, c) ? "selected" : "", style: setElm
132
+ ? {
133
+ backgroundColor: `var(--wp--custom--color--area-${setElm.index})`,
134
+ }
135
+ : undefined, onClick: () => detectCellPosition(r, c) }, setElm && (element.createElement(StopPropagationWrapper, null,
136
+ element.createElement(components.ToolbarDropdownMenu, { label: i18n.__("Lateral Alignment", "block-collections"), icon: setElm.elm.latAlign
137
+ ? alignIconMap[setElm.elm.latAlign]
138
+ : alignIconMap["left"], controls: ["left", "center", "right"].map((align) => ({
139
+ icon: alignIconMap[align],
140
+ title: i18n.__(align.charAt(0).toUpperCase() + align.slice(1), "block-collections"),
141
+ isActive: setElm.elm.latAlign === align,
142
+ onClick: () => updateAlignment(setElm.index, align, "latAlign"),
143
+ })) }),
144
+ element.createElement(components.ToolbarDropdownMenu, { label: i18n.__("Vertical Alignment", "block-collections"), icon: setElm.elm.vertAlign
145
+ ? alignIconMap[setElm.elm.vertAlign]
146
+ : alignIconMap["upper"], controls: ["upper", "middle", "lower"].map((align) => ({
147
+ icon: alignIconMap[align],
148
+ title: i18n.__(align.charAt(0).toUpperCase() + align.slice(1), "block-collections"),
149
+ isActive: setElm.elm.vertAlign === align,
150
+ onClick: () => updateAlignment(setElm.index, align, "vertAlign"),
151
+ })) })))));
152
+ }
153
+ // 行の追加
154
+ rows.push(element.createElement("tr", { key: `row-${r}` }, cells));
137
155
  }
138
- })));
156
+ return rows;
139
157
  };
140
- for (var c = 0; c < colCount; c++) {
141
- _loop(c);
142
- }
143
- rows.push(/*#__PURE__*/React.createElement("tr", {
144
- key: "header-row"
145
- }, headerCells));
146
-
147
- // 各行とセルの生成
148
- var _loop2 = function _loop2(r) {
149
- var cells = [];
150
- // 行行単位入力を追加
151
- cells.push(/*#__PURE__*/React.createElement("th", {
152
- key: "row-header-".concat(r)
153
- }, /*#__PURE__*/React.createElement(components.__experimentalInputControl, {
154
- value: rowUnit ? rowUnit[r] : "",
155
- type: "text",
156
- isPressEnterToChange: true,
157
- onChange: newValue => {
158
- var newArray = [...rowUnit.slice(0, r), newValue, ...rowUnit.slice(r + 1)];
159
- setUnitRowArray(newArray);
158
+ //テーブルの位置選択関数
159
+ const detectCellPosition = (rowIndex, colIndex) => {
160
+ //インナーブロックの選択がなければリターン
161
+ if (!selBlock) {
162
+ data.dispatch("core/notices").createNotice("error", i18n.__("No blocks selected.", "itmar_guest_contact_block"), { type: "snackbar", isDismissible: true });
163
+ return;
160
164
  }
161
- })));
162
-
163
- // 各行に対するセルを生成
164
- var _loop3 = function _loop3(_c) {
165
- if (occupied[r][_c]) {
166
- return 1; // continue
167
- // このセルは既に占められているのでスキップ
165
+ //選択済みのセルが選択されたときはリターン
166
+ if (findElementInGrid(gridElms, rowIndex, colIndex)) {
167
+ data.dispatch("core/notices").createNotice("error", i18n.__("That cell is already selected by another block.", "itmar_guest_contact_block"), { type: "snackbar", isDismissible: true });
168
+ return;
168
169
  }
169
- //複数のセルを占める設定があればセルの結合オブジェクトを生成
170
- var setElm = findElementInGrid(gridElms, r, _c);
171
- var rowSpanValue = setElm ? Math.abs(setElm.elm.startCell.rowInx - setElm.elm.endCell.rowInx) : 0;
172
- var colSpanValue = setElm ? Math.abs(setElm.elm.startCell.colInx - setElm.elm.endCell.colInx) : 0;
173
- var cellSpan = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rowSpanValue !== 0 && {
174
- rowspan: rowSpanValue + 1
175
- }), colSpanValue !== 0 && {
176
- colspan: colSpanValue + 1
177
- });
178
- // 占められるセルの位置を記録
179
- for (var i = 0; i <= rowSpanValue; i++) {
180
- for (var j = 0; j <= colSpanValue; j++) {
181
- if (r + i < rowCount && _c + j < colCount) {
182
- occupied[r + i][_c + j] = true;
170
+ //選択されたブロックのポジションを記録
171
+ const newBlock = !selBlock.startCell
172
+ ? {
173
+ ...selBlock,
174
+ startCell: { rowInx: rowIndex, colInx: colIndex },
175
+ endCell: { rowInx: rowIndex, colInx: colIndex },
183
176
  }
184
- }
177
+ : { ...selBlock, endCell: { rowInx: rowIndex, colInx: colIndex } };
178
+ setSelBlock(newBlock);
179
+ //blockNamesの更新
180
+ const index = gridElms?.findIndex((block) => block.value === selBlock.value);
181
+ const setAreaBlock = [
182
+ ...blockNames.slice(0, index),
183
+ newBlock,
184
+ ...blockNames.slice(index + 1),
185
+ ];
186
+ setBlockNames(setAreaBlock);
187
+ };
188
+ // セルが選択されているか判断する関数
189
+ const isCellSelected = (rowIndex, colIndex) => {
190
+ if (selBlock) {
191
+ // 各座標の最小値と最大値を決定
192
+ const minRow = Math.min(selBlock.startCell?.rowInx, selBlock.endCell?.rowInx);
193
+ const maxRow = Math.max(selBlock.startCell?.rowInx, selBlock.endCell?.rowInx);
194
+ const minCol = Math.min(selBlock.startCell?.colInx, selBlock.endCell?.colInx);
195
+ const maxCol = Math.max(selBlock.startCell?.colInx, selBlock.endCell?.colInx);
196
+ // 座標が範囲内にあるかどうかをチェック
197
+ return (rowIndex >= minRow &&
198
+ rowIndex <= maxRow &&
199
+ colIndex >= minCol &&
200
+ colIndex <= maxCol);
201
+ }
202
+ else {
203
+ return false;
185
204
  }
186
- //セルを生成
187
- cells.push(/*#__PURE__*/React.createElement("td", _rollupPluginBabelHelpers.extends({
188
- key: "cell-".concat(r, "-").concat(_c)
189
- }, cellSpan, {
190
- className: isCellSelected(r, _c) ? "selected" : "",
191
- style: setElm ? {
192
- backgroundColor: "var(--wp--custom--color--area-".concat(setElm.index, ")")
193
- } : undefined,
194
- onClick: () => detectCellPosition(r, _c)
195
- }), setElm && /*#__PURE__*/React.createElement(StopPropagationWrapper, null, /*#__PURE__*/React.createElement(components.ToolbarDropdownMenu, {
196
- label: i18n.__("Lateral Alignment", "block-collections"),
197
- icon: setElm.elm.latAlign ? alignIconMap[setElm.elm.latAlign] : alignIconMap["left"],
198
- controls: ["left", "center", "right"].map(align => ({
199
- icon: alignIconMap[align],
200
- isActive: setElm.elm.latAlign === align,
201
- onClick: () => updateAlignment(setElm.index, align, "latAlign")
202
- }))
203
- }), /*#__PURE__*/React.createElement(components.ToolbarDropdownMenu, {
204
- label: i18n.__("Vertical Alignment", "block-collections"),
205
- icon: setElm.elm.vertAlign ? alignIconMap[setElm.elm.vertAlign] : alignIconMap["upper"],
206
- controls: ["upper", "middle", "lower"].map(align => ({
207
- icon: alignIconMap[align],
208
- isActive: setElm.elm.vertAlign === align,
209
- onClick: () => updateAlignment(setElm.index, align, "vertAlign")
210
- }))
211
- }))));
212
- };
213
- for (var _c = 0; _c < colCount; _c++) {
214
- if (_loop3(_c)) continue;
215
- }
216
- // 行の追加
217
- rows.push(/*#__PURE__*/React.createElement("tr", {
218
- key: "row-".concat(r)
219
- }, cells));
220
205
  };
221
- for (var r = 0; r < rowCount; r++) {
222
- _loop2(r);
223
- }
224
- return rows;
225
- };
226
-
227
- //テーブルの位置選択関数
228
- var detectCellPosition = (rowIndex, colIndex) => {
229
- //インナーブロックの選択がなければリターン
230
- if (!selBlock) {
231
- data.dispatch("core/notices").createNotice("error", i18n.__("No blocks selected.", "itmar_guest_contact_block"), {
232
- type: "snackbar",
233
- isDismissible: true
234
- });
235
- return;
236
- }
237
- //選択済みのセルが選択されたときはリターン
238
- if (findElementInGrid(gridElms, rowIndex, colIndex)) {
239
- data.dispatch("core/notices").createNotice("error", i18n.__("That cell is already selected by another block.", "itmar_guest_contact_block"), {
240
- type: "snackbar",
241
- isDismissible: true
242
- });
243
- return;
244
- }
245
-
246
- //選択されたブロックのポジションを記録
247
- var newBlock = !selBlock.startCell ? _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, selBlock), {}, {
248
- startCell: {
249
- rowInx: rowIndex,
250
- colInx: colIndex
251
- },
252
- endCell: {
253
- rowInx: rowIndex,
254
- colInx: colIndex
255
- }
256
- }) : _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, selBlock), {}, {
257
- endCell: {
258
- rowInx: rowIndex,
259
- colInx: colIndex
260
- }
261
- });
262
- setSelBlock(newBlock);
263
-
264
- //blockNamesの更新
265
- var index = gridElms === null || gridElms === void 0 ? void 0 : gridElms.findIndex(block => block.value === selBlock.value);
266
- var setAreaBlock = [...blockNames.slice(0, index), newBlock, ...blockNames.slice(index + 1)];
267
- setBlockNames(setAreaBlock);
268
- };
269
-
270
- // セルが選択されているか判断する関数
271
- var isCellSelected = (rowIndex, colIndex) => {
272
- if (selBlock) {
273
- var _selBlock$startCell, _selBlock$endCell, _selBlock$startCell2, _selBlock$endCell2, _selBlock$startCell3, _selBlock$endCell3, _selBlock$startCell4, _selBlock$endCell4;
274
- // 各座標の最小値と最大値を決定
275
- var minRow = Math.min((_selBlock$startCell = selBlock.startCell) === null || _selBlock$startCell === void 0 ? void 0 : _selBlock$startCell.rowInx, (_selBlock$endCell = selBlock.endCell) === null || _selBlock$endCell === void 0 ? void 0 : _selBlock$endCell.rowInx);
276
- var maxRow = Math.max((_selBlock$startCell2 = selBlock.startCell) === null || _selBlock$startCell2 === void 0 ? void 0 : _selBlock$startCell2.rowInx, (_selBlock$endCell2 = selBlock.endCell) === null || _selBlock$endCell2 === void 0 ? void 0 : _selBlock$endCell2.rowInx);
277
- var minCol = Math.min((_selBlock$startCell3 = selBlock.startCell) === null || _selBlock$startCell3 === void 0 ? void 0 : _selBlock$startCell3.colInx, (_selBlock$endCell3 = selBlock.endCell) === null || _selBlock$endCell3 === void 0 ? void 0 : _selBlock$endCell3.colInx);
278
- var maxCol = Math.max((_selBlock$startCell4 = selBlock.startCell) === null || _selBlock$startCell4 === void 0 ? void 0 : _selBlock$startCell4.colInx, (_selBlock$endCell4 = selBlock.endCell) === null || _selBlock$endCell4 === void 0 ? void 0 : _selBlock$endCell4.colInx);
279
-
280
- // 座標が範囲内にあるかどうかをチェック
281
- return rowIndex >= minRow && rowIndex <= maxRow && colIndex >= minCol && colIndex <= maxCol;
282
- } else {
283
- return false;
284
- }
285
- };
286
-
287
- //コンテンツ位置設定
288
- var updateAlignment = (index, align, derection) => {
289
- var alignBlock = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, blockNames[index]), {}, {
290
- [derection]: align
291
- });
292
- var setAlignBlock = [...blockNames.slice(0, index), alignBlock, ...blockNames.slice(index + 1)];
293
- setBlockNames(setAlignBlock);
294
- };
295
-
296
- //選択したインナーブロック
297
- var [selBlock, setSelBlock] = element.useState(null);
298
-
299
- //インナーブロックを取得
300
- var parentBlocks = data.useSelect(select => {
301
- var innerBlocks = select("core/block-editor").getBlocks(clientId);
302
- //インナーブロック入れ替えの際は既に登録したブロックの位置情報があれば、それを付加する。
303
- var new_block_names = innerBlocks.map((block, index) => gridElms.length > index ? {
304
- value: block.clientId,
305
- label: block.name,
306
- startCell: gridElms[index].startCell,
307
- endCell: gridElms[index].endCell,
308
- latAlign: gridElms[index].latAlign,
309
- vertAlign: gridElms[index].vertAlign
310
- } : {
311
- value: block.clientId,
312
- label: block.name
313
- });
314
- return new_block_names;
315
- }, [clientId]);
316
- var [blockNames, setBlockNames] = element.useState(parentBlocks);
317
-
318
- //グリッド配置のクリア
319
- var clear_placement = () => {
320
- //ブロックの配置情報削除
321
- var clear_block = blockNames.map(block => ({
322
- value: block.value,
323
- label: block.label
324
- }));
325
- setBlockNames(clear_block);
326
- };
327
-
328
- //単位配列の初期化
329
- var initRowUnitArray = initializeUnitArray(rowUnit, rowCount);
330
- var [unitRowArray, setUnitRowArray] = element.useState(initRowUnitArray);
331
- var initColUnitArray = initializeUnitArray(colUnit, colCount);
332
- var [unitColArray, setUnitColArray] = element.useState(initColUnitArray);
333
-
334
- //親ブロックへの書き戻し
335
- element.useEffect(() => {
336
- var gridStyle = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, attributes), {}, {
337
- gridElms: blockNames,
338
- rowNum: rowCount,
339
- colNum: colCount,
340
- rowUnit: unitRowArray,
341
- colUnit: unitColArray
342
- });
343
- _onChange(gridStyle);
344
- }, [blockNames, unitRowArray, unitColArray]);
345
-
346
- //行と列の数を変えた場合は位置情報を削除・単位の再編成
347
- element.useEffect(() => {
348
- if (!firstFlgRef.current) {
349
- //マウント時は実行しない
350
- //ブロックの位置情報クリア
351
- clear_placement();
352
- //単位情報の再編成
353
- var newRowUnitArray = initializeUnitArray(rowUnit, rowCount);
354
- setUnitRowArray(newRowUnitArray);
355
- var newColUnitArray = initializeUnitArray(colUnit, colCount);
356
- setUnitColArray(newColUnitArray);
357
- } else {
358
- firstFlgRef.current = false;
359
- }
360
- }, [rowCount, colCount]);
361
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(components.PanelRow, {
362
- className: "distance_row"
363
- }, /*#__PURE__*/React.createElement(components.__experimentalNumberControl, {
364
- onChange: newValue => {
365
- var input_val = typeof newValue === "number" ? newValue : Number(newValue);
366
- setRowCount(input_val);
367
- },
368
- label: i18n.__("Number of Row ", "block-collections"),
369
- value: rowCount,
370
- min: 2
371
- }), /*#__PURE__*/React.createElement(components.__experimentalNumberControl, {
372
- onChange: newValue => {
373
- var input_val = typeof newValue === "number" ? newValue : Number(newValue);
374
- setColCount(input_val);
375
- },
376
- label: i18n.__("Number of Colum", "block-collections"),
377
- value: colCount
378
- })), /*#__PURE__*/React.createElement(components.PanelRow, {
379
- className: "distance_row"
380
- }, /*#__PURE__*/React.createElement(components.__experimentalUnitControl, {
381
- onChange: newValue => {
382
- newValue = newValue != "" ? newValue : "0px";
383
- var newStyle = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, attributes), {}, {
384
- rowGap: newValue
385
- });
386
- _onChange(newStyle);
387
- },
388
- label: i18n.__("Row Gap", "block-collections"),
389
- value: rowGap,
390
- units: units
391
- }), /*#__PURE__*/React.createElement(components.__experimentalUnitControl, {
392
- onChange: newValue => {
393
- newValue = newValue != "" ? newValue : "0px";
394
- var newStyle = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, attributes), {}, {
395
- colGap: newValue
396
- });
397
- _onChange(newStyle);
398
- },
399
- label: i18n.__("Colum Gap", "block-collections"),
400
- value: colGap,
401
- units: units
402
- })), /*#__PURE__*/React.createElement(components.PanelRow, {
403
- className: "distance_row"
404
- }, /*#__PURE__*/React.createElement("p", null, i18n.__("Element placement", "block-collections")), /*#__PURE__*/React.createElement(components.Button, {
405
- variant: "secondary",
406
- onClick: clear_placement
407
- }, i18n.__("Clear", "block-collections"))), /*#__PURE__*/React.createElement(components.PanelRow, {
408
- className: "grid_table"
409
- }, /*#__PURE__*/React.createElement("table", null, renderRows())), /*#__PURE__*/React.createElement(components.ComboboxControl, {
410
- label: i18n.__("InnerBlock Name", "block-collections"),
411
- options: blockNames,
412
- value: selBlock ? selBlock.value : null,
413
- onChange: sel_id => {
414
- var matchedBlock = blockNames.find(block => block.value === sel_id);
415
- setSelBlock(matchedBlock);
416
- }
417
- }));
206
+ //コンテンツ位置設定
207
+ const updateAlignment = (index, align, derection) => {
208
+ const alignBlock = { ...blockNames[index], [derection]: align };
209
+ const setAlignBlock = [
210
+ ...blockNames.slice(0, index),
211
+ alignBlock,
212
+ ...blockNames.slice(index + 1),
213
+ ];
214
+ setBlockNames(setAlignBlock);
215
+ };
216
+ const [selBlock, setSelBlock] = element.useState(null);
217
+ //インナーブロックを取得
218
+ const parentBlocks = data.useSelect((select) => {
219
+ // 1. select の型を補完(または any で一時回避)
220
+ const editor = select("core/block-editor");
221
+ const innerBlocks = editor.getBlocks(clientId);
222
+ //インナーブロック入れ替えの際は既に登録したブロックの位置情報があれば、それを付加する。
223
+ const new_block_names = innerBlocks.map((block, index) => gridElms.length > index
224
+ ? {
225
+ value: block.clientId,
226
+ label: block.name,
227
+ startCell: gridElms[index].startCell,
228
+ endCell: gridElms[index].endCell,
229
+ latAlign: gridElms[index].latAlign,
230
+ vertAlign: gridElms[index].vertAlign,
231
+ }
232
+ : {
233
+ value: block.clientId,
234
+ label: block.name,
235
+ });
236
+ return new_block_names;
237
+ }, [clientId]);
238
+ const [blockNames, setBlockNames] = element.useState(parentBlocks);
239
+ //グリッド配置のクリア
240
+ const clear_placement = () => {
241
+ //ブロックの配置情報削除
242
+ const clear_block = blockNames.map((block) => ({
243
+ value: block.value,
244
+ label: block.label,
245
+ }));
246
+ setBlockNames(clear_block);
247
+ };
248
+ //単位配列の初期化
249
+ const initRowUnitArray = initializeUnitArray(rowUnit, rowCount);
250
+ const [unitRowArray, setUnitRowArray] = element.useState(initRowUnitArray);
251
+ const initColUnitArray = initializeUnitArray(colUnit, colCount);
252
+ const [unitColArray, setUnitColArray] = element.useState(initColUnitArray);
253
+ //親ブロックへの書き戻し
254
+ element.useEffect(() => {
255
+ const gridStyle = {
256
+ ...attributes,
257
+ gridElms: blockNames, // BlockNameItem[] を GridElement[] に合わせる
258
+ rowNum: rowCount,
259
+ colNum: colCount,
260
+ rowGap: attributes.rowGap ?? "0px", // 必須プロパティが空の場合のガード
261
+ colGap: attributes.colGap ?? "0px",
262
+ rowUnit: unitRowArray,
263
+ colUnit: unitColArray,
264
+ };
265
+ onChange(gridStyle);
266
+ }, [blockNames, unitRowArray, unitColArray]);
267
+ //行と列の数を変えた場合は位置情報を削除・単位の再編成
268
+ element.useEffect(() => {
269
+ if (!firstFlgRef.current) {
270
+ //マウント時は実行しない
271
+ //ブロックの位置情報クリア
272
+ clear_placement();
273
+ //単位情報の再編成
274
+ const newRowUnitArray = initializeUnitArray(rowUnit, rowCount);
275
+ setUnitRowArray(newRowUnitArray);
276
+ const newColUnitArray = initializeUnitArray(colUnit, colCount);
277
+ setUnitColArray(newColUnitArray);
278
+ }
279
+ else {
280
+ firstFlgRef.current = false;
281
+ }
282
+ }, [rowCount, colCount]);
283
+ return (element.createElement(element.Fragment, null,
284
+ element.createElement(components.PanelRow, { className: "distance_row" },
285
+ element.createElement(components.__experimentalNumberControl, { onChange: (newValue) => {
286
+ const input_val = typeof newValue === "number" ? newValue : Number(newValue);
287
+ setRowCount(input_val);
288
+ }, label: i18n.__("Number of Row ", "block-collections"), value: rowCount, min: 2 }),
289
+ element.createElement(components.__experimentalNumberControl, { onChange: (newValue) => {
290
+ const input_val = typeof newValue === "number" ? newValue : Number(newValue);
291
+ setColCount(input_val);
292
+ }, label: i18n.__("Number of Colum", "block-collections"), value: colCount })),
293
+ element.createElement(components.PanelRow, { className: "distance_row" },
294
+ element.createElement(components.__experimentalUnitControl, { onChange: (newValue) => {
295
+ newValue = newValue != "" ? newValue : "0px";
296
+ const newStyle = { ...attributes, rowGap: newValue };
297
+ onChange(newStyle);
298
+ }, label: i18n.__("Row Gap", "block-collections"), value: rowGap, units: units }),
299
+ element.createElement(components.__experimentalUnitControl, { onChange: (newValue) => {
300
+ newValue = newValue != "" ? newValue : "0px";
301
+ const newStyle = { ...attributes, colGap: newValue };
302
+ onChange(newStyle);
303
+ }, label: i18n.__("Colum Gap", "block-collections"), value: colGap, units: units })),
304
+ element.createElement(components.PanelRow, { className: "distance_row" },
305
+ element.createElement("p", null, i18n.__("Element placement", "block-collections")),
306
+ element.createElement(components.Button, { variant: "secondary", onClick: clear_placement }, i18n.__("Clear", "block-collections"))),
307
+ element.createElement(components.PanelRow, { className: "grid_table" },
308
+ element.createElement("table", null, renderRows())),
309
+ element.createElement(components.ComboboxControl, { label: i18n.__("InnerBlock Name", "block-collections"), options: blockNames, value: selBlock ? selBlock.value : null, onChange: (sel_id) => {
310
+ const matchedBlock = blockNames.find((block) => block.value === sel_id);
311
+ if (matchedBlock) {
312
+ setSelBlock(matchedBlock);
313
+ }
314
+ else {
315
+ setSelBlock(null);
316
+ }
317
+ } })));
418
318
  };
419
319
 
420
320
  exports.default = GridControls;