jamespot-front-business 1.1.100 → 1.1.101

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/esm.js CHANGED
@@ -3671,6 +3671,14 @@ const ExtraAppFieldsItemViews = {
3671
3671
  RECEIVEACOPY: 'RECEIVEACOPY',
3672
3672
  CREATIONDATE: 'CREATIONDATE',
3673
3673
  };
3674
+ const ExtraAppFieldsItemName = {
3675
+ TITLE: 'title',
3676
+ USER: 'user',
3677
+ PUBLISHTO: 'publishTo',
3678
+ SENDALERTTOSUBSCRIBERS: 'sendAlert',
3679
+ RECEIVEACOPY: 'alertAuthor',
3680
+ CREATIONDATE: 'dateCreation',
3681
+ };
3674
3682
  const AppFieldFormPropertyTypes = {
3675
3683
  LABEL: 'label',
3676
3684
  DESCRIPTION: 'description',
@@ -4793,7 +4801,7 @@ const installedToV2ViewNames = {
4793
4801
  };
4794
4802
  const specialAttrName = ['title', 'alertAuthor', 'sendAlert'];
4795
4803
  const ignoredFields = ['edito'];
4796
- function updateViewsFromFields(clonedApp, appFields) {
4804
+ function updateViewsFromFields(views, syncViewFieldOrder, appFields) {
4797
4805
  return Object.assign({}, ...viewsList.map((view) => {
4798
4806
  var _a, _b, _c, _d, _e, _f;
4799
4807
  const viewItems = {};
@@ -4805,7 +4813,7 @@ function updateViewsFromFields(clonedApp, appFields) {
4805
4813
  if (((_d = MapExtraFieldsWithView[view]) === null || _d === void 0 ? void 0 : _d.fixed) !== undefined) {
4806
4814
  viewMissingFixedFields = viewMissingFixedFields.concat((_f = (_e = MapExtraFieldsWithView[view]) === null || _e === void 0 ? void 0 : _e.fixed) !== null && _f !== void 0 ? _f : []);
4807
4815
  }
4808
- Object.entries(clonedApp.views[view]).forEach(([fieldId, field]) => {
4816
+ Object.entries(views[view]).forEach(([fieldId, field]) => {
4809
4817
  if (field.isFixed) {
4810
4818
  viewItems[fieldId] = field;
4811
4819
  viewMissingFixedFields.splice(viewMissingFixedFields.findIndex((fieldType) => fieldType === field.type), 1);
@@ -4834,10 +4842,11 @@ function updateViewsFromFields(clonedApp, appFields) {
4834
4842
  console.error('ExtraAppFieldsItemViews does not have this field type: ' + fieldType);
4835
4843
  }
4836
4844
  });
4845
+ const newFields = [];
4837
4846
  appFields.forEach((field, idx) => {
4838
- var _a, _b, _c, _d, _e, _f, _g, _h;
4847
+ var _a, _b, _c, _d, _e, _f;
4839
4848
  const isFieldUsedInView = field.views[view];
4840
- const isExistingField = Object.keys(clonedApp.views[view]).includes(field.id);
4849
+ const isExistingField = Object.keys(views[view]).includes(field.id);
4841
4850
  const fieldType = field.type;
4842
4851
  if (AppFormBannedFromViews$1.get(fieldType) && ((_a = AppFormBannedFromViews$1.get(fieldType)) === null || _a === void 0 ? void 0 : _a.includes(view))) {
4843
4852
  return;
@@ -4852,7 +4861,7 @@ function updateViewsFromFields(clonedApp, appFields) {
4852
4861
  if (fieldType === AppFormItemTypes.SELECT) {
4853
4862
  const selectProperty = (_c = field.properties) === null || _c === void 0 ? void 0 : _c.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
4854
4863
  if (isExistingField) {
4855
- const exField = clonedApp.views[view][field.id];
4864
+ const exField = views[view][field.id];
4856
4865
  const exSelectProperty = (_d = exField.properties) === null || _d === void 0 ? void 0 : _d.find((prop) => prop.propertyType === AppFieldFormPropertyTypes.OPTIONS_EDITOR);
4857
4866
  const isMultivalued = !!((_e = selectProperty === null || selectProperty === void 0 ? void 0 : selectProperty.value) === null || _e === void 0 ? void 0 : _e.canSelectMultiple);
4858
4867
  const exIsMultivalued = !!((_f = exSelectProperty === null || exSelectProperty === void 0 ? void 0 : exSelectProperty.value) === null || _f === void 0 ? void 0 : _f.canSelectMultiple);
@@ -4871,11 +4880,12 @@ function updateViewsFromFields(clonedApp, appFields) {
4871
4880
  }
4872
4881
  }
4873
4882
  if (isExistingField) {
4874
- const exField = clonedApp.views[view][field.id];
4875
- viewItems[field.id] = Object.assign(Object.assign(Object.assign(Object.assign({}, exField), { properties: field.properties || exField.properties || [] }), (fieldValue !== undefined && { value: fieldValue })), { isUsed: isFieldUsedInView, pos: ((_g = clonedApp.syncViewFieldOrder) === null || _g === void 0 ? void 0 : _g[view]) ? idx : exField.pos, isLockedValue: (fieldValue !== undefined || exField.value !== undefined) && exField.isLockedValue });
4883
+ const exField = views[view][field.id];
4884
+ viewItems[field.id] = Object.assign(Object.assign(Object.assign(Object.assign({}, exField), { properties: field.properties || exField.properties || [] }), (fieldValue !== undefined && { value: fieldValue })), { isUsed: isFieldUsedInView, pos: (syncViewFieldOrder === null || syncViewFieldOrder === void 0 ? void 0 : syncViewFieldOrder[view]) ? idx : exField.pos, isLockedValue: (fieldValue !== undefined || exField.value !== undefined) && exField.isLockedValue });
4876
4885
  }
4877
4886
  else {
4878
- const existingFieldsLen = Object.values(clonedApp.views[view]).filter((v) => !v.isFixed && !v.isOptional).length;
4887
+ newFields.push({ id: field.id, idx: idx });
4888
+ const existingFieldsLen = Object.values(views[view]).filter((v) => !v.isFixed && !v.isOptional).length;
4879
4889
  viewItems[field.id] = {
4880
4890
  type: field.type,
4881
4891
  properties: field.properties || [],
@@ -4884,10 +4894,25 @@ function updateViewsFromFields(clonedApp, appFields) {
4884
4894
  isLockedValue: false,
4885
4895
  isFixed: false,
4886
4896
  value: fieldValue !== null && fieldValue !== void 0 ? fieldValue : null,
4887
- pos: ((_h = clonedApp.syncViewFieldOrder) === null || _h === void 0 ? void 0 : _h[view]) ? idx : existingFieldsLen + idx,
4897
+ pos: (syncViewFieldOrder === null || syncViewFieldOrder === void 0 ? void 0 : syncViewFieldOrder[view]) ? idx : existingFieldsLen + idx,
4888
4898
  };
4889
4899
  }
4890
4900
  });
4901
+ if (!(syncViewFieldOrder === null || syncViewFieldOrder === void 0 ? void 0 : syncViewFieldOrder[view])) {
4902
+ newFields.forEach((nf) => {
4903
+ const item = viewItems[nf.id];
4904
+ item.pos = nf.idx + 1;
4905
+ Object.keys(viewItems).forEach((k) => {
4906
+ const e = viewItems[k];
4907
+ if (e &&
4908
+ !Object.values(ExtraAppFieldsItemName).includes(k) &&
4909
+ k !== nf.id &&
4910
+ e.pos >= item.pos) {
4911
+ e.pos++;
4912
+ }
4913
+ });
4914
+ });
4915
+ }
4891
4916
  return {
4892
4917
  [view]: viewItems,
4893
4918
  };
@@ -5367,7 +5392,7 @@ function InstalledAppStudioAdapter(serverApp, serverApps, state) {
5367
5392
  audience: serverApp.checkAccess === false ? AUDIENCE.ALL : AUDIENCE.CUSTOM,
5368
5393
  };
5369
5394
  populateFieldsAndViews(serverApp, studioApp, state);
5370
- studioApp.views = updateViewsFromFields(studioApp, studioApp.fields);
5395
+ studioApp.views = updateViewsFromFields(studioApp.views, studioApp.syncViewFieldOrder, studioApp.fields);
5371
5396
  const inWorkAppVersion = _findAssociatedDraft(serverApp.idApp, serverApps);
5372
5397
  if (!inWorkAppVersion)
5373
5398
  return studioApp;
@@ -6010,5 +6035,5 @@ const studio = {
6010
6035
  },
6011
6036
  };
6012
6037
 
6013
- export { APP_STATUS_TYPE, AUDIENCE, AdminLogs, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormFieldOnlyInView, AppFormFixedList$1 as AppFormFixedList, AppFormItemTypes, AppFormNoAsFieldList, AppFormNonPrimaryList, AppFormPrimaryList, AppFormPrimaryListValues, AppFormUniqueList, AppFormUniqueListCheck, Application, AssetReservation, Bookmark, Comment, ContentReport, Description, Element, ExtraAppFieldsItemViews, ExtraBot, Faq, Hook, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, SocialActions, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, adminLogsReducer, adminLogsSlice, animationsReducer, animationsSlice, contentReportSlice, extraBotSlice, fetchExtraBotListAll, fetchExtraBotListMines, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, fetchReports, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, saveExtraBot, selectExtraBotListAll, selectExtraBotListMines, slice$1 as slice, studio, toggleExtraBotActivation, updateListBotProperty, updateStatus, updateWidgetContent, viewsList };
6038
+ export { APP_STATUS_TYPE, AUDIENCE, AdminLogs, Animations, AppColumnsDefaultTypes, AppFieldFormPropertyTypes, AppFormBannedFromViews$1 as AppFormBannedFromViews, AppFormFieldOnlyInView, AppFormFixedList$1 as AppFormFixedList, AppFormItemTypes, AppFormNoAsFieldList, AppFormNonPrimaryList, AppFormPrimaryList, AppFormPrimaryListValues, AppFormUniqueList, AppFormUniqueListCheck, Application, AssetReservation, Bookmark, Comment, ContentReport, Description, Element, ExtraAppFieldsItemName, ExtraAppFieldsItemViews, ExtraBot, Faq, Hook, MagicPad, MapExtraFieldsWithView, MediaLibrary, Model, Network, Platform, STUDIO_VIEW, Share, SocialActions, StatusType$1 as StatusType, TVDisplay, TinyMCE, Toast, UserCurrent, WedocApp, Widget, WidgetEditor, actions, adminLogsReducer, adminLogsSlice, animationsReducer, animationsSlice, contentReportSlice, extraBotSlice, fetchExtraBotListAll, fetchExtraBotListMines, fetchMediaLibraryConfig, fetchMediaLibraryFilesStats, fetchMediaLibraryFolders, fetchMediaLibraryFoldersStats, fetchMediaLibraryStats, fetchMediaLibraryUnclassifiedFiles, fetchPads, fetchReports, jland, magicPadSlice, mediaLibraryReducer, mediaLibrarySlice, saveExtraBot, selectExtraBotListAll, selectExtraBotListMines, slice$1 as slice, studio, toggleExtraBotActivation, updateListBotProperty, updateStatus, updateWidgetContent, viewsList };
6014
6039
  //# sourceMappingURL=esm.js.map