@tachybase/schema 0.23.41 → 0.23.47
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,23 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var effects_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(effects_exports);
|
|
17
|
+
__reExport(effects_exports, require("./onFormEffects"), module.exports);
|
|
18
|
+
__reExport(effects_exports, require("./onFieldEffects"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./onFormEffects"),
|
|
22
|
+
...require("./onFieldEffects")
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Form } from '../models';
|
|
2
|
+
import { DataField, FormPathPattern, GeneralField, IFieldState } from '../types';
|
|
3
|
+
export declare const onFieldMount: (pattern: FormPathPattern, callback: (field: GeneralField, form: Form) => void) => void;
|
|
4
|
+
export declare const onFieldUnmount: (pattern: FormPathPattern, callback: (field: GeneralField, form: Form) => void) => void;
|
|
5
|
+
export declare const onFieldValueChange: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
6
|
+
export declare const onFieldInitialValueChange: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
7
|
+
export declare const onFieldInputValueChange: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
8
|
+
export declare const onFieldValidateStart: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
9
|
+
export declare const onFieldValidateEnd: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
10
|
+
export declare const onFieldValidating: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
11
|
+
export declare const onFieldValidateFailed: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
12
|
+
export declare const onFieldValidateSuccess: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
13
|
+
export declare const onFieldSubmit: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
14
|
+
export declare const onFieldSubmitStart: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
15
|
+
export declare const onFieldSubmitEnd: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
16
|
+
export declare const onFieldSubmitValidateStart: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
17
|
+
export declare const onFieldSubmitValidateEnd: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
18
|
+
export declare const onFieldSubmitSuccess: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
19
|
+
export declare const onFieldSubmitFailed: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
20
|
+
export declare const onFieldSubmitValidateSuccess: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
21
|
+
export declare const onFieldSubmitValidateFailed: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
22
|
+
export declare const onFieldReset: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
23
|
+
export declare const onFieldLoading: (pattern: FormPathPattern, callback: (field: DataField, form: Form) => void) => void;
|
|
24
|
+
export declare function onFieldInit(pattern: FormPathPattern, callback?: (field: GeneralField, form: Form) => void): void;
|
|
25
|
+
export declare function onFieldReact(pattern: FormPathPattern, callback?: (field: GeneralField, form: Form) => void): void;
|
|
26
|
+
export declare function onFieldChange(pattern: FormPathPattern, callback?: (field: GeneralField, form: Form) => void): void;
|
|
27
|
+
export declare function onFieldChange(pattern: FormPathPattern, watches: (keyof IFieldState)[], callback?: (field: GeneralField, form: Form) => void): void;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var onFieldEffects_exports = {};
|
|
20
|
+
__export(onFieldEffects_exports, {
|
|
21
|
+
onFieldChange: () => onFieldChange,
|
|
22
|
+
onFieldInit: () => onFieldInit,
|
|
23
|
+
onFieldInitialValueChange: () => onFieldInitialValueChange,
|
|
24
|
+
onFieldInputValueChange: () => onFieldInputValueChange,
|
|
25
|
+
onFieldLoading: () => onFieldLoading,
|
|
26
|
+
onFieldMount: () => onFieldMount,
|
|
27
|
+
onFieldReact: () => onFieldReact,
|
|
28
|
+
onFieldReset: () => onFieldReset,
|
|
29
|
+
onFieldSubmit: () => onFieldSubmit,
|
|
30
|
+
onFieldSubmitEnd: () => onFieldSubmitEnd,
|
|
31
|
+
onFieldSubmitFailed: () => onFieldSubmitFailed,
|
|
32
|
+
onFieldSubmitStart: () => onFieldSubmitStart,
|
|
33
|
+
onFieldSubmitSuccess: () => onFieldSubmitSuccess,
|
|
34
|
+
onFieldSubmitValidateEnd: () => onFieldSubmitValidateEnd,
|
|
35
|
+
onFieldSubmitValidateFailed: () => onFieldSubmitValidateFailed,
|
|
36
|
+
onFieldSubmitValidateStart: () => onFieldSubmitValidateStart,
|
|
37
|
+
onFieldSubmitValidateSuccess: () => onFieldSubmitValidateSuccess,
|
|
38
|
+
onFieldUnmount: () => onFieldUnmount,
|
|
39
|
+
onFieldValidateEnd: () => onFieldValidateEnd,
|
|
40
|
+
onFieldValidateFailed: () => onFieldValidateFailed,
|
|
41
|
+
onFieldValidateStart: () => onFieldValidateStart,
|
|
42
|
+
onFieldValidateSuccess: () => onFieldValidateSuccess,
|
|
43
|
+
onFieldValidating: () => onFieldValidating,
|
|
44
|
+
onFieldValueChange: () => onFieldValueChange
|
|
45
|
+
});
|
|
46
|
+
module.exports = __toCommonJS(onFieldEffects_exports);
|
|
47
|
+
var import_reactive = require("../../reactive");
|
|
48
|
+
var import_shared = require("../../shared");
|
|
49
|
+
var import_effective = require("../shared/effective");
|
|
50
|
+
var import_types = require("../types");
|
|
51
|
+
function createFieldEffect(type) {
|
|
52
|
+
return (0, import_effective.createEffectHook)(
|
|
53
|
+
type,
|
|
54
|
+
(field, form) => (pattern, callback) => {
|
|
55
|
+
if (import_shared.FormPath.parse(pattern).matchAliasGroup(field.address, field.path)) {
|
|
56
|
+
(0, import_reactive.batch)(() => {
|
|
57
|
+
callback(field, form);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
__name(createFieldEffect, "createFieldEffect");
|
|
64
|
+
const _onFieldInit = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_INIT);
|
|
65
|
+
const onFieldMount = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_MOUNT);
|
|
66
|
+
const onFieldUnmount = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_UNMOUNT);
|
|
67
|
+
const onFieldValueChange = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_VALUE_CHANGE);
|
|
68
|
+
const onFieldInitialValueChange = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_INITIAL_VALUE_CHANGE);
|
|
69
|
+
const onFieldInputValueChange = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_INPUT_VALUE_CHANGE);
|
|
70
|
+
const onFieldValidateStart = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_VALIDATE_START);
|
|
71
|
+
const onFieldValidateEnd = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_VALIDATE_END);
|
|
72
|
+
const onFieldValidating = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_VALIDATING);
|
|
73
|
+
const onFieldValidateFailed = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_VALIDATE_FAILED);
|
|
74
|
+
const onFieldValidateSuccess = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_VALIDATE_SUCCESS);
|
|
75
|
+
const onFieldSubmit = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT);
|
|
76
|
+
const onFieldSubmitStart = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT_START);
|
|
77
|
+
const onFieldSubmitEnd = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT_END);
|
|
78
|
+
const onFieldSubmitValidateStart = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT_VALIDATE_START);
|
|
79
|
+
const onFieldSubmitValidateEnd = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT_VALIDATE_END);
|
|
80
|
+
const onFieldSubmitSuccess = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT_SUCCESS);
|
|
81
|
+
const onFieldSubmitFailed = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT_FAILED);
|
|
82
|
+
const onFieldSubmitValidateSuccess = createFieldEffect(
|
|
83
|
+
import_types.LifeCycleTypes.ON_FIELD_SUBMIT_VALIDATE_SUCCESS
|
|
84
|
+
);
|
|
85
|
+
const onFieldSubmitValidateFailed = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_SUBMIT_VALIDATE_FAILED);
|
|
86
|
+
const onFieldReset = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_RESET);
|
|
87
|
+
const onFieldLoading = createFieldEffect(import_types.LifeCycleTypes.ON_FIELD_LOADING);
|
|
88
|
+
function onFieldInit(pattern, callback) {
|
|
89
|
+
const form = (0, import_effective.useEffectForm)();
|
|
90
|
+
const count = form.query(pattern).reduce((count2, field) => {
|
|
91
|
+
callback(field, form);
|
|
92
|
+
return count2 + 1;
|
|
93
|
+
}, 0);
|
|
94
|
+
if (count === 0) {
|
|
95
|
+
_onFieldInit(pattern, callback);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
__name(onFieldInit, "onFieldInit");
|
|
99
|
+
function onFieldReact(pattern, callback) {
|
|
100
|
+
onFieldInit(pattern, (field, form) => {
|
|
101
|
+
field.disposers.push(
|
|
102
|
+
(0, import_reactive.autorun)(() => {
|
|
103
|
+
if ((0, import_shared.isFn)(callback)) callback(field, form);
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
__name(onFieldReact, "onFieldReact");
|
|
109
|
+
function onFieldChange(pattern, watches, callback) {
|
|
110
|
+
if ((0, import_shared.isFn)(watches)) {
|
|
111
|
+
callback = watches;
|
|
112
|
+
watches = ["value"];
|
|
113
|
+
} else {
|
|
114
|
+
watches = watches || ["value"];
|
|
115
|
+
}
|
|
116
|
+
onFieldInit(pattern, (field, form) => {
|
|
117
|
+
if ((0, import_shared.isFn)(callback)) callback(field, form);
|
|
118
|
+
const dispose = (0, import_reactive.reaction)(
|
|
119
|
+
() => {
|
|
120
|
+
return (0, import_shared.toArr)(watches).map((key) => {
|
|
121
|
+
return field[key];
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
() => {
|
|
125
|
+
if ((0, import_shared.isFn)(callback)) callback(field, form);
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
field.disposers.push(dispose);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
__name(onFieldChange, "onFieldChange");
|
|
132
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
133
|
+
0 && (module.exports = {
|
|
134
|
+
onFieldChange,
|
|
135
|
+
onFieldInit,
|
|
136
|
+
onFieldInitialValueChange,
|
|
137
|
+
onFieldInputValueChange,
|
|
138
|
+
onFieldLoading,
|
|
139
|
+
onFieldMount,
|
|
140
|
+
onFieldReact,
|
|
141
|
+
onFieldReset,
|
|
142
|
+
onFieldSubmit,
|
|
143
|
+
onFieldSubmitEnd,
|
|
144
|
+
onFieldSubmitFailed,
|
|
145
|
+
onFieldSubmitStart,
|
|
146
|
+
onFieldSubmitSuccess,
|
|
147
|
+
onFieldSubmitValidateEnd,
|
|
148
|
+
onFieldSubmitValidateFailed,
|
|
149
|
+
onFieldSubmitValidateStart,
|
|
150
|
+
onFieldSubmitValidateSuccess,
|
|
151
|
+
onFieldUnmount,
|
|
152
|
+
onFieldValidateEnd,
|
|
153
|
+
onFieldValidateFailed,
|
|
154
|
+
onFieldValidateStart,
|
|
155
|
+
onFieldValidateSuccess,
|
|
156
|
+
onFieldValidating,
|
|
157
|
+
onFieldValueChange
|
|
158
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Form } from '../models';
|
|
2
|
+
export declare const onFormInit: (callback: (form: Form) => void) => void;
|
|
3
|
+
export declare const onFormMount: (callback: (form: Form) => void) => void;
|
|
4
|
+
export declare const onFormUnmount: (callback: (form: Form) => void) => void;
|
|
5
|
+
export declare const onFormValuesChange: (callback: (form: Form) => void) => void;
|
|
6
|
+
export declare const onFormInitialValuesChange: (callback: (form: Form) => void) => void;
|
|
7
|
+
export declare const onFormInputChange: (callback: (form: Form) => void) => void;
|
|
8
|
+
export declare const onFormSubmit: (callback: (form: Form) => void) => void;
|
|
9
|
+
export declare const onFormReset: (callback: (form: Form) => void) => void;
|
|
10
|
+
export declare const onFormSubmitStart: (callback: (form: Form) => void) => void;
|
|
11
|
+
export declare const onFormSubmitEnd: (callback: (form: Form) => void) => void;
|
|
12
|
+
export declare const onFormSubmitSuccess: (callback: (form: Form) => void) => void;
|
|
13
|
+
export declare const onFormSubmitFailed: (callback: (form: Form) => void) => void;
|
|
14
|
+
export declare const onFormSubmitValidateStart: (callback: (form: Form) => void) => void;
|
|
15
|
+
export declare const onFormSubmitValidateSuccess: (callback: (form: Form) => void) => void;
|
|
16
|
+
export declare const onFormSubmitValidateFailed: (callback: (form: Form) => void) => void;
|
|
17
|
+
export declare const onFormSubmitValidateEnd: (callback: (form: Form) => void) => void;
|
|
18
|
+
export declare const onFormValidateStart: (callback: (form: Form) => void) => void;
|
|
19
|
+
export declare const onFormValidateSuccess: (callback: (form: Form) => void) => void;
|
|
20
|
+
export declare const onFormValidateFailed: (callback: (form: Form) => void) => void;
|
|
21
|
+
export declare const onFormValidateEnd: (callback: (form: Form) => void) => void;
|
|
22
|
+
export declare const onFormGraphChange: (callback: (form: Form) => void) => void;
|
|
23
|
+
export declare const onFormLoading: (callback: (form: Form) => void) => void;
|
|
24
|
+
export declare function onFormReact(callback?: (form: Form) => void): void;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var onFormEffects_exports = {};
|
|
20
|
+
__export(onFormEffects_exports, {
|
|
21
|
+
onFormGraphChange: () => onFormGraphChange,
|
|
22
|
+
onFormInit: () => onFormInit,
|
|
23
|
+
onFormInitialValuesChange: () => onFormInitialValuesChange,
|
|
24
|
+
onFormInputChange: () => onFormInputChange,
|
|
25
|
+
onFormLoading: () => onFormLoading,
|
|
26
|
+
onFormMount: () => onFormMount,
|
|
27
|
+
onFormReact: () => onFormReact,
|
|
28
|
+
onFormReset: () => onFormReset,
|
|
29
|
+
onFormSubmit: () => onFormSubmit,
|
|
30
|
+
onFormSubmitEnd: () => onFormSubmitEnd,
|
|
31
|
+
onFormSubmitFailed: () => onFormSubmitFailed,
|
|
32
|
+
onFormSubmitStart: () => onFormSubmitStart,
|
|
33
|
+
onFormSubmitSuccess: () => onFormSubmitSuccess,
|
|
34
|
+
onFormSubmitValidateEnd: () => onFormSubmitValidateEnd,
|
|
35
|
+
onFormSubmitValidateFailed: () => onFormSubmitValidateFailed,
|
|
36
|
+
onFormSubmitValidateStart: () => onFormSubmitValidateStart,
|
|
37
|
+
onFormSubmitValidateSuccess: () => onFormSubmitValidateSuccess,
|
|
38
|
+
onFormUnmount: () => onFormUnmount,
|
|
39
|
+
onFormValidateEnd: () => onFormValidateEnd,
|
|
40
|
+
onFormValidateFailed: () => onFormValidateFailed,
|
|
41
|
+
onFormValidateStart: () => onFormValidateStart,
|
|
42
|
+
onFormValidateSuccess: () => onFormValidateSuccess,
|
|
43
|
+
onFormValuesChange: () => onFormValuesChange
|
|
44
|
+
});
|
|
45
|
+
module.exports = __toCommonJS(onFormEffects_exports);
|
|
46
|
+
var import_reactive = require("../../reactive");
|
|
47
|
+
var import_shared = require("../../shared");
|
|
48
|
+
var import_effective = require("../shared/effective");
|
|
49
|
+
var import_types = require("../types");
|
|
50
|
+
function createFormEffect(type) {
|
|
51
|
+
return (0, import_effective.createEffectHook)(type, (form) => (callback) => {
|
|
52
|
+
(0, import_reactive.batch)(() => {
|
|
53
|
+
callback(form);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
__name(createFormEffect, "createFormEffect");
|
|
58
|
+
const onFormInit = createFormEffect(import_types.LifeCycleTypes.ON_FORM_INIT);
|
|
59
|
+
const onFormMount = createFormEffect(import_types.LifeCycleTypes.ON_FORM_MOUNT);
|
|
60
|
+
const onFormUnmount = createFormEffect(import_types.LifeCycleTypes.ON_FORM_UNMOUNT);
|
|
61
|
+
const onFormValuesChange = createFormEffect(import_types.LifeCycleTypes.ON_FORM_VALUES_CHANGE);
|
|
62
|
+
const onFormInitialValuesChange = createFormEffect(import_types.LifeCycleTypes.ON_FORM_INITIAL_VALUES_CHANGE);
|
|
63
|
+
const onFormInputChange = createFormEffect(import_types.LifeCycleTypes.ON_FORM_INPUT_CHANGE);
|
|
64
|
+
const onFormSubmit = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT);
|
|
65
|
+
const onFormReset = createFormEffect(import_types.LifeCycleTypes.ON_FORM_RESET);
|
|
66
|
+
const onFormSubmitStart = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_START);
|
|
67
|
+
const onFormSubmitEnd = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_END);
|
|
68
|
+
const onFormSubmitSuccess = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_SUCCESS);
|
|
69
|
+
const onFormSubmitFailed = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_FAILED);
|
|
70
|
+
const onFormSubmitValidateStart = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_VALIDATE_START);
|
|
71
|
+
const onFormSubmitValidateSuccess = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_VALIDATE_SUCCESS);
|
|
72
|
+
const onFormSubmitValidateFailed = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_VALIDATE_FAILED);
|
|
73
|
+
const onFormSubmitValidateEnd = createFormEffect(import_types.LifeCycleTypes.ON_FORM_SUBMIT_VALIDATE_END);
|
|
74
|
+
const onFormValidateStart = createFormEffect(import_types.LifeCycleTypes.ON_FORM_VALIDATE_START);
|
|
75
|
+
const onFormValidateSuccess = createFormEffect(import_types.LifeCycleTypes.ON_FORM_VALIDATE_SUCCESS);
|
|
76
|
+
const onFormValidateFailed = createFormEffect(import_types.LifeCycleTypes.ON_FORM_VALIDATE_FAILED);
|
|
77
|
+
const onFormValidateEnd = createFormEffect(import_types.LifeCycleTypes.ON_FORM_VALIDATE_END);
|
|
78
|
+
const onFormGraphChange = createFormEffect(import_types.LifeCycleTypes.ON_FORM_GRAPH_CHANGE);
|
|
79
|
+
const onFormLoading = createFormEffect(import_types.LifeCycleTypes.ON_FORM_LOADING);
|
|
80
|
+
function onFormReact(callback) {
|
|
81
|
+
let dispose = null;
|
|
82
|
+
onFormInit((form) => {
|
|
83
|
+
dispose = (0, import_reactive.autorun)(() => {
|
|
84
|
+
if ((0, import_shared.isFn)(callback)) callback(form);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
onFormUnmount(() => {
|
|
88
|
+
dispose();
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
__name(onFormReact, "onFormReact");
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
onFormGraphChange,
|
|
95
|
+
onFormInit,
|
|
96
|
+
onFormInitialValuesChange,
|
|
97
|
+
onFormInputChange,
|
|
98
|
+
onFormLoading,
|
|
99
|
+
onFormMount,
|
|
100
|
+
onFormReact,
|
|
101
|
+
onFormReset,
|
|
102
|
+
onFormSubmit,
|
|
103
|
+
onFormSubmitEnd,
|
|
104
|
+
onFormSubmitFailed,
|
|
105
|
+
onFormSubmitStart,
|
|
106
|
+
onFormSubmitSuccess,
|
|
107
|
+
onFormSubmitValidateEnd,
|
|
108
|
+
onFormSubmitValidateFailed,
|
|
109
|
+
onFormSubmitValidateStart,
|
|
110
|
+
onFormSubmitValidateSuccess,
|
|
111
|
+
onFormUnmount,
|
|
112
|
+
onFormValidateEnd,
|
|
113
|
+
onFormValidateFailed,
|
|
114
|
+
onFormValidateStart,
|
|
115
|
+
onFormValidateSuccess,
|
|
116
|
+
onFormValuesChange
|
|
117
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var core_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(core_exports);
|
|
17
|
+
__reExport(core_exports, require("./shared/externals"), module.exports);
|
|
18
|
+
__reExport(core_exports, require("./models/types"), module.exports);
|
|
19
|
+
__reExport(core_exports, require("./effects"), module.exports);
|
|
20
|
+
__reExport(core_exports, require("./types"), module.exports);
|
|
21
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
22
|
+
0 && (module.exports = {
|
|
23
|
+
...require("./shared/externals"),
|
|
24
|
+
...require("./models/types"),
|
|
25
|
+
...require("./effects"),
|
|
26
|
+
...require("./types")
|
|
27
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FormPathPattern, IFieldProps, JSXComponent } from '../types';
|
|
2
|
+
import { Field } from './Field';
|
|
3
|
+
import { Form } from './Form';
|
|
4
|
+
export declare class ArrayField<Decorator extends JSXComponent = any, Component extends JSXComponent = any> extends Field<Decorator, Component, any, any[]> {
|
|
5
|
+
displayName: string;
|
|
6
|
+
constructor(address: FormPathPattern, props: IFieldProps<Decorator, Component>, form: Form, designable: boolean);
|
|
7
|
+
protected makeAutoCleanable(): void;
|
|
8
|
+
push: (...items: any[]) => Promise<void>;
|
|
9
|
+
pop: () => Promise<void>;
|
|
10
|
+
insert: (index: number, ...items: any[]) => Promise<void>;
|
|
11
|
+
remove: (index: number) => Promise<void>;
|
|
12
|
+
shift: () => Promise<void>;
|
|
13
|
+
unshift: (...items: any[]) => Promise<void>;
|
|
14
|
+
move: (fromIndex: number, toIndex: number) => Promise<void>;
|
|
15
|
+
moveUp: (index: number) => Promise<void>;
|
|
16
|
+
moveDown: (index: number) => Promise<void>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var ArrayField_exports = {};
|
|
20
|
+
__export(ArrayField_exports, {
|
|
21
|
+
ArrayField: () => ArrayField
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(ArrayField_exports);
|
|
24
|
+
var import_reactive = require("../../reactive");
|
|
25
|
+
var import_shared = require("../../shared");
|
|
26
|
+
var import_internals = require("../shared/internals");
|
|
27
|
+
var import_Field = require("./Field");
|
|
28
|
+
const _ArrayField = class _ArrayField extends import_Field.Field {
|
|
29
|
+
constructor(address, props, form, designable) {
|
|
30
|
+
super(address, props, form, designable);
|
|
31
|
+
this.displayName = "ArrayField";
|
|
32
|
+
this.push = /* @__PURE__ */ __name((...items) => {
|
|
33
|
+
return (0, import_reactive.action)(() => {
|
|
34
|
+
if (!(0, import_shared.isArr)(this.value)) {
|
|
35
|
+
this.value = [];
|
|
36
|
+
}
|
|
37
|
+
this.value.push(...items);
|
|
38
|
+
return this.onInput(this.value);
|
|
39
|
+
});
|
|
40
|
+
}, "push");
|
|
41
|
+
this.pop = /* @__PURE__ */ __name(() => {
|
|
42
|
+
if (!(0, import_shared.isArr)(this.value)) return;
|
|
43
|
+
return (0, import_reactive.action)(() => {
|
|
44
|
+
const index = this.value.length - 1;
|
|
45
|
+
(0, import_internals.spliceArrayState)(this, {
|
|
46
|
+
startIndex: index,
|
|
47
|
+
deleteCount: 1
|
|
48
|
+
});
|
|
49
|
+
this.value.pop();
|
|
50
|
+
return this.onInput(this.value);
|
|
51
|
+
});
|
|
52
|
+
}, "pop");
|
|
53
|
+
this.insert = /* @__PURE__ */ __name((index, ...items) => {
|
|
54
|
+
return (0, import_reactive.action)(() => {
|
|
55
|
+
if (!(0, import_shared.isArr)(this.value)) {
|
|
56
|
+
this.value = [];
|
|
57
|
+
}
|
|
58
|
+
if (items.length === 0) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
(0, import_internals.spliceArrayState)(this, {
|
|
62
|
+
startIndex: index,
|
|
63
|
+
insertCount: items.length
|
|
64
|
+
});
|
|
65
|
+
this.value.splice(index, 0, ...items);
|
|
66
|
+
return this.onInput(this.value);
|
|
67
|
+
});
|
|
68
|
+
}, "insert");
|
|
69
|
+
this.remove = /* @__PURE__ */ __name((index) => {
|
|
70
|
+
if (!(0, import_shared.isArr)(this.value)) return;
|
|
71
|
+
return (0, import_reactive.action)(() => {
|
|
72
|
+
(0, import_internals.spliceArrayState)(this, {
|
|
73
|
+
startIndex: index,
|
|
74
|
+
deleteCount: 1
|
|
75
|
+
});
|
|
76
|
+
this.value.splice(index, 1);
|
|
77
|
+
return this.onInput(this.value);
|
|
78
|
+
});
|
|
79
|
+
}, "remove");
|
|
80
|
+
this.shift = /* @__PURE__ */ __name(() => {
|
|
81
|
+
if (!(0, import_shared.isArr)(this.value)) return;
|
|
82
|
+
return (0, import_reactive.action)(() => {
|
|
83
|
+
this.value.shift();
|
|
84
|
+
return this.onInput(this.value);
|
|
85
|
+
});
|
|
86
|
+
}, "shift");
|
|
87
|
+
this.unshift = /* @__PURE__ */ __name((...items) => {
|
|
88
|
+
return (0, import_reactive.action)(() => {
|
|
89
|
+
if (!(0, import_shared.isArr)(this.value)) {
|
|
90
|
+
this.value = [];
|
|
91
|
+
}
|
|
92
|
+
(0, import_internals.spliceArrayState)(this, {
|
|
93
|
+
startIndex: 0,
|
|
94
|
+
insertCount: items.length
|
|
95
|
+
});
|
|
96
|
+
this.value.unshift(...items);
|
|
97
|
+
return this.onInput(this.value);
|
|
98
|
+
});
|
|
99
|
+
}, "unshift");
|
|
100
|
+
this.move = /* @__PURE__ */ __name((fromIndex, toIndex) => {
|
|
101
|
+
if (!(0, import_shared.isArr)(this.value)) return;
|
|
102
|
+
if (fromIndex === toIndex) return;
|
|
103
|
+
return (0, import_reactive.action)(() => {
|
|
104
|
+
(0, import_shared.move)(this.value, fromIndex, toIndex);
|
|
105
|
+
(0, import_internals.exchangeArrayState)(this, {
|
|
106
|
+
fromIndex,
|
|
107
|
+
toIndex
|
|
108
|
+
});
|
|
109
|
+
return this.onInput(this.value);
|
|
110
|
+
});
|
|
111
|
+
}, "move");
|
|
112
|
+
this.moveUp = /* @__PURE__ */ __name((index) => {
|
|
113
|
+
if (!(0, import_shared.isArr)(this.value)) return;
|
|
114
|
+
return this.move(index, index - 1 < 0 ? this.value.length - 1 : index - 1);
|
|
115
|
+
}, "moveUp");
|
|
116
|
+
this.moveDown = /* @__PURE__ */ __name((index) => {
|
|
117
|
+
if (!(0, import_shared.isArr)(this.value)) return;
|
|
118
|
+
return this.move(index, index + 1 >= this.value.length ? 0 : index + 1);
|
|
119
|
+
}, "moveDown");
|
|
120
|
+
this.makeAutoCleanable();
|
|
121
|
+
}
|
|
122
|
+
makeAutoCleanable() {
|
|
123
|
+
this.disposers.push(
|
|
124
|
+
(0, import_reactive.reaction)(
|
|
125
|
+
() => {
|
|
126
|
+
var _a;
|
|
127
|
+
return (_a = this.value) == null ? void 0 : _a.length;
|
|
128
|
+
},
|
|
129
|
+
(newLength, oldLength) => {
|
|
130
|
+
if (oldLength && !newLength) {
|
|
131
|
+
(0, import_internals.cleanupArrayChildren)(this, 0);
|
|
132
|
+
} else if (newLength < oldLength) {
|
|
133
|
+
(0, import_internals.cleanupArrayChildren)(this, newLength);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
)
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
__name(_ArrayField, "ArrayField");
|
|
141
|
+
let ArrayField = _ArrayField;
|
|
142
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
143
|
+
0 && (module.exports = {
|
|
144
|
+
ArrayField
|
|
145
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { FormPath, FormPathPattern } from '../../shared';
|
|
2
|
+
import { FieldComponent, FieldDecorator, FieldDisplayTypes, FieldPatternTypes, IFieldActions, JSXComponent, LifeCycleTypes } from '../types';
|
|
3
|
+
import { Form } from './Form';
|
|
4
|
+
import { Query } from './Query';
|
|
5
|
+
export declare class BaseField<Decorator = any, Component = any, TextType = any> {
|
|
6
|
+
title: TextType;
|
|
7
|
+
description: TextType;
|
|
8
|
+
selfDisplay: FieldDisplayTypes;
|
|
9
|
+
selfPattern: FieldPatternTypes;
|
|
10
|
+
initialized: boolean;
|
|
11
|
+
mounted: boolean;
|
|
12
|
+
unmounted: boolean;
|
|
13
|
+
content: any;
|
|
14
|
+
data: any;
|
|
15
|
+
decoratorType: Decorator;
|
|
16
|
+
decoratorProps: Record<string, any>;
|
|
17
|
+
componentType: Component;
|
|
18
|
+
componentProps: Record<string, any>;
|
|
19
|
+
designable: boolean;
|
|
20
|
+
address: FormPath;
|
|
21
|
+
path: FormPath;
|
|
22
|
+
form: Form;
|
|
23
|
+
disposers: (() => void)[];
|
|
24
|
+
actions: IFieldActions;
|
|
25
|
+
locate(address: FormPathPattern): void;
|
|
26
|
+
get indexes(): number[];
|
|
27
|
+
get index(): number;
|
|
28
|
+
get records(): any[];
|
|
29
|
+
get record(): any;
|
|
30
|
+
get component(): FieldComponent<Component>;
|
|
31
|
+
set component(value: FieldComponent<Component>);
|
|
32
|
+
get decorator(): FieldDecorator<Decorator>;
|
|
33
|
+
set decorator(value: FieldDecorator<Decorator>);
|
|
34
|
+
get parent(): import("..").GeneralField;
|
|
35
|
+
get display(): FieldDisplayTypes;
|
|
36
|
+
get pattern(): FieldPatternTypes;
|
|
37
|
+
get editable(): boolean;
|
|
38
|
+
get disabled(): boolean;
|
|
39
|
+
get readOnly(): boolean;
|
|
40
|
+
get readPretty(): boolean;
|
|
41
|
+
get hidden(): boolean;
|
|
42
|
+
get visible(): boolean;
|
|
43
|
+
get destroyed(): boolean;
|
|
44
|
+
set hidden(hidden: boolean);
|
|
45
|
+
set visible(visible: boolean);
|
|
46
|
+
set editable(editable: boolean);
|
|
47
|
+
set readOnly(readOnly: boolean);
|
|
48
|
+
set disabled(disabled: boolean);
|
|
49
|
+
set readPretty(readPretty: boolean);
|
|
50
|
+
set pattern(pattern: FieldPatternTypes);
|
|
51
|
+
set display(display: FieldDisplayTypes);
|
|
52
|
+
setTitle: (title?: TextType) => void;
|
|
53
|
+
setDescription: (description?: TextType) => void;
|
|
54
|
+
setDisplay: (type?: FieldDisplayTypes) => void;
|
|
55
|
+
setPattern: (type?: FieldPatternTypes) => void;
|
|
56
|
+
setComponent: <C extends unknown, ComponentProps extends object = {}>(component?: C, props?: ComponentProps) => void;
|
|
57
|
+
setComponentProps: <ComponentProps extends object = {}>(props?: ComponentProps) => void;
|
|
58
|
+
setDecorator: <D extends unknown, ComponentProps extends object = {}>(component?: D, props?: ComponentProps) => void;
|
|
59
|
+
setDecoratorProps: <ComponentProps extends object = {}>(props?: ComponentProps) => void;
|
|
60
|
+
setData: (data: any) => void;
|
|
61
|
+
setContent: (content: any) => void;
|
|
62
|
+
onInit: () => void;
|
|
63
|
+
onMount: () => void;
|
|
64
|
+
onUnmount: () => void;
|
|
65
|
+
query: (pattern: FormPathPattern | RegExp) => Query;
|
|
66
|
+
notify: (type: LifeCycleTypes, payload?: any) => void;
|
|
67
|
+
dispose: () => void;
|
|
68
|
+
destroy: (forceClear?: boolean) => void;
|
|
69
|
+
match: (pattern: FormPathPattern) => boolean;
|
|
70
|
+
inject: (actions: IFieldActions) => void;
|
|
71
|
+
invoke: (name: string, ...args: any[]) => any;
|
|
72
|
+
}
|