terrier-engine 4.19.1 → 4.20.0
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/package.json +1 -1
- package/terrier/forms.ts +19 -1
package/package.json
CHANGED
package/terrier/forms.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {Field, FormFields, FormPartData, InputType, KeyOfType, SelectOptions} from "tuff-core/forms"
|
|
2
2
|
import {DbErrors} from "./db-client"
|
|
3
3
|
import {PartTag} from "tuff-core/parts"
|
|
4
|
-
import {InputTag, InputTagAttrs} from "tuff-core/html"
|
|
4
|
+
import {InputTag, InputTagAttrs, SelectTag, SelectTagAttrs, TextAreaTag, TextAreaTagAttrs} from "tuff-core/html"
|
|
5
5
|
import TerrierPart from "./parts/terrier-part"
|
|
6
6
|
import GlypPicker from "./parts/glyp-picker"
|
|
7
7
|
import Glyps from "./glyps"
|
|
@@ -97,6 +97,24 @@ export class TerrierFormFields<T extends FormPartData> extends FormFields<T> {
|
|
|
97
97
|
return super.input(parent, type, name, serializerType, attrs);
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
select<Key extends KeyOfType<T, string> & string>(parent: PartTag, name: Key, options?: SelectOptions, attrs: SelectTagAttrs = {}): SelectTag {
|
|
101
|
+
if (this.errors && this.errors[name]) {
|
|
102
|
+
attrs ||= {}
|
|
103
|
+
attrs.classes ||= []
|
|
104
|
+
attrs.classes.push('error')
|
|
105
|
+
}
|
|
106
|
+
return super.select(parent, name, options, attrs);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
textArea<Key extends KeyOfType<T, string> & string>(parent: PartTag, name: Key, attrs: TextAreaTagAttrs={}): TextAreaTag {
|
|
110
|
+
if (this.errors && this.errors[name]) {
|
|
111
|
+
attrs ||= {}
|
|
112
|
+
attrs.classes ||= []
|
|
113
|
+
attrs.classes.push('error')
|
|
114
|
+
}
|
|
115
|
+
return super.textArea(parent, name, attrs);
|
|
116
|
+
}
|
|
117
|
+
|
|
100
118
|
/**
|
|
101
119
|
* Only renders the error bubble if the errors are set.
|
|
102
120
|
* @param parent
|