@operato/form 1.0.0-alpha.9 → 1.0.0-beta.10
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 +581 -0
- package/dist/src/components/ox-custom-input.js +1 -1
- package/dist/src/components/ox-custom-input.js.map +1 -1
- package/dist/src/components/ox-form-master.js +1 -1
- package/dist/src/components/ox-form-master.js.map +1 -1
- package/dist/src/components/ox-search-form.d.ts +0 -1
- package/dist/src/components/ox-search-form.js +6 -10
- package/dist/src/components/ox-search-form.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/components/ox-custom-input.ts +1 -1
- package/src/components/ox-form-master.ts +1 -1
- package/src/components/ox-search-form.ts +6 -11
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "WebApplication form supporting components following open-wc recommendations",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "heartyoh",
|
|
6
|
-
"version": "1.0.0-
|
|
6
|
+
"version": "1.0.0-beta.10",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
9
9
|
"exports": {
|
|
@@ -37,9 +37,9 @@
|
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@material/mwc-icon": "^0.25.3",
|
|
40
|
-
"@operato/graphql": "^1.0.0-
|
|
41
|
-
"@operato/utils": "^1.0.0-
|
|
42
|
-
"lit": "^2.2.
|
|
40
|
+
"@operato/graphql": "^1.0.0-beta.10",
|
|
41
|
+
"@operato/utils": "^1.0.0-beta.10",
|
|
42
|
+
"lit": "^2.2.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@custom-elements-manifest/analyzer": "^0.4.17",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"prettier --write"
|
|
74
74
|
]
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "90fef9c72ab5a9fec0c03bbfb0f49d31408ecb24"
|
|
77
77
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, PropertyValues, css, html } from 'lit'
|
|
2
2
|
import { customElement, property, query, state } from 'lit/decorators.js'
|
|
3
3
|
|
|
4
|
-
@customElement('custom-input')
|
|
4
|
+
@customElement('ox-custom-input')
|
|
5
5
|
export class CustomInput extends LitElement {
|
|
6
6
|
static styles = css`
|
|
7
7
|
input {
|
|
@@ -48,17 +48,12 @@ export class SearchForm extends LitElement {
|
|
|
48
48
|
@query('form') form!: HTMLFormElement
|
|
49
49
|
@queryAll('input, select') formFields!: ((HTMLInputElement | HTMLSelectElement) & { field: string; _value: any })[]
|
|
50
50
|
|
|
51
|
-
/* @deprecated */
|
|
52
|
-
getFields() {
|
|
53
|
-
return Array.from(this.form.querySelectorAll('input, select') || [])
|
|
54
|
-
}
|
|
55
|
-
|
|
56
51
|
render() {
|
|
57
52
|
return html`
|
|
58
53
|
<form
|
|
59
54
|
class="search-form"
|
|
60
55
|
@keypress=${(e: KeyboardEvent) => {
|
|
61
|
-
if (e.
|
|
56
|
+
if (e.key === 'Enter') {
|
|
62
57
|
e.preventDefault()
|
|
63
58
|
this.submit()
|
|
64
59
|
}
|
|
@@ -145,7 +140,7 @@ export class SearchForm extends LitElement {
|
|
|
145
140
|
if (changes.has('fields')) {
|
|
146
141
|
this._checkInputValidity()
|
|
147
142
|
|
|
148
|
-
var formFields = this.formFields
|
|
143
|
+
var formFields = Array.from(this.formFields)
|
|
149
144
|
this.fields &&
|
|
150
145
|
this.fields.forEach(field => {
|
|
151
146
|
var formField = formFields.find(f => f.name == field.name)
|
|
@@ -188,14 +183,14 @@ export class SearchForm extends LitElement {
|
|
|
188
183
|
|
|
189
184
|
get searchParams() {
|
|
190
185
|
let searchParam = new URLSearchParams()
|
|
191
|
-
const fields = this.formFields
|
|
186
|
+
const fields = Array.from(this.formFields)
|
|
192
187
|
fields.forEach(field => searchParam.append(field.name, field.value))
|
|
193
188
|
|
|
194
189
|
return decodeURI(searchParam.toString())
|
|
195
190
|
}
|
|
196
191
|
|
|
197
192
|
get queryFilters() {
|
|
198
|
-
return this.formFields
|
|
193
|
+
return Array.from(this.formFields)
|
|
199
194
|
.filter(
|
|
200
195
|
field =>
|
|
201
196
|
(field.type !== 'checkbox' && field.value && field.value !== '') ||
|
|
@@ -226,7 +221,7 @@ export class SearchForm extends LitElement {
|
|
|
226
221
|
|
|
227
222
|
public async getQueryFilters() {
|
|
228
223
|
return await Promise.all(
|
|
229
|
-
this.formFields
|
|
224
|
+
Array.from(this.formFields)
|
|
230
225
|
.filter(
|
|
231
226
|
field =>
|
|
232
227
|
(field.type !== 'checkbox' && field.value && field.value !== '') ||
|
|
@@ -297,7 +292,7 @@ export class SearchForm extends LitElement {
|
|
|
297
292
|
serialize() {
|
|
298
293
|
let data: { [name: string]: any } = {}
|
|
299
294
|
|
|
300
|
-
this.formFields.forEach(field => {
|
|
295
|
+
Array.from(this.formFields).forEach(field => {
|
|
301
296
|
const name = field.name
|
|
302
297
|
if (field.type === 'number') {
|
|
303
298
|
data[name] = parseFloat(field.value)
|