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/cjs.js
CHANGED
|
@@ -718,6 +718,17 @@ const fetchComments = toolkit.createAsyncThunk('commentList/fetchCommentList', (
|
|
|
718
718
|
return rejectWithValue({ error: 1, errorMsg: 'Cannot retrieve comments' });
|
|
719
719
|
}
|
|
720
720
|
}));
|
|
721
|
+
const deleteComment = toolkit.createAsyncThunk('commentList/deleteComment', (params, { extra, rejectWithValue, dispatch }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
722
|
+
var _b;
|
|
723
|
+
try {
|
|
724
|
+
yield extra.jApi.article.deleteComment(params.idComment);
|
|
725
|
+
return true;
|
|
726
|
+
}
|
|
727
|
+
catch (error) {
|
|
728
|
+
dispatch(Toast.actions.error({ label: (_b = error.errorMsg) !== null && _b !== void 0 ? _b : 'GLOBAL_Technical_Error' }));
|
|
729
|
+
return rejectWithValue({ error: 1, errorMsg: 'Cannot delete comment' });
|
|
730
|
+
}
|
|
731
|
+
}));
|
|
721
732
|
const CommentListSlice = toolkit.createSlice({
|
|
722
733
|
name: 'commentList',
|
|
723
734
|
initialState: initialState$i,
|
|
@@ -773,6 +784,22 @@ const CommentListSlice = toolkit.createSlice({
|
|
|
773
784
|
})
|
|
774
785
|
.addCase(fetchComments.rejected, (state) => {
|
|
775
786
|
state.loading = 'idle';
|
|
787
|
+
})
|
|
788
|
+
.addCase(deleteComment.pending, (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: true }) : comment) });
|
|
794
|
+
});
|
|
795
|
+
})
|
|
796
|
+
.addCase(deleteComment.rejected, (state, action) => {
|
|
797
|
+
state.comments = state.comments.map((c) => {
|
|
798
|
+
if (c.idArticle !== action.meta.arg.idArticle) {
|
|
799
|
+
return c;
|
|
800
|
+
}
|
|
801
|
+
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) });
|
|
802
|
+
});
|
|
776
803
|
});
|
|
777
804
|
},
|
|
778
805
|
});
|
|
@@ -834,13 +861,12 @@ const commentSlice = {
|
|
|
834
861
|
};
|
|
835
862
|
const selectCommentList = (state, idArticle, limit = 0) => {
|
|
836
863
|
const data = state.comment.commentList.comments.find((c) => c.idArticle === idArticle);
|
|
837
|
-
const
|
|
838
|
-
const list = [...dataList].sort((c1, c2) => c1.id - c2.id);
|
|
864
|
+
const list = data ? [...data.list].sort((c1, c2) => c1.id - c2.id) : [];
|
|
839
865
|
return limit !== 0 ? list.slice(-limit) : list;
|
|
840
866
|
};
|
|
841
867
|
const Comment = {
|
|
842
868
|
slice: commentSlice,
|
|
843
|
-
actions: Object.assign({ fetchComments }, CommentListSlice.actions),
|
|
869
|
+
actions: Object.assign({ fetchComments, deleteComment }, CommentListSlice.actions),
|
|
844
870
|
selectors: {
|
|
845
871
|
commentList: selectCommentList,
|
|
846
872
|
},
|
|
@@ -4277,13 +4303,43 @@ const specialAttrName = ['title', 'alertAuthor', 'sendAlert'];
|
|
|
4277
4303
|
const ignoredFields = ['edito'];
|
|
4278
4304
|
function updateViewsFromFields(clonedApp, appFields) {
|
|
4279
4305
|
return Object.assign({}, ...viewsList.map((view) => {
|
|
4306
|
+
var _a, _b, _c, _d, _e, _f;
|
|
4280
4307
|
const viewItems = {};
|
|
4308
|
+
let viewMissingOptionalFields = [];
|
|
4309
|
+
if (((_a = MapExtraFieldsWithView[view]) === null || _a === void 0 ? void 0 : _a.optional) !== undefined) {
|
|
4310
|
+
viewMissingOptionalFields = viewMissingOptionalFields.concat((_c = (_b = MapExtraFieldsWithView[view]) === null || _b === void 0 ? void 0 : _b.optional) !== null && _c !== void 0 ? _c : []);
|
|
4311
|
+
}
|
|
4312
|
+
let viewMissingFixedFields = [];
|
|
4313
|
+
if (((_d = MapExtraFieldsWithView[view]) === null || _d === void 0 ? void 0 : _d.fixed) !== undefined) {
|
|
4314
|
+
viewMissingFixedFields = viewMissingFixedFields.concat((_f = (_e = MapExtraFieldsWithView[view]) === null || _e === void 0 ? void 0 : _e.fixed) !== null && _f !== void 0 ? _f : []);
|
|
4315
|
+
}
|
|
4281
4316
|
Object.entries(clonedApp.views[view]).forEach(([fieldId, field]) => {
|
|
4282
4317
|
if (field.isFixed) {
|
|
4283
4318
|
viewItems[fieldId] = field;
|
|
4319
|
+
viewMissingFixedFields.splice(viewMissingFixedFields.findIndex((fieldType) => fieldType === field.type), 1);
|
|
4284
4320
|
}
|
|
4285
4321
|
if (field.isOptional) {
|
|
4286
4322
|
viewItems[fieldId] = field;
|
|
4323
|
+
viewMissingOptionalFields.splice(viewMissingOptionalFields.findIndex((fieldType) => fieldType === field.type), 1);
|
|
4324
|
+
}
|
|
4325
|
+
});
|
|
4326
|
+
const missingFieldsSet = new Set(viewMissingFixedFields.concat(viewMissingOptionalFields));
|
|
4327
|
+
const fieldTypeHandlers = {
|
|
4328
|
+
[ExtraAppFieldsItemViews.CREATIONDATE]: () => getDateCreationToView(false),
|
|
4329
|
+
[ExtraAppFieldsItemViews.TITLE]: () => getTitleToView({ ref: 'title', fixedValue: undefined }),
|
|
4330
|
+
[ExtraAppFieldsItemViews.USER]: () => getUserToView(false),
|
|
4331
|
+
[ExtraAppFieldsItemViews.RECEIVEACOPY]: () => getAlertAuthorToView({ ref: 'alertAuthor', fixedValue: undefined }),
|
|
4332
|
+
[ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS]: () => getSendAlertToView({ ref: 'sendAlert', fixedValue: undefined }),
|
|
4333
|
+
[ExtraAppFieldsItemViews.PUBLISHTO]: () => getPublishToToView({ ref: 'publishTo', fixedValue: undefined }),
|
|
4334
|
+
};
|
|
4335
|
+
missingFieldsSet.forEach((fieldType) => {
|
|
4336
|
+
const handler = fieldTypeHandlers[fieldType];
|
|
4337
|
+
if (handler) {
|
|
4338
|
+
const [localFieldId, localField] = handler();
|
|
4339
|
+
viewItems[localFieldId] = localField;
|
|
4340
|
+
}
|
|
4341
|
+
else {
|
|
4342
|
+
console.error('ExtraAppFieldsItemViews does not have this field type: ' + fieldType);
|
|
4287
4343
|
}
|
|
4288
4344
|
});
|
|
4289
4345
|
appFields.forEach((field, idx) => {
|
|
@@ -4392,16 +4448,20 @@ function buildView(appS, registeredFields, displayName, displayValue, tables, st
|
|
|
4392
4448
|
if (fieldIdx === -1 && fixedInfo) {
|
|
4393
4449
|
switch (fixedInfo.ref) {
|
|
4394
4450
|
case 'title':
|
|
4395
|
-
|
|
4451
|
+
const [localFieldIdTitle, localFieldTitle] = getTitleToView(fixedInfo);
|
|
4452
|
+
appS.views[newName][localFieldIdTitle] = localFieldTitle;
|
|
4396
4453
|
break;
|
|
4397
4454
|
case 'alertAuthor':
|
|
4398
|
-
|
|
4455
|
+
const [localFieldIdAlertAuthor, localFieldAlertAuthor] = getAlertAuthorToView(fixedInfo);
|
|
4456
|
+
appS.views[newName][localFieldIdAlertAuthor] = localFieldAlertAuthor;
|
|
4399
4457
|
break;
|
|
4400
4458
|
case 'sendAlert':
|
|
4401
|
-
|
|
4459
|
+
const [localFieldIdSendAlert, localFieldSendAlert] = getSendAlertToView(fixedInfo);
|
|
4460
|
+
appS.views[newName][localFieldIdSendAlert] = localFieldSendAlert;
|
|
4402
4461
|
break;
|
|
4403
4462
|
case 'publishTo':
|
|
4404
|
-
|
|
4463
|
+
const [localFieldIdPublishTo, localFieldPublishTo] = getPublishToToView(fixedInfo);
|
|
4464
|
+
appS.views[newName][localFieldIdPublishTo] = localFieldPublishTo;
|
|
4405
4465
|
break;
|
|
4406
4466
|
default:
|
|
4407
4467
|
console.error('fixed field info with unsupported ref ', fixedInfo);
|
|
@@ -4434,15 +4494,18 @@ function buildFilterView(appS, registeredFields, attrExposed, tables, state) {
|
|
|
4434
4494
|
function addFieldToViewFromRef(appS, registeredFields, tables, viewName, fieldRef, index, state) {
|
|
4435
4495
|
switch (fieldRef) {
|
|
4436
4496
|
case 'title':
|
|
4437
|
-
|
|
4497
|
+
const [fieldIDTitle, fieldInfoTitle] = getTitleToView({ ref: 'title', fixedValue: undefined });
|
|
4498
|
+
appS['views'][viewName][fieldIDTitle] = fieldInfoTitle;
|
|
4438
4499
|
break;
|
|
4439
4500
|
case 'iduser':
|
|
4440
4501
|
case 'idUser':
|
|
4441
|
-
|
|
4502
|
+
const [fieldIDIdUser, fieldInfoIdUser] = getUserToView();
|
|
4503
|
+
appS['views'][viewName][fieldIDIdUser] = fieldInfoIdUser;
|
|
4442
4504
|
break;
|
|
4443
4505
|
case 'datecreation':
|
|
4444
4506
|
case 'dateCreation':
|
|
4445
|
-
|
|
4507
|
+
const [fieldIDDateCreation, fieldInfoDateCreation] = getDateCreationToView();
|
|
4508
|
+
appS['views'][viewName][fieldIDDateCreation] = fieldInfoDateCreation;
|
|
4446
4509
|
break;
|
|
4447
4510
|
default:
|
|
4448
4511
|
defaultFieldCreation(appS, registeredFields, tables, viewName, fieldRef, index, state);
|
|
@@ -4682,85 +4745,97 @@ function getFormItemType(installedField) {
|
|
|
4682
4745
|
':' +
|
|
4683
4746
|
JSON.stringify(installedField));
|
|
4684
4747
|
}
|
|
4685
|
-
function
|
|
4748
|
+
function getTitleToView(fixedInfo, isUsed = true) {
|
|
4686
4749
|
var _a;
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4750
|
+
return [
|
|
4751
|
+
'title',
|
|
4752
|
+
{
|
|
4753
|
+
type: ExtraAppFieldsItemViews.TITLE,
|
|
4754
|
+
properties: [],
|
|
4755
|
+
isUsed: isUsed,
|
|
4756
|
+
isOptional: false,
|
|
4757
|
+
isLockedValue: !!(fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue),
|
|
4758
|
+
isFixed: true,
|
|
4759
|
+
value: (_a = fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== null && _a !== void 0 ? _a : null,
|
|
4760
|
+
pos: 0,
|
|
4761
|
+
},
|
|
4762
|
+
];
|
|
4698
4763
|
}
|
|
4699
|
-
function
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4764
|
+
function getAlertAuthorToView(fixedInfo, isUsed = true) {
|
|
4765
|
+
return [
|
|
4766
|
+
'alertAuthor',
|
|
4767
|
+
{
|
|
4768
|
+
type: ExtraAppFieldsItemViews.RECEIVEACOPY,
|
|
4769
|
+
properties: [],
|
|
4770
|
+
isUsed: isUsed,
|
|
4771
|
+
isOptional: true,
|
|
4772
|
+
isLockedValue: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined,
|
|
4773
|
+
isFixed: false,
|
|
4774
|
+
value: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined ? fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue : true,
|
|
4775
|
+
pos: 300,
|
|
4776
|
+
},
|
|
4777
|
+
];
|
|
4711
4778
|
}
|
|
4712
|
-
function
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4779
|
+
function getSendAlertToView(fixedInfo, isUsed = true) {
|
|
4780
|
+
return [
|
|
4781
|
+
'sendAlert',
|
|
4782
|
+
{
|
|
4783
|
+
type: ExtraAppFieldsItemViews.SENDALERTTOSUBSCRIBERS,
|
|
4784
|
+
properties: [],
|
|
4785
|
+
isUsed: isUsed,
|
|
4786
|
+
isOptional: true,
|
|
4787
|
+
isLockedValue: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined,
|
|
4788
|
+
isFixed: false,
|
|
4789
|
+
value: (fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== undefined ? fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue : true,
|
|
4790
|
+
pos: 200,
|
|
4791
|
+
},
|
|
4792
|
+
];
|
|
4724
4793
|
}
|
|
4725
|
-
function
|
|
4794
|
+
function getPublishToToView(fixedInfo, isUsed = true) {
|
|
4726
4795
|
var _a;
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4796
|
+
return [
|
|
4797
|
+
'publishTo',
|
|
4798
|
+
{
|
|
4799
|
+
type: ExtraAppFieldsItemViews.PUBLISHTO,
|
|
4800
|
+
properties: [],
|
|
4801
|
+
isUsed: isUsed,
|
|
4802
|
+
isOptional: true,
|
|
4803
|
+
isLockedValue: !!(fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue),
|
|
4804
|
+
isFixed: false,
|
|
4805
|
+
value: (_a = fixedInfo === null || fixedInfo === void 0 ? void 0 : fixedInfo.fixedValue) !== null && _a !== void 0 ? _a : [],
|
|
4806
|
+
pos: 100,
|
|
4807
|
+
},
|
|
4808
|
+
];
|
|
4738
4809
|
}
|
|
4739
|
-
function
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4810
|
+
function getUserToView(isUsed = true) {
|
|
4811
|
+
return [
|
|
4812
|
+
'user',
|
|
4813
|
+
{
|
|
4814
|
+
type: ExtraAppFieldsItemViews.USER,
|
|
4815
|
+
properties: [],
|
|
4816
|
+
isUsed: isUsed,
|
|
4817
|
+
isOptional: false,
|
|
4818
|
+
isLockedValue: false,
|
|
4819
|
+
isFixed: true,
|
|
4820
|
+
value: null,
|
|
4821
|
+
pos: 1,
|
|
4822
|
+
},
|
|
4823
|
+
];
|
|
4751
4824
|
}
|
|
4752
|
-
function
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4825
|
+
function getDateCreationToView(isUsed = true) {
|
|
4826
|
+
return [
|
|
4827
|
+
'dateCreation',
|
|
4828
|
+
{
|
|
4829
|
+
type: ExtraAppFieldsItemViews.CREATIONDATE,
|
|
4830
|
+
properties: [],
|
|
4831
|
+
isUsed: isUsed,
|
|
4832
|
+
isOptional: true,
|
|
4833
|
+
isLockedValue: false,
|
|
4834
|
+
isFixed: false,
|
|
4835
|
+
value: null,
|
|
4836
|
+
pos: 100,
|
|
4837
|
+
},
|
|
4838
|
+
];
|
|
4764
4839
|
}
|
|
4765
4840
|
|
|
4766
4841
|
function InstalledAppStudioAdapter(serverApp, serverApps, state) {
|