@raketa-builder/menu-builder 1.6.2 → 1.6.4
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.
|
@@ -31,6 +31,10 @@ const ColumnBuilder = ({ value, onChange }) => {
|
|
|
31
31
|
setState(newState);
|
|
32
32
|
onChange(newState);
|
|
33
33
|
};
|
|
34
|
+
const updateColumnWidth = (column, width) => {
|
|
35
|
+
const updatedColumn = __spreadProps(__spreadValues({}, column), { width: parseInt(width) });
|
|
36
|
+
updateColumn(state.columns, updatedColumn);
|
|
37
|
+
};
|
|
34
38
|
const duplicateColumn = (items, item) => {
|
|
35
39
|
const newState = __spreadProps(__spreadValues({}, state), {
|
|
36
40
|
columns: append(items, __spreadProps(__spreadValues({}, item), {
|
|
@@ -69,41 +73,111 @@ const ColumnBuilder = ({ value, onChange }) => {
|
|
|
69
73
|
setList: (columns) => reorder(columns),
|
|
70
74
|
className: "r-list",
|
|
71
75
|
handle: ".r-chandle",
|
|
72
|
-
direction: "
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
variant: "secondary",
|
|
85
|
-
onClick: () => duplicateColumn(state.columns, column),
|
|
86
|
-
children: /* @__PURE__ */ jsx(Copy, {})
|
|
87
|
-
}
|
|
88
|
-
),
|
|
89
|
-
/* @__PURE__ */ jsx(
|
|
90
|
-
Button,
|
|
91
|
-
{
|
|
92
|
-
variant: "secondary",
|
|
93
|
-
onClick: () => removeColumn(state.columns, column),
|
|
94
|
-
children: /* @__PURE__ */ jsx(Delete, {})
|
|
95
|
-
}
|
|
96
|
-
)
|
|
97
|
-
] })
|
|
98
|
-
] }),
|
|
99
|
-
/* @__PURE__ */ jsx(PanelContent, { children: /* @__PURE__ */ jsx(
|
|
100
|
-
ContentBuilder,
|
|
76
|
+
direction: "horizontal",
|
|
77
|
+
style: {
|
|
78
|
+
display: "flex",
|
|
79
|
+
flexWrap: "wrap",
|
|
80
|
+
gap: "0.5em"
|
|
81
|
+
},
|
|
82
|
+
children: state.columns.map((column, idx) => {
|
|
83
|
+
const columnWidth = column.width || 1;
|
|
84
|
+
const widthPercentage = columnWidth / 5 * 100;
|
|
85
|
+
return /* @__PURE__ */ jsxs(
|
|
86
|
+
Panel,
|
|
101
87
|
{
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
88
|
+
style: {
|
|
89
|
+
flexBasis: `calc(${widthPercentage}% - 0.5em)`,
|
|
90
|
+
minWidth: `calc(${widthPercentage}% - 0.5em)`,
|
|
91
|
+
flex: `0 0 calc(${widthPercentage}% - 0.5em)`
|
|
92
|
+
},
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsxs(
|
|
95
|
+
PanelTitle,
|
|
96
|
+
{
|
|
97
|
+
style: {
|
|
98
|
+
display: "flex",
|
|
99
|
+
flexWrap: "wrap",
|
|
100
|
+
gap: "0.5em",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
justifyContent: "space-between"
|
|
103
|
+
},
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ jsxs(
|
|
106
|
+
Stack,
|
|
107
|
+
{
|
|
108
|
+
className: "r-stack-align-center",
|
|
109
|
+
style: { gap: "0.5em" },
|
|
110
|
+
children: [
|
|
111
|
+
/* @__PURE__ */ jsx(Handle, { className: "r-chandle" }),
|
|
112
|
+
/* @__PURE__ */ jsxs("span", { style: { whiteSpace: "nowrap" }, children: [
|
|
113
|
+
"Column #",
|
|
114
|
+
idx + 1
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ jsxs(
|
|
117
|
+
"select",
|
|
118
|
+
{
|
|
119
|
+
value: columnWidth,
|
|
120
|
+
onChange: (e) => updateColumnWidth(column, e.target.value),
|
|
121
|
+
style: {
|
|
122
|
+
padding: "0.25em 0.35em",
|
|
123
|
+
borderRadius: "4px",
|
|
124
|
+
border: "1px solid #ccc",
|
|
125
|
+
fontSize: "0.875rem",
|
|
126
|
+
minWidth: "45px"
|
|
127
|
+
},
|
|
128
|
+
title: `Width: ${columnWidth}/5`,
|
|
129
|
+
children: [
|
|
130
|
+
/* @__PURE__ */ jsx("option", { value: "1", children: "Width 1" }),
|
|
131
|
+
/* @__PURE__ */ jsx("option", { value: "2", children: "Width 2" }),
|
|
132
|
+
/* @__PURE__ */ jsx("option", { value: "3", children: "Width 3" }),
|
|
133
|
+
/* @__PURE__ */ jsx("option", { value: "4", children: "Width 4" }),
|
|
134
|
+
/* @__PURE__ */ jsx("option", { value: "5", children: "Width 5" })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsxs(
|
|
142
|
+
Stack,
|
|
143
|
+
{
|
|
144
|
+
className: "r-stack-align-center",
|
|
145
|
+
style: { gap: "0.25em" },
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx(
|
|
148
|
+
Button,
|
|
149
|
+
{
|
|
150
|
+
variant: "secondary",
|
|
151
|
+
onClick: () => duplicateColumn(state.columns, column),
|
|
152
|
+
children: /* @__PURE__ */ jsx(Copy, {})
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
Button,
|
|
157
|
+
{
|
|
158
|
+
variant: "secondary",
|
|
159
|
+
onClick: () => removeColumn(state.columns, column),
|
|
160
|
+
children: /* @__PURE__ */ jsx(Delete, {})
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ jsx(PanelContent, { children: /* @__PURE__ */ jsx(
|
|
170
|
+
ContentBuilder,
|
|
171
|
+
{
|
|
172
|
+
value: column,
|
|
173
|
+
onChange: (column2) => updateColumn(state.columns, column2)
|
|
174
|
+
}
|
|
175
|
+
) })
|
|
176
|
+
]
|
|
177
|
+
},
|
|
178
|
+
column.id
|
|
179
|
+
);
|
|
180
|
+
})
|
|
107
181
|
}
|
|
108
182
|
)
|
|
109
183
|
] });
|
|
@@ -12,7 +12,7 @@ const Factories = {
|
|
|
12
12
|
rows: []
|
|
13
13
|
}),
|
|
14
14
|
row: () => ({ id: rand(4), columns: [] }),
|
|
15
|
-
column: () => ({ id: rand(4), widgets: [] }),
|
|
15
|
+
column: () => ({ id: rand(4), widgets: [], width: 1 }),
|
|
16
16
|
widget: (component, settings) => ({ id: rand(4), component, settings })
|
|
17
17
|
};
|
|
18
18
|
var Factories_default = Factories;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raketa-builder/menu-builder",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"react-dom": ">=19.1.0 && <=19.3.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@raketa-builder/builder": "1.6.
|
|
34
|
-
"@raketa-builder/ui": "1.6.
|
|
33
|
+
"@raketa-builder/builder": "1.6.4",
|
|
34
|
+
"@raketa-builder/ui": "1.6.4",
|
|
35
35
|
"react-sortablejs": "6.1.4"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|