@ukhomeoffice/formio-gds-template 3.0.0-bravo → 3.0.0-delta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,6 +49,7 @@ export default class GDSSelect extends Select {
49
49
  protected _gdsSearchPatchedChoices?: ChoicesInstance;
50
50
  protected _gdsFilterKey?: string;
51
51
  constructor(component?: any, options?: any, data?: any);
52
+ normalizeSingleValue(value: any): any;
52
53
  init(): any;
53
54
  /**
54
55
  * Patch the choices.js instance attached to this component so that every
@@ -1 +1 @@
1
- {"version":3,"file":"GDSSelect.d.ts","sourceRoot":"","sources":["../../../src/components/select/GDSSelect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,IAAI,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAErE,QAAA,MAAM,MAAM,KAA+B,CAAC;AAG5C,UAAU,UAAU;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,UAAU,YAAY;IAClB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CAChB;AAGD,UAAU,eAAe;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE;QACJ,OAAO,EAAE,UAAU,EAAE,CAAC;QACtB,QAAQ,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,OAAO,CAAC;YAAC,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;SAAE,GAAG,IAAI,CAAC;KACxF,CAAC;IACF,cAAc,CAAC,EAAE,CAAC,MAAM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O,GAAG,GAAG;IAkB5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiDG;IACH,iBAAiB,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM;IAqClF;;;;;;;;;;;;;;;;OAgBG;IAEH,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,GAAG;IA0BxG,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAwCxC"}
@@ -11,6 +11,13 @@ class GDSSelect extends Select {
11
11
  constructor(component, options, data) {
12
12
  super(component, options, data);
13
13
  }
14
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
15
+ normalizeSingleValue(value) {
16
+ if (this.component.dataType === 'object' && value === '[object Object]') {
17
+ return this.emptyValue;
18
+ }
19
+ return super.normalizeSingleValue(value);
20
+ }
14
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
22
  init() {
16
23
  var _a, _b;
package/lib/index.d.ts CHANGED
@@ -60,6 +60,9 @@ declare const _default: {
60
60
  fieldset: {
61
61
  form: string;
62
62
  };
63
+ html: {
64
+ form: string;
65
+ };
63
66
  label: {
64
67
  form: string;
65
68
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAIE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,wBAIE"}
@@ -126,33 +126,31 @@ __p += '\n<div>\n <video class="video" autoplay="true" ref="videoPlayer"></vi
126
126
  } ;
127
127
  __p += '\n';
128
128
  } ;
129
- __p += '\n<div class="govuk-!-margin-top-2">\n ';
130
- ctx.statuses.forEach(function(status) { ;
131
- __p += '\n <div class="file ' +
132
- ((__t = (ctx.statuses.status === 'error' ? ' has-error' : '')) == null ? '' : __t) +
133
- '">\n <div class="govuk-grid-row">\n <div class="govuk-grid-column-one-quarter"><button class="govuk-button govuk-button--warning govuk-!-margin-bottom-2" ref="fileStatusRemove">Remove</button></div>\n <div class="fileName govuk-label govuk-grid-column-one-quarter">' +
134
- ((__t = (status.originalName)) == null ? '' : __t) +
135
- '</div>\n <div class="fileSize govuk-label govuk-grid-column-one-quarter">' +
129
+ __p += '\n<div class="govuk-!-margin-top-2">\n';
130
+ (ctx.filesToUpload || []).forEach(function(status) { ;
131
+ __p += '\n <div class="file ' +
132
+ ((__t = (status.status === 'error' ? 'has-error' : '')) == null ? '' : __t) +
133
+ '">\n <div class="govuk-grid-row">\n <div class="govuk-grid-column-one-quarter">\n <button\n type="button"\n class="govuk-button govuk-button--warning govuk-!-margin-bottom-2"\n ref="fileToSyncRemove">\n Remove\n </button>\n </div>\n <div class="fileName govuk-label govuk-grid-column-one-quarter">\n ' +
134
+ ((__t = (status.originalName || status.name)) == null ? '' : __t) +
135
+ '\n </div>\n <div class="fileSize govuk-label govuk-grid-column-one-quarter">\n ' +
136
136
  ((__t = (ctx.fileSize(status.size))) == null ? '' : __t) +
137
- '</div>\n <div class="govuk-grid-column-one-quarter">\n ';
137
+ '\n </div>\n <div class="govuk-grid-column-one-quarter">\n ';
138
138
  if (status.status === 'progress') { ;
139
- __p += '\n <div class="govuk-label">' +
140
- ((__t = (status.progress)) == null ? '' : __t) +
139
+ __p += '\n <div class="govuk-label">\n ' +
140
+ ((__t = (status.progress || 0)) == null ? '' : __t) +
141
141
  '% ' +
142
142
  ((__t = (ctx.t('Complete'))) == null ? '' : __t) +
143
- '</div>\n ';
144
- } else if (status.status === 'error'){ ;
145
- __p += '\n <div class="govuk-error-message"> ' +
146
- ((__t = (ctx.t(status.message))) == null ? '' : __t) +
147
- '</div>\n ';
143
+ '\n </div>\n ';
144
+ } else if (status.status === 'error') { ;
145
+ __p += '\n <div class="govuk-error-message">\n ' +
146
+ ((__t = (ctx.t(status.message || 'Upload failed'))) == null ? '' : __t) +
147
+ '\n </div>\n ';
148
148
  } else { ;
149
- __p += '\n <div class="bg-' +
150
- ((__t = (status.status)) == null ? '' : __t) +
151
- '">' +
152
- ((__t = (ctx.t(status.message))) == null ? '' : __t) +
153
- '</div>\n ';
149
+ __p += '\n <div class="govuk-label">\n ' +
150
+ ((__t = (ctx.t(status.message || 'Pending upload'))) == null ? '' : __t) +
151
+ '\n </div>\n ';
154
152
  } ;
155
- __p += '\n </div>\n </div>\n </div>\n ';
153
+ __p += '\n </div>\n\n </div>\n </div>\n';
156
154
  }) ;
157
155
  __p += '\n</div>\n';
158
156
  if (!ctx.component.storage || ctx.support.hasWarning) { ;
@@ -0,0 +1,33 @@
1
+ Object.defineProperty(exports, "__esModule", {
2
+ value: true
3
+ });
4
+ exports.default=function(ctx) {
5
+ var __t, __p = '', __j = Array.prototype.join;
6
+ function print() { __p += __j.call(arguments, '') }
7
+ __p += '<' +
8
+ ((__t = (ctx.tag)) == null ? '' : __t) +
9
+ '\n class="formio-component-htmlelement ' +
10
+ ((__t = (ctx.component.className)) == null ? '' : __t) +
11
+ '"\n ref="html"\n ';
12
+ ctx.attrs.forEach(function(attr) { ;
13
+ __p += '\n ' +
14
+ ((__t = (attr.attr)) == null ? '' : __t) +
15
+ '="' +
16
+ ((__t = (attr.value)) == null ? '' : __t) +
17
+ '"\n ';
18
+ }); ;
19
+ __p += '\n>\n';
20
+ if (ctx.builder) { ;
21
+ __p += '\n ' +
22
+ ((__t = (ctx.content)) == null ? '' : __t) +
23
+ '\n';
24
+ } ;
25
+ __p += '\n';
26
+ if (!ctx.singleTags || ctx.singleTags.indexOf(ctx.tag) === -1) { ;
27
+ __p += '\n</' +
28
+ ((__t = (ctx.tag)) == null ? '' : __t) +
29
+ '>\n';
30
+ } ;
31
+
32
+ return __p
33
+ }
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ form: string;
3
+ };
4
+ export default _default;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/templates/gds/html/index.ts"],"names":[],"mappings":";;;AAEA,wBAAwB"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const form_ejs_1 = __importDefault(require("./form.ejs"));
7
+ exports.default = { form: form_ejs_1.default };
@@ -58,6 +58,9 @@ declare const _default: {
58
58
  fieldset: {
59
59
  form: string;
60
60
  };
61
+ html: {
62
+ form: string;
63
+ };
61
64
  label: {
62
65
  form: string;
63
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/gds/index.ts"],"names":[],"mappings":"AA0BA,OAAO,gBAAgB,CAAC;;oBAeJ,MAAM,QAAQ,MAAM,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADjD,wBA6CE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/gds/index.ts"],"names":[],"mappings":"AA2BA,OAAO,gBAAgB,CAAC;;oBAeJ,MAAM,QAAQ,MAAM,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AADjD,wBA8CE"}
@@ -19,6 +19,7 @@ const file_1 = __importDefault(require("./file"));
19
19
  const fieldset_1 = __importDefault(require("./fieldset"));
20
20
  const iconClass_1 = __importDefault(require("./iconClass"));
21
21
  const input_1 = __importDefault(require("./input"));
22
+ const html_1 = __importDefault(require("./html"));
22
23
  const label_1 = __importDefault(require("./label"));
23
24
  const message_1 = __importDefault(require("./message"));
24
25
  const panel_1 = __importDefault(require("./panel"));
@@ -70,6 +71,7 @@ exports.default = {
70
71
  field: unwrap(field_1.default),
71
72
  file: unwrap(file_1.default),
72
73
  fieldset: unwrap(fieldset_1.default),
74
+ html: unwrap(html_1.default),
73
75
  label: unwrap(label_1.default),
74
76
  message: unwrap(message_1.default),
75
77
  panel: unwrap(panel_1.default),
@@ -20,22 +20,26 @@ __p += '\n<' +
20
20
  ((__t = (ctx.input.ref ? ctx.input.ref : 'input')) == null ? '' : __t) +
21
21
  '"\nstyle="margin-bottom: 10px"\n';
22
22
  for (var attr in ctx.input.attr) { ;
23
- __p += '\n' +
24
- ((__t = (attr)) == null ? '' : __t) +
25
- '="' +
23
+ __p += '\n ';
24
+ if (attr === 'class') { ;
25
+ __p += '\n class="' +
26
26
  ((__t = (ctx.input.attr[attr])) == null ? '' : __t);
27
- if (attr==='class') { if (ctx.input.type === 'textarea'){ ;
28
- __p += ' govuk-textarea ';
27
+ if (ctx.input.type === 'textarea') { ;
28
+ __p += ' govuk-textarea';
29
29
  } else { ;
30
- __p += ' govuk-input ';
31
- } } ;
32
- __p += '"\n';
33
- } ;
34
- __p += '\nid="' +
35
- ((__t = (ctx.instance.id)) == null ? '' : __t) +
36
- '-' +
37
- ((__t = (ctx.component.key)) == null ? '' : __t) +
38
- '"\n>' +
30
+ __p += ' govuk-input';
31
+ } ;
32
+ __p += '"\n ';
33
+ } else if (attr !== 'id') { ;
34
+ __p += '\n ' +
35
+ ((__t = (attr)) == null ? '' : __t) +
36
+ '="' +
37
+ ((__t = (ctx.input.attr[attr])) == null ? '' : __t) +
38
+ '"\n ';
39
+ } ;
40
+ __p += '\n';
41
+ } ;
42
+ __p += '\n>' +
39
43
  ((__t = (ctx.input.content)) == null ? '' : __t) +
40
44
  '\n</' +
41
45
  ((__t = (ctx.input.type)) == null ? '' : __t) +
@@ -58,6 +58,9 @@ declare const _default: {
58
58
  fieldset: {
59
59
  form: string;
60
60
  };
61
+ html: {
62
+ form: string;
63
+ };
61
64
  label: {
62
65
  form: string;
63
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAEE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/templates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,wBAEE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ukhomeoffice/formio-gds-template",
3
- "version": "3.0.0-bravo",
3
+ "version": "3.0.0-delta",
4
4
  "description": "Gov UK design system formio templates — upgraded to @formio/js@5.x",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -460,6 +460,31 @@ describe('GDSSelect', () => {
460
460
  /* eslint-enable @typescript-eslint/no-explicit-any */
461
461
  });
462
462
 
463
+ it('normalizes legacy stringified object values to an unselected object value', () => {
464
+ /* eslint-disable @typescript-eslint/no-explicit-any */
465
+ const selectComponent = new GDSSelect({
466
+ type: 'select',
467
+ key: 'agency',
468
+ dataSrc: 'url',
469
+ dataType: 'object',
470
+ valueProperty: '',
471
+ template: '<span>{{ item.name }}</span>',
472
+ data: { url: '/v2/entities/partneragency' },
473
+ }, {});
474
+
475
+ assert.deepStrictEqual(
476
+ (selectComponent as any).normalizeSingleValue('[object Object]'),
477
+ {}
478
+ );
479
+ const agency = { id: 1, name: 'Care Quality Commission' };
480
+ assert.strictEqual(
481
+ (selectComponent as any).normalizeSingleValue(agency),
482
+ agency,
483
+ 'real object values must remain unchanged'
484
+ );
485
+ /* eslint-enable @typescript-eslint/no-explicit-any */
486
+ });
487
+
463
488
  it('valueComparer uses id equality for objects instead of deep comparison', () => {
464
489
  const selectComponent = new GDSSelect({
465
490
  type: 'select',
@@ -63,6 +63,14 @@ export default class GDSSelect extends Select {
63
63
  super(component, options, data);
64
64
  }
65
65
 
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
67
+ normalizeSingleValue(value: any): any {
68
+ if (this.component.dataType === 'object' && value === '[object Object]') {
69
+ return this.emptyValue;
70
+ }
71
+ return super.normalizeSingleValue(value);
72
+ }
73
+
66
74
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
75
  init(): any {
68
76
  // Clear searchField so Form.io does not trigger server-side queries while
@@ -92,24 +92,42 @@
92
92
  {% } %}
93
93
  {% } %}
94
94
  <div class="govuk-!-margin-top-2">
95
- {% ctx.statuses.forEach(function(status) { %}
96
- <div class="file {{ctx.statuses.status === 'error' ? ' has-error' : ''}}">
97
- <div class="govuk-grid-row">
98
- <div class="govuk-grid-column-one-quarter"><button class="govuk-button govuk-button--warning govuk-!-margin-bottom-2" ref="fileStatusRemove">Remove</button></div>
99
- <div class="fileName govuk-label govuk-grid-column-one-quarter">{{status.originalName}}</div>
100
- <div class="fileSize govuk-label govuk-grid-column-one-quarter">{{ctx.fileSize(status.size)}}</div>
101
- <div class="govuk-grid-column-one-quarter">
102
- {% if (status.status === 'progress') { %}
103
- <div class="govuk-label">{{status.progress}}% {{ctx.t('Complete')}}</div>
104
- {% } else if (status.status === 'error'){ %}
105
- <div class="govuk-error-message"> {{ctx.t(status.message)}}</div>
106
- {% } else { %}
107
- <div class="bg-{{status.status}}">{{ctx.t(status.message)}}</div>
108
- {% } %}
109
- </div>
110
- </div>
95
+ {% (ctx.filesToUpload || []).forEach(function(status) { %}
96
+ <div class="file {{status.status === 'error' ? 'has-error' : ''}}">
97
+ <div class="govuk-grid-row">
98
+ <div class="govuk-grid-column-one-quarter">
99
+ <button
100
+ type="button"
101
+ class="govuk-button govuk-button--warning govuk-!-margin-bottom-2"
102
+ ref="fileToSyncRemove">
103
+ Remove
104
+ </button>
105
+ </div>
106
+ <div class="fileName govuk-label govuk-grid-column-one-quarter">
107
+ {{status.originalName || status.name}}
108
+ </div>
109
+ <div class="fileSize govuk-label govuk-grid-column-one-quarter">
110
+ {{ctx.fileSize(status.size)}}
111
+ </div>
112
+ <div class="govuk-grid-column-one-quarter">
113
+ {% if (status.status === 'progress') { %}
114
+ <div class="govuk-label">
115
+ {{status.progress || 0}}% {{ctx.t('Complete')}}
116
+ </div>
117
+ {% } else if (status.status === 'error') { %}
118
+ <div class="govuk-error-message">
119
+ {{ctx.t(status.message || 'Upload failed')}}
120
+ </div>
121
+ {% } else { %}
122
+ <div class="govuk-label">
123
+ {{ctx.t(status.message || 'Pending upload')}}
124
+ </div>
125
+ {% } %}
126
+ </div>
127
+
111
128
  </div>
112
- {% }) %}
129
+ </div>
130
+ {% }) %}
113
131
  </div>
114
132
  {% if (!ctx.component.storage || ctx.support.hasWarning) { %}
115
133
  <div class="govuk-grid-row">
@@ -0,0 +1,13 @@
1
+ <{{ctx.tag}}
2
+ class="formio-component-htmlelement {{ctx.component.className}}"
3
+ ref="html"
4
+ {% ctx.attrs.forEach(function(attr) { %}
5
+ {{attr.attr}}="{{attr.value}}"
6
+ {% }); %}
7
+ >
8
+ {% if (ctx.builder) { %}
9
+ {{ctx.content}}
10
+ {% } %}
11
+ {% if (!ctx.singleTags || ctx.singleTags.indexOf(ctx.tag) === -1) { %}
12
+ </{{ctx.tag}}>
13
+ {% } %}
@@ -0,0 +1,3 @@
1
+ import form from './form.ejs';
2
+
3
+ export default { form };
@@ -14,6 +14,7 @@ import file from './file';
14
14
  import fieldset from './fieldset';
15
15
  import iconClass from './iconClass';
16
16
  import input from './input';
17
+ import html from './html';
17
18
  import label from './label';
18
19
  import message from './message';
19
20
  import panel from './panel';
@@ -68,6 +69,7 @@ export default {
68
69
  field: unwrap(field),
69
70
  file: unwrap(file),
70
71
  fieldset: unwrap(fieldset),
72
+ html: unwrap(html),
71
73
  label: unwrap(label),
72
74
  message: unwrap(message),
73
75
  panel: unwrap(panel),
@@ -10,9 +10,12 @@
10
10
  ref="{{ctx.input.ref ? ctx.input.ref : 'input'}}"
11
11
  style="margin-bottom: 10px"
12
12
  {% for (var attr in ctx.input.attr) { %}
13
- {{attr}}="{{ctx.input.attr[attr]}}{% if (attr==='class') { if (ctx.input.type === 'textarea'){ %} govuk-textarea {% } else { %} govuk-input {%} } %}"
13
+ {% if (attr === 'class') { %}
14
+ class="{{ctx.input.attr[attr]}}{% if (ctx.input.type === 'textarea') { %} govuk-textarea{% } else { %} govuk-input{% } %}"
15
+ {% } else if (attr !== 'id') { %}
16
+ {{attr}}="{{ctx.input.attr[attr]}}"
17
+ {% } %}
14
18
  {% } %}
15
- id="{{ctx.instance.id}}-{{ctx.component.key}}"
16
19
  >{{ctx.input.content}}
17
20
  </{{ctx.input.type}}>
18
21
  {% if (ctx.component.showCharCount) { %}