bem-contrib / bem-forms Goto Github PK
View Code? Open in Web Editor NEWForms building library on BEM methogology
Forms building library on BEM methogology
If i add new field, form don't know about it and validation don't work
Проблемы при пробрасывании положения popup
. Как-то надо этот момент порешать. Положение у popup
, стили у message
, нужны стили от message
на положение popup
Block label
is for add labels to controls in some standard way.
Common mod for validate field value
Mod values
Need: message || DEFAULT_MESSAGE
Card validation returns wrong_length error for 16 digits.
All error messages should be objects (?) or strings
Normalize all validators:
We should refine this interface and move it out to separate element which be used by form.
Some guesses for name:
form__tuple
form__key-value
form__name-value
This one can be a BEM-block with a simple interface:
{*} getVal()
void setVal({*})
{string|Object} getName()
Do we need something else here?
It will be used as a base interface for form__field
/__control
blocks.
Depend on bem/bem-components#1379
jshint, jscs, npm run lint
Mix message on popup
message
block), depend on #1Очень часто форма используется с multipart/form-data
{
block : 'form',
tag : 'form',
attrs : {
action : '/posts/',
enctype : 'multipart/form-data',
method : 'post'
},
content : []
}
We using it as a mix for input
(or similar) blocks right now:
{
block : 'input',
mods : { theme : 'islands' },
mix : [
{ block : 'form', elem : 'control' },
{ block : 'validation', mods : { numbers : true }, js : {/* validation params */} }
]
}
There is a lot of data that we should pass for each field and I really want to simplify it if possible.
Any guesses will help a lot.
The one that placed on the top of my mind probably have troubles with theme deps:
{
elem : 'control',
mods : { type : 'text', theme : 'islands', size : 'l', validation : 'numbers' },
js : { validation : { /* validation params */ } }
}
control_validation_numbers
will require validation_numbers
block, form__control_type_text
will require input
and input_type_text
, and form__control_theme_islands
will require input_theme_islands
. Right?
Also it can internally regenerate the rest of needed bemjson by BH/BEMHTML but I'm afraid of missing deps here and need review.
I think that's all validation
block needed to return some validation result. All other work with form should be placed in form_validation
.
Block message
is for show validation errors and other messages.
.form-field__message
vs .form__field-message
or .form__field .form__message
or form__field_with-message
form-field_type_input
vs form__field_type_input
form-field__control
vs form__control
etc.
null val is 0
form_simple
will search for form__control
s and provide all of them to validation
block or user's code. Also it will provide all of data from them.form_fielded
will search for form__field
(complex proxy blocks) with the same interface that will provide already assembled data from from__control
s that assigned to __field
s.form
's elements.It will allow us to make flexible form variator that can be extended in future with other helpers, interfaces and form types. Any abandoned ideas will be moved out with new releases. Simple.
Why do we need has-validate
mod on form-field? The same thing is denoted by the presence of validate
mod...
Moreover, I think it would be better to setup validators not through mods, but with a parameter, and support multiple validators, the example interface could be:
{
block : 'form-field',
validators : [
{
type : 'required',
message : 'Введите номер карты' // could contain error message
},
'card', // could be just string
{
type : 'regex',
pattern : /^4.*/, // could contain extra parameters
message : 'Тип карты не поддерживается'
}
]
}
Validations types is mods. Info about this method
depend for #12
{
block : 'form-field',
name : 'lastName',
content : []
}
Fix formField.getName()
On project level overriding is very bad. I need info about base events and disable its, then write custom events.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.