@eightshift/ui-components 1.4.3 → 1.4.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.
|
@@ -5117,7 +5117,8 @@ const Repeater = (props) => {
|
|
|
5117
5117
|
{
|
|
5118
5118
|
onPress: () => {
|
|
5119
5119
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
|
|
5120
|
-
|
|
5120
|
+
setItems((items2) => [...items2, newItem]);
|
|
5121
|
+
onChange(items);
|
|
5121
5122
|
if (onAfterItemAdd) {
|
|
5122
5123
|
onAfterItemAdd(newItem);
|
|
5123
5124
|
}
|
|
@@ -5132,7 +5133,8 @@ const Repeater = (props) => {
|
|
|
5132
5133
|
addButton && /* @__PURE__ */ jsx("div", { className: clsx(!hideEmptyState && items.length < 1 && "es-uic-invisible"), children: addButton({
|
|
5133
5134
|
addItem: (additional = {}) => {
|
|
5134
5135
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
|
|
5135
|
-
|
|
5136
|
+
setItems((items2) => [...items2, newItem]);
|
|
5137
|
+
onChange(items);
|
|
5136
5138
|
if (onAfterItemAdd) {
|
|
5137
5139
|
onAfterItemAdd(newItem);
|
|
5138
5140
|
}
|
|
@@ -5174,7 +5176,8 @@ const Repeater = (props) => {
|
|
|
5174
5176
|
if (event.canceled) {
|
|
5175
5177
|
return;
|
|
5176
5178
|
}
|
|
5177
|
-
|
|
5179
|
+
setItems((items2) => move(items2, source, target));
|
|
5180
|
+
onChange(items);
|
|
5178
5181
|
},
|
|
5179
5182
|
children: items.map((item, index) => /* @__PURE__ */ jsx(
|
|
5180
5183
|
SortableItem,
|
|
@@ -5191,6 +5194,7 @@ const Repeater = (props) => {
|
|
|
5191
5194
|
index,
|
|
5192
5195
|
canDelete,
|
|
5193
5196
|
deleteItem: () => {
|
|
5197
|
+
setItems([...items].filter((i2) => i2.id !== item.id));
|
|
5194
5198
|
onChange([...items].filter((i2) => i2.id !== item.id));
|
|
5195
5199
|
if (onAfterItemRemove) {
|
|
5196
5200
|
onAfterItemRemove(item);
|
|
@@ -5219,9 +5223,11 @@ const Repeater = (props) => {
|
|
|
5219
5223
|
updateData: (newValue) => {
|
|
5220
5224
|
const updated = [...items].map((i2) => i2.id === item.id ? { ...i2, ...newValue } : i2);
|
|
5221
5225
|
onChange(updated);
|
|
5226
|
+
setItems(updated);
|
|
5222
5227
|
},
|
|
5223
5228
|
itemIndex: index,
|
|
5224
5229
|
deleteItem: () => {
|
|
5230
|
+
setItems([...items].filter((i2) => i2.id !== item.id));
|
|
5225
5231
|
onChange([...items].filter((i2) => i2.id !== item.id));
|
|
5226
5232
|
if (onAfterItemRemove) {
|
|
5227
5233
|
onAfterItemRemove(item);
|
|
@@ -5245,7 +5251,8 @@ const Repeater = (props) => {
|
|
|
5245
5251
|
{
|
|
5246
5252
|
onPress: () => {
|
|
5247
5253
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem };
|
|
5248
|
-
|
|
5254
|
+
setItems((items2) => [...items2, newItem]);
|
|
5255
|
+
onChange(items);
|
|
5249
5256
|
if (onAfterItemAdd) {
|
|
5250
5257
|
onAfterItemAdd(newItem);
|
|
5251
5258
|
}
|
|
@@ -5260,7 +5267,8 @@ const Repeater = (props) => {
|
|
|
5260
5267
|
addButton && !hideEmptyState && addButton({
|
|
5261
5268
|
addItem: (additional = {}) => {
|
|
5262
5269
|
const newItem = { id: `${itemIdBase}${items.length + 1}`, ...addDefaultItem, ...additional };
|
|
5263
|
-
|
|
5270
|
+
setItems((items2) => [...items2, newItem]);
|
|
5271
|
+
onChange(items);
|
|
5264
5272
|
if (onAfterItemAdd) {
|
|
5265
5273
|
onAfterItemAdd(newItem);
|
|
5266
5274
|
}
|