@dao42/d42paas-front 0.9.10 → 0.9.13

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.
@@ -9263,7 +9263,7 @@ const currentDocStore = createStore("currentDoc")({
9263
9263
  }
9264
9264
  }).extendSelectors((state, get2, _api) => ({})).extendActions((set, get2, _api) => ({
9265
9265
  switchDoc: (doc2) => {
9266
- set.doc(doc2);
9266
+ set.doc(__spreadValues(__spreadValues({}, get2.doc()), doc2));
9267
9267
  },
9268
9268
  setReadOnly: (readonly) => {
9269
9269
  set.doc(__spreadProps(__spreadValues({}, get2.doc()), {
@@ -11421,7 +11421,7 @@ const Loading$1 = () => {
11421
11421
  });
11422
11422
  };
11423
11423
  const name$2 = "@dao42/d42paas-front";
11424
- const version = "0.9.10";
11424
+ const version = "0.9.13";
11425
11425
  const description = "d42paas front";
11426
11426
  const author = "dao42 paas team";
11427
11427
  const homepage = "https://github.com/dao42/d42paas_frontend#readme";
@@ -14012,8 +14012,6 @@ class DaoChannel {
14012
14012
  const updateAgentUser = actions.dao.updateAgentUser;
14013
14013
  const file = data.file;
14014
14014
  this.updateCRDTInfo(data);
14015
- const openedFile = getFileTreeItemByFilePath(file.path);
14016
- actions.currentDoc.setReadOnly(!!(openedFile == null ? void 0 : openedFile.lock));
14017
14015
  if (data.agentUserId === agentUserId || currentAgentUser.followingAgentUserId === data.agentUserId) {
14018
14016
  switchDoc(file);
14019
14017
  }
@@ -33222,6 +33220,7 @@ const TreeRootLayout = newStyled.div`
33222
33220
  padding: 6px 0;
33223
33221
  height: 100%;
33224
33222
  color: #e9f3f0;
33223
+ display: flex;
33225
33224
  }
33226
33225
  .expand-panel {
33227
33226
  display: none;
@@ -53757,11 +53756,13 @@ const Popover = ({
53757
53756
  };
53758
53757
  const FileTreeActions = (props) => {
53759
53758
  const {
53760
- useLockFeature,
53761
- useUnitTestFeature,
53759
+ lockFeature,
53760
+ lockEditFeature,
53761
+ hideFeature,
53762
+ hideEditFeature,
53763
+ unittestFeature,
53764
+ unittestEditFeature,
53762
53765
  treeNode,
53763
- useEnableHideFeature,
53764
- useHideFeature,
53765
53766
  children
53766
53767
  } = props;
53767
53768
  const channel = useStore().dao.channel();
@@ -53771,24 +53772,30 @@ const FileTreeActions = (props) => {
53771
53772
  };
53772
53773
  const handleToggleLockStatusEvent = (e2) => {
53773
53774
  stopPropagation(e2);
53775
+ if (lockEditFeature && lockFeature === "preview" || !lockEditFeature) {
53776
+ return;
53777
+ }
53774
53778
  channel == null ? void 0 : channel.setFileLockStatus({
53775
53779
  path: treeNode.index,
53776
53780
  lock: !treeNode.lock
53777
53781
  });
53778
53782
  };
53779
- const LockCmp = useLockFeature ? treeNode.lock ? /* @__PURE__ */ jsx(Icon, {
53783
+ const LockCmp = lockFeature === "on" || lockFeature === "preview" ? treeNode.lock ? /* @__PURE__ */ jsx(Icon, {
53780
53784
  as: LockIcon
53781
53785
  }) : /* @__PURE__ */ jsx(Icon, {
53782
53786
  as: UnlockIcon
53783
53787
  }) : null;
53784
53788
  const handleToggleVisibleEvent = (e2) => {
53785
53789
  stopPropagation(e2);
53790
+ if (hideEditFeature && hideFeature === "preview" || !hideEditFeature) {
53791
+ return;
53792
+ }
53786
53793
  channel == null ? void 0 : channel.setFileVisiable({
53787
53794
  path: treeNode.index,
53788
53795
  hide: !treeNode.hide
53789
53796
  });
53790
53797
  };
53791
- const Visible2 = useEnableHideFeature && useHideFeature ? treeNode.hide ? /* @__PURE__ */ jsx(UnvisibleIcon, {}) : /* @__PURE__ */ jsx(VisibleIcon, {}) : null;
53798
+ const Visible2 = hideFeature === "on" || hideFeature === "preview" ? treeNode.hide ? /* @__PURE__ */ jsx(UnvisibleIcon, {}) : /* @__PURE__ */ jsx(VisibleIcon, {}) : null;
53792
53799
  const handleAddFileToUnitTestEvent = () => {
53793
53800
  channel == null ? void 0 : channel.addFileToUnitTest(treeNode.index);
53794
53801
  };
@@ -53797,11 +53804,14 @@ const FileTreeActions = (props) => {
53797
53804
  };
53798
53805
  const handleUnitTestEvent = (e2) => {
53799
53806
  stopPropagation(e2);
53807
+ if (unittestEditFeature && unittestFeature === "preview" || !unittestEditFeature) {
53808
+ return;
53809
+ }
53800
53810
  if (!treeNode.unittest)
53801
53811
  return handleAddFileToUnitTestEvent();
53802
53812
  handleRemoveFileFromUnitTestEvent();
53803
53813
  };
53804
- const TestIcon = useUnitTestFeature ? treeNode.unittest ? /* @__PURE__ */ jsx(CollaspedOutlineIcon, {}) : /* @__PURE__ */ jsx(ExpandOutlineIcon, {}) : null;
53814
+ const TestIcon = unittestFeature === "on" || unittestFeature === "preview" ? treeNode.unittest ? /* @__PURE__ */ jsx(CollaspedOutlineIcon, {}) : /* @__PURE__ */ jsx(ExpandOutlineIcon, {}) : null;
53805
53815
  const getClassNames = (show) => {
53806
53816
  return classNames("action-item", {
53807
53817
  show
@@ -53813,21 +53823,21 @@ const FileTreeActions = (props) => {
53813
53823
  className: getClassNames(!!treeNode.hide),
53814
53824
  onClick: handleToggleVisibleEvent,
53815
53825
  children: /* @__PURE__ */ jsx(Popover, {
53816
- tip: treeNode.hide ? "\u5DF2\u9690\u85CF\uFF0C\u70B9\u51FB\u663E\u793A" : "\u70B9\u51FB\u9690\u85CF",
53826
+ tip: treeNode.hide ? `\u5DF2\u9690\u85CF\uFF0C${hideEditFeature ? "\u70B9\u51FB\u663E\u793A" : "\u65E0\u6743\u64CD\u4F5C"}` : hideEditFeature ? "\u70B9\u51FB\u9690\u85CF" : "\u65E0\u6743\u64CD\u4F5C",
53817
53827
  children: Visible2
53818
53828
  })
53819
53829
  }), LockCmp && /* @__PURE__ */ jsx("div", {
53820
53830
  className: getClassNames(!!treeNode.lock),
53821
53831
  onClick: handleToggleLockStatusEvent,
53822
53832
  children: /* @__PURE__ */ jsx(Popover, {
53823
- tip: treeNode.lock ? "\u5DF2\u52A0\u9501\uFF0C\u70B9\u51FB\u53D6\u6D88" : "\u70B9\u51FB\u9501\u5B9A",
53833
+ tip: treeNode.lock ? `\u5DF2\u52A0\u9501\uFF0C${lockEditFeature ? "\u70B9\u51FB\u53D6\u6D88" : "\u65E0\u6743\u64CD\u4F5C"}` : lockEditFeature ? "\u70B9\u51FB\u9501\u5B9A" : "\u65E0\u6743\u64CD\u4F5C",
53824
53834
  children: LockCmp
53825
53835
  })
53826
53836
  }), TestIcon && /* @__PURE__ */ jsx("div", {
53827
53837
  className: getClassNames(!!treeNode.unittest),
53828
53838
  onClick: handleUnitTestEvent,
53829
53839
  children: /* @__PURE__ */ jsx(Popover, {
53830
- tip: treeNode.unittest ? "\u5DF2\u52A0\u5165\u6D4B\u8BD5\uFF0C\u70B9\u51FB\u79FB\u9664" : "\u6DFB\u52A0\u6D4B\u8BD5",
53840
+ tip: treeNode.unittest ? `\u5DF2\u52A0\u5165\u6D4B\u8BD5\uFF0C${unittestEditFeature ? "\u70B9\u51FB\u79FB\u9664" : "\u65E0\u6743\u64CD\u4F5C"}` : unittestEditFeature ? "\u6DFB\u52A0\u6D4B\u8BD5" : "\u65E0\u6743\u64CD\u4F5C",
53831
53841
  children: TestIcon
53832
53842
  })
53833
53843
  }), React.Children.map(children, (child) => child)]
@@ -53844,10 +53854,12 @@ const FileTree = ({
53844
53854
  bgColor = "#1E1F1E",
53845
53855
  fontColor = "#fff",
53846
53856
  treeItemHeight,
53847
- useLockFeature,
53848
- useUnitTestFeature,
53849
- useEnableHideFeature,
53850
- useHideFeature
53857
+ hideFeature,
53858
+ hideEditFeature,
53859
+ lockFeature,
53860
+ lockEditFeature,
53861
+ unittestFeature,
53862
+ unittestEditFeature
53851
53863
  }) => {
53852
53864
  const [focusedItem, setFocusedItem] = react.exports.useState();
53853
53865
  const {
@@ -53964,6 +53976,8 @@ const FileTree = ({
53964
53976
  Editor: true
53965
53977
  });
53966
53978
  (_a2 = store.dao.channel()) == null ? void 0 : _a2.send("fileContent", crdt);
53979
+ const openedFile = getFileTreeItemByFilePath(items[0]);
53980
+ actions.currentDoc.setReadOnly(!!(openedFile == null ? void 0 : openedFile.lock) && !lockEditFeature);
53967
53981
  } else {
53968
53982
  (_b = store.dao.channel()) == null ? void 0 : _b.send("fileDir", crdt);
53969
53983
  }
@@ -54517,7 +54531,7 @@ const FileTree = ({
54517
54531
  return /* @__PURE__ */ jsxs(FollowLayout, {
54518
54532
  name: "file",
54519
54533
  componentType: "Tree",
54520
- children: [/* @__PURE__ */ jsx(Skeleton, {
54534
+ children: [moduleLoading.Tree && /* @__PURE__ */ jsx(Skeleton, {
54521
54535
  type: "Tree",
54522
54536
  loading: moduleLoading.Tree
54523
54537
  }), /* @__PURE__ */ jsxs(TreeRootLayout, {
@@ -54643,7 +54657,7 @@ const FileTree = ({
54643
54657
  })) : null;
54644
54658
  const parentPath = getParentPathByPath(path);
54645
54659
  const inputError = treeData[`${parentPath}${parentPath ? "/" : ""}${fileOrFolderName}`];
54646
- if (item.hide && useEnableHideFeature && useHideFeature)
54660
+ if (item.hide && hideFeature !== "off" && !hideEditFeature)
54647
54661
  return null;
54648
54662
  return /* @__PURE__ */ react.exports.createElement("li", __spreadProps(__spreadValues(__spreadValues({}, context.itemContainerWithChildrenProps), context.itemContainerWithoutChildrenProps), {
54649
54663
  key: item.index,
@@ -54684,7 +54698,7 @@ const FileTree = ({
54684
54698
  onKeyDown: onInputKeyDown
54685
54699
  }) : /* @__PURE__ */ jsx(Fragment, {
54686
54700
  children: /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues(__spreadValues({}, context.itemContainerWithoutChildrenProps), context.interactiveElementProps), {
54687
- className: classNames(btnPrefixCls, "font-sans", "subpixel-antialiased", {
54701
+ className: classNames(btnPrefixCls, {
54688
54702
  [`${btnPrefixCls}-selected`]: context.isSelected,
54689
54703
  [`${btnPrefixCls}-expanded`]: context.isExpanded,
54690
54704
  [`${btnPrefixCls}-focused`]: context.isFocused,
@@ -54720,10 +54734,12 @@ const FileTree = ({
54720
54734
  className: "actions-container",
54721
54735
  children: /* @__PURE__ */ jsx(FileTreeActions, {
54722
54736
  treeNode: item,
54723
- useUnitTestFeature,
54724
- useLockFeature,
54725
- useHideFeature,
54726
- useEnableHideFeature
54737
+ hideFeature,
54738
+ hideEditFeature,
54739
+ lockFeature,
54740
+ lockEditFeature,
54741
+ unittestFeature,
54742
+ unittestEditFeature
54727
54743
  })
54728
54744
  }), !fileLoading[item.index] && renameItem !== path && /* @__PURE__ */ jsx(Whisper$1, {
54729
54745
  placement: "bottomEnd",
@@ -74505,7 +74521,8 @@ const Editor = () => {
74505
74521
  extensions: [basicSetup, javascript({
74506
74522
  jsx: true,
74507
74523
  typescript: true
74508
- }), collabExtension]
74524
+ }), collabExtension],
74525
+ readOnly: currentDoc.readonly
74509
74526
  })]
74510
74527
  });
74511
74528
  };