@plasmicpkgs/antd5 0.0.187 → 0.0.189
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/.tsbuildinfo +1 -1
- package/dist/antd.esm.js +5118 -4958
- package/dist/antd.esm.js.map +1 -1
- package/dist/form/Form.d.ts +72 -0
- package/dist/form/FormGroup.d.ts +6 -0
- package/dist/form/FormItem.d.ts +33 -0
- package/dist/form/FormList.d.ts +5 -0
- package/dist/form/SchemaForm.d.ts +9 -0
- package/dist/form/contexts.d.ts +40 -0
- package/dist/form/registerForm.d.ts +9 -0
- package/dist/form/registerFormGroup.d.ts +2 -0
- package/dist/form/registerFormItem.d.ts +2 -0
- package/dist/form/registerFormList.d.ts +2 -0
- package/dist/form/sharedRegistration.d.ts +14 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.js +5128 -4957
- package/dist/index.js.map +1 -1
- package/dist/names.d.ts +18 -0
- package/dist/registerButton.d.ts +1 -2
- package/dist/registerCheckbox.d.ts +0 -2
- package/dist/registerInput.d.ts +0 -4
- package/dist/registerRadio.d.ts +0 -3
- package/dist/registerSelect.d.ts +0 -3
- package/dist/registerSwitch.d.ts +0 -1
- package/package.json +5 -5
- package/skinny/Form.cjs.js +268 -0
- package/skinny/Form.cjs.js.map +1 -0
- package/skinny/Form.esm.js +256 -0
- package/skinny/Form.esm.js.map +1 -0
- package/skinny/FormGroup.cjs.js +26 -0
- package/skinny/FormGroup.cjs.js.map +1 -0
- package/skinny/FormGroup.esm.js +20 -0
- package/skinny/FormGroup.esm.js.map +1 -0
- package/skinny/FormItem.cjs.js +290 -0
- package/skinny/FormItem.cjs.js.map +1 -0
- package/skinny/FormItem.esm.js +284 -0
- package/skinny/FormItem.esm.js.map +1 -0
- package/skinny/FormList.cjs.js +98 -0
- package/skinny/FormList.cjs.js.map +1 -0
- package/skinny/FormList.esm.js +92 -0
- package/skinny/FormList.esm.js.map +1 -0
- package/skinny/SchemaForm.cjs.js +199 -0
- package/skinny/SchemaForm.cjs.js.map +1 -0
- package/skinny/SchemaForm.esm.js +191 -0
- package/skinny/SchemaForm.esm.js.map +1 -0
- package/skinny/contexts-4c7952c1.esm.js +20 -0
- package/skinny/contexts-4c7952c1.esm.js.map +1 -0
- package/skinny/contexts-a2387bed.cjs.js +31 -0
- package/skinny/contexts-a2387bed.cjs.js.map +1 -0
- package/skinny/names-3aea627b.cjs.js +34 -0
- package/skinny/names-3aea627b.cjs.js.map +1 -0
- package/skinny/names-73583568.esm.js +18 -0
- package/skinny/names-73583568.esm.js.map +1 -0
- package/skinny/names.d.ts +18 -0
- package/skinny/registerButton.cjs.js +3 -4
- package/skinny/registerButton.cjs.js.map +1 -1
- package/skinny/registerButton.d.ts +1 -2
- package/skinny/registerButton.esm.js +3 -3
- package/skinny/registerButton.esm.js.map +1 -1
- package/skinny/registerCheckbox.cjs.js +5 -8
- package/skinny/registerCheckbox.cjs.js.map +1 -1
- package/skinny/registerCheckbox.d.ts +0 -2
- package/skinny/registerCheckbox.esm.js +2 -3
- package/skinny/registerCheckbox.esm.js.map +1 -1
- package/skinny/registerForm.cjs.js +460 -1387
- package/skinny/registerForm.cjs.js.map +1 -1
- package/skinny/registerForm.esm.js +460 -1375
- package/skinny/registerForm.esm.js.map +1 -1
- package/skinny/registerInput.cjs.js +12 -15
- package/skinny/registerInput.cjs.js.map +1 -1
- package/skinny/registerInput.d.ts +0 -4
- package/skinny/registerInput.esm.js +6 -5
- package/skinny/registerInput.esm.js.map +1 -1
- package/skinny/registerRadio.cjs.js +6 -11
- package/skinny/registerRadio.cjs.js.map +1 -1
- package/skinny/registerRadio.d.ts +0 -3
- package/skinny/registerRadio.esm.js +2 -4
- package/skinny/registerRadio.esm.js.map +1 -1
- package/skinny/registerSelect.cjs.js +16 -14
- package/skinny/registerSelect.cjs.js.map +1 -1
- package/skinny/registerSelect.d.ts +0 -3
- package/skinny/registerSelect.esm.js +11 -6
- package/skinny/registerSelect.esm.js.map +1 -1
- package/skinny/registerSwitch.cjs.js +2 -3
- package/skinny/registerSwitch.cjs.js.map +1 -1
- package/skinny/registerSwitch.d.ts +0 -1
- package/skinny/registerSwitch.esm.js +2 -2
- package/skinny/registerSwitch.esm.js.map +1 -1
- package/dist/registerForm.d.ts +0 -143
- package/skinny/registerForm.d.ts +0 -143
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { DataOp, TableSchema } from "@plasmicapp/data-sources";
|
|
2
|
+
import { CodeComponentMode, ComponentHelpers } from "@plasmicapp/host";
|
|
3
|
+
import { CanvasComponentProps } from "@plasmicapp/host/registerComponent";
|
|
4
|
+
import type { FormInstance, FormProps } from "antd/es/form";
|
|
5
|
+
import React from "react";
|
|
6
|
+
import { CommonFormControlContextData } from "./contexts";
|
|
7
|
+
import { InternalFormItemProps } from "./FormItem";
|
|
8
|
+
export declare enum InputType {
|
|
9
|
+
Text = "Text",
|
|
10
|
+
TextArea = "Text Area",
|
|
11
|
+
Password = "Password",
|
|
12
|
+
Number = "Number",
|
|
13
|
+
Select = "Select",
|
|
14
|
+
Option = "Option",
|
|
15
|
+
OptionGroup = "Option Group",
|
|
16
|
+
Radio = "Radio",
|
|
17
|
+
RadioGroup = "Radio Group",
|
|
18
|
+
Checkbox = "Checkbox",
|
|
19
|
+
DatePicker = "DatePicker",
|
|
20
|
+
Unknown = "Unkown"
|
|
21
|
+
}
|
|
22
|
+
export declare const SchemaFormContext: React.Context<{
|
|
23
|
+
schema?: TableSchema | undefined;
|
|
24
|
+
minimalFullLengthFields?: Partial<SimplifiedFormItemsProp>[] | undefined;
|
|
25
|
+
mergedFields?: SimplifiedFormItemsProp[] | undefined;
|
|
26
|
+
} | undefined>;
|
|
27
|
+
export interface SimplifiedFormItemsProp extends InternalFormItemProps {
|
|
28
|
+
inputType: InputType;
|
|
29
|
+
options?: {
|
|
30
|
+
label: string;
|
|
31
|
+
value: string;
|
|
32
|
+
}[];
|
|
33
|
+
optionType?: "default" | "button";
|
|
34
|
+
showTime?: boolean;
|
|
35
|
+
key?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface FormWrapperControlContextData extends CommonFormControlContextData {
|
|
38
|
+
formInstance?: FormInstance<any>;
|
|
39
|
+
schema?: TableSchema;
|
|
40
|
+
minimalFullLengthFields?: Partial<SimplifiedFormItemsProp>[];
|
|
41
|
+
mergedFields?: SimplifiedFormItemsProp[];
|
|
42
|
+
}
|
|
43
|
+
export declare enum FormType {
|
|
44
|
+
NewEntry = 0,
|
|
45
|
+
UpdateEntry = 1
|
|
46
|
+
}
|
|
47
|
+
export interface FormWrapperProps extends FormProps, CanvasComponentProps<FormWrapperControlContextData> {
|
|
48
|
+
/**
|
|
49
|
+
* https://ant.design/components/form#setfieldsvalue-do-not-trigger-onfieldschange-or-onvalueschange
|
|
50
|
+
* Because setFieldsValue doesn't trigger onValuesChange, we need to create our own onChange function.
|
|
51
|
+
* This will allow us to trigger the onChange function and keep the value state updated in canvas.
|
|
52
|
+
* We also don't invoke onValuesChange to avoid changing the standard behavior, since users may have
|
|
53
|
+
* overridden this function in their codebase
|
|
54
|
+
**/
|
|
55
|
+
extendedOnValuesChange?: (values: Parameters<NonNullable<FormProps["onValuesChange"]>>[1]) => void;
|
|
56
|
+
formItems?: SimplifiedFormItemsProp[];
|
|
57
|
+
dataFormItems?: SimplifiedFormItemsProp[];
|
|
58
|
+
mode?: CodeComponentMode;
|
|
59
|
+
formType?: "new-entry" | "update-entry";
|
|
60
|
+
submitSlot?: React.ReactNode;
|
|
61
|
+
data?: DataOp;
|
|
62
|
+
}
|
|
63
|
+
export interface FormRefActions extends Pick<FormInstance<any>, "setFieldsValue" | "resetFields" | "setFieldValue" | "validateFields"> {
|
|
64
|
+
clearFields: () => void;
|
|
65
|
+
formInstance: FormInstance<any>;
|
|
66
|
+
}
|
|
67
|
+
export declare const FormWrapper: React.ForwardRefExoticComponent<FormWrapperProps & React.RefAttributes<FormRefActions>>;
|
|
68
|
+
export declare const formHelpers: ComponentHelpers<FormWrapperProps>;
|
|
69
|
+
export declare const OPTIMIZED_FORM_IMPORT: {
|
|
70
|
+
name: string;
|
|
71
|
+
path: string;
|
|
72
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CanvasComponentProps } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import { Form } from "antd";
|
|
3
|
+
import type { FormItemProps } from "antd/es/form/FormItem";
|
|
4
|
+
import React from "react";
|
|
5
|
+
import { CommonFormControlContextData } from "./contexts";
|
|
6
|
+
export interface FormItemControlContextData extends CommonFormControlContextData {
|
|
7
|
+
parentFormItemPath: (string | number)[];
|
|
8
|
+
status?: ReturnType<typeof Form.Item.useStatus>;
|
|
9
|
+
}
|
|
10
|
+
interface CuratedFieldData {
|
|
11
|
+
status: string | undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface InternalFormItemProps extends Omit<FormItemProps, "rules" | "name">, CanvasComponentProps<FormItemControlContextData> {
|
|
14
|
+
rules?: PlasmicRule[];
|
|
15
|
+
description?: React.ReactNode;
|
|
16
|
+
noLabel?: boolean;
|
|
17
|
+
hideValidationMessage?: boolean;
|
|
18
|
+
customizeProps?: (fieldData: CuratedFieldData, props: InternalFormItemProps) => FormItemProps;
|
|
19
|
+
alignLabellessWithControls?: boolean;
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
interface PlasmicRule {
|
|
23
|
+
ruleType: "enum" | "len" | "max" | "min" | "regex" | "required" | "whitespace" | "advanced";
|
|
24
|
+
length?: number;
|
|
25
|
+
pattern?: string;
|
|
26
|
+
custom?: (...args: any[]) => any;
|
|
27
|
+
options?: {
|
|
28
|
+
value: any;
|
|
29
|
+
}[];
|
|
30
|
+
message?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function FormItemWrapper(props: InternalFormItemProps): React.JSX.Element;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { FormListOperation, FormListProps } from "antd/es/form/FormList";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const FormListWrapper: React.ForwardRefExoticComponent<Omit<FormListProps, "children"> & {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
} & React.RefAttributes<FormListOperation>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TableSchema } from "@plasmicapp/data-sources";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FormRefActions, FormWrapperProps, SimplifiedFormItemsProp } from "./Form";
|
|
4
|
+
export declare function deriveFormFieldConfigs(dataFormItems: SimplifiedFormItemsProp[], schema: TableSchema, data: any): {
|
|
5
|
+
mergedFields: SimplifiedFormItemsProp[];
|
|
6
|
+
minimalFullLengthFields: Partial<SimplifiedFormItemsProp>[];
|
|
7
|
+
};
|
|
8
|
+
export declare const SchemaForm: React.ForwardRefExoticComponent<FormWrapperProps & React.RefAttributes<FormRefActions>>;
|
|
9
|
+
export { SchemaForm as FormWrapper };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Form, type FormInstance, type FormItemProps } from "antd";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export declare const PathContext: React.Context<{
|
|
4
|
+
relativePath: (string | number)[];
|
|
5
|
+
fullPath: (string | number)[];
|
|
6
|
+
}>;
|
|
7
|
+
export declare const useFormItemRelativeName: (name: FormItemProps["name"]) => any[] | undefined;
|
|
8
|
+
export declare const useFormItemFullName: (name: FormItemProps["name"]) => any[] | undefined;
|
|
9
|
+
export declare function useFormInstanceMaybe(): FormInstance<any> | undefined;
|
|
10
|
+
export interface FieldEntity {
|
|
11
|
+
fullPath: (string | number)[];
|
|
12
|
+
name: string | number | undefined;
|
|
13
|
+
preserve: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* - registeredFields: current mounted form fields
|
|
17
|
+
* - preservedRegisteredFields: all fields that were registered and were marked as NOT preserve
|
|
18
|
+
*/
|
|
19
|
+
export interface InternalFieldCtx {
|
|
20
|
+
registeredFields: FieldEntity[];
|
|
21
|
+
preservedRegisteredFields: FieldEntity[];
|
|
22
|
+
}
|
|
23
|
+
export interface CommonFormControlContextData {
|
|
24
|
+
formInstance?: FormInstance<any>;
|
|
25
|
+
layout?: FormLayoutContextValue;
|
|
26
|
+
internalFieldCtx?: InternalFieldCtx;
|
|
27
|
+
}
|
|
28
|
+
export interface InternalFormInstanceContext extends CommonFormControlContextData {
|
|
29
|
+
fireOnValuesChange: () => void;
|
|
30
|
+
forceRemount: () => void;
|
|
31
|
+
registerField: (fieldEntity: FieldEntity) => () => void;
|
|
32
|
+
internalFieldCtx: InternalFieldCtx;
|
|
33
|
+
initialValues: Record<string, any>;
|
|
34
|
+
}
|
|
35
|
+
export declare const InternalFormInstanceContext: React.Context<InternalFormInstanceContext | undefined>;
|
|
36
|
+
export interface FormLayoutContextValue {
|
|
37
|
+
layout: React.ComponentProps<typeof Form>["layout"];
|
|
38
|
+
labelSpan?: number;
|
|
39
|
+
}
|
|
40
|
+
export declare const FormLayoutContext: React.Context<FormLayoutContextValue | undefined>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Registerable } from "../utils";
|
|
2
|
+
import { formHelpers } from "./Form";
|
|
3
|
+
import { FormWrapper } from "./SchemaForm";
|
|
4
|
+
export declare const formTypeDescription = "\n You can create form with two different behaviors:\n \n\n\n 1. Create a new entry: The form will be created empty and it will create a new row when submitted.\n 2. Update an entry: The form will be pre-filled with the row values and it will update the table entry when submitted.\n \n\n\n For both options, you can customize later.\n";
|
|
5
|
+
export declare function registerForm(loader?: Registerable): void;
|
|
6
|
+
export { FormGroup } from "./FormGroup";
|
|
7
|
+
export { FormItemWrapper } from "./FormItem";
|
|
8
|
+
export { FormListWrapper } from "./FormList";
|
|
9
|
+
export { formHelpers, FormWrapper };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionProps, PropType } from "@plasmicapp/host";
|
|
2
|
+
import { ArrayType } from "@plasmicapp/host/registerComponent";
|
|
3
|
+
import { FormWrapperControlContextData, FormWrapperProps, SimplifiedFormItemsProp } from "./Form";
|
|
4
|
+
import { FormItemControlContextData, InternalFormItemProps } from "./FormItem";
|
|
5
|
+
export declare const COMMON_ACTIONS: {
|
|
6
|
+
type: "button-action";
|
|
7
|
+
label: string;
|
|
8
|
+
onClick: ({ studioOps }: ActionProps<any>) => void;
|
|
9
|
+
hidden: (props: any) => boolean;
|
|
10
|
+
}[];
|
|
11
|
+
export declare function getDefaultValueHint(field: keyof SimplifiedFormItemsProp): (_props: any, contextData: FormWrapperControlContextData | FormItemControlContextData | null, { item }: any) => any;
|
|
12
|
+
export declare function commonFormItemProps(usage: "simplified-form-item"): Record<string, PropType<InternalFormItemProps>>;
|
|
13
|
+
export declare function commonFormItemProps(usage: "advanced-form-item"): Record<string, PropType<FormWrapperProps>>;
|
|
14
|
+
export declare const commonSimplifiedFormArrayItemType: (propName: "formItems" | "dataFormItems") => ArrayType<FormWrapperProps>["itemType"];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { InputType } from "./
|
|
1
|
+
import { InputType } from "./form/Form";
|
|
2
2
|
import { Registerable } from "./utils";
|
|
3
3
|
export declare function registerAll(loader?: Registerable): void;
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export
|
|
4
|
+
export { FormType, InputType, OPTIMIZED_FORM_IMPORT } from "./form/Form";
|
|
5
|
+
export type { SimplifiedFormItemsProp } from "./form/Form";
|
|
6
|
+
export { formTypeDescription, registerForm } from "./form/registerForm";
|
|
7
|
+
export { deriveFormFieldConfigs } from "./form/SchemaForm";
|
|
8
|
+
export * from "./names";
|
|
7
9
|
export declare const componentNameToInputType: {
|
|
8
10
|
"plasmic-antd5-input": InputType;
|
|
9
11
|
"plasmic-antd5-textarea": InputType;
|