@univerjs/sheets-ui 0.22.0 → 0.22.1

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/lib/cjs/index.js CHANGED
@@ -21036,7 +21036,7 @@ function DefinedName({ disable }) {
21036
21036
  //#endregion
21037
21037
  //#region src/views/formula-bar/FormulaBar.tsx
21038
21038
  function FormulaBar(props) {
21039
- var _editState$documentLa, _editState$documentLa2;
21039
+ var _workbookEditablePerm, _editState$documentLa, _editState$documentLa2;
21040
21040
  const { className, disableDefinedName } = props;
21041
21041
  const [iconActivated, setIconActivated] = (0, react.useState)(false);
21042
21042
  const [arrowDirection, setArrowDirection] = (0, react.useState)(0);
@@ -21064,6 +21064,10 @@ function FormulaBar(props) {
21064
21064
  const contextService = (0, _univerjs_ui.useDependency)(_univerjs_core.IContextService);
21065
21065
  (0, _univerjs_ui.useObservable)((0, react.useMemo)(() => contextService.subscribeContextValue$(_univerjs_core.FOCUSING_FX_BAR_EDITOR), [contextService]));
21066
21066
  const isFocusFxBar = contextService.getContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR);
21067
+ const workbookEditablePermission = (0, _univerjs_ui.useObservable)((0, react.useMemo)(() => {
21068
+ if (!workbook) return;
21069
+ return permissionService.getPermissionPoint$(new _univerjs_sheets.WorkbookEditablePermission(workbook.getUnitId()).id);
21070
+ }, [permissionService, workbook]));
21067
21071
  const ref = (0, react.useRef)(null);
21068
21072
  const editorService = (0, _univerjs_ui.useDependency)(_univerjs_docs_ui.IEditorService);
21069
21073
  const config = (0, _univerjs_ui.useConfigValue)(SHEETS_UI_PLUGIN_CONFIG_KEY);
@@ -21165,11 +21169,18 @@ function FormulaBar(props) {
21165
21169
  }
21166
21170
  const { viewDisable, editDisable: permissionEditDisable } = disableInfo;
21167
21171
  const editDisable = permissionEditDisable || !!disableEdit;
21172
+ const workbookEditDisable = !((_workbookEditablePerm = workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) !== null && _workbookEditablePerm !== void 0 ? _workbookEditablePerm : true);
21173
+ const editorActivationDisable = editDisable || workbookEditDisable;
21168
21174
  const disabled = editDisable || imageDisable;
21169
21175
  const shouldSkipFocus = (0, react.useRef)(false);
21170
21176
  const handlePointerDown = () => {
21171
21177
  try {
21172
21178
  if (editorBridgeService.isVisible().visible === false) {
21179
+ if (editorActivationDisable) {
21180
+ contextService.setContextValue(_univerjs_core.FOCUSING_FX_BAR_EDITOR, true);
21181
+ editorService.focus(_univerjs_core.DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
21182
+ return;
21183
+ }
21173
21184
  if (!commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
21174
21185
  visible: true,
21175
21186
  eventType: _univerjs_engine_render.DeviceInputEventType.PointerDown,
@@ -23979,7 +23990,7 @@ const useHighlightRange = (ranges = []) => {
23979
23990
  //#endregion
23980
23991
  //#region package.json
23981
23992
  var name = "@univerjs/sheets-ui";
23982
- var version = "0.22.0";
23993
+ var version = "0.22.1";
23983
23994
 
23984
23995
  //#endregion
23985
23996
  //#region src/services/cell-alert-manager.service.ts
package/lib/es/index.js CHANGED
@@ -21007,7 +21007,7 @@ function DefinedName({ disable }) {
21007
21007
  //#endregion
21008
21008
  //#region src/views/formula-bar/FormulaBar.tsx
21009
21009
  function FormulaBar(props) {
21010
- var _editState$documentLa, _editState$documentLa2;
21010
+ var _workbookEditablePerm, _editState$documentLa, _editState$documentLa2;
21011
21011
  const { className, disableDefinedName } = props;
21012
21012
  const [iconActivated, setIconActivated] = useState(false);
21013
21013
  const [arrowDirection, setArrowDirection] = useState(0);
@@ -21035,6 +21035,10 @@ function FormulaBar(props) {
21035
21035
  const contextService = useDependency(IContextService);
21036
21036
  useObservable(useMemo(() => contextService.subscribeContextValue$(FOCUSING_FX_BAR_EDITOR), [contextService]));
21037
21037
  const isFocusFxBar = contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
21038
+ const workbookEditablePermission = useObservable(useMemo(() => {
21039
+ if (!workbook) return;
21040
+ return permissionService.getPermissionPoint$(new WorkbookEditablePermission(workbook.getUnitId()).id);
21041
+ }, [permissionService, workbook]));
21038
21042
  const ref = useRef(null);
21039
21043
  const editorService = useDependency(IEditorService);
21040
21044
  const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
@@ -21136,11 +21140,18 @@ function FormulaBar(props) {
21136
21140
  }
21137
21141
  const { viewDisable, editDisable: permissionEditDisable } = disableInfo;
21138
21142
  const editDisable = permissionEditDisable || !!disableEdit;
21143
+ const workbookEditDisable = !((_workbookEditablePerm = workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) !== null && _workbookEditablePerm !== void 0 ? _workbookEditablePerm : true);
21144
+ const editorActivationDisable = editDisable || workbookEditDisable;
21139
21145
  const disabled = editDisable || imageDisable;
21140
21146
  const shouldSkipFocus = useRef(false);
21141
21147
  const handlePointerDown = () => {
21142
21148
  try {
21143
21149
  if (editorBridgeService.isVisible().visible === false) {
21150
+ if (editorActivationDisable) {
21151
+ contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
21152
+ editorService.focus(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
21153
+ return;
21154
+ }
21144
21155
  if (!commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
21145
21156
  visible: true,
21146
21157
  eventType: DeviceInputEventType.PointerDown,
@@ -23950,7 +23961,7 @@ const useHighlightRange = (ranges = []) => {
23950
23961
  //#endregion
23951
23962
  //#region package.json
23952
23963
  var name = "@univerjs/sheets-ui";
23953
- var version = "0.22.0";
23964
+ var version = "0.22.1";
23954
23965
 
23955
23966
  //#endregion
23956
23967
  //#region src/services/cell-alert-manager.service.ts
package/lib/index.js CHANGED
@@ -21007,7 +21007,7 @@ function DefinedName({ disable }) {
21007
21007
  //#endregion
21008
21008
  //#region src/views/formula-bar/FormulaBar.tsx
21009
21009
  function FormulaBar(props) {
21010
- var _editState$documentLa, _editState$documentLa2;
21010
+ var _workbookEditablePerm, _editState$documentLa, _editState$documentLa2;
21011
21011
  const { className, disableDefinedName } = props;
21012
21012
  const [iconActivated, setIconActivated] = useState(false);
21013
21013
  const [arrowDirection, setArrowDirection] = useState(0);
@@ -21035,6 +21035,10 @@ function FormulaBar(props) {
21035
21035
  const contextService = useDependency(IContextService);
21036
21036
  useObservable(useMemo(() => contextService.subscribeContextValue$(FOCUSING_FX_BAR_EDITOR), [contextService]));
21037
21037
  const isFocusFxBar = contextService.getContextValue(FOCUSING_FX_BAR_EDITOR);
21038
+ const workbookEditablePermission = useObservable(useMemo(() => {
21039
+ if (!workbook) return;
21040
+ return permissionService.getPermissionPoint$(new WorkbookEditablePermission(workbook.getUnitId()).id);
21041
+ }, [permissionService, workbook]));
21038
21042
  const ref = useRef(null);
21039
21043
  const editorService = useDependency(IEditorService);
21040
21044
  const config = useConfigValue(SHEETS_UI_PLUGIN_CONFIG_KEY);
@@ -21136,11 +21140,18 @@ function FormulaBar(props) {
21136
21140
  }
21137
21141
  const { viewDisable, editDisable: permissionEditDisable } = disableInfo;
21138
21142
  const editDisable = permissionEditDisable || !!disableEdit;
21143
+ const workbookEditDisable = !((_workbookEditablePerm = workbookEditablePermission === null || workbookEditablePermission === void 0 ? void 0 : workbookEditablePermission.value) !== null && _workbookEditablePerm !== void 0 ? _workbookEditablePerm : true);
21144
+ const editorActivationDisable = editDisable || workbookEditDisable;
21139
21145
  const disabled = editDisable || imageDisable;
21140
21146
  const shouldSkipFocus = useRef(false);
21141
21147
  const handlePointerDown = () => {
21142
21148
  try {
21143
21149
  if (editorBridgeService.isVisible().visible === false) {
21150
+ if (editorActivationDisable) {
21151
+ contextService.setContextValue(FOCUSING_FX_BAR_EDITOR, true);
21152
+ editorService.focus(DOCS_FORMULA_BAR_EDITOR_UNIT_ID_KEY);
21153
+ return;
21154
+ }
21144
21155
  if (!commandService.syncExecuteCommand(SetCellEditVisibleOperation.id, {
21145
21156
  visible: true,
21146
21157
  eventType: DeviceInputEventType.PointerDown,
@@ -23950,7 +23961,7 @@ const useHighlightRange = (ranges = []) => {
23950
23961
  //#endregion
23951
23962
  //#region package.json
23952
23963
  var name = "@univerjs/sheets-ui";
23953
- var version = "0.22.0";
23964
+ var version = "0.22.1";
23954
23965
 
23955
23966
  //#endregion
23956
23967
  //#region src/services/cell-alert-manager.service.ts