jamespot-front-business 1.1.82 → 1.1.83
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/cjs.js +157 -82
- package/dist/cjs.js.map +1 -1
- package/dist/esm.js +157 -82
- package/dist/esm.js.map +1 -1
- package/dist/types.d.ts +225 -9
- package/package.json +2 -2
package/dist/esm.js
CHANGED
|
@@ -710,6 +710,17 @@ const fetchComments = createAsyncThunk('commentList/fetchCommentList', (params,
|
|
|
710
710
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
|
|
711
711
|
}
|
|
712
712
|
}));
|
|
713
|
+
const deleteComment = createAsyncThunk('commentList/deleteComment', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
714
|
+
var _b;
|
|
715
|
+
try {
|
|
716
|
+
yield extra.jApi.article.deleteComment(params.idComment);
|
|
717
|
+
return true;
|
|
718
|
+
}
|
|
719
|
+
catch (error) {
|
|
720
|
+
dispatch(Toast.actions.error({ label: (_b = error.errorMsg) !== null && _b !== void 0 ? _b : 'GLOBAL_Technical_Error' }));
|
|
721
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete comment' });
|
|
722
|
+
}
|
|
723
|
+
}));
|
|
713
724
|
const CommentListSlice = createSlice({
|
|
714
725
|
name: 'commentList',
|
|
715
726
|
initialState: initialState$i,
|
|
@@ -765,6 +776,22 @@ const CommentListSlice = createSlice({
|
|
|
765
776
|
})
|
|
766
777
|
.addCase(fetchComments.rejected, (state) => {
|
|
767
778
|
state.loading = 'idle';
|
|
779
|
+
})
|
|
780
|
+
.addCase(deleteComment.pending, (state, action) => {
|
|
781
|
+
state.comments = state.comments.map((c) => {
|
|
782
|
+
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
783
|
+
return c;
|
|
784
|
+
}
|
|
785
|
+
return Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? Object.assign(Object.assign({}, comment), { pending: true }) : comment) });
|
|
786
|
+
});
|
|
787
|
+
})
|
|
788
|
+
.addCase(deleteComment.rejected, (state, action) => {
|
|
789
|
+
state.comments = state.comments.map((c) => {
|
|
790
|
+
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
791
|
+
return c;
|
|
792
|
+
}
|
|
793
|
+
return Object.assign(Object.assign({}, c), { list: c.list.map((comment) => comment.id === action.meta.arg.idComment ? Object.assign(Object.assign({}, comment), { pending: false }) : comment) });
|
|
794
|
+
});
|
|
768
795
|
});
|
|
769
796
|
},
|
|
770
797
|
});
|
|
@@ -826,13 +853,12 @@ const commentSlice = {
|
|
|
826
853
|
};
|
|
827
854
|
const selectCommentList = (state, idArticle, limit = 0) => {
|
|
828
855
|
const data = state.comment.commentList.comments.find((c) => c.idArticle === idArticle);
|
|
829
|
-
const
|
|
830
|
-
const list = [...dataList].sort((c1, c2) => c1.id - c2.id);
|
|
856
|
+
const list = data ? [...data.list].sort((c1, c2) => c1.id - c2.id) : [];
|
|
831
857
|
return limit !== 0 ? list.slice(-limit) : list;
|
|
832
858
|
};
|
|
833
859
|
const Comment = {
|
|
834
860
|
slice: commentSlice,
|
|
835
|
-
actions: Object.assign({ fetchComments }, CommentListSlice.actions),
|
|
861
|
+
actions: Object.assign({ fetchComments, deleteComment }, CommentListSlice.actions),
|
|
836
862
|
selectors: {
|
|
837
863
|
commentList: selectCommentList,
|
|
838
864
|
},
|
|
@@ -4269,13 +4295,43 @@ const specialAttrName = ['title', 'alertAuthor', 'sendAlert'];
|
|
|
4269
4295
|
const ignoredFields = ['edito'];
|
|
4270
4296
|
function updateViewsFromFields(clonedApp, appFields) {
|
|
4271
4297
|
return Object.assign({}, ...viewsList.map((view) => {
|
|
4298
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4272
4299
|
const viewItems = {};
|
|
4300
|
+
let viewMissingOptionalFields = [];
|
|
4301
|
+
if (((_a = MapExtraFieldsWithView[view]) === null || _a === void 0 ? void 0 : _a.optional) !== undefined) {
|
|
4302
|
+
viewMissingOptionalFields = viewMissingOptionalFields.concat((_c = (_b = MapExtraFieldsWithView[view]) === null || _b === void 0 ? void 0 : _b.optional) !== null && _c !== void 0 ? _c : []);
|
|
4303
|
+
}
|
|
4304
|
+
let viewMissingFixedFields = [];
|
|
4305
|
+
if (((_d = MapExtraFieldsWithView[view]) === null || _d === void 0 ? void 0 : _d.fixed) !== undefined) {
|
|
4306
|
+
viewMissingFixedFields = viewMissingFixedFields.concat((_f = (_e = MapExtraFieldsWithView[view]) === null || _e === void 0 ? void 0 : _e.fixed) !== null && _f !== void 0 ? _f : []);
|
|
4307
|
+
}
|
|
4273
4308
|
Object.entries(clonedApp.views[view]).forEach(([fieldId, field]) => {
|
|
4274
4309
|
if (field.isFixed) {
|
|
4275
4310
|
viewItems[fieldId] = field;
|
|
4311
|
+
viewMissingFixedFields.splice(viewMissingFixedFields.findIndex((fieldType) => fieldType === field.type), 1);
|
|
4276
4312
|
}
|
|
4277
4313
|
if (field.isOptional) {
|
|
4278
4314
|
viewItems[fieldId] = field;
|
|
4315
|
+
viewMissingOptionalFields.splice(viewMissingOptionalFields.findIndex((fieldType) => fieldType === field.type), 1);
|
|
4316
|
+
}
|
|
4317
|
+
});
|
|
4318
|
+
const missingFieldsSet = new Set(viewMissingFixedFields.concat(viewMissingOptionalFields));
|
|
4319
|
+
const fieldTypeHandlers = {
|
|
4320
|
+
[ExtraAppFieldsItemViews.CREATIONDATE]: () => getDateCreationToView(false),
|
|
4321
|
+
[ExtraAppFieldsItemViews.TITLE]: () => getTitleToView({ ref: 'title', fixedValue: undefined }),
|
|
4322
|
+
[ExtraAppFieldsItemViews.USER]: () => getUserToView(false),
|
|
4323
|
+
[ExtraAppFieldsItemViews.RECEIVEACOPY]: () => getAlertAuthorToView({ ref: 'alertAuthor', fixedValue: undefined }),
|
|
4324
|
+
[ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS]: () => getSendAlertToView({ ref: 'sendAlert', fixedValue: undefined }),
|
|
4325
|
+
[ExtraAppFieldsItemViews.PUBLISHTO]: () => getPublishToToView({ ref: 'publishTo', fixedValue: undefined }),
|
|
4326
|
+
};
|
|
4327
|
+
missingFieldsSet.forEach((fieldType) => {
|
|
4328
|
+
const handler = fieldTypeHandlers[fieldType];
|
|
4329
|
+
if (handler) {
|
|
4330
|
+
const [localFieldId, localField] = handler();
|
|
4331
|
+
viewItems[localFieldId] = localField;
|
|
4332
|
+
}
|
|
4333
|
+
else {
|
|
4334
|
+
console.error('ExtraAppFieldsItemViews does not have this field type: ' + fieldType);
|
|
4279
4335
|
}
|
|
4280
4336
|
});
|
|
4281
4337
|
appFields.forEach((field, idx) => {
|
|
@@ -4384,16 +4440,20 @@ function buildView(appS, registeredFields, displayName, displayValue, tables, st
|
|
|
4384
4440
|
if (fieldIdx === -1 && fixedInfo) {
|
|
4385
4441
|
switch (fixedInfo.ref) {
|
|
4386
4442
|
case 'title':
|
|
4387
|
-
|
|
4443
|
+
const [localFieldIdTitle, localFieldTitle] = getTitleToView(fixedInfo);
|
|
4444
|
+
appS.views[newName][localFieldIdTitle] = localFieldTitle;
|
|
4388
4445
|
break;
|
|
4389
4446
|
case 'alertAuthor':
|
|
4390
|
-
|
|
4447
|
+
const [localFieldIdAlertAuthor, localFieldAlertAuthor] = getAlertAuthorToView(fixedInfo);
|
|
4448
|
+
appS.views[newName][localFieldIdAlertAuthor] = localFieldAlertAuthor;
|
|
4391
4449
|
break;
|
|
4392
4450
|
case 'sendAlert':
|
|
4393
|
-
|
|
4451
|
+
const [localFieldIdSendAlert, localFieldSendAlert] = getSendAlertToView(fixedInfo);
|
|
4452
|
+
appS.views[newName][localFieldIdSendAlert] = localFieldSendAlert;
|
|
4394
4453
|
break;
|
|
4395
4454
|
case 'publishTo':
|
|
4396
|
-
|
|
4455
|
+
const [localFieldIdPublishTo, localFieldPublishTo] = getPublishToToView(fixedInfo);
|
|
4456
|
+
appS.views[newName][localFieldIdPublishTo] = localFieldPublishTo;
|
|
4397
4457
|
break;
|
|
4398
4458
|
default:
|
|
4399
4459
|
console.error('fixed field info with unsupported ref ', fixedInfo);
|
|
@@ -4426,15 +4486,18 @@ function buildFilterView(appS, registeredFields, attrExposed, tables, state) {
|
|
|
4426
4486
|
function addFieldToViewFromRef(appS, registeredFields, tables, viewName, fieldRef, index, state) {
|
|
4427
4487
|
switch (fieldRef) {
|
|
4428
4488
|
case 'title':
|
|
4429
|
-
|
|
4489
|
+
const [fieldIDTitle, fieldInfoTitle] = getTitleToView({ ref: 'title', fixedValue: undefined });
|
|
4490
|
+
appS['views'][viewName][fieldIDTitle] = fieldInfoTitle;
|
|
4430
4491
|
break;
|
|
4431
4492
|
case 'iduser':
|
|
4432
4493
|
case 'idUser':
|
|
4433
|
-
|
|
4494
|
+
const [fieldIDIdUser, fieldInfoIdUser] = getUserToView();
|
|
4495
|
+
appS['views'][viewName][fieldIDIdUser] = fieldInfoIdUser;
|
|
4434
4496
|
break;
|
|
4435
4497
|
case 'datecreation':
|
|
4436
4498
|
case 'dateCreation':
|
|
4437
|
-
|
|
4499
|
+
const [fieldIDDateCreation, fieldInfoDateCreation] = getDateCreationToView();
|
|
4500
|
+
appS['views'][viewName][fieldIDDateCreation] = fieldInfoDateCreation;
|
|
4438
4501
|
break;
|
|
4439
4502
|
default:
|
|
4440
4503
|
defaultFieldCreation(appS, registeredFields, tables, viewName, fieldRef, index, state);
|
|
@@ -4674,85 +4737,97 @@ function getFormItemType(installedField) {
|
|
|
4674
4737
|
':' +
|
|
4675
4738
|
JSON.stringify(installedField));
|
|
4676
4739
|
}
|
|
4677
|
-
function
|
|
4740
|
+
function getTitleToView(fixedInfo, isUsed = true) {
|
|
4678
4741
|
var _a;
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4742
|
+
return [
|
|
4743
|
+
'title',
|
|
4744
|
+
{
|
|
4745
|
+
type: ExtraAppFieldsItemViews.TITLE,
|
|
4746
|
+
properties: [],
|
|
4747
|
+
isUsed: isUsed,
|
|
4748
|
+
isOptional: false,
|
|
4749
|
+
isLockedValue: !!(fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue),
|
|
4750
|
+
isFixed: true,
|
|
4751
|
+
value: (_a = fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== null && _a !== void 0 ? _a : null,
|
|
4752
|
+
pos: 0,
|
|
4753
|
+
},
|
|
4754
|
+
];
|
|
4690
4755
|
}
|
|
4691
|
-
function
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4756
|
+
function getAlertAuthorToView(fixedInfo, isUsed = true) {
|
|
4757
|
+
return [
|
|
4758
|
+
'alertAuthor',
|
|
4759
|
+
{
|
|
4760
|
+
type: ExtraAppFieldsItemViews.RECEIVEACOPY,
|
|
4761
|
+
properties: [],
|
|
4762
|
+
isUsed: isUsed,
|
|
4763
|
+
isOptional: true,
|
|
4764
|
+
isLockedValue: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined,
|
|
4765
|
+
isFixed: false,
|
|
4766
|
+
value: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined ? fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue : true,
|
|
4767
|
+
pos: 300,
|
|
4768
|
+
},
|
|
4769
|
+
];
|
|
4703
4770
|
}
|
|
4704
|
-
function
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4771
|
+
function getSendAlertToView(fixedInfo, isUsed = true) {
|
|
4772
|
+
return [
|
|
4773
|
+
'sendAlert',
|
|
4774
|
+
{
|
|
4775
|
+
type: ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS,
|
|
4776
|
+
properties: [],
|
|
4777
|
+
isUsed: isUsed,
|
|
4778
|
+
isOptional: true,
|
|
4779
|
+
isLockedValue: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined,
|
|
4780
|
+
isFixed: false,
|
|
4781
|
+
value: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined ? fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue : true,
|
|
4782
|
+
pos: 200,
|
|
4783
|
+
},
|
|
4784
|
+
];
|
|
4716
4785
|
}
|
|
4717
|
-
function
|
|
4786
|
+
function getPublishToToView(fixedInfo, isUsed = true) {
|
|
4718
4787
|
var _a;
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4788
|
+
return [
|
|
4789
|
+
'publishTo',
|
|
4790
|
+
{
|
|
4791
|
+
type: ExtraAppFieldsItemViews.PUBLISHTO,
|
|
4792
|
+
properties: [],
|
|
4793
|
+
isUsed: isUsed,
|
|
4794
|
+
isOptional: true,
|
|
4795
|
+
isLockedValue: !!(fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue),
|
|
4796
|
+
isFixed: false,
|
|
4797
|
+
value: (_a = fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== null && _a !== void 0 ? _a : [],
|
|
4798
|
+
pos: 100,
|
|
4799
|
+
},
|
|
4800
|
+
];
|
|
4730
4801
|
}
|
|
4731
|
-
function
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4802
|
+
function getUserToView(isUsed = true) {
|
|
4803
|
+
return [
|
|
4804
|
+
'user',
|
|
4805
|
+
{
|
|
4806
|
+
type: ExtraAppFieldsItemViews.USER,
|
|
4807
|
+
properties: [],
|
|
4808
|
+
isUsed: isUsed,
|
|
4809
|
+
isOptional: false,
|
|
4810
|
+
isLockedValue: false,
|
|
4811
|
+
isFixed: true,
|
|
4812
|
+
value: null,
|
|
4813
|
+
pos: 1,
|
|
4814
|
+
},
|
|
4815
|
+
];
|
|
4743
4816
|
}
|
|
4744
|
-
function
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4817
|
+
function getDateCreationToView(isUsed = true) {
|
|
4818
|
+
return [
|
|
4819
|
+
'dateCreation',
|
|
4820
|
+
{
|
|
4821
|
+
type: ExtraAppFieldsItemViews.CREATIONDATE,
|
|
4822
|
+
properties: [],
|
|
4823
|
+
isUsed: isUsed,
|
|
4824
|
+
isOptional: true,
|
|
4825
|
+
isLockedValue: false,
|
|
4826
|
+
isFixed: false,
|
|
4827
|
+
value: null,
|
|
4828
|
+
pos: 100,
|
|
4829
|
+
},
|
|
4830
|
+
];
|
|
4756
4831
|
}
|
|
4757
4832
|
|
|
4758
4833
|
function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|