Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jenesius-vue-form

Package Overview
Dependencies
Maintainers
1
Versions
125
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jenesius-vue-form - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

dist/types/utils/get-next-from-toggle-values.d.ts

2

dist/types/classes/Form.d.ts

@@ -30,2 +30,3 @@ import EventEmitter from "jenesius-event-emitter";

static getEventValueByName(name: string): string;
static getEventAvailabilityByName(name: string): string;
static restoreFullName<T extends {

@@ -142,3 +143,2 @@ name?: string;

get enabled(): boolean;
private getAvailableEventName;
onavailable(callback: (disabled: boolean) => any): any;

@@ -145,0 +145,0 @@ onavailable(fieldName: string, callback: (disabled: boolean) => any): any;

declare const STORE: IStore;
declare type defineInputTypes = 'text' | 'select' | 'radio' | 'checkbox' | 'switch' | 'password' | 'tel' | 'number' | 'range' | 'textarea';
declare type defineInputTypes = 'single-checkbox' | 'single-radio' | 'text' | 'select' | 'radio' | 'checkbox' | 'switch' | 'password' | 'tel' | 'number' | 'range' | 'textarea';
export interface IStore {

@@ -21,4 +21,8 @@ inputTypes: {

};
select: {
countWithoutSearch: number;
searchLabel: string;
};
}
export default STORE;
export declare function getFieldType(type: any): any;
import { StringModify } from "../types";
declare type ModifyParam = undefined | StringModify | Array<StringModify | undefined>;
declare type ModifyParam = undefined | StringModify | Array<StringModify | undefined | Function> | Function;
export default function useModify(callbackModifyProps: () => ModifyParam): (v: unknown) => string;
export {};

@@ -10,3 +10,5 @@ export interface Values {

export declare type ValidationError = string | false;
export declare type FormFieldOptions = OptionRow | Record<string, string>;
export declare type OptionRow = IOptionRowWithLabel | IOptionRowWithTitle;
export declare type ToggleValues = [any, any];
export interface IOptionRowWithLabel {

@@ -13,0 +15,0 @@ label: string;

/**
* @description Функция проходит по всем конечным полям объекта.
* @description Функция проходит по всем конечным элементам объекта.
* @return Array of {path: string[], value: any}

@@ -22,3 +22,5 @@ * @example

path: string[];
name: string;
set: (x: any) => void;
}
export {};

@@ -0,1 +1,7 @@

/**
* @description Проверяет является parentName родителем для childrenName.
* @example
* parent:address или address.city или address.city.index
* children: address.city.index
* */
export default function checkCompositeName(parentName: string, childrenName: string): boolean;

@@ -41,3 +41,3 @@ export interface CompareItem {

* [
* { name: 'coordinate', newValue: { x: 1, y: 2 }, oldValue: { x: 1, y: 2 } },
* { name: 'coordinate', newValue: { x: 1, y: 2 }, oldValue: { x: 1 } },
* { name: 'coordinate.y', newValue: 2, oldValue: undefined }

@@ -44,0 +44,0 @@ * ]

@@ -1,1 +0,1 @@

export default function findNearestNameFromArray<T extends string>(name: string, array: T[]): T | undefined;
export default function findNearestNameFromArray<T extends string>(array: T[], name: string): T | undefined;

@@ -1,1 +0,1 @@

export default function findNearestPrefixFromArray<T extends string>(name: string, arrayPrefixes: T[]): T | undefined;
export default function findNearestPrefixFromArray<T extends string>(arrayPrefixes: T[], name: string): T | undefined;

@@ -8,3 +8,2 @@ /**

* */
export default function grandObject(object: any, data?: any): any;
export declare function grandValue(name: string, value: any): any;
export default function grandObject(object: any): {};

@@ -6,3 +6,4 @@ /**

* @example position.city.type city -> false
* @example name name -> false
* */
export default function isPrefixName(fieldName: string, prefix: string): boolean;
import { Values } from "../types";
/**
* @description Метод вернёт новый объект, заменив все примитивные значения.
* на переданный аргумент.
*
* @warning Не заменит объект на объект, а поменяет все !isIterablePoint на переданное значение.
* */
export default function replaceValues(object: Values, value?: any): any;
import bypassObject from "./bypass-object";
import checkCompositeName from "./check-composite-name";
import checkDeepValue from "./check-deep-value";
import checkNameInObject from "./check-name-in-object";

@@ -14,3 +13,2 @@ import checkPrimitiveValue from "./check-primitive-value";

import findNearestPrefixFromArray from "./find-nearest-prefix-from-array";
import generateFieldByPath from "./generate-field-by-path";
import getCastObject from "./get-cast-object";

@@ -22,5 +20,3 @@ import getLabelFromOptionRow from "./get-label-from-option-row";

import isEmptyObject from "./is-empty-object";
import isEndPointValue from "./is-end-point-value";
import isPrefixName from "./is-prefix-name";
import iterateEndpoint from "./iterate-endpoint";
import iteratePoints from "./iterate-points";

@@ -39,3 +35,2 @@ import mergeObjects from "./merge-objects";

checkCompositeName: typeof checkCompositeName;
checkDeepValue: typeof checkDeepValue;
checkNameInObject: typeof checkNameInObject;

@@ -52,3 +47,2 @@ checkPrimitiveValue: typeof checkPrimitiveValue;

findNearestPrefixFromArray: typeof findNearestPrefixFromArray;
generateFieldByPath: typeof generateFieldByPath;
getCastObject: typeof getCastObject;

@@ -60,5 +54,3 @@ getLabelFromOptionRow: typeof getLabelFromOptionRow;

isEmptyObject: typeof isEmptyObject;
isEndPointValue: typeof isEndPointValue;
isPrefixName: typeof isPrefixName;
iterateEndpoint: typeof iterateEndpoint;
iteratePoints: typeof iteratePoints;

@@ -65,0 +57,0 @@ mergeObjects: typeof mergeObjects;

{
"name": "jenesius-vue-form",
"version": "3.0.0",
"version": "3.0.1",
"description": "Heavy form system for Vue.js",

@@ -5,0 +5,0 @@ "type": "module",

@@ -12,4 +12,3 @@ <p align="center"><a href="https://form.jenesius.com/" target="_blank" rel="noopener noreferrer"><img height="100" src="https://form.jenesius.com/images/logo.svg" alt="Vue logo"></a></p>

# Jenesius Vue Form
Heavy form system for Vue.js ( **Only 3 Version** ). Library provides a wide range of
functionality and interaction with form elements.
Powerful system for working with forms and inputs. The deep library integrates with Vue (**3 version only**) and provides a large set of tools for working with forms.

@@ -16,0 +15,0 @@ ## Documentation

@@ -14,3 +14,5 @@ import bypassObject from "../../../src/utils/bypass-object";

path: ['name'],
value: 'Jenesius'
value: 'Jenesius',
name: 'name',
set: expect.any(Function)
}

@@ -34,3 +36,5 @@ ])

path: ['address', 'city', 'index'],
value: 11011
value: 11011,
name: "address.city.index",
set: expect.any(Function)
}

@@ -57,7 +61,11 @@ ])

path: ['person', 'profile', 'head', 'mouth'],
value: 1
value: 1,
name: "person.profile.head.mouth",
set: expect.any(Function)
},
{
path: ['person', 'profile', 'head', 'eyes'],
value: 2
value: 2,
name: "person.profile.head.eyes",
set: expect.any(Function)
}

@@ -75,3 +83,5 @@ ])

path: ['address','name'],
value: null
value: null,
name: "address.name",
set: expect.any(Function)
}

@@ -81,3 +91,90 @@ ])

})
test("One field iteration", () => {
const values = {
name: 'test'
}
expect(bypassObject(values)).toEqual([
{
value: 'test',
path: ['name'],
name: 'name',
set: expect.any(Function)
}
])
})
test("Deepen object", () => {
jest.fn()
const values = {
address: {
city: "Berlin"
}
}
// .map(a => ({value: a.value, path: a.path}))
expect(bypassObject(values)).toEqual(
[
{
value: 'Berlin',
path: ['address', 'city'],
name: 'address.city',
set: expect.any(Function)
}
]
)
})
test("Setting values", () => {
const values = {
a: 1,
b: 2,
c: 3
}
const array = bypassObject(values).map(a => ++a.value);
expect(array).toEqual([2,3,4])
})
test('Values of data', () => {
const values = {
a: 1,
b: "Jenesius",
c: 1
}
expect(bypassObject(values).map(a => a.value)).toEqual([1, "Jenesius", 1])
})
test("plain name", () => {
const values = {
"address.city": "Berlin"
}
expect(bypassObject(values)).toEqual(
[
{
value: 'Berlin',
path: ["address", "city"],
name: "address.city",
set: expect.any(Function)
}
]
)
})
test("Should return empty array for empty object", () =>{
expect(bypassObject({})).toEqual([]);
})
test("Should return array with length 2, for object with two empty props", () => {
expect(bypassObject({
address: {},
value: {}
})).toEqual([
{
path: ["address"],
name: "address",
value: {},
set: expect.any(Function)
},
{
path: ["value"],
name: "value",
value: {},
set: expect.any(Function)
}
])
} )
})

@@ -17,3 +17,10 @@ import checkCompositeName from "../../../src/utils/check-composite-name";

})
test("Should return true if Equal", () => expect(checkCompositeName("address.city", "address.city")).toBe(true))
test("Should return true if start with", () => expect(checkCompositeName( "address.city", "address.city.index")).toBe(true))
test("Should return false if not full start with", () => expect(checkCompositeName("address.name", "address.city")).toBe(false))
test("Should return false if dont start with", () => expect(checkCompositeName("index", "address.city")).toBe(false))
test("Should return false if start with but is not part of name", () => expect(checkCompositeName("address.cityMol", "address.city")).toBe(false))
test("Should return false if parent not full start with", () => expect(checkCompositeName("address.cit", "address.city")).toBe(false))
test("Should return false if child dont start with parent", () => expect(checkCompositeName("city", "address.city")).toBe(false))
})

@@ -7,15 +7,15 @@ import findNearestNameFromArray

test("Name is founded.", () => {
expect(findNearestNameFromArray('address.city', ['city', 'address'])).toBe('address')
expect(findNearestNameFromArray(['city', 'address'], 'address.city' )).toBe('address')
})
test("Name not founded", () => {
expect(findNearestNameFromArray('address.city', ['a', 'b', 'city', 'addre'])).toBe(undefined)
expect(findNearestNameFromArray(['a', 'b', 'city', 'addre'], 'address.city')).toBe(undefined)
})
test("Founded more nearest", () => {
expect(findNearestNameFromArray('address.city.name', ['address', 'city', 'address.city'])).toBe('address.city');
expect(findNearestNameFromArray(['address', 'city', 'address.city'], 'address.city.name')).toBe('address.city');
})
test("Founded more nearest", () => {
expect(findNearestNameFromArray('address.city.name', ['address.city', 'address', 'city'])).toBe('address.city');
expect(findNearestNameFromArray(['address.city', 'address', 'city'], 'address.city.name' )).toBe('address.city');
})
})

@@ -6,15 +6,15 @@ import findNearestPrefixFromArray from "../../../src/utils/find-nearest-prefix-from-array";

test("Name is founded.", () => {
expect(findNearestPrefixFromArray('address.city', ['city', 'address', 'address.city'])).toBe('address')
expect(findNearestPrefixFromArray(['city', 'address', 'address.city'], 'address.city' )).toBe('address')
})
test("Name not founded", () => {
expect(findNearestPrefixFromArray('address.city', ['a', 'b', 'city', 'addre'])).toBe(undefined)
expect(findNearestPrefixFromArray(['a', 'b', 'city', 'addre'], 'address.city' )).toBe(undefined)
})
test("Founded more nearest", () => {
expect(findNearestPrefixFromArray('address.city.name', ['address', 'city', 'address.city'])).toBe('address.city');
expect(findNearestPrefixFromArray(['address', 'city', 'address.city'], 'address.city.name')).toBe('address.city');
})
test("Founded more nearest with other order", () => {
expect(findNearestPrefixFromArray('address.city.name', ['address.city', 'address', 'city'])).toBe('address.city');
expect(findNearestPrefixFromArray(['address.city', 'address', 'city'], 'address.city.name')).toBe('address.city');
})
})

@@ -19,2 +19,8 @@ import {parseNumber} from "../../../src/utils/parse-number";

})
test("Float number", () => {
expect(parseNumber("13123.10")).toBe(13123.10)
})
test("Float number with comma", () =>{
expect(parseNumber("123,15")).toBe(123.15);
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc