@operato/input 1.0.0-alpha.5 → 1.0.0-alpha.50
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 +396 -0
- package/README.md +9 -6
- package/assets/images/icon-editor-gradient-direction.png +0 -0
- package/assets/images/icon-properties-label.png +0 -0
- package/assets/images/icon-properties-line-type.png +0 -0
- package/assets/images/icon-properties-table.png +0 -0
- package/demo/index-color-gradient.html +35 -0
- package/demo/index-color-stops.html +62 -0
- package/demo/index-color.html +35 -0
- package/demo/index-crontab.html +37 -0
- package/demo/index-multiple-colors.html +37 -0
- package/demo/index-partition-keys.html +71 -0
- package/demo/index-select.html +21 -14
- package/demo/index-table.html +39 -0
- package/demo/index-value-map.html +80 -0
- package/demo/index-value-ranges.html +80 -0
- package/demo/index-work-shift.html +59 -0
- package/demo/index.html +14 -0
- package/dist/src/index.d.ts +21 -11
- package/dist/src/index.js +21 -11
- package/dist/src/index.js.map +1 -1
- package/dist/src/ox-checkbox.d.ts +1 -1
- package/dist/src/ox-checkbox.js +1 -1
- package/dist/src/ox-checkbox.js.map +1 -1
- package/dist/src/ox-form-field.d.ts +2 -2
- package/dist/src/ox-form-field.js.map +1 -1
- package/dist/src/ox-input-barcode.d.ts +1 -1
- package/dist/src/ox-input-barcode.js +1 -1
- package/dist/src/ox-input-barcode.js.map +1 -1
- package/dist/src/ox-input-code.d.ts +4 -4
- package/dist/src/ox-input-code.js +8 -8
- package/dist/src/ox-input-code.js.map +1 -1
- package/dist/src/ox-input-color-gradient.d.ts +26 -0
- package/dist/src/ox-input-color-gradient.js +318 -0
- package/dist/src/ox-input-color-gradient.js.map +1 -0
- package/dist/src/ox-input-color-stops.d.ts +71 -0
- package/dist/src/ox-input-color-stops.js +445 -0
- package/dist/src/ox-input-color-stops.js.map +1 -0
- package/dist/src/ox-input-color.d.ts +176 -0
- package/dist/src/ox-input-color.js +298 -0
- package/dist/src/ox-input-color.js.map +1 -0
- package/dist/src/ox-input-crontab.d.ts +23 -0
- package/dist/src/ox-input-crontab.js +560 -0
- package/dist/src/ox-input-crontab.js.map +1 -0
- package/dist/src/ox-input-data.d.ts +1 -1
- package/dist/src/ox-input-data.js +1 -1
- package/dist/src/ox-input-data.js.map +1 -1
- package/dist/src/ox-input-layout/ox-input-card-layout.d.ts +4 -0
- package/dist/src/ox-input-layout/ox-input-card-layout.js +57 -0
- package/dist/src/ox-input-layout/ox-input-card-layout.js.map +1 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.d.ts +4 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.js +63 -0
- package/dist/src/ox-input-layout/ox-input-grid-layout.js.map +1 -0
- package/dist/src/ox-input-layout/ox-input-layout.d.ts +5 -0
- package/dist/src/ox-input-layout/ox-input-layout.js +73 -0
- package/dist/src/ox-input-layout/ox-input-layout.js.map +1 -0
- package/dist/src/ox-input-multiple-colors.d.ts +28 -0
- package/dist/src/ox-input-multiple-colors.js +113 -0
- package/dist/src/ox-input-multiple-colors.js.map +1 -0
- package/dist/src/ox-input-options.js.map +1 -1
- package/dist/src/ox-input-partition-keys.d.ts +36 -0
- package/dist/src/ox-input-partition-keys.js +204 -0
- package/dist/src/ox-input-partition-keys.js.map +1 -0
- package/dist/src/{ox-input-id.d.ts → ox-input-scene-component-id.d.ts} +0 -0
- package/dist/src/{ox-input-id.js → ox-input-scene-component-id.js} +2 -2
- package/dist/src/ox-input-scene-component-id.js.map +1 -0
- package/dist/src/ox-input-search.d.ts +1 -0
- package/dist/src/ox-input-search.js +7 -1
- package/dist/src/ox-input-search.js.map +1 -1
- package/dist/src/ox-input-stack.d.ts +1 -1
- package/dist/src/ox-input-stack.js +1 -1
- package/dist/src/ox-input-stack.js.map +1 -1
- package/dist/src/ox-input-table.d.ts +8 -0
- package/dist/src/ox-input-table.js +379 -0
- package/dist/src/ox-input-table.js.map +1 -0
- package/dist/src/ox-input-value-map.d.ts +41 -0
- package/dist/src/ox-input-value-map.js +279 -0
- package/dist/src/ox-input-value-map.js.map +1 -0
- package/dist/src/ox-input-value-ranges.d.ts +41 -0
- package/dist/src/ox-input-value-ranges.js +298 -0
- package/dist/src/ox-input-value-ranges.js.map +1 -0
- package/dist/src/ox-input-work-shift.d.ts +33 -0
- package/dist/src/ox-input-work-shift.js +229 -0
- package/dist/src/ox-input-work-shift.js.map +1 -0
- package/dist/src/ox-select.d.ts +3 -0
- package/dist/src/ox-select.js +28 -3
- package/dist/src/ox-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -7
- package/src/index.ts +21 -11
- package/src/ox-checkbox.ts +2 -2
- package/src/ox-form-field.ts +2 -2
- package/src/ox-input-barcode.ts +2 -3
- package/src/ox-input-code.ts +9 -10
- package/src/ox-input-color-gradient.ts +343 -0
- package/src/ox-input-color-stops.ts +499 -0
- package/src/ox-input-color.ts +323 -0
- package/src/ox-input-crontab.ts +561 -0
- package/src/ox-input-data.ts +2 -2
- package/src/ox-input-layout/ox-input-card-layout.ts +58 -0
- package/src/ox-input-layout/ox-input-grid-layout.ts +64 -0
- package/src/ox-input-layout/ox-input-layout.ts +77 -0
- package/src/ox-input-multiple-colors.ts +113 -0
- package/src/ox-input-options.ts +1 -1
- package/src/ox-input-partition-keys.ts +243 -0
- package/src/{ox-input-id.ts → ox-input-scene-component-id.ts} +1 -1
- package/src/ox-input-search.ts +9 -1
- package/src/ox-input-stack.ts +1 -1
- package/src/ox-input-table.ts +404 -0
- package/src/{ox-input-keyvalues.ts.ing → ox-input-value-map.ts} +125 -94
- package/src/ox-input-value-ranges.ts +325 -0
- package/src/ox-input-work-shift.ts +251 -0
- package/src/ox-select.ts +31 -5
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
- package/dist/src/ox-input-id.js.map +0 -1
- package/src/ox-input-ranges.ts.ing +0 -292
@@ -0,0 +1,77 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import './things-grid-layout'
|
6
|
+
import './things-card-layout'
|
7
|
+
|
8
|
+
import { LitElement, PropertyValues, html } from 'lit'
|
9
|
+
import { customElement, property, state } from 'lit/decorators.js'
|
10
|
+
|
11
|
+
// import './things-linear-horizontal-layout'
|
12
|
+
// import './things-linear-vertical-layout'
|
13
|
+
|
14
|
+
const layouts = ['absolute', 'card', 'grid', 'linear-horizontal', 'linear-vertical', 'table']
|
15
|
+
|
16
|
+
@customElement('ox-input-layout')
|
17
|
+
class OxInputLayout extends LitElement {
|
18
|
+
@property({ type: Object }) value: any = {}
|
19
|
+
@property({ type: String }) layout:
|
20
|
+
| ''
|
21
|
+
| 'absolute'
|
22
|
+
| 'card'
|
23
|
+
| 'grid'
|
24
|
+
| 'linear-horizontal'
|
25
|
+
| 'linear-vertical'
|
26
|
+
| 'table' = ''
|
27
|
+
@property({ type: Object }) options: any = {}
|
28
|
+
|
29
|
+
firstUpdated() {
|
30
|
+
this.renderRoot.addEventListener('change', this._onValueChange.bind(this))
|
31
|
+
}
|
32
|
+
|
33
|
+
updated(changes: PropertyValues<this>) {
|
34
|
+
if (changes.has('value')) {
|
35
|
+
this.layout = this.value.layout
|
36
|
+
this.options = this.value.options
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
render() {
|
41
|
+
return html`
|
42
|
+
<div>
|
43
|
+
<select value-key="layout" .value=${this.layout}>
|
44
|
+
<option value="" selected></option>
|
45
|
+
${layouts.map(layout => {
|
46
|
+
return html` <option value=${layout}>${layout}</option> `
|
47
|
+
})}
|
48
|
+
</select>
|
49
|
+
|
50
|
+
${this.layout == 'grid'
|
51
|
+
? html` <things-grid-layout value-key="options" .value=${this.options}></things-grid-layout> `
|
52
|
+
: this.layout == 'card'
|
53
|
+
? html` <things-card-layout value-key="options" .value=${this.options}></things-card-layout> `
|
54
|
+
: html``}
|
55
|
+
</div>
|
56
|
+
`
|
57
|
+
}
|
58
|
+
|
59
|
+
_onValueChange(e: Event) {
|
60
|
+
var element = e.target as HTMLElement
|
61
|
+
var key = element.getAttribute('value-key')
|
62
|
+
|
63
|
+
if (!key) {
|
64
|
+
return
|
65
|
+
}
|
66
|
+
|
67
|
+
//@ts-ignore
|
68
|
+
this[key] = element.value
|
69
|
+
|
70
|
+
this.value = {
|
71
|
+
layout: this.layout,
|
72
|
+
options: this.options
|
73
|
+
}
|
74
|
+
|
75
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
76
|
+
}
|
77
|
+
}
|
@@ -0,0 +1,113 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import './ox-input-color.js'
|
6
|
+
|
7
|
+
import { css, html } from 'lit'
|
8
|
+
import { customElement, property, query, queryAll } from 'lit/decorators.js'
|
9
|
+
|
10
|
+
import { OxFormField } from './ox-form-field.js'
|
11
|
+
import { OxInputColor } from './ox-input-color.js'
|
12
|
+
|
13
|
+
/**
|
14
|
+
색상 배열을 편집하는 컴포넌트이다.
|
15
|
+
|
16
|
+
새로운 색상을 추가하고자 할 때는 `+` 버튼을 클릭한다.<br />
|
17
|
+
색상을 제거하고자 할 때는 `-` 버튼을 클릭한다.<br />
|
18
|
+
|
19
|
+
Example:
|
20
|
+
|
21
|
+
<ox-input-multiple-colors values=${values}>
|
22
|
+
</ox-input-multiple-colors>
|
23
|
+
*/
|
24
|
+
|
25
|
+
@customElement('ox-input-multiple-colors')
|
26
|
+
export class OxInputMultipleColors extends OxFormField {
|
27
|
+
static styles = css`
|
28
|
+
:host {
|
29
|
+
display: inline-block;
|
30
|
+
}
|
31
|
+
|
32
|
+
#colors-container > div {
|
33
|
+
display: grid;
|
34
|
+
grid-template-columns: 22px 1fr 22px;
|
35
|
+
grid-gap: 5px;
|
36
|
+
align-items: center;
|
37
|
+
justify-content: left;
|
38
|
+
}
|
39
|
+
|
40
|
+
ox-input-color {
|
41
|
+
height: 25px;
|
42
|
+
width: 100%;
|
43
|
+
}
|
44
|
+
|
45
|
+
input[type='button'] {
|
46
|
+
width: 22px;
|
47
|
+
height: 25px;
|
48
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
49
|
+
padding-top: 0px;
|
50
|
+
padding-bottom: 2px;
|
51
|
+
background-color: #f1f2f4;
|
52
|
+
color: #8f9192;
|
53
|
+
font-size: 16px;
|
54
|
+
}
|
55
|
+
`
|
56
|
+
|
57
|
+
@property({ type: Array }) value: string[] = []
|
58
|
+
|
59
|
+
@query('#colors-container') colorsContainer!: HTMLDivElement
|
60
|
+
@queryAll('ox-input-color') colors!: NodeListOf<OxInputColor>
|
61
|
+
|
62
|
+
firstUpdated() {
|
63
|
+
this.renderRoot.addEventListener('change', this._onValueChanged.bind(this))
|
64
|
+
}
|
65
|
+
|
66
|
+
render() {
|
67
|
+
return html`
|
68
|
+
<div id="colors-container">
|
69
|
+
${(this.value || []).map(
|
70
|
+
(item, index) => html`
|
71
|
+
<div>
|
72
|
+
<input type="button" value="+" @click=${() => this._appendEditorColor()} data-index=${index} />
|
73
|
+
|
74
|
+
<ox-input-color .value=${item}> </ox-input-color>
|
75
|
+
|
76
|
+
${(this.value || []).length > 1
|
77
|
+
? html`
|
78
|
+
<input
|
79
|
+
type="button"
|
80
|
+
value="-"
|
81
|
+
@click=${(e: Event) => this._removeEditorColor(e)}
|
82
|
+
data-index=${index}
|
83
|
+
/>
|
84
|
+
`
|
85
|
+
: html``}
|
86
|
+
</div>
|
87
|
+
`
|
88
|
+
)}
|
89
|
+
</div>
|
90
|
+
`
|
91
|
+
}
|
92
|
+
|
93
|
+
_onValueChanged() {
|
94
|
+
this.value = Array.from(this.colors).map(color => color.value!)
|
95
|
+
}
|
96
|
+
|
97
|
+
_appendEditorColor() {
|
98
|
+
this.value = [...this.value, 'black']
|
99
|
+
|
100
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
101
|
+
}
|
102
|
+
|
103
|
+
_removeEditorColor(e: Event) {
|
104
|
+
var values = []
|
105
|
+
for (var i = 0; i < this.value.length; i++) {
|
106
|
+
if (i == Number((e.target as HTMLElement).dataset.index)) continue
|
107
|
+
else values.push(this.value[i])
|
108
|
+
}
|
109
|
+
|
110
|
+
this.value = values
|
111
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true }))
|
112
|
+
}
|
113
|
+
}
|
package/src/ox-input-options.ts
CHANGED
@@ -0,0 +1,243 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
+
*/
|
4
|
+
|
5
|
+
import { css, html } from 'lit'
|
6
|
+
import { customElement, property, queryAll } from 'lit/decorators.js'
|
7
|
+
|
8
|
+
import { OxFormField } from './ox-form-field'
|
9
|
+
|
10
|
+
type PartitionKeys = { [key: string]: any }
|
11
|
+
type ArrayedPartitionKeys = { key: string; value: any }
|
12
|
+
|
13
|
+
/**
|
14
|
+
key-value map for partitions editor element
|
15
|
+
|
16
|
+
Example:
|
17
|
+
|
18
|
+
<ox-input-partition-keys
|
19
|
+
value=${map}
|
20
|
+
</ox-input-partition-keys>
|
21
|
+
*/
|
22
|
+
@customElement('ox-input-partition-keys')
|
23
|
+
export class OxInputPartitionKeys extends OxFormField {
|
24
|
+
static styles = css`
|
25
|
+
:host {
|
26
|
+
display: flex;
|
27
|
+
flex-direction: column;
|
28
|
+
align-content: center;
|
29
|
+
|
30
|
+
width: 100%;
|
31
|
+
overflow: hidden;
|
32
|
+
border: 1px solid #ccc;
|
33
|
+
}
|
34
|
+
|
35
|
+
div {
|
36
|
+
display: flex;
|
37
|
+
flex-flow: row nowrap;
|
38
|
+
align-items: center;
|
39
|
+
|
40
|
+
border-bottom: 1px solid #c0c0c0;
|
41
|
+
}
|
42
|
+
|
43
|
+
div:last-child {
|
44
|
+
border-bottom: none;
|
45
|
+
}
|
46
|
+
|
47
|
+
div > * {
|
48
|
+
min-width: 0px;
|
49
|
+
margin: 2px;
|
50
|
+
padding: 0;
|
51
|
+
}
|
52
|
+
|
53
|
+
button {
|
54
|
+
width: 20px;
|
55
|
+
text-align: center;
|
56
|
+
}
|
57
|
+
|
58
|
+
input {
|
59
|
+
flex: 1;
|
60
|
+
}
|
61
|
+
`
|
62
|
+
|
63
|
+
@property({ type: Object }) value: PartitionKeys = {}
|
64
|
+
|
65
|
+
private _changingNow: boolean = false
|
66
|
+
|
67
|
+
firstUpdated() {
|
68
|
+
this.renderRoot.addEventListener('change', this._onChange.bind(this))
|
69
|
+
}
|
70
|
+
|
71
|
+
render() {
|
72
|
+
const value = !this.value || typeof this.value !== 'object' ? {} : this.value
|
73
|
+
|
74
|
+
return html`
|
75
|
+
${this._toArray(value).map(
|
76
|
+
item => html`
|
77
|
+
<div data-record>
|
78
|
+
<input type="text" data-key placeholder="key" .value=${item.key} />
|
79
|
+
<input type="text" data-value placeholder="value" .value=${item.value} list="value-template" />
|
80
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._delete(e)} tabindex="-1">-</button>
|
81
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._up(e)} tabindex="-1">↑</button>
|
82
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._down(e)} tabindex="-1">↓</button>
|
83
|
+
</div>
|
84
|
+
`
|
85
|
+
)}
|
86
|
+
|
87
|
+
<div data-record-new>
|
88
|
+
<input type="text" data-key placeholder="key" value="" />
|
89
|
+
<input type="text" data-value placeholder="value" value="" list="value-template" />
|
90
|
+
<button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">+</button>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<datalist id="value-template">
|
94
|
+
<option value="%YYYY">year</option>
|
95
|
+
<option value="%MM">month</option>
|
96
|
+
<option value="%DD">day</option>
|
97
|
+
<option value="%YYYYMMDD">date</option>
|
98
|
+
</datalist>
|
99
|
+
`
|
100
|
+
}
|
101
|
+
|
102
|
+
_onChange(e: Event) {
|
103
|
+
if (this._changingNow) {
|
104
|
+
return
|
105
|
+
}
|
106
|
+
|
107
|
+
this._changingNow = true
|
108
|
+
|
109
|
+
const input = e.target as HTMLInputElement
|
110
|
+
var value = input.value
|
111
|
+
|
112
|
+
const record = (e.target as Element).closest('[data-record],[data-record-new]') as HTMLElement
|
113
|
+
|
114
|
+
if (record.hasAttribute('data-record')) {
|
115
|
+
this._build()
|
116
|
+
} else if (record.hasAttribute('data-record-new') && input.hasAttribute('data-value')) {
|
117
|
+
this._add()
|
118
|
+
}
|
119
|
+
|
120
|
+
this._changingNow = false
|
121
|
+
}
|
122
|
+
|
123
|
+
_build(includeNewRecord?: boolean) {
|
124
|
+
if (includeNewRecord) {
|
125
|
+
var records = this.renderRoot.querySelectorAll('[data-record],[data-record-new]') as NodeListOf<HTMLElement>
|
126
|
+
} else {
|
127
|
+
var records = this.renderRoot.querySelectorAll('[data-record]') as NodeListOf<HTMLElement>
|
128
|
+
}
|
129
|
+
|
130
|
+
var newmap: PartitionKeys = {}
|
131
|
+
|
132
|
+
for (var i = 0; i < records.length; i++) {
|
133
|
+
var record = records[i]
|
134
|
+
|
135
|
+
const key = (record.querySelector('[data-key]') as HTMLInputElement).value
|
136
|
+
const inputs = record.querySelectorAll(
|
137
|
+
'[data-value]:not([style*="display: none"])'
|
138
|
+
) as NodeListOf<HTMLInputElement>
|
139
|
+
|
140
|
+
if (!inputs || inputs.length == 0) {
|
141
|
+
continue
|
142
|
+
}
|
143
|
+
|
144
|
+
var input = inputs[inputs.length - 1]
|
145
|
+
|
146
|
+
var value = input.value
|
147
|
+
|
148
|
+
if (key) {
|
149
|
+
newmap[key] = value || ''
|
150
|
+
}
|
151
|
+
}
|
152
|
+
|
153
|
+
this.value = newmap
|
154
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
155
|
+
}
|
156
|
+
|
157
|
+
/* map아이템들을 template(dom-repeat)용 배열로 변환하는 함수 */
|
158
|
+
_toArray(map: PartitionKeys) {
|
159
|
+
var array: ArrayedPartitionKeys[] = []
|
160
|
+
|
161
|
+
for (var key in map) {
|
162
|
+
array.push({
|
163
|
+
key: key,
|
164
|
+
value: map[key]
|
165
|
+
})
|
166
|
+
}
|
167
|
+
|
168
|
+
return array
|
169
|
+
}
|
170
|
+
|
171
|
+
_add() {
|
172
|
+
this._build(true)
|
173
|
+
|
174
|
+
const inputs = this.renderRoot.querySelectorAll(
|
175
|
+
'[data-record-new] input:not([style*="display: none"])'
|
176
|
+
) as NodeListOf<HTMLInputElement & { value: any }>
|
177
|
+
|
178
|
+
for (var i = 0; i < inputs.length; i++) {
|
179
|
+
let input = inputs[i]
|
180
|
+
|
181
|
+
if (input.type == 'checkbox') input.checked = false
|
182
|
+
else input.value = ''
|
183
|
+
}
|
184
|
+
|
185
|
+
inputs[0].focus()
|
186
|
+
}
|
187
|
+
|
188
|
+
_delete(e: MouseEvent) {
|
189
|
+
const record = (e.target as Element).closest('[data-record]') as HTMLElement
|
190
|
+
|
191
|
+
;(record!.querySelector('[data-key]') as HTMLInputElement)!.value = ''
|
192
|
+
|
193
|
+
this._build()
|
194
|
+
}
|
195
|
+
|
196
|
+
@queryAll('[data-record]') records!: NodeListOf<HTMLElement>
|
197
|
+
|
198
|
+
_up(e: MouseEvent) {
|
199
|
+
const record = (e.target as Element).closest('[data-record]') as HTMLElement
|
200
|
+
const array = Array.from(this.records)
|
201
|
+
const index = array.indexOf(record) - 1
|
202
|
+
|
203
|
+
if (index < 0) {
|
204
|
+
return
|
205
|
+
}
|
206
|
+
|
207
|
+
const deleted = array.splice(index, 1)
|
208
|
+
array.splice(index + 1, 0, ...deleted)
|
209
|
+
|
210
|
+
this.value = array.reduce((sum, record) => {
|
211
|
+
const key = (record.querySelector('[data-key]') as HTMLInputElement).value
|
212
|
+
const value = (record.querySelector('[data-value]') as HTMLInputElement).value
|
213
|
+
|
214
|
+
sum[key] = value
|
215
|
+
return sum
|
216
|
+
}, {} as { [key: string]: string })
|
217
|
+
|
218
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
219
|
+
}
|
220
|
+
|
221
|
+
_down(e: MouseEvent) {
|
222
|
+
const record = (e.target as Element).closest('[data-record]') as HTMLElement
|
223
|
+
const array = Array.from(this.records)
|
224
|
+
const index = array.indexOf(record)
|
225
|
+
|
226
|
+
if (index > array.length) {
|
227
|
+
return
|
228
|
+
}
|
229
|
+
|
230
|
+
array.splice(index, 1)
|
231
|
+
array.splice(index + 1, 0, record)
|
232
|
+
|
233
|
+
this.value = array.reduce((sum, record) => {
|
234
|
+
const key = (record.querySelector('[data-key]') as HTMLInputElement).value
|
235
|
+
const value = (record.querySelector('[data-value]') as HTMLInputElement).value
|
236
|
+
|
237
|
+
sum[key] = value
|
238
|
+
return sum
|
239
|
+
}, {} as { [key: string]: string })
|
240
|
+
|
241
|
+
this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true, detail: this.value }))
|
242
|
+
}
|
243
|
+
}
|
@@ -3,7 +3,7 @@ import { customElement, property, state } from 'lit/decorators.js'
|
|
3
3
|
|
4
4
|
import { OxFormField } from './ox-form-field'
|
5
5
|
|
6
|
-
@customElement('ox-input-id')
|
6
|
+
@customElement('ox-input-scene-component-id')
|
7
7
|
export class OxInputId extends OxFormField {
|
8
8
|
static styles = css`
|
9
9
|
:host {
|
package/src/ox-input-search.ts
CHANGED
@@ -46,7 +46,7 @@ export class OxInputSearch extends OxFormField {
|
|
46
46
|
|
47
47
|
render() {
|
48
48
|
return html`
|
49
|
-
<mwc-icon>search</mwc-icon>
|
49
|
+
<mwc-icon @click=${(e: Event) => this._onClickSearch(e)}>search</mwc-icon>
|
50
50
|
<input
|
51
51
|
type="text"
|
52
52
|
.value=${this.value || ''}
|
@@ -72,4 +72,12 @@ export class OxInputSearch extends OxFormField {
|
|
72
72
|
})
|
73
73
|
)
|
74
74
|
}
|
75
|
+
|
76
|
+
_onClickSearch(e: Event) {
|
77
|
+
e.stopPropagation()
|
78
|
+
|
79
|
+
if (this._form) {
|
80
|
+
this._form.requestSubmit()
|
81
|
+
}
|
82
|
+
}
|
75
83
|
}
|
package/src/ox-input-stack.ts
CHANGED
@@ -8,7 +8,7 @@ import { customElement, property } from 'lit/decorators.js'
|
|
8
8
|
import { OxFormField } from './ox-form-field'
|
9
9
|
|
10
10
|
@customElement('ox-input-stack')
|
11
|
-
export
|
11
|
+
export class OxInputStack extends OxFormField {
|
12
12
|
static styles = [
|
13
13
|
css`
|
14
14
|
:host {
|