@dovetail-v2/refine 0.0.40-bowen.3 → 0.0.40-bowen.6

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-be658132.js";
1
+ import { j as jsxRuntimeExports } from "./index-70f11bd6.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "i18next";
@@ -8282,6 +8282,9 @@ function NamespaceSelectWidget(props) {
8282
8282
  meta: {
8283
8283
  resourceBasePath: "/api/v1",
8284
8284
  kind: "Namespace"
8285
+ },
8286
+ pagination: {
8287
+ mode: "off"
8285
8288
  }
8286
8289
  });
8287
8290
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.select, { input: props, disabled: action === "edit", children: data2 == null ? void 0 : data2.data.map((namespace2) => /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, { value: namespace2.metadata.name, children: namespace2.metadata.name }, namespace2.metadata.name)) });
@@ -10391,6 +10394,9 @@ const CronjobJobsTable = ({
10391
10394
  meta: {
10392
10395
  resourceBasePath: "/apis/batch/v1",
10393
10396
  kind: "Job"
10397
+ },
10398
+ pagination: {
10399
+ mode: "off"
10394
10400
  }
10395
10401
  });
10396
10402
  const dataSource = useMemo(() => {
@@ -10433,7 +10439,10 @@ const EventsTable = ({}) => {
10433
10439
  const [currentPage, setCurrentPage] = useState(1);
10434
10440
  const { data: data2, isLoading } = useList({
10435
10441
  resource: "events",
10436
- meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" }
10442
+ meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
10443
+ pagination: {
10444
+ mode: "off"
10445
+ }
10437
10446
  });
10438
10447
  const parsed = useParsed();
10439
10448
  const columns = useMemo(
@@ -21666,23 +21675,30 @@ const RefineFormContent = (props) => {
21666
21675
  var _a, _b;
21667
21676
  const {
21668
21677
  config,
21669
- control,
21678
+ formResult,
21670
21679
  action,
21671
21680
  errorMsg
21672
21681
  } = props;
21682
+ const {
21683
+ control,
21684
+ watch,
21685
+ getValues
21686
+ } = formResult;
21687
+ watch();
21673
21688
  const fields = (_b = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _b.map((c2) => {
21674
21689
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
21675
21690
  control,
21676
21691
  name: c2.path.join("."),
21677
21692
  rules: {
21678
- validate(value2, formValues) {
21693
+ validate(value2) {
21694
+ const formValue = getValues();
21679
21695
  if (!c2.validators || c2.validators.length === 0)
21680
21696
  return true;
21681
21697
  for (const func of c2.validators) {
21682
21698
  const {
21683
21699
  isValid,
21684
21700
  errorMsg: errorMsg2
21685
- } = func(value2, formValues);
21701
+ } = func(value2, formValue);
21686
21702
  if (!isValid)
21687
21703
  return errorMsg2;
21688
21704
  }
@@ -21699,6 +21715,7 @@ const RefineFormContent = (props) => {
21699
21715
  fieldState
21700
21716
  }) => {
21701
21717
  var _a2;
21718
+ const formValue = getValues();
21702
21719
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(Fields.String, {
21703
21720
  input: {
21704
21721
  value: value2,
@@ -21727,6 +21744,9 @@ const RefineFormContent = (props) => {
21727
21744
  children: value2
21728
21745
  });
21729
21746
  }
21747
+ if (c2 == null ? void 0 : c2.render) {
21748
+ ele = c2.render(value2, onChange, formValue, onBlur);
21749
+ }
21730
21750
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, {
21731
21751
  label: c2.label,
21732
21752
  labelCol: {
@@ -22301,6 +22321,7 @@ const useRefineForm = (props) => {
22301
22321
  resource: config.name,
22302
22322
  action: id ? "edit" : "create",
22303
22323
  id,
22324
+ liveMode: "off",
22304
22325
  ...refineProps
22305
22326
  },
22306
22327
  defaultValues: config == null ? void 0 : config.initValue
@@ -22324,7 +22345,7 @@ const Separator = () => {
22324
22345
  });
22325
22346
  };
22326
22347
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
22327
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-436acb0f.js"));
22348
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-915e1b64.js"));
22328
22349
  const YamlEditorComponent = forwardRef(
22329
22350
  function YamlEditorComponent2(props, ref) {
22330
22351
  const {
@@ -23062,7 +23083,7 @@ function FormModal(props) {
23062
23083
  ...yamlFormProps
23063
23084
  });
23064
23085
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23065
- control: refineFormResult.formResult.control,
23086
+ formResult: refineFormResult.formResult,
23066
23087
  config,
23067
23088
  errorMsg: refineFormResult.responseErrorMsg,
23068
23089
  action: id ? "edit" : "create"
@@ -23125,8 +23146,7 @@ const RefineFormPage = (props) => {
23125
23146
  onFinish
23126
23147
  },
23127
23148
  getValues,
23128
- saveButtonProps,
23129
- control
23149
+ saveButtonProps
23130
23150
  } = formResult;
23131
23151
  const onClick = () => {
23132
23152
  const data2 = getValues();
@@ -23137,7 +23157,7 @@ const RefineFormPage = (props) => {
23137
23157
  className: "c1pvtlkp",
23138
23158
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23139
23159
  config,
23140
- control
23160
+ formResult
23141
23161
  }), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
23142
23162
  ...saveButtonProps,
23143
23163
  onClick,
package/dist/refine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b5, bJ, A, ay, aA, ai, bl, aI, G, bz, bn, as, w, C, g, bN, al, aM, X, bP, $, a6, bY, aa, bo, bm, b$, ao, aS, t, ag, aX, b_, bK, a$, D, aF, b1, bZ, aG, aw, b8, bM, bO, bx, aj, a0, p, o, bQ, I, aP, av, q, bp, bS, an, aO, ab, ac, Q, ad, az, ah, aY, b0, T, by, b4, N, H, b, ax, M, b7, aU, aT, bR, bj, e, br, U, P, aK, s, Y, bi, aH, bW, bV, aD, aQ, n, am, aJ, v, aR, aE, c3, bL, b2, b9, ba, ak, R, _, a4, a3, b3, a1, bX, a2, a7, f, bE, bH, bD, bC, bF, bG, bA, bs, bv, bw, bu, bt, bq, bb, ap, aN, ae, k, be, i, aB, c2, m, bf, aC, l, au, aL, h, c1, ar, at, aW, aV, aq, S, a_, aZ, c0, bB, bk, bg, bh, V, bU, Z, W, bT, a5, a9, a8, c, bI, af, bc, x, J, d, O, L, K, r, a, z, y, B, E, b6, F, bd, u } from "./index-be658132.js";
1
+ import { b5, bJ, A, ay, aA, ai, bl, aI, G, bz, bn, as, w, C, g, bN, al, aM, X, bP, $, a6, bY, aa, bo, bm, b$, ao, aS, t, ag, aX, b_, bK, a$, D, aF, b1, bZ, aG, aw, b8, bM, bO, bx, aj, a0, p, o, bQ, I, aP, av, q, bp, bS, an, aO, ab, ac, Q, ad, az, ah, aY, b0, T, by, b4, N, H, b, ax, M, b7, aU, aT, bR, bj, e, br, U, P, aK, s, Y, bi, aH, bW, bV, aD, aQ, n, am, aJ, v, aR, aE, c3, bL, b2, b9, ba, ak, R, _, a4, a3, b3, a1, bX, a2, a7, f, bE, bH, bD, bC, bF, bG, bA, bs, bv, bw, bu, bt, bq, bb, ap, aN, ae, k, be, i, aB, c2, m, bf, aC, l, au, aL, h, c1, ar, at, aW, aV, aq, S, a_, aZ, c0, bB, bk, bg, bh, V, bU, Z, W, bT, a5, a9, a8, c, bI, af, bc, x, J, d, O, L, K, r, a, z, y, B, E, b6, F, bd, u } from "./index-70f11bd6.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "@cloudtower/icons-react";
@@ -8288,6 +8288,9 @@ var __publicField = (obj, key, value) => {
8288
8288
  meta: {
8289
8289
  resourceBasePath: "/api/v1",
8290
8290
  kind: "Namespace"
8291
+ },
8292
+ pagination: {
8293
+ mode: "off"
8291
8294
  }
8292
8295
  });
8293
8296
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.select, { input: props, disabled: action === "edit", children: data2 == null ? void 0 : data2.data.map((namespace2) => /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, { value: namespace2.metadata.name, children: namespace2.metadata.name }, namespace2.metadata.name)) });
@@ -10397,6 +10400,9 @@ var __publicField = (obj, key, value) => {
10397
10400
  meta: {
10398
10401
  resourceBasePath: "/apis/batch/v1",
10399
10402
  kind: "Job"
10403
+ },
10404
+ pagination: {
10405
+ mode: "off"
10400
10406
  }
10401
10407
  });
10402
10408
  const dataSource = React.useMemo(() => {
@@ -10439,7 +10445,10 @@ var __publicField = (obj, key, value) => {
10439
10445
  const [currentPage, setCurrentPage] = React.useState(1);
10440
10446
  const { data: data2, isLoading } = core.useList({
10441
10447
  resource: "events",
10442
- meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" }
10448
+ meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
10449
+ pagination: {
10450
+ mode: "off"
10451
+ }
10443
10452
  });
10444
10453
  const parsed = core.useParsed();
10445
10454
  const columns = React.useMemo(
@@ -21672,23 +21681,30 @@ var __publicField = (obj, key, value) => {
21672
21681
  var _a, _b;
21673
21682
  const {
21674
21683
  config,
21675
- control,
21684
+ formResult,
21676
21685
  action,
21677
21686
  errorMsg
21678
21687
  } = props;
21688
+ const {
21689
+ control,
21690
+ watch,
21691
+ getValues
21692
+ } = formResult;
21693
+ watch();
21679
21694
  const fields = (_b = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _b.map((c2) => {
21680
21695
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
21681
21696
  control,
21682
21697
  name: c2.path.join("."),
21683
21698
  rules: {
21684
- validate(value2, formValues) {
21699
+ validate(value2) {
21700
+ const formValue = getValues();
21685
21701
  if (!c2.validators || c2.validators.length === 0)
21686
21702
  return true;
21687
21703
  for (const func of c2.validators) {
21688
21704
  const {
21689
21705
  isValid,
21690
21706
  errorMsg: errorMsg2
21691
- } = func(value2, formValues);
21707
+ } = func(value2, formValue);
21692
21708
  if (!isValid)
21693
21709
  return errorMsg2;
21694
21710
  }
@@ -21705,6 +21721,7 @@ var __publicField = (obj, key, value) => {
21705
21721
  fieldState
21706
21722
  }) => {
21707
21723
  var _a2;
21724
+ const formValue = getValues();
21708
21725
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.String, {
21709
21726
  input: {
21710
21727
  value: value2,
@@ -21733,6 +21750,9 @@ var __publicField = (obj, key, value) => {
21733
21750
  children: value2
21734
21751
  });
21735
21752
  }
21753
+ if (c2 == null ? void 0 : c2.render) {
21754
+ ele = c2.render(value2, onChange, formValue, onBlur);
21755
+ }
21736
21756
  return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Form.Item, {
21737
21757
  label: c2.label,
21738
21758
  labelCol: {
@@ -22307,6 +22327,7 @@ var __publicField = (obj, key, value) => {
22307
22327
  resource: config.name,
22308
22328
  action: id ? "edit" : "create",
22309
22329
  id,
22330
+ liveMode: "off",
22310
22331
  ...refineProps
22311
22332
  },
22312
22333
  defaultValues: config == null ? void 0 : config.initValue
@@ -23068,7 +23089,7 @@ var __publicField = (obj, key, value) => {
23068
23089
  ...yamlFormProps
23069
23090
  });
23070
23091
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23071
- control: refineFormResult.formResult.control,
23092
+ formResult: refineFormResult.formResult,
23072
23093
  config,
23073
23094
  errorMsg: refineFormResult.responseErrorMsg,
23074
23095
  action: id ? "edit" : "create"
@@ -23131,8 +23152,7 @@ var __publicField = (obj, key, value) => {
23131
23152
  onFinish
23132
23153
  },
23133
23154
  getValues,
23134
- saveButtonProps,
23135
- control
23155
+ saveButtonProps
23136
23156
  } = formResult;
23137
23157
  const onClick = () => {
23138
23158
  const data2 = getValues();
@@ -23143,7 +23163,7 @@ var __publicField = (obj, key, value) => {
23143
23163
  className: "c1pvtlkp",
23144
23164
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23145
23165
  config,
23146
- control
23166
+ formResult
23147
23167
  }), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
23148
23168
  ...saveButtonProps,
23149
23169
  onClick,
@@ -1,10 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { Control } from 'react-hook-form';
2
+ import { UseFormReturnType } from '@refinedev/react-hook-form';
3
3
  import { ResourceModel } from '../../models';
4
4
  import { ResourceConfig } from '../../types';
5
5
  type Props<Model extends ResourceModel> = {
6
6
  config?: ResourceConfig<Model>;
7
- control: Control;
7
+ formResult: UseFormReturnType;
8
8
  errorMsg?: string;
9
9
  action?: 'create' | 'edit';
10
10
  };
@@ -9,9 +9,5 @@ export type RefineFormField = {
9
9
  label: string;
10
10
  type?: 'number';
11
11
  validators?: RefineFormValidator[];
12
- render?: React.FC<{
13
- value: unknown;
14
- onChange: (event: unknown) => void;
15
- onBlur: () => void;
16
- }>;
12
+ render?: (value: unknown, onChange: (event: unknown) => void, formValue: unknown, onBlur: () => void) => React.ReactElement;
17
13
  };
@@ -0,0 +1,10 @@
1
+ import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
+ import { ResourceModel } from './resource-model';
3
+ type ServerInstanceTypes = Required<Unstructured>;
4
+ export declare class ServerInstanceModel extends ResourceModel<ServerInstanceTypes> {
5
+ _rawYaml: ServerInstanceTypes;
6
+ _globalStore: GlobalStore;
7
+ sshMethod: 'password' | 'privateKey';
8
+ constructor(_rawYaml: ServerInstanceTypes, _globalStore: GlobalStore);
9
+ }
10
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.0.40-bowen.3",
3
+ "version": "0.0.40-bowen.6",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",