@dovetail-v2/refine 0.1.31 → 0.1.32

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.
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntimeExports } from "./index-f8de0e3f.js";
1
+ import { j as jsxRuntimeExports } from "./index-12763c77.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "i18next";
@@ -1236,7 +1236,7 @@ const taint_effect_NoExecute_tooltip_2$1 = "Pods with tolerance but no duration
1236
1236
  const taint_effect_NoExecute_tooltip_3$1 = "Pods with tolerance and a duration set will run for the specified time and then be evicted.";
1237
1237
  const taint_effect_PreferNoSchedule_tooltip$1 = "The control plane will try to avoid scheduling pods without taint tolerance to the node, but full avoidance isn't guaranteed.";
1238
1238
  const cant_delete_resource$1 = "Unable to delete {{resource}}";
1239
- const cant_delete_resource_with_name$1 = "The {{resource}} <0>{name}</0> cannot be deleted.";
1239
+ const cant_delete_resource_with_name$1 = "The {{resource}} <0>{{name}}</0> cannot be deleted.";
1240
1240
  const close$1 = "Close";
1241
1241
  const dovetail$1 = {
1242
1242
  copy: copy$2,
@@ -19522,7 +19522,7 @@ const PodLogTab = (i18n2) => ({
19522
19522
  }
19523
19523
  ]
19524
19524
  });
19525
- const style_j3z7so = "";
19525
+ const style_10p48dp = "";
19526
19526
  const ToolBarStyle = "t1joof7s";
19527
19527
  const ToolBarHeaderStyle = "tti58uh";
19528
19528
  const ErrorIconStyle = "e15yt16p";
@@ -38725,7 +38725,7 @@ const Separator = () => {
38725
38725
  });
38726
38726
  };
38727
38727
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38728
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-fec09973.js"));
38728
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-286ba95e.js"));
38729
38729
  const YamlEditorComponent = forwardRef(
38730
38730
  function YamlEditorComponent2(props, ref) {
38731
38731
  const {
package/dist/refine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { bO, cD, A, aX, aZ, aG, cb, bl, a2, cp, cd, aR, U, C, k, cH, aJ, bq, ad, cJ, aj, aq, cS, ay, ce, cc, cV, aN, bx, x, aE, bE, cU, cE, bH, D, b2, at, bK, as, au, a1, ca, c9, cT, bj, aV, ae, bR, cG, cI, cn, aH, ak, t, s, cK, I, bu, aU, v, O, bf, bh, cf, cM, aM, bt, ar, az, aA, a9, aB, aY, aF, bF, bI, aa, d3, co, cy, bN, N, a3, f, aW, a7, bQ, bz, by, cL, c0, c_, h, cZ, aK, br, ch, M, bb, bc, bp, J, bd, K, be, E, b6, cB, B, b5, H, b9, F, b7, G, b8, L, c1, ba, cA, ab, d1, d0, P, bn, w, af, ai, b$, bk, cQ, cP, b0, bv, c7, c6, q, aL, bm, y, bw, b1, d2, z, cr, cF, bL, bS, bT, d5, aI, R, ah, ao, an, bM, al, cR, c3, am, cC, c8, bi, bB, av, i, T, Q, bg, cu, cx, ct, cs, cv, cw, cq, ci, cl, cm, ck, cj, cg, cz, bU, aO, bs, aC, n, bX, m, a_, cY, p, bY, a$, o, aT, bo, l, cX, aQ, aS, c5, bD, bC, c4, aP, S, bG, cW, c$, b3, b4, bA, bJ, c2, bZ, b_, ac, a0, cO, ag, W, cN, ap, ax, aw, g, aD, bV, V, a4, d, d8, d7, da, d4, a8, db, d6, d9, a6, a5, r, a, c, Y, X, Z, e, _, u, bP, $, bW, b } from "./index-f8de0e3f.js";
1
+ import { bO, cD, A, aX, aZ, aG, cb, bl, a2, cp, cd, aR, U, C, k, cH, aJ, bq, ad, cJ, aj, aq, cS, ay, ce, cc, cV, aN, bx, x, aE, bE, cU, cE, bH, D, b2, at, bK, as, au, a1, ca, c9, cT, bj, aV, ae, bR, cG, cI, cn, aH, ak, t, s, cK, I, bu, aU, v, O, bf, bh, cf, cM, aM, bt, ar, az, aA, a9, aB, aY, aF, bF, bI, aa, d3, co, cy, bN, N, a3, f, aW, a7, bQ, bz, by, cL, c0, c_, h, cZ, aK, br, ch, M, bb, bc, bp, J, bd, K, be, E, b6, cB, B, b5, H, b9, F, b7, G, b8, L, c1, ba, cA, ab, d1, d0, P, bn, w, af, ai, b$, bk, cQ, cP, b0, bv, c7, c6, q, aL, bm, y, bw, b1, d2, z, cr, cF, bL, bS, bT, d5, aI, R, ah, ao, an, bM, al, cR, c3, am, cC, c8, bi, bB, av, i, T, Q, bg, cu, cx, ct, cs, cv, cw, cq, ci, cl, cm, ck, cj, cg, cz, bU, aO, bs, aC, n, bX, m, a_, cY, p, bY, a$, o, aT, bo, l, cX, aQ, aS, c5, bD, bC, c4, aP, S, bG, cW, c$, b3, b4, bA, bJ, c2, bZ, b_, ac, a0, cO, ag, W, cN, ap, ax, aw, g, aD, bV, V, a4, d, d8, d7, da, d4, a8, db, d6, d9, a6, a5, r, a, c, Y, X, Z, e, _, u, bP, $, bW, b } from "./index-12763c77.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "react";
@@ -1242,7 +1242,7 @@ var __publicField = (obj, key, value) => {
1242
1242
  const taint_effect_NoExecute_tooltip_3$1 = "Pods with tolerance and a duration set will run for the specified time and then be evicted.";
1243
1243
  const taint_effect_PreferNoSchedule_tooltip$1 = "The control plane will try to avoid scheduling pods without taint tolerance to the node, but full avoidance isn't guaranteed.";
1244
1244
  const cant_delete_resource$1 = "Unable to delete {{resource}}";
1245
- const cant_delete_resource_with_name$1 = "The {{resource}} <0>{name}</0> cannot be deleted.";
1245
+ const cant_delete_resource_with_name$1 = "The {{resource}} <0>{{name}}</0> cannot be deleted.";
1246
1246
  const close$1 = "Close";
1247
1247
  const dovetail$1 = {
1248
1248
  copy: copy$2,
@@ -19528,7 +19528,7 @@ var __publicField = (obj, key, value) => {
19528
19528
  }
19529
19529
  ]
19530
19530
  });
19531
- const style_j3z7so = "";
19531
+ const style_10p48dp = "";
19532
19532
  const ToolBarStyle = "t1joof7s";
19533
19533
  const ToolBarHeaderStyle = "tti58uh";
19534
19534
  const ErrorIconStyle = "e15yt16p";
package/dist/style.css CHANGED
@@ -3402,8 +3402,7 @@
3402
3402
  padding: 11px;
3403
3403
  border-bottom: 1px solid rgba(211, 218, 235, 0.6);
3404
3404
  background: rgba(225, 230, 241, 0.6);
3405
- border-top-left-radius: 8px;
3406
- border-top-right-radius: 8px;
3405
+ border-radius: 8px;
3407
3406
  }
3408
3407
  .t1joof7s.collapsed {
3409
3408
  border-bottom: 0;
@@ -9,7 +9,7 @@ export declare enum ErrorContentType {
9
9
  export type WidgetErrorContentProps = {
10
10
  className?: string;
11
11
  style?: React.CSSProperties;
12
- errorText?: string;
12
+ errorText?: React.ReactNode;
13
13
  type?: ErrorContentType;
14
14
  refetch?: () => void;
15
15
  };
@@ -24,47 +24,125 @@ export type WithId<T> = T & {
24
24
  id: string;
25
25
  };
26
26
  export type ResourceConfig<Model extends ResourceModel = ResourceModel> = {
27
+ /** 资源名称,用于 API 调用和路由。
28
+ * 默认复数形式,如:deployments
29
+ */
27
30
  name: string;
31
+ /** Kubernetes 资源类型
32
+ * 如:Deployment
33
+ */
28
34
  kind: string;
35
+ /** API 请求的基础路径
36
+ * 实际效果为:{apiUrl}{basePath}{apiVersion}{name}
37
+ */
29
38
  basePath: string;
39
+ /** Kubernetes API 版本,会影响请求 URL
40
+ * 实际效果为:{apiUrl}{basePath}{apiVersion}{name}
41
+ */
30
42
  apiVersion: string;
43
+ /** 资源在界面上显示的名称 */
31
44
  displayName?: string;
45
+ /** 是否隐藏列表页的工具栏。会连标题和描述一起去掉 */
32
46
  hideListToolBar?: boolean;
47
+ /** 是否隐藏命名空间过滤器 */
33
48
  hideNamespacesFilter?: boolean;
49
+ /** 是否隐藏编辑功能。会隐藏 Dropdown 和详情中的编辑按钮 */
34
50
  hideEdit?: boolean;
51
+ /** 是否隐藏创建功能 */
35
52
  hideCreate?: boolean;
53
+ /** 资源的描述信息 */
36
54
  description?: string;
55
+ /** 父级资源名称,用于建立资源层级关系。在 Dovetail2 中用不到这个 */
37
56
  parent?: string;
57
+ /** 格式化数据参数,目前暂未完全实现,可能会删除 */
38
58
  formatter?: (v: Model) => Model;
59
+ /** 创建资源时的初始值 */
39
60
  initValue?: Record<string, unknown>;
61
+ /** 定义资源列表的表格列配置 */
40
62
  columns?: () => Column<Model>[];
63
+ /** 是否禁用详情页面。禁用后,表格的名称将无法点击。仅对配置型表格有效。 */
41
64
  noShow?: boolean;
65
+ /** 详情页面的配置 */
42
66
  showConfig?: () => ShowConfig<Model>;
67
+ /** 自定义下拉菜单组件 */
43
68
  Dropdown?: React.FC<{
44
69
  record: Model;
45
70
  }>;
71
+ /** 表格组件的额外属性配置。会被传递给表格组件。仅对配置型表格有效。 */
46
72
  tableProps?: Partial<InternalTableProps<Model>>;
73
+ /** 是否为自定义资源。
74
+ * 开启后,Dovetail不会为该资源创建路由,也不会渲染默认的UI组件。
75
+ */
47
76
  isCustom?: boolean;
77
+ /** 创建按钮的文本 */
48
78
  createButtonText?: string;
79
+ /** 删除操作的提示文本
80
+ * 默认是:该操作无法被撤回。
81
+ */
49
82
  deleteTip?: string;
83
+ /** 表单相关配置 */
50
84
  formConfig?: {
85
+ /**
86
+ * 表单字段配置函数
87
+ * @param props 包含记录和动作类型的配置对象
88
+ * @returns 表单字段配置数组
89
+ */
51
90
  fields?: (props: {
52
91
  record?: Model;
53
92
  records: Model[];
54
93
  action: 'create' | 'edit';
55
94
  }) => RefineFormField[];
95
+ /** 保存按钮文本 */
56
96
  saveButtonText?: string;
97
+ /**
98
+ * 自定义表单渲染函数
99
+ * @param props YAML表单属性,待完善
100
+ * @returns React节点
101
+ */
57
102
  renderForm?: (props: YamlFormProps) => React.ReactNode;
103
+ /** 表单类型:页面形式或模态框形式
104
+ * PAGE 或者 MODAL
105
+ */
58
106
  formType?: FormType;
107
+ /**
108
+ * 初始值转换函数
109
+ * @param values 原始值
110
+ * @returns 转换后的值
111
+ */
59
112
  transformInitValues?: (values: Record<string, unknown>) => Record<string, unknown>;
113
+ /**
114
+ * 提交值转换函数,转换为 YAML 格式
115
+ * @param values 表单值
116
+ * @returns YAML格式的数据
117
+ */
60
118
  transformApplyValues?: (values: Record<string, unknown>) => Model['_rawYaml'];
119
+ /**
120
+ * 表单标题,可以是字符串或根据操作类型返回不同标题的函数
121
+ * @param action 操作类型:create 或 edit
122
+ */
61
123
  formTitle?: string | ((action: 'create' | 'edit') => string);
124
+ /**
125
+ * 表单描述,可以是字符串或根据操作类型返回不同描述的函数
126
+ * @param action 操作类型:create 或 edit
127
+ */
62
128
  formDesc?: string | ((action: 'create' | 'edit') => string);
129
+ /** 表单标签的宽度
130
+ * 默认是 216px
131
+ */
63
132
  labelWidth?: string;
133
+ /**
134
+ * 错误信息格式化函数,待完善
135
+ * @param errorBody 错误信息体
136
+ * @returns 格式化后的错误信息
137
+ */
64
138
  formatError?: (errorBody: unknown) => string;
139
+ /** Refine Core 的表单属性 */
65
140
  refineCoreProps?: UseFormProps['refineCoreProps'];
141
+ /** React Hook Form 的配置属性 */
66
142
  useFormProps?: UseFormProps;
143
+ /** 是否禁用切换表单模式(在 YAML 和表单之间切换) */
67
144
  isDisabledChangeMode?: boolean;
145
+ /** 自定义表单模态框组件 */
68
146
  CustomFormModal?: React.FC<FormModalProps>;
69
147
  };
70
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",