jenesius-vue-form
Advanced tools
Comparing version 2.1.15 to 2.2.0
import EventEmitter from "jenesius-event-emitter"; | ||
import { FormDependence, FunctionHandleData, Values } from "../types"; | ||
import { FormDependence, FunctionHandleData, Value, Values } from "../types"; | ||
import { IComparisonResult } from "../utils/search-changes-by-comparison"; | ||
export default class Form extends EventEmitter implements FormDependence { | ||
@@ -14,2 +15,4 @@ #private; | ||
static EVENT_UPDATE_ABILITY: string; | ||
static EVENT_INPUT: string; | ||
static GET_EVENT_FIELD_INPUT(name: string): string; | ||
/** | ||
@@ -53,3 +56,11 @@ * @description Вызывается всякий раз, когда форма была изменена. Внимание! | ||
get values(): any; | ||
set values(a: any); | ||
/** | ||
* @description Notify about input event all provided changes. | ||
*/ | ||
private notifyInputs; | ||
set values(newValues: any); | ||
/** | ||
* @description Method used for set values. New values don't overwrite previous, Mixing, GrandValues used for this. | ||
* */ | ||
setValues(values?: Values): void; | ||
get debug(): boolean; | ||
@@ -63,2 +74,8 @@ constructor(params?: FormParams); | ||
/** | ||
* @description Callback triggers each time when input[name] was changed. Callback function get just one parameter: | ||
* newValue. | ||
* */ | ||
oninput(callback: (state: IComparisonResult) => void): any; | ||
oninput(name: string, callback: (newValue?: Value, oldValue?: Value) => void): any; | ||
/** | ||
* Рекурсивное изменение значений. | ||
@@ -97,6 +114,2 @@ * В конечной реализации оно нихуя не рекурсивное. | ||
/** | ||
* @description Установка новых значений формы. | ||
* */ | ||
setValues(values?: Values): void; | ||
/** | ||
* @description Method using for clear field. Dont set NULL. Remove field | ||
@@ -103,0 +116,0 @@ * from values. |
@@ -9,3 +9,4 @@ export default class FormErrors extends Error { | ||
static ComputedValueWithoutName(): FormErrors; | ||
static MergingObjectGotPrimitiveValue(): void; | ||
static ProvidedValueNotObject(object: any): FormErrors; | ||
static CallbackIsNotProvided(): FormErrors; | ||
} |
import Form from "../classes/Form"; | ||
export default function useFormState(form: Form): { | ||
changed: boolean; | ||
disabled: boolean; | ||
state: { | ||
@@ -4,0 +6,0 @@ changed: boolean; |
import Form from "./classes/Form"; | ||
import FormProxy from "./classes/FormProxy"; | ||
import useFormState from "./hooks/use-form-state"; | ||
import useFormValues from "./hooks/use-form-values"; | ||
import useInputState from "./hooks/use-input-state"; | ||
@@ -11,2 +12,2 @@ import useProxyState from "./hooks/use-proxy-state"; | ||
import utils from "./utils/utils"; | ||
export { Form, FormProxy, useProxyState, useInputState, useFormState, InputField, config, STORE, ComputedValue, utils }; | ||
export { Form, FormProxy, useProxyState, useInputState, useFormState, useFormValues, InputField, config, STORE, ComputedValue, utils }; |
{ | ||
"name": "jenesius-vue-form", | ||
"version": "2.1.15", | ||
"version": "2.2.0", | ||
"description": "Heavy form system for Vue.js", | ||
@@ -5,0 +5,0 @@ "author": "Jenesius", |
@@ -26,2 +26,22 @@ import ComputedValue from "../../plugin/methods/ComputedValue"; | ||
}) | ||
test("Hard computed name", () => { | ||
const form = new Form(); | ||
const test = ComputedValue(form, "address.name"); | ||
form.change({ | ||
address: { | ||
city: "1" | ||
} | ||
}) | ||
form.setValues({ | ||
address: { | ||
name: { | ||
code: 1 | ||
} | ||
} | ||
}) | ||
expect(test.value).toEqual({code: 1}) | ||
}) | ||
}) |
@@ -63,3 +63,4 @@ import mergeObjects from "../../plugin/utils/merge-objects"; | ||
}) | ||
}) |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
155309
67
3966