@3t-transform/threeteeui 0.1.28 → 0.1.30
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.
- package/dist/cjs/{index-dc6cc829.js → index-457ca775.js} +104 -2
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/tttx-button.cjs.entry.js +24 -24
- package/dist/cjs/tttx-filter.cjs.entry.js +159 -159
- package/dist/cjs/tttx-form.cjs.entry.js +376 -364
- package/dist/cjs/tttx-icon.cjs.entry.js +11 -11
- package/dist/cjs/tttx-keyvalue-block.cjs.entry.js +59 -59
- package/dist/cjs/tttx-list.cjs.entry.js +43 -43
- package/dist/cjs/tttx-loading-spinner.cjs.entry.js +16 -16
- package/dist/cjs/tttx-sorter.cjs.entry.js +102 -102
- package/dist/cjs/tttx-standalone-input.cjs.entry.js +62 -62
- package/dist/cjs/tttx-toolbar.cjs.entry.js +10 -10
- package/dist/cjs/tttx.cjs.js +7 -3
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/tttx-button/tttx-button.js +110 -110
- package/dist/collection/components/atoms/tttx-button/tttx-button.stories.js +14 -14
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.js +62 -62
- package/dist/collection/components/atoms/tttx-icon/tttx-icon.stories.js +22 -22
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.js +109 -109
- package/dist/collection/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.js +38 -38
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.js +67 -67
- package/dist/collection/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.js +17 -17
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.js +334 -334
- package/dist/collection/components/molecules/tttx-filter/tttx-filter.stories.js +62 -62
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.js +37 -35
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.js +58 -58
- package/dist/collection/components/molecules/tttx-form/tttx-form.css +5 -0
- package/dist/collection/components/molecules/tttx-form/tttx-form.js +396 -364
- package/dist/collection/components/molecules/tttx-form/tttx-form.stories.js +248 -127
- package/dist/collection/components/molecules/tttx-list/tttx-list.js +105 -105
- package/dist/collection/components/molecules/tttx-list/tttx-list.stories.js +43 -43
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.js +224 -224
- package/dist/collection/components/molecules/tttx-sorter/tttx-sorter.stories.js +42 -42
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.css +27 -5
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.js +645 -645
- package/dist/collection/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.js +163 -163
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.js +44 -44
- package/dist/collection/components/molecules/tttx-toolbar/tttx-toolbar.stories.js +14 -14
- package/dist/collection/components/palette.stories.js +7 -7
- package/dist/collection/docs/gettingstarted-developer.stories.js +5 -5
- package/dist/collection/icons.js +2838 -2838
- package/dist/collection/index.js +1 -1
- package/dist/collection/shared/domsanitiser.options.js +14 -14
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +1 -1
- package/dist/components/tttx-button.js +48 -48
- package/dist/components/tttx-filter.js +191 -191
- package/dist/components/tttx-form.js +394 -381
- package/dist/components/tttx-icon2.js +28 -28
- package/dist/components/tttx-keyvalue-block.js +76 -76
- package/dist/components/tttx-list.js +65 -65
- package/dist/components/tttx-loading-spinner.js +33 -33
- package/dist/components/tttx-sorter.js +130 -130
- package/dist/components/tttx-standalone-input.js +110 -110
- package/dist/components/tttx-toolbar.js +26 -26
- package/dist/esm/{index-86faeaab.js → index-d784fb3e.js} +104 -3
- package/dist/esm/loader.js +4 -3
- package/dist/esm/polyfills/core-js.js +0 -0
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/polyfills/dom.js +0 -0
- package/dist/esm/polyfills/es5-html-element.js +0 -0
- package/dist/esm/polyfills/index.js +0 -0
- package/dist/esm/polyfills/system.js +0 -0
- package/dist/esm/tttx-button.entry.js +24 -24
- package/dist/esm/tttx-filter.entry.js +159 -159
- package/dist/esm/tttx-form.entry.js +376 -364
- package/dist/esm/tttx-icon.entry.js +11 -11
- package/dist/esm/tttx-keyvalue-block.entry.js +59 -59
- package/dist/esm/tttx-list.entry.js +43 -43
- package/dist/esm/tttx-loading-spinner.entry.js +16 -16
- package/dist/esm/tttx-sorter.entry.js +102 -102
- package/dist/esm/tttx-standalone-input.entry.js +62 -62
- package/dist/esm/tttx-toolbar.entry.js +10 -10
- package/dist/esm/tttx.js +4 -3
- package/dist/tttx/p-0ebffdfc.js +2 -0
- package/dist/tttx/p-1112ed2e.entry.js +1 -0
- package/dist/tttx/p-13495422.entry.js +1 -0
- package/dist/tttx/{p-ae00cae3.entry.js → p-1ed7a43d.entry.js} +1 -1
- package/dist/tttx/p-237fe0d5.entry.js +1 -0
- package/dist/tttx/p-2731fbc6.entry.js +1 -0
- package/dist/tttx/p-280b8e45.entry.js +1 -0
- package/dist/tttx/p-3772f4d0.entry.js +1 -0
- package/dist/tttx/p-390d97dd.entry.js +1 -0
- package/dist/tttx/p-49796abf.entry.js +1 -0
- package/dist/tttx/p-4f68f1eb.entry.js +1 -0
- package/dist/tttx/p-53793ed2.entry.js +1 -0
- package/dist/tttx/p-5f335153.entry.js +1 -0
- package/dist/tttx/p-60a0fee2.entry.js +1 -0
- package/dist/tttx/p-6ab75c0b.entry.js +1 -0
- package/dist/tttx/{p-daa27411.entry.js → p-6b006ccf.entry.js} +1 -1
- package/dist/tttx/p-6cbe1824.entry.js +1 -0
- package/dist/tttx/p-6cefa1ce.entry.js +1 -0
- package/dist/tttx/p-72e7f7dd.entry.js +3 -0
- package/dist/tttx/{p-c72d1a03.entry.js → p-798a098a.entry.js} +1 -1
- package/dist/tttx/p-824af346.entry.js +1 -0
- package/dist/tttx/{p-f1d7eb35.entry.js → p-91e42647.entry.js} +1 -1
- package/dist/tttx/{p-8f3badad.entry.js → p-b720c4ad.entry.js} +1 -1
- package/dist/tttx/p-c06f1207.entry.js +1 -0
- package/dist/tttx/p-c0a15524.entry.js +1 -0
- package/dist/tttx/{p-e25d5fe2.entry.js → p-c4162029.entry.js} +1 -1
- package/dist/tttx/p-c7c968dd.entry.js +1 -0
- package/dist/tttx/{p-c4538d55.entry.js → p-cac26a1b.entry.js} +1 -1
- package/dist/tttx/p-ce728715.entry.js +1 -0
- package/dist/tttx/p-d3932db5.entry.js +1 -0
- package/dist/tttx/p-d575ef2d.entry.js +1 -0
- package/dist/tttx/p-d83edcfb.entry.js +1 -0
- package/dist/tttx/p-d8e03ed6.entry.js +1 -0
- package/dist/tttx/p-ebb496a2.entry.js +1 -0
- package/dist/tttx/p-fb5e737b.entry.js +1 -0
- package/dist/tttx/p-fce571c2.entry.js +1 -0
- package/dist/tttx/tttx.esm.js +1 -1
- package/dist/types/components/atoms/tttx-button/tttx-button.d.ts +10 -10
- package/dist/types/components/atoms/tttx-button/tttx-button.stories.d.ts +10 -10
- package/dist/types/components/atoms/tttx-icon/tttx-icon.d.ts +5 -5
- package/dist/types/components/atoms/tttx-icon/tttx-icon.stories.d.ts +20 -20
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.d.ts +7 -7
- package/dist/types/components/atoms/tttx-keyvalue-block/tttx-keyvalue-block.stories.d.ts +9 -9
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.d.ts +6 -6
- package/dist/types/components/atoms/tttx-loading-spinner/tttx-loading-spinner.stories.d.ts +17 -17
- package/dist/types/components/molecules/tttx-filter/tttx-filter.d.ts +39 -39
- package/dist/types/components/molecules/tttx-filter/tttx-filter.stories.d.ts +68 -68
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.d.ts +13 -13
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.d.ts +17 -17
- package/dist/types/components/molecules/tttx-form/tttx-form.d.ts +111 -114
- package/dist/types/components/molecules/tttx-form/tttx-form.stories.d.ts +13 -13
- package/dist/types/components/molecules/tttx-list/tttx-list.d.ts +11 -11
- package/dist/types/components/molecules/tttx-list/tttx-list.stories.d.ts +14 -14
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.d.ts +19 -19
- package/dist/types/components/molecules/tttx-sorter/tttx-sorter.stories.d.ts +30 -30
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.d.ts +60 -60
- package/dist/types/components/molecules/tttx-standalone-input/tttx-standalone-input.stories.d.ts +128 -128
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.d.ts +4 -4
- package/dist/types/components/molecules/tttx-toolbar/tttx-toolbar.stories.d.ts +13 -13
- package/dist/types/components/palette.stories.d.ts +6 -6
- package/dist/types/components.d.ts +3 -2
- package/dist/types/docs/gettingstarted-developer.stories.d.ts +5 -5
- package/dist/types/icons.d.ts +2 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/shared/domsanitiser.options.d.ts +10 -10
- package/dist/types/stencil-public-runtime.d.ts +59 -3
- package/loader/index.d.ts +9 -0
- package/package.json +1 -1
- package/dist/cjs/domsanitiser.options-277161b9.js +0 -1667
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.e2e.js +0 -9
- package/dist/collection/components/atoms/tttx-button/test/tttx-button.spec.js +0 -83
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.e2e.js +0 -9
- package/dist/collection/components/atoms/tttx-icon/test/tttx-icon.spec.js +0 -16
- package/dist/collection/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.js +0 -216
- package/dist/collection/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.js +0 -64
- package/dist/collection/components/molecules/tttx-filter/test/tttx-filter.spec.js +0 -231
- package/dist/collection/components/molecules/tttx-form/lib/setErrorState.spec.js +0 -38
- package/dist/collection/components/molecules/tttx-form/lib/validityCheck.spec.js +0 -214
- package/dist/collection/components/molecules/tttx-form/test/tttx-form.e2e.js +0 -9
- package/dist/collection/components/molecules/tttx-form/test/tttx-form.spec.js +0 -232
- package/dist/collection/components/molecules/tttx-list/test/ttttx-list.spec.e2e.js +0 -26
- package/dist/collection/components/molecules/tttx-list/test/tttx-list.spec.js +0 -183
- package/dist/collection/components/molecules/tttx-sorter/test/tttx-sorter.spec.js +0 -87
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.js +0 -9
- package/dist/collection/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.js +0 -215
- package/dist/collection/components/molecules/tttx-toolbar/test/tttx-toolbar.spec.js +0 -52
- package/dist/collection/shared/test/domsanitiser.options.spec.js +0 -23
- package/dist/components/domsanitiser.options.js +0 -1664
- package/dist/esm/domsanitiser.options-cc420431.js +0 -1664
- package/dist/tttx/p-12fc0b16.entry.js +0 -3
- package/dist/tttx/p-2e43a578.entry.js +0 -1
- package/dist/tttx/p-33c0cbdc.entry.js +0 -1
- package/dist/tttx/p-52a47b7c.js +0 -2
- package/dist/tttx/p-72b4c98a.entry.js +0 -1
- package/dist/tttx/p-7e6fa227.entry.js +0 -1
- package/dist/tttx/p-90b0f72a.entry.js +0 -1
- package/dist/tttx/p-b4290a5b.js +0 -3
- package/dist/tttx/p-c4f2186e.entry.js +0 -1
- package/dist/types/components/atoms/tttx-button/test/tttx-button.e2e.d.ts +0 -1
- package/dist/types/components/atoms/tttx-button/test/tttx-button.spec.d.ts +0 -1
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.e2e.d.ts +0 -1
- package/dist/types/components/atoms/tttx-icon/test/tttx-icon.spec.d.ts +0 -1
- package/dist/types/components/atoms/tttx-keyvalue-block/test/tttx-keyvalue-block.spec.d.ts +0 -1
- package/dist/types/components/atoms/tttx-loading-spinner/Test/tttx-loading-spinner.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-filter/test/tttx-filter.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-form/lib/setErrorState.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-form/lib/validityCheck.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-form/test/tttx-form.e2e.d.ts +0 -1
- package/dist/types/components/molecules/tttx-form/test/tttx-form.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-list/test/ttttx-list.spec.e2e.d.ts +0 -1
- package/dist/types/components/molecules/tttx-list/test/tttx-list.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-sorter/test/tttx-sorter.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.e2e.d.ts +0 -1
- package/dist/types/components/molecules/tttx-standalone-input/test/tttx-standalone-input.spec.d.ts +0 -1
- package/dist/types/components/molecules/tttx-toolbar/test/tttx-toolbar.spec.d.ts +0 -1
- package/dist/types/shared/test/domsanitiser.options.spec.d.ts +0 -1
|
@@ -1,127 +1,248 @@
|
|
|
1
|
-
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
-
export default {
|
|
3
|
-
title: 'molecules/Form',
|
|
4
|
-
component: 'tttx-form',
|
|
5
|
-
parameters: {
|
|
6
|
-
actions: {
|
|
7
|
-
handles: ['dataSubmitted', 'dataChanged'],
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
decorators: [withActions],
|
|
11
|
-
};
|
|
12
|
-
const formSchema = {
|
|
13
|
-
properties: {
|
|
14
|
-
title: {
|
|
15
|
-
type: 'string',
|
|
16
|
-
format: 'string',
|
|
17
|
-
form: {
|
|
18
|
-
type: 'text',
|
|
19
|
-
placeholder: 'Mr, Mrs, Dr, Hon Rev',
|
|
20
|
-
label: 'Title'
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
forename: {
|
|
24
|
-
type: 'string',
|
|
25
|
-
format: 'string',
|
|
26
|
-
form: {
|
|
27
|
-
type: 'text',
|
|
28
|
-
placeholder: 'John',
|
|
29
|
-
label: 'Forename',
|
|
30
|
-
validation: {
|
|
31
|
-
required: {
|
|
32
|
-
message: 'Please enter your forename',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
surname: {
|
|
38
|
-
type: 'string',
|
|
39
|
-
format: 'string',
|
|
40
|
-
form: {
|
|
41
|
-
type: 'text',
|
|
42
|
-
placeholder: 'Doe',
|
|
43
|
-
label: 'Surname',
|
|
44
|
-
validation: {
|
|
45
|
-
required: {
|
|
46
|
-
message: 'Please enter your surname',
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
postcode: {
|
|
52
|
-
type: 'string',
|
|
53
|
-
format: 'string',
|
|
54
|
-
form: {
|
|
55
|
-
type: 'text',
|
|
56
|
-
placeholder: 'AB10',
|
|
57
|
-
label: 'Start of postcode',
|
|
58
|
-
validation: {
|
|
59
|
-
required: {
|
|
60
|
-
message: 'Please enter the beginning of your postcode',
|
|
61
|
-
},
|
|
62
|
-
pattern: {
|
|
63
|
-
pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
|
|
64
|
-
message: 'Please enter the first half of your postcode. EG: ZZ99',
|
|
65
|
-
},
|
|
66
|
-
maxlength: 4,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
age: {
|
|
71
|
-
type: 'number',
|
|
72
|
-
format: 'number',
|
|
73
|
-
form: {
|
|
74
|
-
type: 'number',
|
|
75
|
-
placeholder: '',
|
|
76
|
-
label: 'Age',
|
|
77
|
-
validation: {
|
|
78
|
-
required: {
|
|
79
|
-
message: 'Please enter your age',
|
|
80
|
-
},
|
|
81
|
-
badInput: {
|
|
82
|
-
message: 'Please enter a number',
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
},
|
|
87
|
-
dob: {
|
|
88
|
-
type: 'string',
|
|
89
|
-
format: 'date-time',
|
|
90
|
-
form: {
|
|
91
|
-
type: 'date',
|
|
92
|
-
placeholder: '',
|
|
93
|
-
label: 'Date of birth',
|
|
94
|
-
validation: {
|
|
95
|
-
required: {
|
|
96
|
-
message: 'Please enter your date of birth',
|
|
97
|
-
},
|
|
98
|
-
minmax: {
|
|
99
|
-
min: '1900-01-01',
|
|
100
|
-
max: '2100-12-31',
|
|
101
|
-
message: 'Please enter a date between 1900 and 2100',
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
};
|
|
108
|
-
const jsonFormSchema = JSON.stringify(formSchema);
|
|
109
|
-
export const ExampleFormFromJSON = () => `<tttx-form formSchema='${jsonFormSchema}'></tttx-form
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
1
|
+
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
+
export default {
|
|
3
|
+
title: 'molecules/Form',
|
|
4
|
+
component: 'tttx-form',
|
|
5
|
+
parameters: {
|
|
6
|
+
actions: {
|
|
7
|
+
handles: ['dataSubmitted', 'dataChanged'],
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
decorators: [withActions],
|
|
11
|
+
};
|
|
12
|
+
const formSchema = {
|
|
13
|
+
properties: {
|
|
14
|
+
title: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
format: 'string',
|
|
17
|
+
form: {
|
|
18
|
+
type: 'text',
|
|
19
|
+
placeholder: 'Mr, Mrs, Dr, Hon Rev',
|
|
20
|
+
label: 'Title'
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
forename: {
|
|
24
|
+
type: 'string',
|
|
25
|
+
format: 'string',
|
|
26
|
+
form: {
|
|
27
|
+
type: 'text',
|
|
28
|
+
placeholder: 'John',
|
|
29
|
+
label: 'Forename',
|
|
30
|
+
validation: {
|
|
31
|
+
required: {
|
|
32
|
+
message: 'Please enter your forename',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
surname: {
|
|
38
|
+
type: 'string',
|
|
39
|
+
format: 'string',
|
|
40
|
+
form: {
|
|
41
|
+
type: 'text',
|
|
42
|
+
placeholder: 'Doe',
|
|
43
|
+
label: 'Surname',
|
|
44
|
+
validation: {
|
|
45
|
+
required: {
|
|
46
|
+
message: 'Please enter your surname',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
postcode: {
|
|
52
|
+
type: 'string',
|
|
53
|
+
format: 'string',
|
|
54
|
+
form: {
|
|
55
|
+
type: 'text',
|
|
56
|
+
placeholder: 'AB10',
|
|
57
|
+
label: 'Start of postcode',
|
|
58
|
+
validation: {
|
|
59
|
+
required: {
|
|
60
|
+
message: 'Please enter the beginning of your postcode',
|
|
61
|
+
},
|
|
62
|
+
pattern: {
|
|
63
|
+
pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
|
|
64
|
+
message: 'Please enter the first half of your postcode. EG: ZZ99',
|
|
65
|
+
},
|
|
66
|
+
maxlength: 4,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
age: {
|
|
71
|
+
type: 'number',
|
|
72
|
+
format: 'number',
|
|
73
|
+
form: {
|
|
74
|
+
type: 'number',
|
|
75
|
+
placeholder: '',
|
|
76
|
+
label: 'Age',
|
|
77
|
+
validation: {
|
|
78
|
+
required: {
|
|
79
|
+
message: 'Please enter your age',
|
|
80
|
+
},
|
|
81
|
+
badInput: {
|
|
82
|
+
message: 'Please enter a number',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
dob: {
|
|
88
|
+
type: 'string',
|
|
89
|
+
format: 'date-time',
|
|
90
|
+
form: {
|
|
91
|
+
type: 'date',
|
|
92
|
+
placeholder: '',
|
|
93
|
+
label: 'Date of birth',
|
|
94
|
+
validation: {
|
|
95
|
+
required: {
|
|
96
|
+
message: 'Please enter your date of birth',
|
|
97
|
+
},
|
|
98
|
+
minmax: {
|
|
99
|
+
min: '1900-01-01',
|
|
100
|
+
max: '2100-12-31',
|
|
101
|
+
message: 'Please enter a date between 1900 and 2100',
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
const jsonFormSchema = JSON.stringify(formSchema);
|
|
109
|
+
export const ExampleFormFromJSON = () => `<tttx-form id='form' formSchema='${jsonFormSchema}'></tttx-form>
|
|
110
|
+
<hr/>
|
|
111
|
+
<button type='button' id='button'>Submit Form</button>
|
|
112
|
+
<script>
|
|
113
|
+
if (window['tttxform'] === undefined && window['submitButton'] === undefined) {
|
|
114
|
+
let tttxform = document.getElementById('form');
|
|
115
|
+
tttxform.addEventListener('dataSubmitted', (event) => {
|
|
116
|
+
for(var entry of event.detail.entries()) {
|
|
117
|
+
console.log(entry[0], entry[1]);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
let submitButton = document.getElementById('button');
|
|
121
|
+
submitButton.onclick = () => {
|
|
122
|
+
tttxform.submit();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
</script>`;
|
|
126
|
+
const formSchemaWithReadonly = JSON.stringify({
|
|
127
|
+
properties: {
|
|
128
|
+
title: {
|
|
129
|
+
type: 'string',
|
|
130
|
+
format: 'string',
|
|
131
|
+
form: {
|
|
132
|
+
type: 'text',
|
|
133
|
+
placeholder: 'Mr, Mrs, Dr, Hon Rev',
|
|
134
|
+
label: 'Title'
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
forename: {
|
|
138
|
+
type: 'string',
|
|
139
|
+
format: 'string',
|
|
140
|
+
form: {
|
|
141
|
+
type: 'text',
|
|
142
|
+
placeholder: 'John',
|
|
143
|
+
label: 'Forename',
|
|
144
|
+
validation: {
|
|
145
|
+
required: {
|
|
146
|
+
message: 'Please enter your forename',
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
surname: {
|
|
152
|
+
type: 'string',
|
|
153
|
+
format: 'string',
|
|
154
|
+
form: {
|
|
155
|
+
type: 'text',
|
|
156
|
+
placeholder: 'Doe',
|
|
157
|
+
label: 'Surname',
|
|
158
|
+
validation: {
|
|
159
|
+
required: {
|
|
160
|
+
message: 'Please enter your surname',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
postcode: {
|
|
166
|
+
type: 'string',
|
|
167
|
+
format: 'string',
|
|
168
|
+
form: {
|
|
169
|
+
type: 'text',
|
|
170
|
+
placeholder: 'AB10',
|
|
171
|
+
label: 'Start of postcode',
|
|
172
|
+
validation: {
|
|
173
|
+
required: {
|
|
174
|
+
message: 'Please enter the beginning of your postcode',
|
|
175
|
+
},
|
|
176
|
+
pattern: {
|
|
177
|
+
pattern: '^([A-Za-z][0-9])$|^([A-Za-z][0-9]{2})$|^([A-Za-z]{2}[0-9])$|^([A-Za-z]{2}[0-9]{2})$|^([A-Za-z][0-9][A-Za-z])$|^([A-Za-z]{2}[0-9][A-Za-z])$|^(GIR|BF|BX|XX)$',
|
|
178
|
+
message: 'Please enter the first half of your postcode. EG: ZZ99',
|
|
179
|
+
},
|
|
180
|
+
maxlength: 4,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
age: {
|
|
185
|
+
type: 'number',
|
|
186
|
+
format: 'number',
|
|
187
|
+
form: {
|
|
188
|
+
type: 'number',
|
|
189
|
+
placeholder: '',
|
|
190
|
+
label: 'Age',
|
|
191
|
+
readonly: true,
|
|
192
|
+
validation: {
|
|
193
|
+
required: {
|
|
194
|
+
message: 'Please enter your age',
|
|
195
|
+
},
|
|
196
|
+
badInput: {
|
|
197
|
+
message: 'Please enter a number',
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
dob: {
|
|
203
|
+
type: 'string',
|
|
204
|
+
format: 'date-time',
|
|
205
|
+
form: {
|
|
206
|
+
type: 'date',
|
|
207
|
+
placeholder: '',
|
|
208
|
+
label: 'Date of birth',
|
|
209
|
+
readonly: true,
|
|
210
|
+
validation: {
|
|
211
|
+
required: {
|
|
212
|
+
message: 'Please enter your date of birth',
|
|
213
|
+
},
|
|
214
|
+
minmax: {
|
|
215
|
+
min: '1900-01-01',
|
|
216
|
+
max: '2100-12-31',
|
|
217
|
+
message: 'Please enter a date between 1900 and 2100',
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
const data = JSON.stringify({
|
|
225
|
+
title: 'Ms',
|
|
226
|
+
forename: 'Jane',
|
|
227
|
+
surname: 'Doe',
|
|
228
|
+
postcode: 'AB10',
|
|
229
|
+
age: '50',
|
|
230
|
+
dob: '1973-06-02'
|
|
231
|
+
});
|
|
232
|
+
export const PrePopulateForm = () => `<tttx-form id='form' formSchema='${formSchemaWithReadonly}' data='${data}'></tttx-form>
|
|
233
|
+
<hr/>
|
|
234
|
+
<button type='button' id='button'>Submit Form</button>
|
|
235
|
+
<script>
|
|
236
|
+
if (window['tttxform'] === undefined && window['submitButton'] === undefined) {
|
|
237
|
+
let tttxform = document.getElementById('form');
|
|
238
|
+
tttxform.addEventListener('dataSubmitted', (event) => {
|
|
239
|
+
for(var entry of event.detail.entries()) {
|
|
240
|
+
console.log(entry[0], entry[1]);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
let submitButton = document.getElementById('button');
|
|
244
|
+
submitButton.onclick = () => {
|
|
245
|
+
tttxform.submit();
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
</script>`;
|
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
import { h } from '@stencil/core';
|
|
3
|
-
import * as DOMPurify from 'dompurify';
|
|
4
|
-
import domSanitiserOptions from '../../../shared/domsanitiser.options';
|
|
5
|
-
export class TttxList {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.data = undefined;
|
|
8
|
-
this.name = undefined;
|
|
9
|
-
}
|
|
10
|
-
onRowClickHandler(item) {
|
|
11
|
-
if (!item.clickable || !item.rowData)
|
|
12
|
-
return;
|
|
13
|
-
this.rowClick.emit({ name: this.name, data: item.rowData });
|
|
14
|
-
}
|
|
15
|
-
renderListItem(item) {
|
|
16
|
-
const cleanHTML = DOMPurify.sanitize(item.element, domSanitiserOptions);
|
|
17
|
-
return (h("li", { class: `item ${item.clickable ? 'clickable' : ''}`, onClick: () => {
|
|
18
|
-
this.onRowClickHandler(item);
|
|
19
|
-
} }, item.element && h("span", { class: "item-content", innerHTML: cleanHTML }), item.icon && h("tttx-icon", { class: "align-right ", icon: item.icon })));
|
|
20
|
-
}
|
|
21
|
-
render() {
|
|
22
|
-
if (!this.data)
|
|
23
|
-
return;
|
|
24
|
-
if (typeof this.data === 'string') {
|
|
25
|
-
this._data = JSON.parse(this.data);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this._data = this.data;
|
|
29
|
-
}
|
|
30
|
-
return h("ul", { class: "list" }, this._data.map((item) => this.renderListItem(item)));
|
|
31
|
-
}
|
|
32
|
-
static get is() { return "tttx-list"; }
|
|
33
|
-
static get encapsulation() { return "shadow"; }
|
|
34
|
-
static get originalStyleUrls() {
|
|
35
|
-
return {
|
|
36
|
-
"$": ["tttx-list.scss"]
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
static get styleUrls() {
|
|
40
|
-
return {
|
|
41
|
-
"$": ["tttx-list.css"]
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
static get properties() {
|
|
45
|
-
return {
|
|
46
|
-
"data": {
|
|
47
|
-
"type": "string",
|
|
48
|
-
"mutable": true,
|
|
49
|
-
"complexType": {
|
|
50
|
-
"original": "string | ListItem[]",
|
|
51
|
-
"resolved": "ListItem[] | string",
|
|
52
|
-
"references": {
|
|
53
|
-
"ListItem": {
|
|
54
|
-
"location": "import",
|
|
55
|
-
"path": "./interfaces"
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"required": false,
|
|
60
|
-
"optional": false,
|
|
61
|
-
"docs": {
|
|
62
|
-
"tags": [],
|
|
63
|
-
"text": ""
|
|
64
|
-
},
|
|
65
|
-
"attribute": "data",
|
|
66
|
-
"reflect": false
|
|
67
|
-
},
|
|
68
|
-
"name": {
|
|
69
|
-
"type": "string",
|
|
70
|
-
"mutable": false,
|
|
71
|
-
"complexType": {
|
|
72
|
-
"original": "string",
|
|
73
|
-
"resolved": "string",
|
|
74
|
-
"references": {}
|
|
75
|
-
},
|
|
76
|
-
"required": false,
|
|
77
|
-
"optional": false,
|
|
78
|
-
"docs": {
|
|
79
|
-
"tags": [],
|
|
80
|
-
"text": ""
|
|
81
|
-
},
|
|
82
|
-
"attribute": "name",
|
|
83
|
-
"reflect": false
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
static get events() {
|
|
88
|
-
return [{
|
|
89
|
-
"method": "rowClick",
|
|
90
|
-
"name": "listRowClick",
|
|
91
|
-
"bubbles": true,
|
|
92
|
-
"cancelable": true,
|
|
93
|
-
"composed": true,
|
|
94
|
-
"docs": {
|
|
95
|
-
"tags": [],
|
|
96
|
-
"text": ""
|
|
97
|
-
},
|
|
98
|
-
"complexType": {
|
|
99
|
-
"original": "any",
|
|
100
|
-
"resolved": "any",
|
|
101
|
-
"references": {}
|
|
102
|
-
}
|
|
103
|
-
}];
|
|
104
|
-
}
|
|
105
|
-
}
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
+
import { h } from '@stencil/core';
|
|
3
|
+
import * as DOMPurify from 'dompurify';
|
|
4
|
+
import domSanitiserOptions from '../../../shared/domsanitiser.options';
|
|
5
|
+
export class TttxList {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.data = undefined;
|
|
8
|
+
this.name = undefined;
|
|
9
|
+
}
|
|
10
|
+
onRowClickHandler(item) {
|
|
11
|
+
if (!item.clickable || !item.rowData)
|
|
12
|
+
return;
|
|
13
|
+
this.rowClick.emit({ name: this.name, data: item.rowData });
|
|
14
|
+
}
|
|
15
|
+
renderListItem(item) {
|
|
16
|
+
const cleanHTML = DOMPurify.sanitize(item.element, domSanitiserOptions);
|
|
17
|
+
return (h("li", { class: `item ${item.clickable ? 'clickable' : ''}`, onClick: () => {
|
|
18
|
+
this.onRowClickHandler(item);
|
|
19
|
+
} }, item.element && h("span", { class: "item-content", innerHTML: cleanHTML }), item.icon && h("tttx-icon", { class: "align-right ", icon: item.icon })));
|
|
20
|
+
}
|
|
21
|
+
render() {
|
|
22
|
+
if (!this.data)
|
|
23
|
+
return;
|
|
24
|
+
if (typeof this.data === 'string') {
|
|
25
|
+
this._data = JSON.parse(this.data);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
this._data = this.data;
|
|
29
|
+
}
|
|
30
|
+
return h("ul", { class: "list" }, this._data.map((item) => this.renderListItem(item)));
|
|
31
|
+
}
|
|
32
|
+
static get is() { return "tttx-list"; }
|
|
33
|
+
static get encapsulation() { return "shadow"; }
|
|
34
|
+
static get originalStyleUrls() {
|
|
35
|
+
return {
|
|
36
|
+
"$": ["tttx-list.scss"]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
static get styleUrls() {
|
|
40
|
+
return {
|
|
41
|
+
"$": ["tttx-list.css"]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
static get properties() {
|
|
45
|
+
return {
|
|
46
|
+
"data": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"mutable": true,
|
|
49
|
+
"complexType": {
|
|
50
|
+
"original": "string | ListItem[]",
|
|
51
|
+
"resolved": "ListItem[] | string",
|
|
52
|
+
"references": {
|
|
53
|
+
"ListItem": {
|
|
54
|
+
"location": "import",
|
|
55
|
+
"path": "./interfaces"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"required": false,
|
|
60
|
+
"optional": false,
|
|
61
|
+
"docs": {
|
|
62
|
+
"tags": [],
|
|
63
|
+
"text": ""
|
|
64
|
+
},
|
|
65
|
+
"attribute": "data",
|
|
66
|
+
"reflect": false
|
|
67
|
+
},
|
|
68
|
+
"name": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"mutable": false,
|
|
71
|
+
"complexType": {
|
|
72
|
+
"original": "string",
|
|
73
|
+
"resolved": "string",
|
|
74
|
+
"references": {}
|
|
75
|
+
},
|
|
76
|
+
"required": false,
|
|
77
|
+
"optional": false,
|
|
78
|
+
"docs": {
|
|
79
|
+
"tags": [],
|
|
80
|
+
"text": ""
|
|
81
|
+
},
|
|
82
|
+
"attribute": "name",
|
|
83
|
+
"reflect": false
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
static get events() {
|
|
88
|
+
return [{
|
|
89
|
+
"method": "rowClick",
|
|
90
|
+
"name": "listRowClick",
|
|
91
|
+
"bubbles": true,
|
|
92
|
+
"cancelable": true,
|
|
93
|
+
"composed": true,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": ""
|
|
97
|
+
},
|
|
98
|
+
"complexType": {
|
|
99
|
+
"original": "any",
|
|
100
|
+
"resolved": "any",
|
|
101
|
+
"references": {}
|
|
102
|
+
}
|
|
103
|
+
}];
|
|
104
|
+
}
|
|
105
|
+
}
|