Skip to content

Commit

Permalink
Merge pull request #1681 from xaylpq/2.1/feature/1003850
Browse files Browse the repository at this point in the history
[#1003850] add text masks
  • Loading branch information
stasguryev committed Dec 3, 2021
2 parents bbcfeb8 + e46277d commit 855d9fb
Show file tree
Hide file tree
Showing 12 changed files with 270 additions and 65 deletions.
5 changes: 5 additions & 0 deletions demo/app/DemoConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export default {
displayName: 'Form using form behaviour',
description: 'Form using form behaviour'
},
{
id: 'TextMasks',
displayName: 'Text masks',
description: 'Text masks'
},
{
id: 'TabLayout',
displayName: 'Tab Layout',
Expand Down
106 changes: 106 additions & 0 deletions demo/app/cases/components/TextMasks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import CanvasView from 'demoPage/views/CanvasView';

export default function() {
// 1. Create form template
const template =
'<div data-fields="tel"></div>' +
'<div data-fields="passport"></div>' +
'<div data-fields="index"></div>' +
'<div data-fields="inn"></div>' +
'<div data-fields="ogrn"></div>' +
'<div data-fields="carnumber"></div>' +
'<div data-fields="email"></div>';

// 2. Create form model
const model = new Backbone.Model({
tel: undefined,
passport: undefined,
index: undefined,
inn: undefined,
ogrn: undefined,
carnumber: undefined,
email: undefined
});

// 3. Create view with BackboneFormBehavior and construct form scheme
const View = Marionette.View.extend({
className: 'layout__vertical-layout',

template: Handlebars.compile(template),

behaviors: {
BackboneFormBehavior: {
model,
behaviorClass: Core.form.behaviors.BackboneFormBehavior,
transliteratedFields: {
name: 'alias'
}, // transliteratedFields becomes required-like, and overwrite next property in schema { changeMode: 'blur', autocommit: true, forceCommit: true}
schema() {
return {
tel: {
title: 'tel',
type: 'Text',
helpText: 'Some help information',
autocommit: true,
format: 'PhoneRuMask',
allowEmptyValue: true //turn off required-like behavior for name
},
passport: {
title: 'passport',
type: 'Text',
helpText: 'Some help information',
autocommit: true,
format: 'PassportRuMask',
allowEmptyValue: true //turn off required-like behavior for name
},
index: {
title: 'index',
type: 'Text',
helpText: 'Some help information',
autocommit: true,
format: 'IndexRuMask',
allowEmptyValue: true //turn off required-like behavior for name
},
inn: {
title: 'inn',
type: 'Text',
helpText: 'Some help information',
autocommit: true,
format: 'INNMask',
allowEmptyValue: true //turn off required-like behavior for name
},
ogrn: {
title: 'ogrn',
type: 'Text',
helpText: 'Some help information',
autocommit: true,
format: 'OGRNMask',
allowEmptyValue: true //turn off required-like behavior for name
},
carnumber: {
title: 'carnumber',
type: 'Text',
helpText: 'Some help information',
autocommit: true,
format: 'LicensePlateNumberRuMask',
allowEmptyValue: true //turn off required-like behavior for name
},
email: {
title: 'email',
type: 'Text',
helpText: 'Some help information',
autocommit: true,
format: 'EmailMask',
allowEmptyValue: true //turn off required-like behavior for name
}
};
}
}
}
});

// 4. Show created view
return new CanvasView({
view: new View({ model })
});
}
2 changes: 1 addition & 1 deletion dist/localization/localization.de.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/localization/localization.en.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/localization/localization.ru.json

Large diffs are not rendered by default.

42 changes: 41 additions & 1 deletion localization/localization.n3
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,47 @@

<http://comindware.com/text/core/form/editors/textEditor#disablePlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:createdBy ""; l10n:modifiedBy "Alexey Prykin"; l10n:creationDate "2015-07-14T06:49:47.9940740Z"; l10n:modificationDate "2015-07-31T11:55:18.7632797Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Field is disabled"].

<http://comindware.com/text/core/form/editors/textEditor#emailPlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy ""; l10n:modifiedBy ""; l10n:creationDate "2018-09-29T16:30:04.2640482Z"; l10n:modificationDate "2018-09-29T16:30:07.0212267Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter email"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].
<http://comindware.com/text/core/form/editors/textEditor#emailErrorMessageExpression> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-23T13:26:47.6713548Z"; l10n:modificationDate "2021-11-23T13:27:04.1233877Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter the e-mail address in @.* format"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#emailPlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-26T16:26:33.7429953Z"; l10n:modificationDate "2021-11-26T16:27:13.9220695Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "ivanov@comindware.com"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#emailRegexp> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-25T15:20:32.9275443Z"; l10n:modificationDate "2021-11-25T15:20:34.4695473Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "^(([a-zа-я0-9_-]+\\.)*[a-zа-я0-9_-]+@[a-zа-я0-9-]+(\\.[a-zа-я0-9-]+)*\\.[a-zа-я]{2,6})?$"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#indexMessageExpression> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-23T13:51:01.6341809Z"; l10n:modificationDate "2021-11-23T13:51:48.2282984Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter the postal code in 000000 format"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#indexPlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-26T16:28:09.3250702Z"; l10n:modificationDate "2021-11-26T16:28:17.8720994Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "000000"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#indexRegexp> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-25T15:16:52.6452732Z"; l10n:modificationDate "2021-11-25T15:16:54.6802776Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "([0-9]{6})"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#innMessageExpression> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-23T13:48:35.1409026Z"; l10n:modificationDate "2021-11-23T13:48:46.5159232Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter INN in 000000000099 format"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#innPlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-26T16:29:27.1051286Z"; l10n:modificationDate "2021-11-26T16:29:29.1261288Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "000000000099"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#innRegexp> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-25T15:15:47.6781576Z"; l10n:modificationDate "2021-11-25T15:15:55.7161721Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "(([0-9]{12})|([0-9]{10}))"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#licensePlateErrorMessageExpression> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-23T13:39:35.4288784Z"; l10n:modificationDate "2021-11-25T15:10:46.2856012Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter license plate number in А999АА 099 format"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#licensePlatePlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-26T16:31:57.7933842Z"; l10n:modificationDate "2021-11-26T16:32:36.7924413Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "A 000 AA 000"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#licensePlateRegexp> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-25T15:10:29.2285701Z"; l10n:modificationDate "2021-11-25T15:11:56.0977345Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "([АВЕКМНОРСТУХавекмнорстух]{1}[0-9]{3}[АВЕКМНОРСТУХавекмнорстух]{2} [0-9]{3})"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#ogrnMessageExpression> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-23T13:45:58.4666043Z"; l10n:modificationDate "2021-11-23T13:46:38.0456796Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter OGRN in the 0000000000000 format"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#ogrnPlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-26T16:33:59.5774355Z"; l10n:modificationDate "2021-11-26T16:34:01.5344364Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "0000000000000"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#ogrnRegexp> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-25T15:14:15.6279906Z"; l10n:modificationDate "2021-11-25T15:14:31.3860212Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "([0-9]{13})"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#passportMessageExpression> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-23T13:59:50.7361411Z"; l10n:modificationDate "2021-11-23T14:01:05.1643043Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter the passport series and number in 0000 000000 format"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#passportPlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-26T16:34:46.0124793Z"; l10n:modificationDate "2021-11-26T16:34:47.3964805Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "0000 000000"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#passportRegexp> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-25T15:17:53.3383843Z"; l10n:modificationDate "2021-11-25T15:17:55.1103868Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "([0-9]{4} [0-9]{6})"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#phoneMessageExpression> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-23T14:03:00.5094845Z"; l10n:modificationDate "2021-11-23T14:04:26.1656370Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter phone number in +7 (999) 999-99-99 format"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#phonePlaceholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-26T16:35:58.0744832Z"; l10n:modificationDate "2021-11-26T16:35:59.6604841Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "+7 (999) 999-99-99"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#phoneRegexp> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:needsReview true; l10n:createdBy "Anatoly Vasilkov"; l10n:modifiedBy "Anatoly Vasilkov"; l10n:creationDate "2021-11-25T15:19:03.2045086Z"; l10n:modificationDate "2021-11-25T15:19:49.3914679Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "(\\+7 \\([0-9]{3}\\) [0-9]{3}-[0-9]{2}-[0-9]{2})"; l10n:originalData "{62D69EB8-800C-480F-9571-E11F3DF477C0}"].

<http://comindware.com/text/core/form/editors/textEditor#placeholder> a l10n:Resource; l10n:descr ""; l10n:isLocalizable true; l10n:createdBy ""; l10n:modifiedBy "Alexey Prykin"; l10n:creationDate "2015-07-14T06:48:49.4222174Z"; l10n:modificationDate "2015-07-30T12:59:01.8417384Z"; l10n:text [a l10n:Text; l10n:lang l10n:en; l10n:data "Enter text here"].

Expand Down
Loading

0 comments on commit 855d9fb

Please sign in to comment.