utopia-ui 3.0.0-alpha.217 → 3.0.0-alpha.219
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/dist/index.js +16 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -4255,6 +4255,7 @@ var SimpleView = function (_a) {
|
|
4255
4255
|
return (jsx("div", __assign({ className: 'tw-mt-8 tw-h-full tw-overflow-y-auto fade tw-px-6' }, { children: jsx(TextView, { item: item }) })));
|
4256
4256
|
};
|
4257
4257
|
|
4258
|
+
var sleep = function (ms) { return new Promise(function (resolve) { return setTimeout(resolve, ms); }); };
|
4258
4259
|
var linkItem = function (id, item, updateItem) { return __awaiter(void 0, void 0, void 0, function () {
|
4259
4260
|
var new_relations, updatedItem, success, error_2;
|
4260
4261
|
var _a, _b;
|
@@ -4385,23 +4386,24 @@ var onUpdateItem = function (state, item, tags, addTag, setLoading, navigate, up
|
|
4385
4386
|
changedItem = __assign(__assign(__assign(__assign(__assign({ id: state.id, group_type: state.groupType, status: state.status, name: state.name, subname: state.subname, text: state.text, color: state.color, position: item.position, contact: state.contact, telephone: state.telephone }, state.markerIcon && { markerIcon: state.markerIcon }), { next_appointment: state.nextAppointment }), state.image.length > 10 && { image: state.image }), state.offers.length > 0 && { offers: offer_updates }), state.needs.length > 0 && { needs: needs_updates });
|
4386
4387
|
offers_state = [];
|
4387
4388
|
needs_state = [];
|
4388
|
-
|
4389
|
-
|
4390
|
-
|
4389
|
+
state.offers.map(function (o) {
|
4390
|
+
offers_state.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: o.id });
|
4391
|
+
});
|
4392
|
+
state.needs.map(function (n) {
|
4393
|
+
needs_state.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: n.id });
|
4394
|
+
});
|
4395
|
+
changedItem = __assign(__assign({}, changedItem), { offers: offers_state, needs: needs_state });
|
4396
|
+
setLoading(true);
|
4397
|
+
return [4 /*yield*/, ((_c = state.text.toLocaleLowerCase().match(hashTagRegex)) === null || _c === void 0 ? void 0 : _c.map(function (tag) {
|
4398
|
+
if (!tags.find(function (t) { return t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase(); })) {
|
4399
|
+
addTag({ id: crypto.randomUUID(), name: encodeTag(tag.slice(1).toLocaleLowerCase()), color: randomColor() });
|
4400
|
+
}
|
4401
|
+
}))];
|
4391
4402
|
case 3:
|
4392
4403
|
_m.sent();
|
4393
|
-
return [4 /*yield*/,
|
4394
|
-
needs_state.push({ items_id: item === null || item === void 0 ? void 0 : item.id, tags_id: n.id });
|
4395
|
-
})];
|
4404
|
+
return [4 /*yield*/, sleep(200)];
|
4396
4405
|
case 4:
|
4397
4406
|
_m.sent();
|
4398
|
-
changedItem = __assign(__assign({}, changedItem), { offers: offers_state, needs: needs_state });
|
4399
|
-
(_c = state.text.toLocaleLowerCase().match(hashTagRegex)) === null || _c === void 0 ? void 0 : _c.map(function (tag) {
|
4400
|
-
if (!tags.find(function (t) { return t.name.toLocaleLowerCase() === tag.slice(1).toLocaleLowerCase(); })) {
|
4401
|
-
addTag({ id: crypto.randomUUID(), name: encodeTag(tag.slice(1).toLocaleLowerCase()), color: randomColor() });
|
4402
|
-
}
|
4403
|
-
});
|
4404
|
-
setLoading(true);
|
4405
4407
|
if (!item.new) {
|
4406
4408
|
((_e = (_d = item === null || item === void 0 ? void 0 : item.layer) === null || _d === void 0 ? void 0 : _d.api) === null || _e === void 0 ? void 0 : _e.updateItem) && toast.promise((_g = (_f = item === null || item === void 0 ? void 0 : item.layer) === null || _f === void 0 ? void 0 : _f.api) === null || _g === void 0 ? void 0 : _g.updateItem(changedItem), {
|
4407
4409
|
pending: 'updating Item ...',
|
@@ -4420,6 +4422,7 @@ var onUpdateItem = function (state, item, tags, addTag, setLoading, navigate, up
|
|
4420
4422
|
});
|
4421
4423
|
}
|
4422
4424
|
else {
|
4425
|
+
item.new = false;
|
4423
4426
|
((_j = (_h = item.layer) === null || _h === void 0 ? void 0 : _h.api) === null || _j === void 0 ? void 0 : _j.createItem) && toast.promise((_l = (_k = item.layer) === null || _k === void 0 ? void 0 : _k.api) === null || _l === void 0 ? void 0 : _l.createItem(changedItem), {
|
4424
4427
|
pending: 'updating Item ...',
|
4425
4428
|
success: 'Item updated',
|
@@ -4946,12 +4949,6 @@ function ProfileForm(_a) {
|
|
4946
4949
|
var layer = layers.find(function (l) { return l.itemType.name == userType; });
|
4947
4950
|
!item && setItem({ id: crypto.randomUUID(), name: user ? user.first_name : "", text: "", layer: layer, new: true });
|
4948
4951
|
}, [items]);
|
4949
|
-
useEffect(function () {
|
4950
|
-
console.log(state.offers);
|
4951
|
-
console.log(state.needs);
|
4952
|
-
console.log(state.id);
|
4953
|
-
console.log(item);
|
4954
|
-
}, [state]);
|
4955
4952
|
useEffect(function () {
|
4956
4953
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
4957
4954
|
var newColor = ((_a = item.layer) === null || _a === void 0 ? void 0 : _a.itemColorField) && getValue(item, (_b = item.layer) === null || _b === void 0 ? void 0 : _b.itemColorField)
|