Skip to content

Commit

Permalink
Merge pull request #2 from jadmsaadaot/add-postal-code
Browse files Browse the repository at this point in the history
Add postalcode component
  • Loading branch information
jadmsaadaot authored Aug 9, 2022
2 parents 7731888 + 55266fb commit e9436a6
Show file tree
Hide file tree
Showing 29 changed files with 471 additions and 47 deletions.
39 changes: 36 additions & 3 deletions dist/met-formio-components.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/met-formio-components.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/met-formio-components.use.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/components/Common/Constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var Constants = /** @class */ (function () {
function Constants() {
}
Constants.DEFAULT_HELP_LINK = 'https://github.com/bcgov/common-hosted-form-service/wiki';
Constants.DEFAULT_HELP_LINK = "";
return Constants;
}());
export { Constants };
2 changes: 2 additions & 0 deletions lib/components/Common/Simple.edit.validation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare const _default: ({
tooltip: string;
key: string;
input: boolean;
defaultValue: boolean;
placeholder?: undefined;
} | {
weight: number;
Expand All @@ -14,5 +15,6 @@ declare const _default: ({
type: string;
tooltip: string;
input: boolean;
defaultValue?: undefined;
})[];
export default _default;
19 changes: 10 additions & 9 deletions lib/components/Common/Simple.edit.validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,20 @@
export default [
{
weight: 10,
type: 'checkbox',
label: 'Required',
tooltip: 'A required field must be filled in before the form can be submitted.',
key: 'validate.required',
type: "checkbox",
label: "Required",
tooltip: "A required field must be filled in before the form can be submitted.",
key: "validate.required",
input: true,
defaultValue: true,
},
{
weight: 200,
key: 'validate.customMessage',
label: 'Custom Error Message',
placeholder: 'Custom Error Message',
type: 'textfield',
tooltip: 'Error message displayed if any error occurred.',
key: "validate.customMessage",
label: "Custom Error Message",
placeholder: "Custom Error Message",
type: "textfield",
tooltip: "Error message displayed if any error occurred.",
input: true,
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare const _default: ({
tooltip: string;
key: string;
input: boolean;
defaultValue: boolean;
placeholder?: undefined;
} | {
weight: number;
Expand All @@ -14,5 +15,13 @@ declare const _default: ({
type: string;
tooltip: string;
input: boolean;
defaultValue?: undefined;
} | {
type: string;
input: boolean;
key: string;
label: string;
tooltip: string;
weight: number;
})[];
export default _default;
15 changes: 15 additions & 0 deletions lib/components/SimplePostalCode/Component.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import editForm from './Component.form';
declare const Component_base: any;
export default class Component extends Component_base {
static schema(...extend: any[]): any;
static editForm: typeof editForm;
static get builderInfo(): {
title: string;
group: string;
icon: string;
weight: number;
documentation: string;
schema: any;
};
}
export {};
1 change: 1 addition & 0 deletions lib/components/SimplePostalCode/Component.form.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default function (...extend: any[]): any;
62 changes: 62 additions & 0 deletions lib/components/SimplePostalCode/Component.form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import baseEditForm from 'formiojs/components/_classes/component/Component.form';
import EditDisplay from './editForm/Component.edit.display';
import SimpleConditional from '../Common/Simple.edit.conditional';
import SimpleValidation from '../Common/Simple.edit.validation';
export default function () {
var extend = [];
for (var _i = 0; _i < arguments.length; _i++) {
extend[_i] = arguments[_i];
}
return baseEditForm.apply(void 0, __spreadArray([[
EditDisplay,
{
key: 'data',
ignore: true,
},
{
key: 'api',
ignore: true,
},
{
key: 'layout',
ignore: true,
},
{
key: 'conditional',
ignore: true,
},
{
key: 'validation',
ignore: true,
},
{
key: 'logic',
ignore: true,
},
{
key: 'addons',
ignore: true,
},
{
label: 'Validation',
key: 'customValidation',
weight: 20,
components: SimpleValidation,
},
{
label: 'Conditional',
key: 'customConditional',
weight: 40,
components: SimpleConditional,
},
]], extend, false));
}
68 changes: 68 additions & 0 deletions lib/components/SimplePostalCode/Component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
/* tslint:disable */
import { Components } from 'formiojs';
var ParentComponent = Components.components.phoneNumber;
import editForm from './Component.form';
import { Constants } from '../Common/Constants';
var ID = 'simplepostalcode';
var DISPLAY = 'Postal Code';
var Component = /** @class */ (function (_super) {
__extends(Component, _super);
function Component() {
return _super !== null && _super.apply(this, arguments) || this;
}
Component.schema = function () {
var extend = [];
for (var _i = 0; _i < arguments.length; _i++) {
extend[_i] = arguments[_i];
}
return ParentComponent.schema.apply(ParentComponent, __spreadArray([{
type: ID,
label: DISPLAY,
key: ID,
inputType: 'postalcode',
inputFormat: 'plain',
inputMask: '***',
}], extend, false));
};
Object.defineProperty(Component, "builderInfo", {
get: function () {
return {
title: DISPLAY,
group: 'simple',
icon: 'map',
weight: 11,
documentation: Constants.DEFAULT_HELP_LINK,
schema: Component.schema(),
};
},
enumerable: false,
configurable: true
});
Component.editForm = editForm;
return Component;
}(ParentComponent));
export default Component;
18 changes: 18 additions & 0 deletions lib/components/SimplePostalCode/editForm/Component.edit.data.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
declare const _default: ({
weight: number;
type: string;
label: string;
tooltip: string;
key: string;
input: boolean;
placeholder?: undefined;
} | {
type: string;
label: string;
key: string;
weight: number;
placeholder: string;
tooltip: string;
input: boolean;
})[];
export default _default;
11 changes: 11 additions & 0 deletions lib/components/SimplePostalCode/editForm/Component.edit.data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import common from '../../Common/Simple.edit.data';
export default __spreadArray([], common, true);
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
declare const _default: {
key: string;
components: ({
key: string;
ignore: boolean;
} | {
weight: number;
type: string;
input: boolean;
key: string;
label: string;
tooltip: string;
})[];
};
export default _default;
43 changes: 43 additions & 0 deletions lib/components/SimplePostalCode/editForm/Component.edit.display.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
import common from '../../Common/Simple.edit.display';
export default {
key: 'display',
components: __spreadArray(__spreadArray([], common, true), [
{
key: 'refreshOnChange',
ignore: true,
},
{
key: 'className',
ignore: true,
},
{
key: 'prefix',
ignore: true,
},
{
key: 'suffix',
ignore: true,
},
{
key: 'placeholder',
ignore: true,
},
{
weight: 410,
type: 'textfield',
input: true,
key: 'inputMask',
label: 'Input Mask',
tooltip: "An input mask helps the user with input by ensuring a predefined format.<br><br>9: numeric<br>a: alphabetical<br>*: alphanumeric<br><br>Example telephone mask: (999) 999-9999<br><br>See the <a target='_blank' href='https://github.com/RobinHerbots/jquery.inputmask'>jquery.inputmask documentation</a> for more information.</a>",
},
], false),
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare const _default: ({
tooltip: string;
key: string;
input: boolean;
defaultValue: boolean;
placeholder?: undefined;
} | {
weight: number;
Expand All @@ -14,5 +15,6 @@ declare const _default: ({
type: string;
tooltip: string;
input: boolean;
defaultValue?: undefined;
})[];
export default _default;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare const _default: ({
tooltip: string;
key: string;
input: boolean;
defaultValue: boolean;
placeholder?: undefined;
} | {
weight: number;
Expand All @@ -14,5 +15,6 @@ declare const _default: ({
type: string;
tooltip: string;
input: boolean;
defaultValue?: undefined;
})[];
export default _default;
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare const _default: ({
tooltip: string;
key: string;
input: boolean;
defaultValue: boolean;
placeholder?: undefined;
} | {
weight: number;
Expand All @@ -14,5 +15,6 @@ declare const _default: ({
type: string;
tooltip: string;
input: boolean;
defaultValue?: undefined;
})[];
export default _default;
6 changes: 4 additions & 2 deletions lib/components/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import simpletextfield from './SimpleTextField/Component';
import simpletextarea from './SimpleTextArea/Component';
import simpleradios from './SimpleRadios/Component';
import simplecheckboxes from './SimpleCheckboxes/Component';
import header from './Header/Component';
import paragraph from './Paragraph/Component';
import simplepostalcode from "./SimplePostalCode/Component";
import header from "./Header/Component";
import paragraph from "./Paragraph/Component";
declare const _default: {
simpletextfield: typeof simpletextfield;
simpletextarea: typeof simpletextarea;
simpleradios: typeof simpleradios;
simplecheckboxes: typeof simplecheckboxes;
header: typeof header;
paragraph: typeof paragraph;
simplepostalcode: typeof simplepostalcode;
};
export default _default;
6 changes: 4 additions & 2 deletions lib/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import simpletextfield from './SimpleTextField/Component';
import simpletextarea from './SimpleTextArea/Component';
import simpleradios from './SimpleRadios/Component';
import simplecheckboxes from './SimpleCheckboxes/Component';
import header from './Header/Component';
import paragraph from './Paragraph/Component';
import simplepostalcode from "./SimplePostalCode/Component";
import header from "./Header/Component";
import paragraph from "./Paragraph/Component";
export default {
simpletextfield: simpletextfield,
simpletextarea: simpletextarea,
simpleradios: simpleradios,
simplecheckboxes: simplecheckboxes,
header: header,
paragraph: paragraph,
simplepostalcode: simplepostalcode,
};
Loading

0 comments on commit e9436a6

Please sign in to comment.