CreditCardExample/models/CreditCardProps.js
2023-08-31 09:01:31 -06:00

372 lines
8.6 KiB
JavaScript

const CreditCardProps = () => {
return [
{
text: "Name",
i18n: "",
value: "name",
listName: "",
listNameParams: "",
class: " ",
headerClass: "w-36",
disableOnEdit: false,
disableOnNew: false,
isKey: null,
defaultValue: "",
showInForm: true,
showInTable: false,
showAsBadge: false,
icon: "",
iconClass: "via-detalle-datatable",
badgeClass: "via-badge-datatable",
toLocation: "",
fromLocation: "",
fromTitle: "",
isFilter: false,
type: "string",
label: "Name",
filterOrder: 0,
filterType: "list",
filterSort: "ascending",
isSearchable: true,
isClearable: true,
isGroup: false,
isMulti: false,
useSpeechToText: false,
id: "field_name",
fieldId: 1,
fieldOrder: 1,
docType: "img",
formClass: "col-span-2",
countFormatDef: 1,
countInputProps: 1,
countChangeDef: 0,
countPristineMsg: 1,
formatDefinition: {"action":"format","value":"uppercase"},
onChangeDefinition: {},
pristineMessages: {"required":"common.ruleRequired","pattern":null,"minlength":null,"maxlength":null},
inputProps: {"type":"text","autoComplete":"off"},
fixedListParams: [],
mappingRules: [],
fileNameParts: [],
fileExtensionParts: [],
valor: "name",
texto: "Name",
classItem: null,
substituteVal: null,
format: null,
chosen: false,
selected: false,
onChange: null
}, {
text: "Card Number",
i18n: "",
value: "card_number",
listName: "",
listNameParams: "",
class: " text-right ",
headerClass: "w-36",
disableOnEdit: false,
disableOnNew: false,
isKey: null,
defaultValue: "",
showInForm: true,
showInTable: false,
showAsBadge: false,
icon: "",
iconClass: "via-detalle-datatable",
badgeClass: "via-badge-datatable",
toLocation: "",
fromLocation: "",
fromTitle: "",
isFilter: false,
type: "number",
label: "Card Number",
filterOrder: 0,
filterType: "list",
filterSort: "ascending",
isSearchable: true,
isClearable: true,
isGroup: false,
isMulti: false,
useSpeechToText: false,
id: "field_card_number",
fieldId: 2,
fieldOrder: 2,
docType: "img",
formClass: "col-span-2",
countFormatDef: 0,
countInputProps: 1,
countChangeDef: 0,
countPristineMsg: 1,
formatDefinition: {},
onChangeDefinition: {},
pristineMessages: {"required":"common.ruleRequired","pattern":null,"minlength":null,"maxlength":null},
inputProps: {"type":"number","autoComplete":"off", required: true},
fixedListParams: [],
mappingRules: [],
fileNameParts: [],
fileExtensionParts: [],
valor: "card_number",
texto: "Card Number",
classItem: null,
substituteVal: null,
format: null,
chosen: false,
selected: false,
onChange: null,
imask: {
mask: [
{
mask: '0000 000000 00000',
regex: '^3[47]\\d{0,13}',
cardtype: 'american express'
},
{
mask: '0000 0000 0000 0000',
regex: '^(?:6011|65\\d{0,2}|64[4-9]\\d?)\\d{0,12}',
cardtype: 'discover'
},
{
mask: '0000 000000 0000',
regex: '^3(?:0([0-5]|9)|[689]\\d?)\\d{0,11}',
cardtype: 'diners'
},
{
mask: '0000 0000 0000 0000',
regex: '^(5[1-5]\\d{0,2}|22[2-9]\\d{0,1}|2[3-7]\\d{0,2})\\d{0,12}',
cardtype: 'mastercard'
},
// {
// mask: '0000-0000-0000-0000',
// regex: '^(5019|4175|4571)\\d{0,12}',
// cardtype: 'dankort'
// },
// {
// mask: '0000-0000-0000-0000',
// regex: '^63[7-9]\\d{0,13}',
// cardtype: 'instapayment'
// },
{
mask: '0000 000000 00000',
regex: '^(?:2131|1800)\\d{0,11}',
cardtype: 'jcb15'
},
{
mask: '0000 0000 0000 0000',
regex: '^(?:35\\d{0,2})\\d{0,12}',
cardtype: 'jcb'
},
{
mask: '0000 0000 0000 0000',
regex: '^(?:5[0678]\\d{0,2}|6304|67\\d{0,2})\\d{0,12}',
cardtype: 'maestro'
},
// {
// mask: '0000-0000-0000-0000',
// regex: '^220[0-4]\\d{0,12}',
// cardtype: 'mir'
// },
{
mask: '0000 0000 0000 0000',
regex: '^4\\d{0,15}',
cardtype: 'visa'
},
{
mask: '0000 0000 0000 0000',
regex: '^62\\d{0,14}',
cardtype: 'unionpay'
},
{
mask: '0000 0000 0000 0000',
cardtype: 'Unknown'
}
],
dispatch: function (appended, dynamicMasked) {
var number = (dynamicMasked.value + appended).replace(/\D/g, '');
for (var i = 0; i < dynamicMasked.compiledMasks.length; i++) {
let re = new RegExp(dynamicMasked.compiledMasks[i].regex);
if (number.match(re) != null) {
return dynamicMasked.compiledMasks[i];
}
}
}
}
}, {
text: "Expiration (mm/yy)",
i18n: "",
value: "expiration_date",
listName: "",
listNameParams: "",
class: " text-right ",
headerClass: "w-36",
disableOnEdit: false,
disableOnNew: false,
isKey: null,
defaultValue: "",
showInForm: true,
showInTable: false,
showAsBadge: false,
icon: "",
iconClass: "via-detalle-datatable",
badgeClass: "via-badge-datatable",
toLocation: "",
fromLocation: "",
fromTitle: "",
isFilter: false,
type: "number",
label: "Expiration (mm/yy)",
filterOrder: 0,
filterType: "list",
filterSort: "ascending",
isSearchable: true,
isClearable: true,
isGroup: false,
isMulti: false,
useSpeechToText: false,
id: "field_expiration_date",
fieldId: 3,
fieldOrder: 3,
docType: "img",
formClass: null,
countFormatDef: 0,
countInputProps: 1,
countChangeDef: 0,
countPristineMsg: 1,
formatDefinition: {},
onChangeDefinition: {},
pristineMessages: {"required":"common.ruleRequired","pattern":null,"minlength":null,"maxlength":null},
inputProps: {"type":"number","autoComplete":"off", required: true},
fixedListParams: [],
mappingRules: [],
fileNameParts: [],
fileExtensionParts: [],
valor: "expiration_date",
texto: "Expiration (mm/yy)",
classItem: null,
substituteVal: null,
format: null,
chosen: false,
selected: false,
onChange: null,
imask: {
mask: [
{
mask: 'MY{/}YY',
startsWith: '0',
definitions: {
'Y': /[1-9]/,
'M': /[0-1]/,
'N': /[0-2]/
}
},
{
mask: 'MN{/}YY',
startsWith: '1',
definitions: {
'Y': /[1-9]/,
'M': /[0-1]/,
'N': /[0-2]/
}
},
{
mask: 'MY{/}YY',
startsWith: '',
definitions: {
'Y': /[1-9]/,
'M': /[0-1]/,
'N': /[0-2]/
}
}
],
dispatch: (appended, dynamicMasked) => {
const number = (dynamicMasked.value + appended).replace(/\D/g,'');
return dynamicMasked.compiledMasks.find(m => number.indexOf(m.startsWith) === 0);
}
}
// IMask(element, {
// mask: 'Ple\\ase fill ye\\ar 19YY, month MM \\and v\\alue VL',
// lazy: false, // make placeholder always visible
// blocks: {
// YY: {
// mask: '00',
// },
// MM: {
// mask: IMask.MaskedRange,
// from: 1,
// to: 12
// },
// VL: {
// mask: IMask.MaskedEnum,
// enum: ['TV', 'HD', 'VR']
// }
// }
// })
}, {
text: "Security Code",
i18n: "",
value: "security_code",
listName: "",
listNameParams: "",
class: " text-right ",
headerClass: "w-36",
disableOnEdit: false,
disableOnNew: false,
isKey: null,
defaultValue: "",
showInForm: true,
showInTable: false,
showAsBadge: false,
icon: "",
iconClass: "via-detalle-datatable",
badgeClass: "via-badge-datatable",
toLocation: "",
fromLocation: "",
fromTitle: "",
isFilter: false,
type: "number",
label: "Security Code",
filterOrder: 0,
filterType: "list",
filterSort: "ascending",
isSearchable: true,
isClearable: true,
isGroup: false,
isMulti: false,
useSpeechToText: false,
id: "field_security_code",
fieldId: 4,
fieldOrder: 4,
docType: "img",
formClass: null,
countFormatDef: 0,
countInputProps: 1,
countChangeDef: 0,
countPristineMsg: 1,
formatDefinition: {},
onChangeDefinition: {},
pristineMessages: {"required":"common.ruleRequired","pattern":null,"minlength":null,"maxlength":null},
inputProps: {"type":"number","autoComplete":"off", required: true},
fixedListParams: [],
mappingRules: [],
fileNameParts: [],
fileExtensionParts: [],
valor: "security_code",
texto: "Security Code",
classItem: null,
substituteVal: null,
format: null,
chosen: false,
selected: false,
onChange: null,
imask: {
mask: '0000',
}
}
]
}
export default CreditCardProps