@dovetail-v2/refine 0.0.45-bowen.0 → 0.0.45-bowen.2

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-c644b7e1.js";
1
+ import { j as jsxRuntimeExports } from "./index-f5ec6d38.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "i18next";
@@ -10,7 +10,7 @@ import React__default, { createElement, isValidElement, cloneElement, Children,
10
10
  import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, useParsed, useGo, useDeleteMany, CanAccess, useCan, useShow, useUpdate, useDataProvider, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, useTable, Refine } from "@refinedev/core";
11
11
  import { parse, stringify } from "qs";
12
12
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
13
- import { Typo, Tag, useUIKit, kitContext, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, pushModal, Button, Icon as Icon$1, popModal, Loading, Divider, Fields, Form, Space, Modal, useMessage, ModalStack, KitStoreProvider } from "@cloudtower/eagle";
13
+ import { Typo, Tag, useUIKit, kitContext, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, pushModal, Button, Icon as Icon$1, popModal, Loading, Divider, Fields, Space, Form, Modal, useMessage, ModalStack, KitStoreProvider } from "@cloudtower/eagle";
14
14
  import { PlusAddCreateNew16BoldOntintIcon, EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, EditPen16GradientBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon } from "@cloudtower/icons-react";
15
15
  import { get as get$3, first, debounce, last, isObject as isObject$4, merge, keyBy } from "lodash-es";
16
16
  import yaml from "js-yaml";
@@ -21779,20 +21779,44 @@ function useForm$1(props = {}) {
21779
21779
  _formControl.current.formState = getProxyFormState(formState, control);
21780
21780
  return _formControl.current;
21781
21781
  }
21782
- const RefineFormContent_1in3vad = "";
21782
+ const RefineFormContent_1tb00bi = "";
21783
21783
  const RefineFormContent = (props) => {
21784
- var _a, _b;
21784
+ var _a, _b, _c, _d;
21785
21785
  const {
21786
21786
  config,
21787
21787
  formResult,
21788
- action,
21788
+ resourceId,
21789
21789
  errorMsg
21790
21790
  } = props;
21791
21791
  const {
21792
21792
  control,
21793
21793
  getValues
21794
21794
  } = formResult;
21795
- const fields = (_b = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _b.map((c2) => {
21795
+ const action = resourceId ? "edit" : "create";
21796
+ const listQuery = useList({
21797
+ resource: config == null ? void 0 : config.name,
21798
+ meta: {
21799
+ resourceBasePath: config == null ? void 0 : config.basePath,
21800
+ kind: config == null ? void 0 : config.kind
21801
+ },
21802
+ pagination: {
21803
+ mode: "off"
21804
+ }
21805
+ });
21806
+ const showQuery = useShow({
21807
+ resource: config == null ? void 0 : config.name,
21808
+ meta: {
21809
+ resourceBasePath: config == null ? void 0 : config.basePath,
21810
+ kind: config == null ? void 0 : config.kind
21811
+ },
21812
+ id: resourceId
21813
+ });
21814
+ const formFieldsConfig = (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
21815
+ record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
21816
+ records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
21817
+ action
21818
+ });
21819
+ const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
21796
21820
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
21797
21821
  control,
21798
21822
  name: c2.path.join("."),
@@ -21824,6 +21848,7 @@ const RefineFormContent = (props) => {
21824
21848
  var _a2;
21825
21849
  const formValue = getValues();
21826
21850
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(Fields.String, {
21851
+ placeholder: c2.placeholder,
21827
21852
  input: {
21828
21853
  value: value2,
21829
21854
  onChange,
@@ -21851,6 +21876,17 @@ const RefineFormContent = (props) => {
21851
21876
  children: value2
21852
21877
  });
21853
21878
  }
21879
+ if (c2.helperText) {
21880
+ ele = /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
21881
+ size: 4,
21882
+ direction: "vertical",
21883
+ className: "c154n7ie",
21884
+ children: [ele, /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
21885
+ className: cx_default(Typo.Footnote.f2_regular, "c1c9j4da"),
21886
+ children: c2.helperText
21887
+ })]
21888
+ });
21889
+ }
21854
21890
  if (c2 == null ? void 0 : c2.render) {
21855
21891
  ele = c2.render(value2, onChange, formValue, onBlur, action);
21856
21892
  }
@@ -21868,7 +21904,7 @@ const RefineFormContent = (props) => {
21868
21904
  });
21869
21905
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
21870
21906
  direction: "vertical",
21871
- className: "c154n7ie",
21907
+ className: "cjxv8cf",
21872
21908
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
21873
21909
  errorMsgs: errorMsg ? [errorMsg] : [],
21874
21910
  style: {
@@ -22559,7 +22595,7 @@ const Separator = () => {
22559
22595
  });
22560
22596
  };
22561
22597
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
22562
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-5ce46809.js"));
22598
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-eeaea5de.js"));
22563
22599
  const YamlEditorComponent = forwardRef(
22564
22600
  function YamlEditorComponent2(props, ref) {
22565
22601
  const {
@@ -23307,7 +23343,7 @@ function FormModal(props) {
23307
23343
  formResult: refineFormResult.formResult,
23308
23344
  config,
23309
23345
  errorMsg: refineFormResult.responseErrorMsg,
23310
- action: id ? "edit" : "create"
23346
+ resourceId: id
23311
23347
  });
23312
23348
  })();
23313
23349
  const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
@@ -23390,7 +23426,7 @@ const RefineFormPage = (props) => {
23390
23426
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23391
23427
  config,
23392
23428
  formResult,
23393
- action
23429
+ resourceId: id
23394
23430
  }), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
23395
23431
  ...saveButtonProps,
23396
23432
  onClick,
@@ -23791,7 +23827,11 @@ const PlainTextNameColumnRenderer = (i18n2) => {
23791
23827
  title: i18n2.t("dovetail.name"),
23792
23828
  sortable: true,
23793
23829
  width: 200,
23794
- sorter: CommonSorter(dataIndex)
23830
+ sorter: CommonSorter(dataIndex),
23831
+ render: (v) => /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTooltip, {
23832
+ content: v,
23833
+ tooltip: v
23834
+ })
23795
23835
  };
23796
23836
  };
23797
23837
  const NameSpaceColumnRenderer = (i18n2) => {
@@ -24231,7 +24271,7 @@ const PortMappingColumnRenderer = (i18n2) => {
24231
24271
  href: `//${v.servicePort}`,
24232
24272
  target: "_blank",
24233
24273
  children: v.servicePort
24234
- }) : v.servicePort, " > ", v.targetPort, "/", v.protocol]
24274
+ }) : v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
24235
24275
  }),
24236
24276
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
24237
24277
  }, v.servicePort));
package/dist/refine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b6, bK, A, az, aB, aj, bm, aJ, G, bA, bo, at, w, C, g, bO, am, aN, Y, bQ, a0, a7, bZ, ab, bp, bn, c0, ap, aT, t, ah, aY, b$, bL, b0, D, aG, b2, b_, aH, ax, b9, bN, bP, by, ak, a1, p, o, bR, I, aQ, aw, q, bq, bT, ao, aP, ac, ad, T, ae, aA, ai, aZ, b1, U, M, bz, b5, N, H, b, ay, O, b8, aV, aU, bS, bk, e, bs, V, P, aL, s, Z, bj, aI, bX, bW, aE, aR, n, an, aK, v, aS, aF, c4, bM, b3, ba, bb, al, R, $, a5, a4, b4, a2, bY, a3, a8, f, bF, bI, bE, bD, bG, bH, bB, bt, bw, bx, bv, bu, br, bc, aq, aO, af, k, bf, i, aC, c3, m, bg, aD, l, av, aM, h, c2, as, au, aX, aW, ar, S, a$, a_, c1, bC, bl, bh, bi, X, bV, _, W, bU, a6, aa, a9, c, bJ, ag, bd, x, J, d, Q, L, K, r, a, z, y, B, E, b7, F, be, u } from "./index-c644b7e1.js";
1
+ import { b6, bK, A, az, aB, aj, bm, aJ, G, bA, bo, at, w, C, g, bO, am, aN, Y, bQ, a0, a7, bZ, ab, bp, bn, c0, ap, aT, t, ah, aY, b$, bL, b0, D, aG, b2, b_, aH, ax, b9, bN, bP, by, ak, a1, p, o, bR, I, aQ, aw, q, bq, bT, ao, aP, ac, ad, T, ae, aA, ai, aZ, b1, U, M, bz, b5, N, H, b, ay, O, b8, aV, aU, bS, bk, e, bs, V, P, aL, s, Z, bj, aI, bX, bW, aE, aR, n, an, aK, v, aS, aF, c4, bM, b3, ba, bb, al, R, $, a5, a4, b4, a2, bY, a3, a8, f, bF, bI, bE, bD, bG, bH, bB, bt, bw, bx, bv, bu, br, bc, aq, aO, af, k, bf, i, aC, c3, m, bg, aD, l, av, aM, h, c2, as, au, aX, aW, ar, S, a$, a_, c1, bC, bl, bh, bi, X, bV, _, W, bU, a6, aa, a9, c, bJ, ag, bd, x, J, d, Q, L, K, r, a, z, y, B, E, b7, F, be, u } from "./index-f5ec6d38.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "@cloudtower/icons-react";
@@ -21785,20 +21785,44 @@ var __publicField = (obj, key, value) => {
21785
21785
  _formControl.current.formState = getProxyFormState(formState, control);
21786
21786
  return _formControl.current;
21787
21787
  }
21788
- const RefineFormContent_1in3vad = "";
21788
+ const RefineFormContent_1tb00bi = "";
21789
21789
  const RefineFormContent = (props) => {
21790
- var _a, _b;
21790
+ var _a, _b, _c, _d;
21791
21791
  const {
21792
21792
  config,
21793
21793
  formResult,
21794
- action,
21794
+ resourceId,
21795
21795
  errorMsg
21796
21796
  } = props;
21797
21797
  const {
21798
21798
  control,
21799
21799
  getValues
21800
21800
  } = formResult;
21801
- const fields = (_b = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _b.map((c2) => {
21801
+ const action = resourceId ? "edit" : "create";
21802
+ const listQuery = core.useList({
21803
+ resource: config == null ? void 0 : config.name,
21804
+ meta: {
21805
+ resourceBasePath: config == null ? void 0 : config.basePath,
21806
+ kind: config == null ? void 0 : config.kind
21807
+ },
21808
+ pagination: {
21809
+ mode: "off"
21810
+ }
21811
+ });
21812
+ const showQuery = core.useShow({
21813
+ resource: config == null ? void 0 : config.name,
21814
+ meta: {
21815
+ resourceBasePath: config == null ? void 0 : config.basePath,
21816
+ kind: config == null ? void 0 : config.kind
21817
+ },
21818
+ id: resourceId
21819
+ });
21820
+ const formFieldsConfig = (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
21821
+ record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
21822
+ records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
21823
+ action
21824
+ });
21825
+ const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
21802
21826
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
21803
21827
  control,
21804
21828
  name: c2.path.join("."),
@@ -21830,6 +21854,7 @@ var __publicField = (obj, key, value) => {
21830
21854
  var _a2;
21831
21855
  const formValue = getValues();
21832
21856
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.String, {
21857
+ placeholder: c2.placeholder,
21833
21858
  input: {
21834
21859
  value: value2,
21835
21860
  onChange,
@@ -21857,6 +21882,17 @@ var __publicField = (obj, key, value) => {
21857
21882
  children: value2
21858
21883
  });
21859
21884
  }
21885
+ if (c2.helperText) {
21886
+ ele = /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
21887
+ size: 4,
21888
+ direction: "vertical",
21889
+ className: "c154n7ie",
21890
+ children: [ele, /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
21891
+ className: cx_default(eagle.Typo.Footnote.f2_regular, "c1c9j4da"),
21892
+ children: c2.helperText
21893
+ })]
21894
+ });
21895
+ }
21860
21896
  if (c2 == null ? void 0 : c2.render) {
21861
21897
  ele = c2.render(value2, onChange, formValue, onBlur, action);
21862
21898
  }
@@ -21874,7 +21910,7 @@ var __publicField = (obj, key, value) => {
21874
21910
  });
21875
21911
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
21876
21912
  direction: "vertical",
21877
- className: "c154n7ie",
21913
+ className: "cjxv8cf",
21878
21914
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
21879
21915
  errorMsgs: errorMsg ? [errorMsg] : [],
21880
21916
  style: {
@@ -23313,7 +23349,7 @@ var __publicField = (obj, key, value) => {
23313
23349
  formResult: refineFormResult.formResult,
23314
23350
  config,
23315
23351
  errorMsg: refineFormResult.responseErrorMsg,
23316
- action: id ? "edit" : "create"
23352
+ resourceId: id
23317
23353
  });
23318
23354
  })();
23319
23355
  const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
@@ -23396,7 +23432,7 @@ var __publicField = (obj, key, value) => {
23396
23432
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23397
23433
  config,
23398
23434
  formResult,
23399
- action
23435
+ resourceId: id
23400
23436
  }), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
23401
23437
  ...saveButtonProps,
23402
23438
  onClick,
@@ -23797,7 +23833,11 @@ var __publicField = (obj, key, value) => {
23797
23833
  title: i18n2.t("dovetail.name"),
23798
23834
  sortable: true,
23799
23835
  width: 200,
23800
- sorter: CommonSorter(dataIndex)
23836
+ sorter: CommonSorter(dataIndex),
23837
+ render: (v) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
23838
+ content: v,
23839
+ tooltip: v
23840
+ })
23801
23841
  };
23802
23842
  };
23803
23843
  const NameSpaceColumnRenderer = (i18n2) => {
@@ -24237,7 +24277,7 @@ var __publicField = (obj, key, value) => {
24237
24277
  href: `//${v.servicePort}`,
24238
24278
  target: "_blank",
24239
24279
  children: v.servicePort
24240
- }) : v.servicePort, " > ", v.targetPort, "/", v.protocol]
24280
+ }) : v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
24241
24281
  }),
24242
24282
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
24243
24283
  }, v.servicePort));
package/dist/style.css CHANGED
@@ -1520,7 +1520,9 @@
1520
1520
  .l1ng0psc{padding:12px 24px;-webkit-flex:1;-ms-flex:1;flex:1;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;min-height:0;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}
1521
1521
  .tj6zpn4{-webkit-flex:1;-ms-flex:1;flex:1;min-height:0;}.tj6zpn4.table-wrapper{height:auto;-webkit-flex-shrink:1;-ms-flex-negative:1;flex-shrink:1;min-height:0;}
1522
1522
  .n1rqcyjn.ant-select{margin-bottom:12px;}
1523
- .c154n7ie{-webkit-flex-basis:58%;-ms-flex-preferred-size:58%;flex-basis:58%;width:100%;}
1523
+ .c154n7ie{width:100%;}
1524
+ .c1c9j4da{color:rgba(44,56,82,0.6);}
1525
+ .cjxv8cf{-webkit-flex-basis:58%;-ms-flex-preferred-size:58%;flex-basis:58%;width:100%;}
1524
1526
  .s1bsn3us{width:1px;height:16px;border-radius:1px;background:rgba(172,186,211,0.6);}
1525
1527
 
1526
1528
  .e1guqlj2{-webkit-flex:1;-ms-flex:1;flex:1;height:100%;margin-bottom:16px;}
@@ -6,7 +6,7 @@ type Props<Model extends ResourceModel> = {
6
6
  config?: ResourceConfig<Model>;
7
7
  formResult: UseFormReturnType;
8
8
  errorMsg?: string;
9
- action: 'create' | 'edit';
9
+ resourceId?: string;
10
10
  };
11
11
  export declare const RefineFormContent: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(props: Props<Model>) => JSX.Element;
12
12
  export {};
@@ -7,6 +7,8 @@ export type RefineFormField = {
7
7
  path: string[];
8
8
  key: string;
9
9
  label: string;
10
+ placeholder?: string;
11
+ helperText?: string;
10
12
  type?: 'number';
11
13
  validators?: RefineFormValidator[];
12
14
  disabledWhenEdit?: boolean;
@@ -41,7 +41,11 @@ export type ResourceConfig<Model extends ResourceModel = ResourceModel> = {
41
41
  }>;
42
42
  isCustom?: boolean;
43
43
  formConfig?: {
44
- fields?: RefineFormField[];
44
+ fields?: (props: {
45
+ record?: Model;
46
+ records: Model[];
47
+ action: 'create' | 'edit';
48
+ }) => RefineFormField[];
45
49
  renderForm?: (props: YamlFormProps) => React.ReactNode;
46
50
  formType?: FormType;
47
51
  transformInitValues?: (values: Unstructured) => Unstructured;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.0.45-bowen.0",
3
+ "version": "0.0.45-bowen.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",