@thi.ng/rdom-forms 0.3.33 → 0.4.1
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/CHANGELOG.md +10 -1
- package/README.md +1 -1
- package/api.d.ts +18 -9
- package/compile.js +9 -12
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-10-05T12:12:32Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,15 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
## [0.4.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom-forms@0.4.0) (2024-10-05)
|
|
13
|
+
|
|
14
|
+
#### 🚀 Features
|
|
15
|
+
|
|
16
|
+
- update attrib & value config handling ([7495584](https://github.com/thi-ng/umbrella/commit/7495584))
|
|
17
|
+
- allow reactive attributes in more places
|
|
18
|
+
- don't generate event handlers if widget spec has no `value` option
|
|
19
|
+
- always apply user provided attribs (incl. event handlers) last
|
|
20
|
+
|
|
12
21
|
### [0.3.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/rdom-forms@0.3.1) (2024-03-28)
|
|
13
22
|
|
|
14
23
|
#### 🩹 Bug fixes
|
package/README.md
CHANGED
package/api.d.ts
CHANGED
|
@@ -33,14 +33,22 @@ export interface Custom extends Pick<FormItem, "type"> {
|
|
|
33
33
|
export interface Group extends FormItem {
|
|
34
34
|
type: "group";
|
|
35
35
|
items: FormItem[];
|
|
36
|
-
label?:
|
|
36
|
+
label?: StringAttrib | false;
|
|
37
37
|
}
|
|
38
38
|
export interface Value extends FormItem, Partial<CommonAttribs> {
|
|
39
39
|
id: string;
|
|
40
40
|
name?: string;
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* If false, no `<label>` element will be generated for this control and the
|
|
43
|
+
* {@link Value.desc} value will be unused.
|
|
44
|
+
*/
|
|
45
|
+
label?: StringAttrib | false;
|
|
42
46
|
desc?: any;
|
|
43
47
|
required?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* If true, no input/change event handlers will be generated and the
|
|
50
|
+
* `readonly` attribute will be set on the input DOM element.
|
|
51
|
+
*/
|
|
44
52
|
readonly?: boolean;
|
|
45
53
|
attribs?: Partial<InputAttribs>;
|
|
46
54
|
}
|
|
@@ -59,7 +67,7 @@ export interface Num extends Value, WithPresets<number> {
|
|
|
59
67
|
type: "num";
|
|
60
68
|
min?: number;
|
|
61
69
|
max?: number;
|
|
62
|
-
placeholder?:
|
|
70
|
+
placeholder?: StringAttrib;
|
|
63
71
|
size?: number;
|
|
64
72
|
step?: number;
|
|
65
73
|
value?: ISubscription<number, number>;
|
|
@@ -74,7 +82,7 @@ export interface Str extends Value, WithPresets<string> {
|
|
|
74
82
|
min?: number;
|
|
75
83
|
max?: number;
|
|
76
84
|
pattern?: string | RegExp | Predicate<string>;
|
|
77
|
-
placeholder?:
|
|
85
|
+
placeholder?: StringAttrib;
|
|
78
86
|
size?: number;
|
|
79
87
|
value?: ISubscription<string, string>;
|
|
80
88
|
attribs?: Partial<InputTextAttribs>;
|
|
@@ -98,7 +106,7 @@ export interface Text extends Value {
|
|
|
98
106
|
type: "text";
|
|
99
107
|
cols?: number;
|
|
100
108
|
rows?: number;
|
|
101
|
-
placeholder?:
|
|
109
|
+
placeholder?: StringAttrib;
|
|
102
110
|
value?: ISubscription<string, string>;
|
|
103
111
|
attribs?: Partial<TextAreaAttribs>;
|
|
104
112
|
}
|
|
@@ -164,18 +172,18 @@ export interface Toggle extends Value {
|
|
|
164
172
|
}
|
|
165
173
|
export interface Trigger extends Value {
|
|
166
174
|
type: "trigger";
|
|
167
|
-
title:
|
|
175
|
+
title: StringAttrib;
|
|
168
176
|
value?: ISubscriber<boolean>;
|
|
169
177
|
}
|
|
170
178
|
export interface Submit extends Omit<Value, "required" | "readonly"> {
|
|
171
179
|
type: "submit";
|
|
172
|
-
title:
|
|
180
|
+
title: StringAttrib;
|
|
173
181
|
value?: ISubscriber<boolean>;
|
|
174
182
|
attribs?: Partial<InputSubmitAttribs>;
|
|
175
183
|
}
|
|
176
184
|
export interface Reset extends Omit<Value, "required" | "readonly"> {
|
|
177
185
|
type: "submit";
|
|
178
|
-
title:
|
|
186
|
+
title: StringAttrib;
|
|
179
187
|
value?: ISubscriber<boolean>;
|
|
180
188
|
}
|
|
181
189
|
export interface Radio<T> extends Value {
|
|
@@ -268,7 +276,8 @@ export interface BehaviorOpts {
|
|
|
268
276
|
*/
|
|
269
277
|
labels: boolean;
|
|
270
278
|
/**
|
|
271
|
-
* If false, no `value` attributes and event handlers will be generated
|
|
279
|
+
* If false, no `value` attributes and event handlers will be generated,
|
|
280
|
+
* even if a `value` option has been specified.
|
|
272
281
|
*
|
|
273
282
|
* @defaultValue true
|
|
274
283
|
*/
|
package/compile.js
CHANGED
|
@@ -112,25 +112,22 @@ const __genCommon = (val, opts) => {
|
|
|
112
112
|
};
|
|
113
113
|
const __attribs = (attribs, events, val, opts, value = "value") => {
|
|
114
114
|
const id = __genID(val.id, opts);
|
|
115
|
-
Object.assign(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
readonly: val.readonly
|
|
123
|
-
},
|
|
124
|
-
val.attribs
|
|
125
|
-
);
|
|
115
|
+
Object.assign(attribs, {
|
|
116
|
+
id,
|
|
117
|
+
name: val.name || val.id,
|
|
118
|
+
list: val.list ? id + "--list" : void 0,
|
|
119
|
+
required: val.required,
|
|
120
|
+
readonly: val.readonly
|
|
121
|
+
});
|
|
126
122
|
if (__useValues(opts)) {
|
|
127
|
-
if (!val.readonly) {
|
|
123
|
+
if (!val.readonly && val.value !== void 0) {
|
|
128
124
|
Object.assign(attribs, events);
|
|
129
125
|
}
|
|
130
126
|
if (value !== false) {
|
|
131
127
|
attribs[value] = val.value;
|
|
132
128
|
}
|
|
133
129
|
}
|
|
130
|
+
if (val.attribs) Object.assign(attribs, val.attribs);
|
|
134
131
|
return attribs;
|
|
135
132
|
};
|
|
136
133
|
const __component = (val, opts, el, attribs, events, value = "value", ...body) => div(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/rdom-forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Data-driven declarative & extensible HTML form generation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/defmulti": "^3.0.
|
|
42
|
-
"@thi.ng/hiccup-html": "^2.7.
|
|
43
|
-
"@thi.ng/rdom": "^1.7.
|
|
44
|
-
"@thi.ng/rstream": "^9.0.
|
|
39
|
+
"@thi.ng/api": "^8.11.11",
|
|
40
|
+
"@thi.ng/checks": "^3.6.13",
|
|
41
|
+
"@thi.ng/defmulti": "^3.0.49",
|
|
42
|
+
"@thi.ng/hiccup-html": "^2.7.8",
|
|
43
|
+
"@thi.ng/rdom": "^1.7.7",
|
|
44
|
+
"@thi.ng/rstream": "^9.0.6"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@microsoft/api-extractor": "^7.47.9",
|
|
48
|
-
"esbuild": "^0.
|
|
48
|
+
"esbuild": "^0.24.0",
|
|
49
49
|
"typedoc": "^0.26.7",
|
|
50
50
|
"typescript": "^5.6.2"
|
|
51
51
|
},
|
|
@@ -96,5 +96,5 @@
|
|
|
96
96
|
"status": "alpha",
|
|
97
97
|
"year": 2023
|
|
98
98
|
},
|
|
99
|
-
"gitHead": "
|
|
99
|
+
"gitHead": "241df2019d93359c34da1a11a94e416b6ea73f32\n"
|
|
100
100
|
}
|