@dovetail-v2/refine 0.3.0 → 0.3.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/dist/{MonacoYamlEditor-74ecf0d5.js → MonacoYamlEditor-5e4c98ce.js} +1 -1
- package/dist/{MonacoYamlEditor-1ed09191.cjs → MonacoYamlEditor-9b8b7cef.cjs} +1 -1
- package/dist/components/Form/FormModal.d.ts +2 -0
- package/dist/components/Form/RefineFormContainer.d.ts +2 -1
- package/dist/components/Form/YamlForm.d.ts +2 -2
- package/dist/components/Form/YamlFormContainer.d.ts +3 -2
- package/dist/components/Form/type.d.ts +11 -1
- package/dist/components/KeyValueTableForm/index.d.ts +34 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/hooks/useOpenForm.d.ts +5 -2
- package/dist/i18n.d.ts +1 -0
- package/dist/{index-23ef5f69.js → index-c4f4f337.js} +393 -252
- package/dist/{index-7c78ef6f.cjs → index-e9523181.cjs} +306 -165
- package/dist/locales/zh-CN/index.d.ts +1 -0
- package/dist/refine.cjs +6 -1
- package/dist/refine.js +90 -85
- package/dist/style.css +9 -4
- package/dist/utils/file.d.ts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/validation.d.ts +5 -1
- package/package.json +1 -1
- package/dist/components/EditMetadataForm/KeyValueTableForm.d.ts +0 -16
|
@@ -3,7 +3,7 @@ import * as monaco from "monaco-editor";
|
|
|
3
3
|
import { setDiagnosticsOptions } from "monaco-yaml";
|
|
4
4
|
import { useRef, useEffect } from "react";
|
|
5
5
|
import ReactDOM from "react-dom";
|
|
6
|
-
import { Y as YamlEditorStyle } from "./index-
|
|
6
|
+
import { Y as YamlEditorStyle } from "./index-c4f4f337.js";
|
|
7
7
|
import "dayjs";
|
|
8
8
|
import "i18next";
|
|
9
9
|
import "@refinedev/core";
|
|
@@ -5,7 +5,7 @@ const monaco = require("monaco-editor");
|
|
|
5
5
|
const monacoYaml = require("monaco-yaml");
|
|
6
6
|
const React = require("react");
|
|
7
7
|
const ReactDOM = require("react-dom");
|
|
8
|
-
const refine = require("./index-
|
|
8
|
+
const refine = require("./index-e9523181.cjs");
|
|
9
9
|
require("dayjs");
|
|
10
10
|
require("i18next");
|
|
11
11
|
require("@refinedev/core");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseRecord, CreateResponse, UpdateResponse } from '@refinedev/core';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { YamlFormProps } from './YamlForm';
|
|
3
4
|
export type SaveButtonProps = {
|
|
@@ -16,5 +17,6 @@ export type FormModalProps = {
|
|
|
16
17
|
resource?: string;
|
|
17
18
|
id?: string;
|
|
18
19
|
yamlFormProps?: YamlFormProps;
|
|
20
|
+
onSuccess?: (data: UpdateResponse<BaseRecord> | CreateResponse<BaseRecord>) => void;
|
|
19
21
|
};
|
|
20
22
|
export declare function FormModal(props: FormModalProps): JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { BaseRecord, CreateResponse, UpdateResponse } from '@refinedev/core';
|
|
2
3
|
import { type SaveButtonProps } from 'src/components/Form/FormModal';
|
|
3
4
|
import { ResourceConfig } from 'src/types';
|
|
4
5
|
import { CommonFormConfig, RefineFormConfig } from 'src/types';
|
|
@@ -11,7 +12,7 @@ interface RefineFormContainerProps {
|
|
|
11
12
|
customYamlFormProps?: YamlFormProps;
|
|
12
13
|
onSaveButtonPropsChange?: (props: SaveButtonProps) => void;
|
|
13
14
|
onError?: () => void;
|
|
14
|
-
onSuccess?: () => void;
|
|
15
|
+
onSuccess?: (data: UpdateResponse<BaseRecord> | CreateResponse<BaseRecord>) => void;
|
|
15
16
|
}
|
|
16
17
|
declare function RefineFormContainer({ id, config, customYamlFormProps, formConfig, isYamlMode, onSuccess, onError, onSaveButtonPropsChange, }: RefineFormContainerProps): JSX.Element;
|
|
17
18
|
export default RefineFormContainer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FormAction } from '@refinedev/core';
|
|
2
|
+
import { BaseRecord, CreateResponse, FormAction, UpdateResponse } from '@refinedev/core';
|
|
3
3
|
import { Unstructured } from 'k8s-api-provider';
|
|
4
4
|
import { ResourceModel } from 'src/models';
|
|
5
5
|
import { ResourceConfig } from 'src/types';
|
|
@@ -30,6 +30,6 @@ export interface YamlFormProps<Model extends ResourceModel = ResourceModel> {
|
|
|
30
30
|
};
|
|
31
31
|
}) => void;
|
|
32
32
|
onErrorsChange?: (errors: string[]) => void;
|
|
33
|
-
onFinish?: () => void;
|
|
33
|
+
onFinish?: (data: UpdateResponse<BaseRecord> | CreateResponse<BaseRecord>) => void;
|
|
34
34
|
}
|
|
35
35
|
export declare function YamlForm<Model extends ResourceModel = ResourceModel>(props: YamlFormProps<Model>): JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { BaseRecord, CreateResponse, UpdateResponse } from '@refinedev/core';
|
|
2
3
|
import { type SaveButtonProps } from 'src/components/Form/FormModal';
|
|
3
4
|
import { ResourceConfig } from 'src/types';
|
|
4
5
|
import { CommonFormConfig } from 'src/types';
|
|
@@ -9,9 +10,9 @@ interface YamlFormContainerProps {
|
|
|
9
10
|
config: ResourceConfig;
|
|
10
11
|
customYamlFormProps?: YamlFormProps;
|
|
11
12
|
formConfig?: YamlFormConfig & CommonFormConfig;
|
|
12
|
-
onSuccess?: () => void;
|
|
13
|
+
onSuccess?: (data: UpdateResponse<BaseRecord> | CreateResponse<BaseRecord>) => void;
|
|
13
14
|
onError?: () => void;
|
|
14
15
|
onSaveButtonPropsChange?: (props: SaveButtonProps) => void;
|
|
15
16
|
}
|
|
16
|
-
declare function YamlFormContainer({ id, customYamlFormProps, config, formConfig, onSuccess, onError, onSaveButtonPropsChange }: YamlFormContainerProps): JSX.Element;
|
|
17
|
+
declare function YamlFormContainer({ id, customYamlFormProps, config, formConfig, onSuccess, onError, onSaveButtonPropsChange, }: YamlFormContainerProps): JSX.Element;
|
|
17
18
|
export default YamlFormContainer;
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Control, UseFormTrigger, FieldValues, ControllerRenderProps } from 'react-hook-form';
|
|
3
3
|
import { FormType } from 'src/types/resource';
|
|
4
|
+
export declare enum FormItemLayout {
|
|
5
|
+
VERTICAL = "VERTICAL",
|
|
6
|
+
HORIZONTAL = "HORIZONTAL"
|
|
7
|
+
}
|
|
4
8
|
export type RefineFormValidator = (value: unknown, formValue: unknown, formMode: FormType) => {
|
|
5
9
|
isValid: boolean;
|
|
6
10
|
errorMsg: string;
|
|
7
|
-
}
|
|
11
|
+
} | Promise<{
|
|
12
|
+
isValid: boolean;
|
|
13
|
+
errorMsg: string;
|
|
14
|
+
}>;
|
|
8
15
|
export type RefineFormFieldRenderProps = {
|
|
9
16
|
field: ControllerRenderProps<FieldValues, string>;
|
|
10
17
|
fieldConfig: RefineFormField;
|
|
@@ -20,7 +27,10 @@ export type RefineFormField = {
|
|
|
20
27
|
helperText?: React.ReactNode;
|
|
21
28
|
type?: 'number';
|
|
22
29
|
validators?: RefineFormValidator[];
|
|
30
|
+
isSkipValidationInYaml?: boolean;
|
|
23
31
|
disabledWhenEdit?: boolean;
|
|
32
|
+
layout?: FormItemLayout;
|
|
33
|
+
isHideErrorStatus?: boolean;
|
|
24
34
|
render?: (props: RefineFormFieldRenderProps) => React.ReactElement;
|
|
25
35
|
/**
|
|
26
36
|
* 表单项条件渲染函数
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TableFormColumn } from '@cloudtower/eagle';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export type KeyValuePair = {
|
|
4
|
+
key: string;
|
|
5
|
+
value?: string;
|
|
6
|
+
};
|
|
7
|
+
interface KeyValueTableFormProps<T extends KeyValuePair> {
|
|
8
|
+
value?: T[];
|
|
9
|
+
defaultValue: T[];
|
|
10
|
+
onChange?: (value: T[]) => void;
|
|
11
|
+
extraColumns?: TableFormColumn[];
|
|
12
|
+
addButtonText?: string;
|
|
13
|
+
noValueValidation?: boolean;
|
|
14
|
+
isHideLabelFormatPopover?: boolean;
|
|
15
|
+
isValueOptional?: boolean;
|
|
16
|
+
canImportFromFile?: boolean;
|
|
17
|
+
minSize?: number;
|
|
18
|
+
validateKey?: (key: string) => {
|
|
19
|
+
isValid: boolean;
|
|
20
|
+
errorMessage?: string;
|
|
21
|
+
};
|
|
22
|
+
validateValue?: (value: string) => {
|
|
23
|
+
isValid: boolean;
|
|
24
|
+
errorMessage?: string;
|
|
25
|
+
};
|
|
26
|
+
onSubmit?: (value: T[]) => Promise<unknown> | undefined;
|
|
27
|
+
}
|
|
28
|
+
export type KeyValueTableFormHandle<T extends KeyValuePair = KeyValuePair> = {
|
|
29
|
+
validate: () => Promise<boolean>;
|
|
30
|
+
submit: () => Promise<unknown> | undefined;
|
|
31
|
+
setValue: (value: T[]) => void;
|
|
32
|
+
};
|
|
33
|
+
export declare const KeyValueTableForm: React.ForwardRefExoticComponent<KeyValueTableFormProps<KeyValuePair> & React.RefAttributes<KeyValueTableFormHandle<KeyValuePair>>>;
|
|
34
|
+
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { CreateResponse, UpdateResponse, BaseRecord } from '@refinedev/core';
|
|
2
|
+
interface OpenFormOptions {
|
|
2
3
|
id?: string;
|
|
4
|
+
resourceName?: string;
|
|
5
|
+
onSuccess?: (data: UpdateResponse<BaseRecord> | CreateResponse<BaseRecord>) => void;
|
|
3
6
|
}
|
|
4
|
-
export declare function useOpenForm(
|
|
7
|
+
export declare function useOpenForm(): (options?: OpenFormOptions) => void;
|
|
5
8
|
export {};
|