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.
- package/README.md +18 -4
- package/build/cjs/AnimationBlock.js +61 -92
- package/build/cjs/AnimationBlock.js.map +1 -1
- package/build/cjs/BlockEditWrapper.js +3 -10
- package/build/cjs/BlockEditWrapper.js.map +1 -1
- package/build/cjs/BlockPlace.js +277 -482
- package/build/cjs/BlockPlace.js.map +1 -1
- package/build/cjs/BrockInserter.js +195 -191
- package/build/cjs/BrockInserter.js.map +1 -1
- package/build/cjs/DateElm.js +254 -281
- package/build/cjs/DateElm.js.map +1 -1
- package/build/cjs/DraggableBox.js +99 -129
- package/build/cjs/DraggableBox.js.map +1 -1
- package/build/cjs/GridControls.js +292 -392
- package/build/cjs/GridControls.js.map +1 -1
- package/build/cjs/IconSelectControl.js +65 -156
- package/build/cjs/IconSelectControl.js.map +1 -1
- package/build/cjs/JapaneseHolidays.js +67 -76
- package/build/cjs/JapaneseHolidays.js.map +1 -1
- package/build/cjs/MasonryControl.js +95 -100
- package/build/cjs/MasonryControl.js.map +1 -1
- package/build/cjs/PseudoElm.js +37 -50
- package/build/cjs/PseudoElm.js.map +1 -1
- package/build/cjs/ShadowStyle.js +216 -430
- package/build/cjs/ShadowStyle.js.map +1 -1
- package/build/cjs/SwiperControl.js +240 -241
- package/build/cjs/SwiperControl.js.map +1 -1
- package/build/cjs/ToggleElement.js +17 -9
- package/build/cjs/ToggleElement.js.map +1 -1
- package/build/cjs/TypographyControls.js +73 -139
- package/build/cjs/TypographyControls.js.map +1 -1
- package/build/cjs/UpdateAllPostsBlockAttributes.js +102 -119
- package/build/cjs/UpdateAllPostsBlockAttributes.js.map +1 -1
- package/build/cjs/ZipAddress.js +27 -23
- package/build/cjs/ZipAddress.js.map +1 -1
- package/build/cjs/blockStore.js +42 -47
- package/build/cjs/blockStore.js.map +1 -1
- package/build/cjs/cssPropertes.js +165 -117
- package/build/cjs/cssPropertes.js.map +1 -1
- package/build/cjs/customHooks.js +277 -0
- package/build/cjs/customHooks.js.map +1 -0
- package/build/cjs/formatCreate.js +115 -145
- package/build/cjs/formatCreate.js.map +1 -1
- package/build/cjs/hslToRgb.js +112 -116
- package/build/cjs/hslToRgb.js.map +1 -1
- package/build/cjs/index.js +15 -11
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/mediaUpload.js +95 -158
- package/build/cjs/mediaUpload.js.map +1 -1
- package/build/cjs/node_modules/swiper/shared/ssr-window.esm.js +144 -0
- package/build/cjs/node_modules/swiper/shared/ssr-window.esm.js.map +1 -0
- package/build/cjs/node_modules/swiper/shared/swiper-core.js +3925 -0
- package/build/cjs/node_modules/swiper/shared/swiper-core.js.map +1 -0
- package/build/cjs/node_modules/swiper/shared/utils.js +294 -0
- package/build/cjs/node_modules/swiper/shared/utils.js.map +1 -0
- package/build/cjs/pickupStore.js +56 -54
- package/build/cjs/pickupStore.js.map +1 -1
- package/build/cjs/shopfiApi.js +127 -138
- package/build/cjs/shopfiApi.js.map +1 -1
- package/build/cjs/types/AnimationBlock.d.ts +22 -0
- package/build/cjs/types/BlockEditWrapper.d.ts +7 -0
- package/build/cjs/types/BlockPlace.d.ts +49 -0
- package/build/cjs/types/BrockInserter.d.ts +6 -0
- package/build/cjs/types/DateElm.d.ts +69 -0
- package/build/cjs/types/DraggableBox.d.ts +19 -0
- package/build/cjs/types/GridControls.d.ts +27 -0
- package/build/cjs/types/IconSelectControl.d.ts +17 -0
- package/build/cjs/types/JapaneseHolidays.d.ts +6 -0
- package/build/cjs/types/MasonryControl.d.ts +35 -0
- package/build/cjs/types/PseudoElm.d.ts +11 -0
- package/build/cjs/types/ShadowStyle.d.ts +33 -0
- package/build/cjs/types/SwiperControl.d.ts +12 -0
- package/build/cjs/types/ToggleElement.d.ts +13 -0
- package/build/cjs/types/TypographyControls.d.ts +17 -0
- package/build/cjs/types/UpdateAllPostsBlockAttributes.d.ts +10 -0
- package/build/cjs/types/ZipAddress.d.ts +18 -0
- package/build/cjs/types/blockStore.d.ts +15 -0
- package/build/cjs/types/cssPropertes.d.ts +53 -0
- package/build/cjs/types/customHooks.d.ts +11 -0
- package/build/cjs/types/formatCreate.d.ts +18 -0
- package/build/cjs/types/hslToRgb.d.ts +23 -0
- package/build/cjs/types/index.d.ts +31 -0
- package/build/cjs/types/mediaUpload.d.ts +29 -0
- package/build/cjs/types/pickupStore.d.ts +39 -0
- package/build/cjs/types/shopfiApi.d.ts +18 -0
- package/build/cjs/types/validationCheck.d.ts +5 -0
- package/build/cjs/types/wordpressApi.d.ts +99 -0
- package/build/cjs/validationCheck.js +15 -9
- package/build/cjs/validationCheck.js.map +1 -1
- package/build/cjs/wordpressApi.js +364 -576
- package/build/cjs/wordpressApi.js.map +1 -1
- package/build/esm/AnimationBlock.d.ts +22 -0
- package/build/esm/AnimationBlock.js +61 -92
- package/build/esm/AnimationBlock.js.map +1 -1
- package/build/esm/BlockEditWrapper.d.ts +7 -0
- package/build/esm/BlockEditWrapper.js +4 -11
- package/build/esm/BlockEditWrapper.js.map +1 -1
- package/build/esm/BlockPlace.d.ts +49 -0
- package/build/esm/BlockPlace.js +279 -484
- package/build/esm/BlockPlace.js.map +1 -1
- package/build/esm/BrockInserter.d.ts +6 -0
- package/build/esm/BrockInserter.js +195 -191
- package/build/esm/BrockInserter.js.map +1 -1
- package/build/esm/DateElm.d.ts +69 -0
- package/build/esm/DateElm.js +254 -281
- package/build/esm/DateElm.js.map +1 -1
- package/build/esm/DraggableBox.d.ts +19 -0
- package/build/esm/DraggableBox.js +99 -129
- package/build/esm/DraggableBox.js.map +1 -1
- package/build/esm/GridControls.d.ts +27 -0
- package/build/esm/GridControls.js +294 -394
- package/build/esm/GridControls.js.map +1 -1
- package/build/esm/IconSelectControl.d.ts +17 -0
- package/build/esm/IconSelectControl.js +65 -156
- package/build/esm/IconSelectControl.js.map +1 -1
- package/build/esm/JapaneseHolidays.d.ts +6 -0
- package/build/esm/JapaneseHolidays.js +67 -76
- package/build/esm/JapaneseHolidays.js.map +1 -1
- package/build/esm/MasonryControl.d.ts +35 -0
- package/build/esm/MasonryControl.js +95 -100
- package/build/esm/MasonryControl.js.map +1 -1
- package/build/esm/PseudoElm.d.ts +11 -0
- package/build/esm/PseudoElm.js +37 -50
- package/build/esm/PseudoElm.js.map +1 -1
- package/build/esm/ShadowStyle.d.ts +33 -0
- package/build/esm/ShadowStyle.js +217 -431
- package/build/esm/ShadowStyle.js.map +1 -1
- package/build/esm/SwiperControl.d.ts +12 -0
- package/build/esm/SwiperControl.js +240 -241
- package/build/esm/SwiperControl.js.map +1 -1
- package/build/esm/ToggleElement.d.ts +13 -0
- package/build/esm/ToggleElement.js +17 -9
- package/build/esm/ToggleElement.js.map +1 -1
- package/build/esm/TypographyControls.d.ts +17 -0
- package/build/esm/TypographyControls.js +73 -139
- package/build/esm/TypographyControls.js.map +1 -1
- package/build/esm/UpdateAllPostsBlockAttributes.d.ts +10 -0
- package/build/esm/UpdateAllPostsBlockAttributes.js +103 -120
- package/build/esm/UpdateAllPostsBlockAttributes.js.map +1 -1
- package/build/esm/ZipAddress.d.ts +18 -0
- package/build/esm/ZipAddress.js +27 -23
- package/build/esm/ZipAddress.js.map +1 -1
- package/build/esm/blockStore.d.ts +15 -0
- package/build/esm/blockStore.js +42 -47
- package/build/esm/blockStore.js.map +1 -1
- package/build/esm/cssPropertes.d.ts +53 -0
- package/build/esm/cssPropertes.js +165 -117
- package/build/esm/cssPropertes.js.map +1 -1
- package/build/esm/customHooks.d.ts +11 -0
- package/build/esm/customHooks.js +267 -0
- package/build/esm/customHooks.js.map +1 -0
- package/build/esm/formatCreate.d.ts +18 -0
- package/build/esm/formatCreate.js +115 -145
- package/build/esm/formatCreate.js.map +1 -1
- package/build/esm/hslToRgb.d.ts +23 -0
- package/build/esm/hslToRgb.js +112 -116
- package/build/esm/hslToRgb.js.map +1 -1
- package/build/esm/index.d.ts +27 -0
- package/build/esm/index.js +8 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/mediaUpload.d.ts +29 -0
- package/build/esm/mediaUpload.js +95 -158
- package/build/esm/mediaUpload.js.map +1 -1
- package/build/esm/node_modules/swiper/shared/ssr-window.esm.js +141 -0
- package/build/esm/node_modules/swiper/shared/ssr-window.esm.js.map +1 -0
- package/build/esm/node_modules/swiper/shared/swiper-core.js +3922 -0
- package/build/esm/node_modules/swiper/shared/swiper-core.js.map +1 -0
- package/build/esm/node_modules/swiper/shared/utils.js +274 -0
- package/build/esm/node_modules/swiper/shared/utils.js.map +1 -0
- package/build/esm/pickupStore.d.ts +39 -0
- package/build/esm/pickupStore.js +56 -54
- package/build/esm/pickupStore.js.map +1 -1
- package/build/esm/shopfiApi.d.ts +18 -0
- package/build/esm/shopfiApi.js +127 -138
- package/build/esm/shopfiApi.js.map +1 -1
- package/build/esm/types/AnimationBlock.d.ts +22 -0
- package/build/esm/types/BlockEditWrapper.d.ts +7 -0
- package/build/esm/types/BlockPlace.d.ts +49 -0
- package/build/esm/types/BrockInserter.d.ts +6 -0
- package/build/esm/types/DateElm.d.ts +69 -0
- package/build/esm/types/DraggableBox.d.ts +19 -0
- package/build/esm/types/GridControls.d.ts +27 -0
- package/build/esm/types/IconSelectControl.d.ts +17 -0
- package/build/esm/types/JapaneseHolidays.d.ts +6 -0
- package/build/esm/types/MasonryControl.d.ts +35 -0
- package/build/esm/types/PseudoElm.d.ts +11 -0
- package/build/esm/types/ShadowStyle.d.ts +33 -0
- package/build/esm/types/SwiperControl.d.ts +12 -0
- package/build/esm/types/ToggleElement.d.ts +13 -0
- package/build/esm/types/TypographyControls.d.ts +17 -0
- package/build/esm/types/UpdateAllPostsBlockAttributes.d.ts +10 -0
- package/build/esm/types/ZipAddress.d.ts +18 -0
- package/build/esm/types/blockStore.d.ts +15 -0
- package/build/esm/types/cssPropertes.d.ts +53 -0
- package/build/esm/types/customHooks.d.ts +11 -0
- package/build/esm/types/formatCreate.d.ts +18 -0
- package/build/esm/types/hslToRgb.d.ts +23 -0
- package/build/esm/types/index.d.ts +31 -0
- package/build/esm/types/mediaUpload.d.ts +29 -0
- package/build/esm/types/pickupStore.d.ts +39 -0
- package/build/esm/types/shopfiApi.d.ts +18 -0
- package/build/esm/types/validationCheck.d.ts +5 -0
- package/build/esm/types/wordpressApi.d.ts +99 -0
- package/build/esm/validationCheck.d.ts +5 -0
- package/build/esm/validationCheck.js +15 -9
- package/build/esm/validationCheck.js.map +1 -1
- package/build/esm/wordpressApi.d.ts +99 -0
- package/build/esm/wordpressApi.js +365 -577
- package/build/esm/wordpressApi.js.map +1 -1
- package/package.json +29 -7
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -117
- package/build/cjs/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/cjs/customFooks.js +0 -300
- package/build/cjs/customFooks.js.map +0 -1
- package/build/esm/_virtual/_rollupPluginBabelHelpers.js +0 -107
- package/build/esm/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/esm/customFooks.js +0 -290
- 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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
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
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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;
|