Skip to content

Commit 0efb998

Browse files
committed
Made most input elements form aware
This makes most elements that represent an input be aware of their surrounding form. It currently handles sending the values to the form and reacting to resets. I need to do at least 2 more PRs to complete this: 1. To make dnn-richtext also form aware (need to fix a bug before that) 2. To iron out validation UX/logic when validating a whole form. I though making those is separate PRs might make it easier to review.
1 parent 8b961f8 commit 0efb998

File tree

26 files changed

+548
-181
lines changed

26 files changed

+548
-181
lines changed

Diff for: packages/stencil-library/custom-elements.json

+63-3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,15 @@
5656
"default": "false",
5757
"required": false
5858
},
59+
{
60+
"name": "form-button-type",
61+
"type": {
62+
"text": "\"button\" | \"reset\" | \"submit\""
63+
},
64+
"description": "Optional button type,\ncan be either submit, reset or button and defaults to button if not specified.\nWarning: DNN wraps the whole page in a form, only use this if you are handling\nform submission manually.",
65+
"default": "'button'",
66+
"required": false
67+
},
5968
{
6069
"name": "reversed",
6170
"type": {
@@ -156,6 +165,14 @@
156165
"default": "\"unchecked\"",
157166
"required": false
158167
},
168+
{
169+
"name": "name",
170+
"type": {
171+
"text": "string"
172+
},
173+
"description": "The name to show in the formData (if using forms).",
174+
"required": false
175+
},
159176
{
160177
"name": "use-intermediate",
161178
"type": {
@@ -171,6 +188,7 @@
171188
"text": "string"
172189
},
173190
"description": "The value for this checkbox (not to be confused with its checked state).",
191+
"default": "\"on\"",
174192
"required": false
175193
}
176194
],
@@ -385,7 +403,7 @@
385403
"type": {
386404
"text": "string"
387405
},
388-
"description": "The name for this input, if not provided a random name will be assigned.",
406+
"description": "The name for this input if forms are used.",
389407
"required": false
390408
},
391409
{
@@ -565,6 +583,14 @@
565583
},
566584
"description": "Max file size in bytes.",
567585
"required": false
586+
},
587+
{
588+
"name": "name",
589+
"type": {
590+
"text": "string"
591+
},
592+
"description": "The name of the field when used in a form.",
593+
"required": false
568594
}
569595
],
570596
"members": [
@@ -651,6 +677,14 @@
651677
"description": "Sets the desired final image height.",
652678
"required": false
653679
},
680+
{
681+
"name": "name",
682+
"type": {
683+
"text": "string"
684+
},
685+
"description": "The name of the control when used in a form.",
686+
"required": false
687+
},
654688
{
655689
"name": "prevent-undersized",
656690
"type": {
@@ -814,7 +848,7 @@
814848
"type": {
815849
"text": "string"
816850
},
817-
"description": "The name for this input, if not provided a random name will be assigned.",
851+
"description": "The name for this input when used in forms.",
818852
"required": false
819853
},
820854
{
@@ -1046,12 +1080,21 @@
10461080
"default": "\"html\"",
10471081
"required": false
10481082
},
1083+
{
1084+
"name": "name",
1085+
"type": {
1086+
"text": "string"
1087+
},
1088+
"description": "The name of the control to use for forms.",
1089+
"required": false
1090+
},
10491091
{
10501092
"name": "value",
10511093
"type": {
10521094
"text": "string"
10531095
},
10541096
"description": "Sets the code contained in the editor",
1097+
"default": "\"\"",
10551098
"required": false
10561099
}
10571100
],
@@ -1391,7 +1434,7 @@
13911434
"type": {
13921435
"text": "string"
13931436
},
1394-
"description": "The name for this input, if not provided a random name will be assigned.",
1437+
"description": "The name for this input, if used in forms.",
13951438
"required": false
13961439
},
13971440
{
@@ -1607,6 +1650,23 @@
16071650
"description": "If 'true' the toggle is not be interacted with.",
16081651
"default": "false",
16091652
"required": false
1653+
},
1654+
{
1655+
"name": "name",
1656+
"type": {
1657+
"text": "string"
1658+
},
1659+
"description": "The field name to use in forms.",
1660+
"required": false
1661+
},
1662+
{
1663+
"name": "value",
1664+
"type": {
1665+
"text": "string"
1666+
},
1667+
"description": "The value to post when used in forms.",
1668+
"default": "\"on\"",
1669+
"required": false
16101670
}
16111671
],
16121672
"members": [],

Diff for: packages/stencil-library/licenses.json

+1-80
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,11 @@
11
{
2-
"@babel/code-frame@7.12.11": {
3-
"licenses": "MIT",
4-
"repository": "https://github.com/babel/babel",
5-
"publisher": "Sebastian McKenzie",
6-
"email": "sebmck@gmail.com",
7-
"path": "node_modules\\@babel\\code-frame",
8-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\@babel\\code-frame\\LICENSE"
9-
},
102
"@dnncommunity/dnn-elements@0.23.3-alpha.7": {
113
"licenses": "MIT",
124
"repository": "https://github.com/dnncommunity/dnn-elements",
135
"path": "",
146
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\README.md"
157
},
16-
"@eslint/eslintrc@0.4.3": {
17-
"licenses": "MIT",
18-
"repository": "https://github.com/eslint/eslintrc",
19-
"publisher": "Nicholas C. Zakas",
20-
"path": "node_modules\\@eslint\\eslintrc",
21-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\@eslint\\eslintrc\\LICENSE"
22-
},
23-
"@humanwhocodes/config-array@0.5.0": {
24-
"licenses": "Apache-2.0",
25-
"repository": "https://github.com/humanwhocodes/config-array",
26-
"publisher": "Nicholas C. Zakas",
27-
"path": "node_modules\\@humanwhocodes\\config-array",
28-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\@humanwhocodes\\config-array\\LICENSE"
29-
},
30-
"@stencil/eslint-plugin@0.4.0": {
31-
"licenses": "MIT",
32-
"repository": "https://github.com/ionic-team/stencil-eslint",
33-
"path": "node_modules\\@stencil\\eslint-plugin",
34-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\@stencil\\eslint-plugin\\LICENSE.md"
35-
},
36-
"eslint-utils@2.1.0": {
37-
"licenses": "MIT",
38-
"repository": "https://github.com/mysticatea/eslint-utils",
39-
"publisher": "Toru Nagashima",
40-
"path": "node_modules\\eslint\\node_modules\\eslint-utils",
41-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\eslint\\node_modules\\eslint-utils\\LICENSE"
42-
},
43-
"eslint-visitor-keys@1.3.0": {
44-
"licenses": "Apache-2.0",
45-
"repository": "https://github.com/eslint/eslint-visitor-keys",
46-
"publisher": "Toru Nagashima",
47-
"path": "node_modules\\espree\\node_modules\\eslint-visitor-keys",
48-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\espree\\node_modules\\eslint-visitor-keys\\LICENSE"
49-
},
50-
"eslint@7.32.0": {
51-
"licenses": "MIT",
52-
"repository": "https://github.com/eslint/eslint",
53-
"publisher": "Nicholas C. Zakas",
54-
"email": "nicholas+npm@nczconsulting.com",
55-
"path": "node_modules\\eslint",
56-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\eslint\\LICENSE"
57-
},
58-
"espree@7.3.1": {
59-
"licenses": "BSD-2-Clause",
60-
"repository": "https://github.com/eslint/espree",
61-
"publisher": "Nicholas C. Zakas",
62-
"email": "nicholas+npm@nczconsulting.com",
63-
"path": "node_modules\\espree",
64-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\espree\\LICENSE"
65-
},
66-
"ignore@4.0.6": {
67-
"licenses": "MIT",
68-
"repository": "https://github.com/kaelzhang/node-ignore",
69-
"publisher": "kael",
70-
"path": "node_modules\\ignore",
71-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\ignore\\LICENSE-MIT"
72-
},
73-
"tslib@1.14.1": {
74-
"licenses": "0BSD",
75-
"repository": "https://github.com/Microsoft/tslib",
76-
"publisher": "Microsoft Corp.",
77-
"path": "node_modules\\tslib",
78-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\tslib\\LICENSE.txt"
79-
},
80-
"tsutils@3.0.0": {
81-
"licenses": "MIT",
82-
"repository": "https://github.com/ajafff/tsutils",
83-
"publisher": "Klaus Meinhardt",
84-
"path": "node_modules\\tsutils",
85-
"licenseFile": "D:\\dnn-elements\\dnn-elements\\packages\\stencil-library\\node_modules\\tsutils\\LICENSE"
86-
},
87-
"typescript@4.9.5": {
8+
"typescript@5.2.2": {
889
"licenses": "Apache-2.0",
8910
"repository": "https://github.com/Microsoft/TypeScript",
9011
"publisher": "Microsoft Corp.",

0 commit comments

Comments
 (0)