@dovetail-v2/refine 0.3.28-alpha.1 → 0.3.28-alpha.3

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.
@@ -9,12 +9,12 @@ interface K8sDropdownProps {
9
9
  customButton?: React.ReactNode;
10
10
  resourceConfig?: Pick<ResourceConfig, 'name' | 'displayName' | 'kind' | 'initValue' | 'apiVersion' | 'basePath' | 'formConfig' | 'hideEdit'>;
11
11
  deleteDialogProps?: Partial<DeleteDialogProps>;
12
- /**
13
- * 为 true 时跳过基于路由上下文的操作隐藏逻辑,始终显示全部操作按钮(编辑、编辑 YAML、下载 YAML)。
14
- * 适用于在详情页或表单中嵌套渲染的子资源列表(如 AccessMethodForm 中的 Service/Ingress),
15
- * 这些场景下子资源需要独立的编辑和下载能力,不应被父资源详情页的隐藏规则影响。
16
- */
17
- forceShowAllActions?: boolean;
12
+ /** 隐藏「编辑」按钮 */
13
+ hideEdit?: boolean;
14
+ /** 隐藏「编辑 YAML」按钮 */
15
+ hideEditYaml?: boolean;
16
+ /** 隐藏「下载 YAML」按钮 */
17
+ hideDownloadYaml?: boolean;
18
18
  }
19
19
  export declare function K8sDropdown(props: React.PropsWithChildren<K8sDropdownProps>): JSX.Element;
20
20
  export default K8sDropdown;
package/dist/refine.cjs CHANGED
@@ -11999,17 +11999,18 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
11999
11999
  return { isValid: true };
12000
12000
  }
12001
12001
  function K8sDropdown(props) {
12002
- var _a, _b, _c;
12002
+ var _a, _b;
12003
12003
  const {
12004
12004
  record,
12005
12005
  size = "normal",
12006
12006
  resourceConfig,
12007
12007
  customButton,
12008
12008
  deleteDialogProps,
12009
- forceShowAllActions
12009
+ hideEdit: hideEditProp,
12010
+ hideEditYaml,
12011
+ hideDownloadYaml
12010
12012
  } = props;
12011
12013
  const globalStore = useGlobalStore();
12012
- const useResourceResult = core.useResource();
12013
12014
  const configs = React.useContext(ConfigsContext);
12014
12015
  const resourceName = (resourceConfig == null ? void 0 : resourceConfig.name) || getResourceNameByKind(record.kind || "", configs);
12015
12016
  const config = resourceConfig || configs[resourceName || ""];
@@ -12028,8 +12029,6 @@ function K8sDropdown(props) {
12028
12029
  });
12029
12030
  const download2 = useDownloadYAML();
12030
12031
  const openForm = useOpenForm();
12031
- const isInShowPage = forceShowAllActions ? false : useResourceResult.action === "show";
12032
- const isChildResource = forceShowAllActions ? false : isInShowPage && ((_b = useResourceResult.resource) == null ? void 0 : _b.name) !== resourceName;
12033
12032
  const { data: canEditData } = core.useCan({
12034
12033
  resource: resourceName,
12035
12034
  action: AccessControlAuth.Edit,
@@ -12044,12 +12043,12 @@ function K8sDropdown(props) {
12044
12043
  namespace: record.namespace
12045
12044
  }
12046
12045
  });
12047
- const formType = (_c = config == null ? void 0 : config.formConfig) == null ? void 0 : _c.formType;
12046
+ const formType = (_b = config == null ? void 0 : config.formConfig) == null ? void 0 : _b.formType;
12048
12047
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(common.jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12049
12048
  eagle.Dropdown,
12050
12049
  {
12051
12050
  overlay: /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Menu, { children: [
12052
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12051
+ hideEditProp || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12053
12052
  eagle.Menu.Item,
12054
12053
  {
12055
12054
  onClick: () => openForm({ id: record.id, resourceName, resourceConfig: config }),
@@ -12059,7 +12058,7 @@ function K8sDropdown(props) {
12059
12058
  )}` : t2("dovetail.edit_yaml") })
12060
12059
  }
12061
12060
  ),
12062
- isChildResource || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12061
+ hideEditYaml || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12063
12062
  eagle.Menu.Item,
12064
12063
  {
12065
12064
  onClick: () => openForm({
@@ -12071,7 +12070,7 @@ function K8sDropdown(props) {
12071
12070
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
12072
12071
  }
12073
12072
  ),
12074
- isChildResource ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12073
+ hideDownloadYaml ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12075
12074
  eagle.Menu.Item,
12076
12075
  {
12077
12076
  onClick: () => {
package/dist/refine.js CHANGED
@@ -11980,17 +11980,18 @@ function validateNodePort(nodePort, allNodePorts, i18n2) {
11980
11980
  return { isValid: true };
11981
11981
  }
11982
11982
  function K8sDropdown(props) {
11983
- var _a, _b, _c;
11983
+ var _a, _b;
11984
11984
  const {
11985
11985
  record,
11986
11986
  size = "normal",
11987
11987
  resourceConfig,
11988
11988
  customButton,
11989
11989
  deleteDialogProps,
11990
- forceShowAllActions
11990
+ hideEdit: hideEditProp,
11991
+ hideEditYaml,
11992
+ hideDownloadYaml
11991
11993
  } = props;
11992
11994
  const globalStore = useGlobalStore();
11993
- const useResourceResult = useResource();
11994
11995
  const configs = useContext(ConfigsContext);
11995
11996
  const resourceName = (resourceConfig == null ? void 0 : resourceConfig.name) || getResourceNameByKind(record.kind || "", configs);
11996
11997
  const config = resourceConfig || configs[resourceName || ""];
@@ -12009,8 +12010,6 @@ function K8sDropdown(props) {
12009
12010
  });
12010
12011
  const download2 = useDownloadYAML();
12011
12012
  const openForm = useOpenForm();
12012
- const isInShowPage = forceShowAllActions ? false : useResourceResult.action === "show";
12013
- const isChildResource = forceShowAllActions ? false : isInShowPage && ((_b = useResourceResult.resource) == null ? void 0 : _b.name) !== resourceName;
12014
12013
  const { data: canEditData } = useCan({
12015
12014
  resource: resourceName,
12016
12015
  action: AccessControlAuth.Edit,
@@ -12025,12 +12024,12 @@ function K8sDropdown(props) {
12025
12024
  namespace: record.namespace
12026
12025
  }
12027
12026
  });
12028
- const formType = (_c = config == null ? void 0 : config.formConfig) == null ? void 0 : _c.formType;
12027
+ const formType = (_b = config == null ? void 0 : config.formConfig) == null ? void 0 : _b.formType;
12029
12028
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
12030
12029
  Dropdown,
12031
12030
  {
12032
12031
  overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { children: [
12033
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
12032
+ hideEditProp || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
12034
12033
  Menu$1.Item,
12035
12034
  {
12036
12035
  onClick: () => openForm({ id: record.id, resourceName, resourceConfig: config }),
@@ -12040,7 +12039,7 @@ function K8sDropdown(props) {
12040
12039
  )}` : t2("dovetail.edit_yaml") })
12041
12040
  }
12042
12041
  ),
12043
- isChildResource || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
12042
+ hideEditYaml || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
12044
12043
  Menu$1.Item,
12045
12044
  {
12046
12045
  onClick: () => openForm({
@@ -12052,7 +12051,7 @@ function K8sDropdown(props) {
12052
12051
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { src: EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
12053
12052
  }
12054
12053
  ),
12055
- isChildResource ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
12054
+ hideDownloadYaml ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
12056
12055
  Menu$1.Item,
12057
12056
  {
12058
12057
  onClick: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.28-alpha.1",
3
+ "version": "0.3.28-alpha.3",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",