@tachybase/schema 0.23.41 → 0.23.48
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/lib/core/effects/index.d.ts +2 -0
- package/lib/core/effects/index.js +23 -0
- package/lib/core/effects/onFieldEffects.d.ts +27 -0
- package/lib/core/effects/onFieldEffects.js +158 -0
- package/lib/core/effects/onFormEffects.d.ts +24 -0
- package/lib/core/effects/onFormEffects.js +117 -0
- package/lib/core/global.d.js +0 -0
- package/lib/core/index.d.ts +4 -0
- package/lib/core/index.js +27 -0
- package/lib/core/models/ArrayField.d.ts +17 -0
- package/lib/core/models/ArrayField.js +145 -0
- package/lib/core/models/BaseField.d.ts +72 -0
- package/lib/core/models/BaseField.js +285 -0
- package/lib/core/models/Field.d.ts +70 -0
- package/lib/core/models/Field.js +426 -0
- package/lib/core/models/Form.d.ts +102 -0
- package/lib/core/models/Form.js +483 -0
- package/lib/core/models/Graph.d.ts +8 -0
- package/lib/core/models/Graph.js +77 -0
- package/lib/core/models/Heart.d.ts +16 -0
- package/lib/core/models/Heart.js +91 -0
- package/lib/core/models/LifeCycle.d.ts +14 -0
- package/lib/core/models/LifeCycle.js +64 -0
- package/lib/core/models/ObjectField.d.ts +12 -0
- package/lib/core/models/ObjectField.js +64 -0
- package/lib/core/models/Query.d.ts +18 -0
- package/lib/core/models/Query.js +105 -0
- package/lib/core/models/VoidField.d.ts +14 -0
- package/lib/core/models/VoidField.js +117 -0
- package/lib/core/models/index.d.ts +9 -0
- package/lib/core/models/index.js +37 -0
- package/lib/core/models/types.d.ts +9 -0
- package/lib/core/models/types.js +15 -0
- package/lib/core/shared/checkers.d.ts +117 -0
- package/lib/core/shared/checkers.js +109 -0
- package/lib/core/shared/constants.d.ts +48 -0
- package/lib/core/shared/constants.js +86 -0
- package/lib/core/shared/effective.d.ts +9 -0
- package/lib/core/shared/effective.js +91 -0
- package/lib/core/shared/externals.d.ts +8 -0
- package/lib/core/shared/externals.js +87 -0
- package/lib/core/shared/internals.d.ts +54 -0
- package/lib/core/shared/internals.js +956 -0
- package/lib/core/types.d.ts +275 -0
- package/lib/core/types.js +76 -0
- package/lib/grid/index.d.ts +67 -0
- package/lib/grid/index.js +378 -0
- package/lib/grid/observer.d.ts +19 -0
- package/lib/grid/observer.js +107 -0
- package/lib/index.d.ts +12 -24
- package/lib/index.js +27 -244
- package/lib/json-schema/compiler.d.ts +8 -0
- package/lib/json-schema/compiler.js +129 -0
- package/lib/json-schema/global.d.js +0 -0
- package/lib/json-schema/index.d.ts +2 -0
- package/lib/json-schema/index.js +23 -0
- package/lib/json-schema/patches.d.ts +5 -0
- package/lib/json-schema/patches.js +68 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.d.ts +2 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.js +132 -0
- package/lib/json-schema/polyfills/index.d.ts +1 -0
- package/lib/json-schema/polyfills/index.js +21 -0
- package/lib/json-schema/schema.d.ts +88 -0
- package/lib/json-schema/schema.js +231 -0
- package/lib/json-schema/shared.d.ts +62 -0
- package/lib/json-schema/shared.js +232 -0
- package/lib/json-schema/transformer.d.ts +4 -0
- package/lib/json-schema/transformer.js +238 -0
- package/lib/json-schema/types.d.ts +119 -0
- package/lib/json-schema/types.js +15 -0
- package/lib/path/contexts.d.ts +10 -0
- package/lib/path/contexts.js +49 -0
- package/lib/path/destructor.d.ts +15 -0
- package/lib/path/destructor.js +151 -0
- package/lib/path/index.d.ts +51 -0
- package/lib/path/index.js +513 -0
- package/lib/path/matcher.d.ts +33 -0
- package/lib/path/matcher.js +197 -0
- package/lib/path/parser.d.ts +33 -0
- package/lib/path/parser.js +379 -0
- package/lib/path/shared.d.ts +13 -0
- package/lib/path/shared.js +121 -0
- package/lib/path/tokenizer.d.ts +27 -0
- package/lib/path/tokenizer.js +269 -0
- package/lib/path/tokens.d.ts +27 -0
- package/lib/path/tokens.js +216 -0
- package/lib/path/types.d.ts +88 -0
- package/lib/path/types.js +63 -0
- package/lib/react/components/ArrayField.d.ts +6 -0
- package/lib/react/components/ArrayField.js +44 -0
- package/lib/react/components/ExpressionScope.d.ts +2 -0
- package/lib/react/components/ExpressionScope.js +35 -0
- package/lib/react/components/Field.d.ts +5 -0
- package/lib/react/components/Field.js +45 -0
- package/lib/react/components/FormConsumer.d.ts +2 -0
- package/lib/react/components/FormConsumer.js +36 -0
- package/lib/react/components/FormProvider.d.ts +2 -0
- package/lib/react/components/FormProvider.js +35 -0
- package/lib/react/components/ObjectField.d.ts +6 -0
- package/lib/react/components/ObjectField.js +39 -0
- package/lib/react/components/ReactiveField.d.ts +11 -0
- package/lib/react/components/ReactiveField.js +115 -0
- package/lib/react/components/RecordScope.d.ts +2 -0
- package/lib/react/components/RecordScope.js +65 -0
- package/lib/react/components/RecordsScope.d.ts +2 -0
- package/lib/react/components/RecordsScope.js +43 -0
- package/lib/react/components/RecursionField.d.ts +2 -0
- package/lib/react/components/RecursionField.js +105 -0
- package/lib/react/components/SchemaField.d.ts +41 -0
- package/lib/react/components/SchemaField.js +154 -0
- package/lib/react/components/VoidField.d.ts +5 -0
- package/lib/react/components/VoidField.js +39 -0
- package/lib/react/components/index.d.ts +11 -0
- package/lib/react/components/index.js +41 -0
- package/lib/react/global.d.js +0 -0
- package/lib/react/hooks/index.d.ts +6 -0
- package/lib/react/hooks/index.js +31 -0
- package/lib/react/hooks/useAttach.d.ts +6 -0
- package/lib/react/hooks/useAttach.js +35 -0
- package/lib/react/hooks/useExpressionScope.d.ts +1 -0
- package/lib/react/hooks/useExpressionScope.js +30 -0
- package/lib/react/hooks/useField.d.ts +2 -0
- package/lib/react/hooks/useField.js +32 -0
- package/lib/react/hooks/useFieldSchema.d.ts +2 -0
- package/lib/react/hooks/useFieldSchema.js +32 -0
- package/lib/react/hooks/useForm.d.ts +2 -0
- package/lib/react/hooks/useForm.js +32 -0
- package/lib/react/hooks/useFormEffects.d.ts +2 -0
- package/lib/react/hooks/useFormEffects.js +42 -0
- package/lib/react/hooks/useParentForm.d.ts +2 -0
- package/lib/react/hooks/useParentForm.js +40 -0
- package/lib/react/index.d.ts +5 -0
- package/lib/react/index.js +29 -0
- package/lib/react/shared/connect.d.ts +9 -0
- package/lib/react/shared/connect.js +118 -0
- package/lib/react/shared/context.d.ts +14 -0
- package/lib/react/shared/context.js +74 -0
- package/lib/react/shared/index.d.ts +2 -0
- package/lib/react/shared/index.js +23 -0
- package/lib/react/shared/render.d.ts +2 -0
- package/lib/react/shared/render.js +69 -0
- package/lib/react/types.d.ts +84 -0
- package/lib/react/types.js +15 -0
- package/lib/reactive/action.d.ts +2 -0
- package/lib/reactive/action.js +48 -0
- package/lib/reactive/annotations/box.d.ts +7 -0
- package/lib/reactive/annotations/box.js +76 -0
- package/lib/reactive/annotations/computed.d.ts +12 -0
- package/lib/reactive/annotations/computed.js +154 -0
- package/lib/reactive/annotations/index.d.ts +5 -0
- package/lib/reactive/annotations/index.js +29 -0
- package/lib/reactive/annotations/observable.d.ts +4 -0
- package/lib/reactive/annotations/observable.js +67 -0
- package/lib/reactive/annotations/ref.d.ts +6 -0
- package/lib/reactive/annotations/ref.js +78 -0
- package/lib/reactive/annotations/shallow.d.ts +2 -0
- package/lib/reactive/annotations/shallow.js +67 -0
- package/lib/reactive/array.d.ts +12 -0
- package/lib/reactive/array.js +83 -0
- package/lib/reactive/autorun.d.ts +7 -0
- package/lib/reactive/autorun.js +155 -0
- package/lib/reactive/batch.d.ts +2 -0
- package/lib/reactive/batch.js +40 -0
- package/lib/reactive/checkers.d.ts +10 -0
- package/lib/reactive/checkers.js +60 -0
- package/lib/reactive/environment.d.ts +28 -0
- package/lib/reactive/environment.js +76 -0
- package/lib/reactive/externals.d.ts +10 -0
- package/lib/reactive/externals.js +156 -0
- package/lib/reactive/global.d.js +0 -0
- package/lib/reactive/handlers.d.ts +4 -0
- package/lib/reactive/handlers.js +246 -0
- package/lib/reactive/index.d.ts +10 -0
- package/lib/reactive/index.js +39 -0
- package/lib/reactive/internals.d.ts +17 -0
- package/lib/reactive/internals.js +139 -0
- package/lib/reactive/model.d.ts +3 -0
- package/lib/reactive/model.js +68 -0
- package/lib/reactive/observable.d.ts +9 -0
- package/lib/reactive/observable.js +50 -0
- package/lib/reactive/observe.d.ts +2 -0
- package/lib/reactive/observe.js +58 -0
- package/lib/reactive/reaction.d.ts +21 -0
- package/lib/reactive/reaction.js +278 -0
- package/lib/reactive/tracker.d.ts +7 -0
- package/lib/reactive/tracker.js +63 -0
- package/lib/reactive/tree.d.ts +25 -0
- package/lib/reactive/tree.js +106 -0
- package/lib/reactive/types.d.ts +79 -0
- package/lib/reactive/types.js +21 -0
- package/lib/reactive/untracked.d.ts +4 -0
- package/lib/reactive/untracked.js +29 -0
- package/lib/reactive-react/hooks/index.d.ts +9 -0
- package/lib/reactive-react/hooks/index.js +48 -0
- package/lib/reactive-react/hooks/useCompatEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useCompatEffect.js +60 -0
- package/lib/reactive-react/hooks/useCompatFactory.d.ts +3 -0
- package/lib/reactive-react/hooks/useCompatFactory.js +74 -0
- package/lib/reactive-react/hooks/useDidUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useDidUpdate.js +38 -0
- package/lib/reactive-react/hooks/useForceUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useForceUpdate.js +76 -0
- package/lib/reactive-react/hooks/useLayoutEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useLayoutEffect.js +28 -0
- package/lib/reactive-react/hooks/useObserver.d.ts +2 -0
- package/lib/reactive-react/hooks/useObserver.js +43 -0
- package/lib/reactive-react/index.d.ts +3 -0
- package/lib/reactive-react/index.js +25 -0
- package/lib/reactive-react/observer.d.ts +8 -0
- package/lib/reactive-react/observer.js +64 -0
- package/lib/reactive-react/shared/gc.d.ts +8 -0
- package/lib/reactive-react/shared/gc.js +59 -0
- package/lib/reactive-react/shared/global.d.ts +1 -0
- package/lib/reactive-react/shared/global.js +50 -0
- package/lib/reactive-react/shared/immediate.d.ts +1 -0
- package/lib/reactive-react/shared/immediate.js +40 -0
- package/lib/reactive-react/shared/index.d.ts +2 -0
- package/lib/reactive-react/shared/index.js +23 -0
- package/lib/reactive-react/types.d.ts +14 -0
- package/lib/reactive-react/types.js +15 -0
- package/lib/shared/array.d.ts +35 -0
- package/lib/shared/array.js +189 -0
- package/lib/shared/case.d.ts +6 -0
- package/lib/shared/case.js +39 -0
- package/lib/shared/checkers.d.ts +21 -0
- package/lib/shared/checkers.js +77 -0
- package/lib/shared/clone.d.ts +2 -0
- package/lib/shared/clone.js +97 -0
- package/lib/shared/compare.d.ts +1 -0
- package/lib/shared/compare.js +129 -0
- package/lib/shared/defaults.d.ts +6 -0
- package/lib/shared/defaults.js +63 -0
- package/lib/shared/deprecate.d.ts +1 -0
- package/lib/shared/deprecate.js +42 -0
- package/lib/shared/global.d.ts +1 -0
- package/lib/shared/global.js +50 -0
- package/lib/shared/index.d.ts +16 -0
- package/lib/shared/index.js +51 -0
- package/lib/shared/instanceof.d.ts +1 -0
- package/lib/shared/instanceof.js +36 -0
- package/lib/shared/isEmpty.d.ts +3 -0
- package/lib/shared/isEmpty.js +94 -0
- package/lib/shared/merge.d.ts +12 -0
- package/lib/shared/merge.js +214 -0
- package/lib/shared/middleware.d.ts +4 -0
- package/lib/shared/middleware.js +41 -0
- package/lib/shared/path.d.ts +3 -0
- package/lib/shared/path.js +27 -0
- package/lib/shared/string.d.ts +1 -0
- package/lib/shared/string.js +38 -0
- package/lib/shared/subscribable.d.ts +11 -0
- package/lib/shared/subscribable.js +74 -0
- package/lib/shared/uid.d.ts +1 -0
- package/lib/shared/uid.js +35 -0
- package/lib/validator/formats.d.ts +16 -0
- package/lib/validator/formats.js +40 -0
- package/lib/validator/index.d.ts +4 -0
- package/lib/validator/index.js +27 -0
- package/lib/validator/locale.d.ts +219 -0
- package/lib/validator/locale.js +240 -0
- package/lib/validator/parser.d.ts +5 -0
- package/lib/validator/parser.js +153 -0
- package/lib/validator/registry.d.ts +15 -0
- package/lib/validator/registry.js +116 -0
- package/lib/validator/rules.d.ts +3 -0
- package/lib/validator/rules.js +154 -0
- package/lib/validator/template.d.ts +2 -0
- package/lib/validator/template.js +42 -0
- package/lib/validator/types.d.ts +62 -0
- package/lib/validator/types.js +28 -0
- package/lib/validator/validator.d.ts +2 -0
- package/lib/validator/validator.js +63 -0
- package/package.json +16 -10
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { FormPath } from '../shared';
|
|
2
|
+
import { IValidatorRules, Validator, ValidatorTriggerType } from '../validator';
|
|
3
|
+
import { ArrayField, Field, Form, LifeCycle, ObjectField, Query, VoidField } from './models';
|
|
4
|
+
export type NonFunctionPropertyNames<T> = {
|
|
5
|
+
[K in keyof T]: T[K] extends (...args: any) => any ? never : K;
|
|
6
|
+
}[keyof T];
|
|
7
|
+
export type NonFunctionProperties<T> = Pick<T, NonFunctionPropertyNames<T>>;
|
|
8
|
+
export type AnyFunction = (...args: any[]) => any;
|
|
9
|
+
export type JSXComponent = any;
|
|
10
|
+
export type LifeCycleHandler<T> = (payload: T, context: any) => void;
|
|
11
|
+
export type LifeCyclePayload<T> = (params: {
|
|
12
|
+
type: string;
|
|
13
|
+
payload: T;
|
|
14
|
+
}, context: any) => void;
|
|
15
|
+
export declare enum LifeCycleTypes {
|
|
16
|
+
/**
|
|
17
|
+
* Form LifeCycle
|
|
18
|
+
**/
|
|
19
|
+
ON_FORM_INIT = "onFormInit",
|
|
20
|
+
ON_FORM_MOUNT = "onFormMount",
|
|
21
|
+
ON_FORM_UNMOUNT = "onFormUnmount",
|
|
22
|
+
ON_FORM_INPUT_CHANGE = "onFormInputChange",
|
|
23
|
+
ON_FORM_VALUES_CHANGE = "onFormValuesChange",
|
|
24
|
+
ON_FORM_INITIAL_VALUES_CHANGE = "onFormInitialValuesChange",
|
|
25
|
+
ON_FORM_SUBMIT = "onFormSubmit",
|
|
26
|
+
ON_FORM_RESET = "onFormReset",
|
|
27
|
+
ON_FORM_SUBMIT_START = "onFormSubmitStart",
|
|
28
|
+
ON_FORM_SUBMITTING = "onFormSubmitting",
|
|
29
|
+
ON_FORM_SUBMIT_END = "onFormSubmitEnd",
|
|
30
|
+
ON_FORM_SUBMIT_VALIDATE_START = "onFormSubmitValidateStart",
|
|
31
|
+
ON_FORM_SUBMIT_VALIDATE_SUCCESS = "onFormSubmitValidateSuccess",
|
|
32
|
+
ON_FORM_SUBMIT_VALIDATE_FAILED = "onFormSubmitValidateFailed",
|
|
33
|
+
ON_FORM_SUBMIT_VALIDATE_END = "onFormSubmitValidateEnd",
|
|
34
|
+
ON_FORM_SUBMIT_SUCCESS = "onFormSubmitSuccess",
|
|
35
|
+
ON_FORM_SUBMIT_FAILED = "onFormSubmitFailed",
|
|
36
|
+
ON_FORM_VALIDATE_START = "onFormValidateStart",
|
|
37
|
+
ON_FORM_VALIDATING = "onFormValidating",
|
|
38
|
+
ON_FORM_VALIDATE_SUCCESS = "onFormValidateSuccess",
|
|
39
|
+
ON_FORM_VALIDATE_FAILED = "onFormValidateFailed",
|
|
40
|
+
ON_FORM_VALIDATE_END = "onFormValidateEnd",
|
|
41
|
+
ON_FORM_GRAPH_CHANGE = "onFormGraphChange",
|
|
42
|
+
ON_FORM_LOADING = "onFormLoading",
|
|
43
|
+
/**
|
|
44
|
+
* Field LifeCycle
|
|
45
|
+
**/
|
|
46
|
+
ON_FIELD_INIT = "onFieldInit",
|
|
47
|
+
ON_FIELD_INPUT_VALUE_CHANGE = "onFieldInputValueChange",
|
|
48
|
+
ON_FIELD_VALUE_CHANGE = "onFieldValueChange",
|
|
49
|
+
ON_FIELD_INITIAL_VALUE_CHANGE = "onFieldInitialValueChange",
|
|
50
|
+
ON_FIELD_SUBMIT = "onFieldSubmit",
|
|
51
|
+
ON_FIELD_SUBMIT_START = "onFieldSubmitStart",
|
|
52
|
+
ON_FIELD_SUBMITTING = "onFieldSubmitting",
|
|
53
|
+
ON_FIELD_SUBMIT_END = "onFieldSubmitEnd",
|
|
54
|
+
ON_FIELD_SUBMIT_VALIDATE_START = "onFieldSubmitValidateStart",
|
|
55
|
+
ON_FIELD_SUBMIT_VALIDATE_SUCCESS = "onFieldSubmitValidateSuccess",
|
|
56
|
+
ON_FIELD_SUBMIT_VALIDATE_FAILED = "onFieldSubmitValidateFailed",
|
|
57
|
+
ON_FIELD_SUBMIT_VALIDATE_END = "onFieldSubmitValidateEnd",
|
|
58
|
+
ON_FIELD_SUBMIT_SUCCESS = "onFieldSubmitSuccess",
|
|
59
|
+
ON_FIELD_SUBMIT_FAILED = "onFieldSubmitFailed",
|
|
60
|
+
ON_FIELD_VALIDATE_START = "onFieldValidateStart",
|
|
61
|
+
ON_FIELD_VALIDATING = "onFieldValidating",
|
|
62
|
+
ON_FIELD_VALIDATE_SUCCESS = "onFieldValidateSuccess",
|
|
63
|
+
ON_FIELD_VALIDATE_FAILED = "onFieldValidateFailed",
|
|
64
|
+
ON_FIELD_VALIDATE_END = "onFieldValidateEnd",
|
|
65
|
+
ON_FIELD_LOADING = "onFieldLoading",
|
|
66
|
+
ON_FIELD_RESET = "onFieldReset",
|
|
67
|
+
ON_FIELD_MOUNT = "onFieldMount",
|
|
68
|
+
ON_FIELD_UNMOUNT = "onFieldUnmount"
|
|
69
|
+
}
|
|
70
|
+
export type HeartSubscriber = ({ type, payload }: {
|
|
71
|
+
type: string;
|
|
72
|
+
payload: any;
|
|
73
|
+
}) => void;
|
|
74
|
+
export interface INodePatch<T> {
|
|
75
|
+
type: 'remove' | 'update';
|
|
76
|
+
address: string;
|
|
77
|
+
oldAddress?: string;
|
|
78
|
+
payload?: T;
|
|
79
|
+
}
|
|
80
|
+
export interface IHeartProps<Context> {
|
|
81
|
+
lifecycles?: LifeCycle[];
|
|
82
|
+
context?: Context;
|
|
83
|
+
}
|
|
84
|
+
export interface IFieldFeedback {
|
|
85
|
+
triggerType?: FieldFeedbackTriggerTypes;
|
|
86
|
+
type?: FieldFeedbackTypes;
|
|
87
|
+
code?: FieldFeedbackCodeTypes;
|
|
88
|
+
messages?: FeedbackMessage;
|
|
89
|
+
}
|
|
90
|
+
export type IFormFeedback = IFieldFeedback & {
|
|
91
|
+
path?: string;
|
|
92
|
+
address?: string;
|
|
93
|
+
};
|
|
94
|
+
export interface ISearchFeedback {
|
|
95
|
+
triggerType?: FieldFeedbackTriggerTypes;
|
|
96
|
+
type?: FieldFeedbackTypes;
|
|
97
|
+
code?: FieldFeedbackCodeTypes;
|
|
98
|
+
address?: FormPathPattern;
|
|
99
|
+
path?: FormPathPattern;
|
|
100
|
+
messages?: FeedbackMessage;
|
|
101
|
+
}
|
|
102
|
+
export type FeedbackMessage = any[];
|
|
103
|
+
export type IFieldUpdate = {
|
|
104
|
+
pattern: FormPath;
|
|
105
|
+
callbacks: ((...args: any[]) => any)[];
|
|
106
|
+
};
|
|
107
|
+
export interface IFormRequests {
|
|
108
|
+
validate?: ReturnType<typeof setTimeout>;
|
|
109
|
+
submit?: ReturnType<typeof setTimeout>;
|
|
110
|
+
loading?: ReturnType<typeof setTimeout>;
|
|
111
|
+
updates?: IFieldUpdate[];
|
|
112
|
+
updateIndexes?: Record<string, number>;
|
|
113
|
+
}
|
|
114
|
+
export type IFormFields = Record<string, GeneralField>;
|
|
115
|
+
export type FieldFeedbackTypes = 'error' | 'success' | 'warning';
|
|
116
|
+
export type FieldFeedbackTriggerTypes = ValidatorTriggerType;
|
|
117
|
+
export type FieldFeedbackCodeTypes = 'ValidateError' | 'ValidateSuccess' | 'ValidateWarning' | 'EffectError' | 'EffectSuccess' | 'EffectWarning' | (string & {});
|
|
118
|
+
export type FormPatternTypes = 'editable' | 'readOnly' | 'disabled' | 'readPretty' | ({} & string);
|
|
119
|
+
export type FormDisplayTypes = 'none' | 'hidden' | 'visible' | ({} & string);
|
|
120
|
+
export type FormPathPattern = string | number | Array<string | number> | FormPath | RegExp | (((address: Array<string | number>) => boolean) & {
|
|
121
|
+
path: FormPath;
|
|
122
|
+
});
|
|
123
|
+
type OmitState<P> = Omit<P, 'selfDisplay' | 'selfPattern' | 'originValues' | 'originInitialValues' | 'id' | 'address' | 'path' | 'lifecycles' | 'disposers' | 'requests' | 'fields' | 'graph' | 'heart' | 'indexes' | 'props' | 'displayName' | 'setState' | 'getState' | 'getFormGraph' | 'setFormGraph' | 'setFormState' | 'getFormState'>;
|
|
124
|
+
export type IFieldState = Partial<Pick<Field, NonFunctionPropertyNames<OmitState<Field<any, any, string, string>>>>>;
|
|
125
|
+
export type IVoidFieldState = Partial<Pick<VoidField, NonFunctionPropertyNames<OmitState<VoidField<any, any, string>>>>>;
|
|
126
|
+
export type IFormState<T extends Record<any, any> = any> = Pick<Form<T>, NonFunctionPropertyNames<OmitState<Form<{
|
|
127
|
+
[key: string]: any;
|
|
128
|
+
}>>>>;
|
|
129
|
+
export type IFormGraph = Record<string, IGeneralFieldState | IFormState>;
|
|
130
|
+
export interface IFormProps<T extends object = any> {
|
|
131
|
+
values?: Partial<T>;
|
|
132
|
+
initialValues?: Partial<T>;
|
|
133
|
+
pattern?: FormPatternTypes;
|
|
134
|
+
display?: FormDisplayTypes;
|
|
135
|
+
hidden?: boolean;
|
|
136
|
+
visible?: boolean;
|
|
137
|
+
editable?: boolean;
|
|
138
|
+
disabled?: boolean;
|
|
139
|
+
readOnly?: boolean;
|
|
140
|
+
readPretty?: boolean;
|
|
141
|
+
effects?: (form: Form<T>) => void;
|
|
142
|
+
validateFirst?: boolean;
|
|
143
|
+
validatePattern?: FormPatternTypes[];
|
|
144
|
+
validateDisplay?: FormDisplayTypes[];
|
|
145
|
+
designable?: boolean;
|
|
146
|
+
}
|
|
147
|
+
export type IFormMergeStrategy = 'overwrite' | 'merge' | 'deepMerge' | 'shallowMerge';
|
|
148
|
+
export interface IFieldFactoryProps<Decorator extends JSXComponent, Component extends JSXComponent, TextType = any, ValueType = any> extends IFieldProps<Decorator, Component, TextType, ValueType> {
|
|
149
|
+
name: FormPathPattern;
|
|
150
|
+
basePath?: FormPathPattern;
|
|
151
|
+
}
|
|
152
|
+
export interface IVoidFieldFactoryProps<Decorator extends JSXComponent, Component extends JSXComponent, TextType = any> extends IVoidFieldProps<Decorator, Component, TextType> {
|
|
153
|
+
name: FormPathPattern;
|
|
154
|
+
basePath?: FormPathPattern;
|
|
155
|
+
}
|
|
156
|
+
export interface IFieldRequests {
|
|
157
|
+
validate?: ReturnType<typeof setTimeout>;
|
|
158
|
+
submit?: ReturnType<typeof setTimeout>;
|
|
159
|
+
loading?: ReturnType<typeof setTimeout>;
|
|
160
|
+
batch?: () => void;
|
|
161
|
+
}
|
|
162
|
+
export interface IFieldCaches {
|
|
163
|
+
value?: any;
|
|
164
|
+
initialValue?: any;
|
|
165
|
+
inputting?: boolean;
|
|
166
|
+
}
|
|
167
|
+
export type FieldDisplayTypes = 'none' | 'hidden' | 'visible' | ({} & string);
|
|
168
|
+
export type FieldPatternTypes = 'editable' | 'readOnly' | 'disabled' | 'readPretty' | ({} & string);
|
|
169
|
+
export type FieldValidatorContext = IValidatorRules & {
|
|
170
|
+
field?: Field;
|
|
171
|
+
form?: Form;
|
|
172
|
+
value?: any;
|
|
173
|
+
};
|
|
174
|
+
export type FieldValidator = Validator<FieldValidatorContext>;
|
|
175
|
+
export type FieldDataSource = {
|
|
176
|
+
label?: any;
|
|
177
|
+
value?: any;
|
|
178
|
+
title?: any;
|
|
179
|
+
key?: any;
|
|
180
|
+
text?: any;
|
|
181
|
+
children?: FieldDataSource;
|
|
182
|
+
[key: string]: any;
|
|
183
|
+
}[];
|
|
184
|
+
export type FieldComponent<Component extends JSXComponent, ComponentProps = any> = [Component] | [Component, ComponentProps] | boolean | any[];
|
|
185
|
+
export type FieldDecorator<Decorator extends JSXComponent, ComponentProps = any> = [Decorator] | [Decorator, ComponentProps] | boolean | any[];
|
|
186
|
+
export type FieldReaction = (field: Field) => void;
|
|
187
|
+
export interface IFieldProps<Decorator extends JSXComponent = any, Component extends JSXComponent = any, TextType = any, ValueType = any> {
|
|
188
|
+
name: FormPathPattern;
|
|
189
|
+
basePath?: FormPathPattern;
|
|
190
|
+
title?: TextType;
|
|
191
|
+
description?: TextType;
|
|
192
|
+
value?: ValueType;
|
|
193
|
+
initialValue?: ValueType;
|
|
194
|
+
required?: boolean;
|
|
195
|
+
display?: FieldDisplayTypes;
|
|
196
|
+
pattern?: FieldPatternTypes;
|
|
197
|
+
hidden?: boolean;
|
|
198
|
+
visible?: boolean;
|
|
199
|
+
editable?: boolean;
|
|
200
|
+
disabled?: boolean;
|
|
201
|
+
readOnly?: boolean;
|
|
202
|
+
readPretty?: boolean;
|
|
203
|
+
dataSource?: FieldDataSource;
|
|
204
|
+
validateFirst?: boolean;
|
|
205
|
+
validatePattern?: FieldPatternTypes[];
|
|
206
|
+
validateDisplay?: FieldDisplayTypes[];
|
|
207
|
+
validator?: FieldValidator;
|
|
208
|
+
decorator?: FieldDecorator<Decorator>;
|
|
209
|
+
component?: FieldComponent<Component>;
|
|
210
|
+
reactions?: FieldReaction[] | FieldReaction;
|
|
211
|
+
content?: any;
|
|
212
|
+
data?: any;
|
|
213
|
+
}
|
|
214
|
+
export interface IVoidFieldProps<Decorator extends JSXComponent = any, Component extends JSXComponent = any, TextType = any> {
|
|
215
|
+
name: FormPathPattern;
|
|
216
|
+
basePath?: FormPathPattern;
|
|
217
|
+
title?: TextType;
|
|
218
|
+
description?: TextType;
|
|
219
|
+
display?: FieldDisplayTypes;
|
|
220
|
+
pattern?: FieldPatternTypes;
|
|
221
|
+
hidden?: boolean;
|
|
222
|
+
visible?: boolean;
|
|
223
|
+
editable?: boolean;
|
|
224
|
+
disabled?: boolean;
|
|
225
|
+
readOnly?: boolean;
|
|
226
|
+
readPretty?: boolean;
|
|
227
|
+
decorator?: FieldDecorator<Decorator>;
|
|
228
|
+
component?: FieldComponent<Component>;
|
|
229
|
+
reactions?: FieldReaction[] | FieldReaction;
|
|
230
|
+
content?: any;
|
|
231
|
+
data?: any;
|
|
232
|
+
}
|
|
233
|
+
export interface IFieldResetOptions {
|
|
234
|
+
forceClear?: boolean;
|
|
235
|
+
validate?: boolean;
|
|
236
|
+
}
|
|
237
|
+
export type IGeneralFieldState = IFieldState & IVoidFieldState;
|
|
238
|
+
export type GeneralField = Field | VoidField | ArrayField | ObjectField;
|
|
239
|
+
export type DataField = Field | ArrayField | ObjectField;
|
|
240
|
+
export interface ISpliceArrayStateProps {
|
|
241
|
+
startIndex?: number;
|
|
242
|
+
deleteCount?: number;
|
|
243
|
+
insertCount?: number;
|
|
244
|
+
}
|
|
245
|
+
export interface IExchangeArrayStateProps {
|
|
246
|
+
fromIndex?: number;
|
|
247
|
+
toIndex?: number;
|
|
248
|
+
}
|
|
249
|
+
export interface IQueryProps {
|
|
250
|
+
pattern: FormPathPattern;
|
|
251
|
+
base: FormPathPattern;
|
|
252
|
+
form: Form;
|
|
253
|
+
}
|
|
254
|
+
export interface IModelSetter<P = any> {
|
|
255
|
+
(setter: (state: P) => void): void;
|
|
256
|
+
(setter: Partial<P>): void;
|
|
257
|
+
(): void;
|
|
258
|
+
}
|
|
259
|
+
export interface IModelGetter<P = any> {
|
|
260
|
+
<Getter extends (state: P) => any>(getter: Getter): ReturnType<Getter>;
|
|
261
|
+
(): P;
|
|
262
|
+
}
|
|
263
|
+
export type FieldMatchPattern = FormPathPattern | Query | GeneralField;
|
|
264
|
+
export interface IFieldStateSetter {
|
|
265
|
+
(pattern: FieldMatchPattern, setter: (state: IFieldState) => void): void;
|
|
266
|
+
(pattern: FieldMatchPattern, setter: Partial<IFieldState>): void;
|
|
267
|
+
}
|
|
268
|
+
export interface IFieldStateGetter {
|
|
269
|
+
<Getter extends (state: IGeneralFieldState) => any>(pattern: FieldMatchPattern, getter: Getter): ReturnType<Getter>;
|
|
270
|
+
(pattern: FieldMatchPattern): IGeneralFieldState;
|
|
271
|
+
}
|
|
272
|
+
export interface IFieldActions {
|
|
273
|
+
[key: string]: (...args: any[]) => any;
|
|
274
|
+
}
|
|
275
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var types_exports = {};
|
|
19
|
+
__export(types_exports, {
|
|
20
|
+
LifeCycleTypes: () => LifeCycleTypes
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(types_exports);
|
|
23
|
+
var LifeCycleTypes = /* @__PURE__ */ ((LifeCycleTypes2) => {
|
|
24
|
+
LifeCycleTypes2["ON_FORM_INIT"] = "onFormInit";
|
|
25
|
+
LifeCycleTypes2["ON_FORM_MOUNT"] = "onFormMount";
|
|
26
|
+
LifeCycleTypes2["ON_FORM_UNMOUNT"] = "onFormUnmount";
|
|
27
|
+
LifeCycleTypes2["ON_FORM_INPUT_CHANGE"] = "onFormInputChange";
|
|
28
|
+
LifeCycleTypes2["ON_FORM_VALUES_CHANGE"] = "onFormValuesChange";
|
|
29
|
+
LifeCycleTypes2["ON_FORM_INITIAL_VALUES_CHANGE"] = "onFormInitialValuesChange";
|
|
30
|
+
LifeCycleTypes2["ON_FORM_SUBMIT"] = "onFormSubmit";
|
|
31
|
+
LifeCycleTypes2["ON_FORM_RESET"] = "onFormReset";
|
|
32
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_START"] = "onFormSubmitStart";
|
|
33
|
+
LifeCycleTypes2["ON_FORM_SUBMITTING"] = "onFormSubmitting";
|
|
34
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_END"] = "onFormSubmitEnd";
|
|
35
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_VALIDATE_START"] = "onFormSubmitValidateStart";
|
|
36
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_VALIDATE_SUCCESS"] = "onFormSubmitValidateSuccess";
|
|
37
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_VALIDATE_FAILED"] = "onFormSubmitValidateFailed";
|
|
38
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_VALIDATE_END"] = "onFormSubmitValidateEnd";
|
|
39
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_SUCCESS"] = "onFormSubmitSuccess";
|
|
40
|
+
LifeCycleTypes2["ON_FORM_SUBMIT_FAILED"] = "onFormSubmitFailed";
|
|
41
|
+
LifeCycleTypes2["ON_FORM_VALIDATE_START"] = "onFormValidateStart";
|
|
42
|
+
LifeCycleTypes2["ON_FORM_VALIDATING"] = "onFormValidating";
|
|
43
|
+
LifeCycleTypes2["ON_FORM_VALIDATE_SUCCESS"] = "onFormValidateSuccess";
|
|
44
|
+
LifeCycleTypes2["ON_FORM_VALIDATE_FAILED"] = "onFormValidateFailed";
|
|
45
|
+
LifeCycleTypes2["ON_FORM_VALIDATE_END"] = "onFormValidateEnd";
|
|
46
|
+
LifeCycleTypes2["ON_FORM_GRAPH_CHANGE"] = "onFormGraphChange";
|
|
47
|
+
LifeCycleTypes2["ON_FORM_LOADING"] = "onFormLoading";
|
|
48
|
+
LifeCycleTypes2["ON_FIELD_INIT"] = "onFieldInit";
|
|
49
|
+
LifeCycleTypes2["ON_FIELD_INPUT_VALUE_CHANGE"] = "onFieldInputValueChange";
|
|
50
|
+
LifeCycleTypes2["ON_FIELD_VALUE_CHANGE"] = "onFieldValueChange";
|
|
51
|
+
LifeCycleTypes2["ON_FIELD_INITIAL_VALUE_CHANGE"] = "onFieldInitialValueChange";
|
|
52
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT"] = "onFieldSubmit";
|
|
53
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_START"] = "onFieldSubmitStart";
|
|
54
|
+
LifeCycleTypes2["ON_FIELD_SUBMITTING"] = "onFieldSubmitting";
|
|
55
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_END"] = "onFieldSubmitEnd";
|
|
56
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_VALIDATE_START"] = "onFieldSubmitValidateStart";
|
|
57
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_VALIDATE_SUCCESS"] = "onFieldSubmitValidateSuccess";
|
|
58
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_VALIDATE_FAILED"] = "onFieldSubmitValidateFailed";
|
|
59
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_VALIDATE_END"] = "onFieldSubmitValidateEnd";
|
|
60
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_SUCCESS"] = "onFieldSubmitSuccess";
|
|
61
|
+
LifeCycleTypes2["ON_FIELD_SUBMIT_FAILED"] = "onFieldSubmitFailed";
|
|
62
|
+
LifeCycleTypes2["ON_FIELD_VALIDATE_START"] = "onFieldValidateStart";
|
|
63
|
+
LifeCycleTypes2["ON_FIELD_VALIDATING"] = "onFieldValidating";
|
|
64
|
+
LifeCycleTypes2["ON_FIELD_VALIDATE_SUCCESS"] = "onFieldValidateSuccess";
|
|
65
|
+
LifeCycleTypes2["ON_FIELD_VALIDATE_FAILED"] = "onFieldValidateFailed";
|
|
66
|
+
LifeCycleTypes2["ON_FIELD_VALIDATE_END"] = "onFieldValidateEnd";
|
|
67
|
+
LifeCycleTypes2["ON_FIELD_LOADING"] = "onFieldLoading";
|
|
68
|
+
LifeCycleTypes2["ON_FIELD_RESET"] = "onFieldReset";
|
|
69
|
+
LifeCycleTypes2["ON_FIELD_MOUNT"] = "onFieldMount";
|
|
70
|
+
LifeCycleTypes2["ON_FIELD_UNMOUNT"] = "onFieldUnmount";
|
|
71
|
+
return LifeCycleTypes2;
|
|
72
|
+
})(LifeCycleTypes || {});
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
LifeCycleTypes
|
|
76
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export interface IGridOptions {
|
|
2
|
+
maxRows?: number;
|
|
3
|
+
maxColumns?: number | number[];
|
|
4
|
+
minColumns?: number | number[];
|
|
5
|
+
maxWidth?: number | number[];
|
|
6
|
+
minWidth?: number | number[];
|
|
7
|
+
breakpoints?: number[];
|
|
8
|
+
columnGap?: number;
|
|
9
|
+
rowGap?: number;
|
|
10
|
+
colWrap?: boolean;
|
|
11
|
+
strictAutoFit?: boolean;
|
|
12
|
+
shouldVisible?: (node: GridNode, grid: Grid<HTMLElement>) => boolean;
|
|
13
|
+
onDigest?: (grid: Grid<HTMLElement>) => void;
|
|
14
|
+
onInitialized?: (grid: Grid<HTMLElement>) => void;
|
|
15
|
+
}
|
|
16
|
+
export type GridNode = {
|
|
17
|
+
index?: number;
|
|
18
|
+
visible?: boolean;
|
|
19
|
+
column?: number;
|
|
20
|
+
shadowColumn?: number;
|
|
21
|
+
row?: number;
|
|
22
|
+
shadowRow?: number;
|
|
23
|
+
span?: number;
|
|
24
|
+
originSpan?: number;
|
|
25
|
+
element?: HTMLElement;
|
|
26
|
+
};
|
|
27
|
+
export declare class Grid<Container extends HTMLElement> {
|
|
28
|
+
options: IGridOptions;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
container: Container;
|
|
32
|
+
children: GridNode[];
|
|
33
|
+
childTotalColumns: number;
|
|
34
|
+
shadowChildTotalColumns: number;
|
|
35
|
+
childOriginTotalColumns: number;
|
|
36
|
+
shadowChildOriginTotalColumns: number;
|
|
37
|
+
ready: boolean;
|
|
38
|
+
constructor(options?: IGridOptions);
|
|
39
|
+
set breakpoints(breakpoints: number[]);
|
|
40
|
+
get breakpoints(): number[];
|
|
41
|
+
get breakpoint(): number;
|
|
42
|
+
set maxWidth(maxWidth: number);
|
|
43
|
+
get maxWidth(): number;
|
|
44
|
+
set minWidth(minWidth: number);
|
|
45
|
+
get minWidth(): number;
|
|
46
|
+
set maxColumns(maxColumns: number);
|
|
47
|
+
get maxColumns(): number;
|
|
48
|
+
set maxRows(maxRows: number);
|
|
49
|
+
get maxRows(): number;
|
|
50
|
+
set minColumns(minColumns: number);
|
|
51
|
+
get minColumns(): number;
|
|
52
|
+
set rowGap(rowGap: number);
|
|
53
|
+
get rowGap(): number;
|
|
54
|
+
set columnGap(columnGap: number);
|
|
55
|
+
get columnGap(): number;
|
|
56
|
+
set colWrap(colWrap: boolean);
|
|
57
|
+
get colWrap(): boolean;
|
|
58
|
+
get columns(): number;
|
|
59
|
+
get rows(): number;
|
|
60
|
+
get shadowRows(): number;
|
|
61
|
+
get templateColumns(): string;
|
|
62
|
+
get gap(): string;
|
|
63
|
+
get childSize(): number;
|
|
64
|
+
get fullnessLastColumn(): boolean;
|
|
65
|
+
connect: (container: Container) => () => void;
|
|
66
|
+
static id: (options?: IGridOptions) => string;
|
|
67
|
+
}
|