@operato/input 8.0.0-beta.0 → 8.0.0-beta.2
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 +18 -0
- package/package.json +7 -7
- package/.editorconfig +0 -29
- package/.storybook/main.js +0 -3
- package/.storybook/preview.js +0 -52
- package/.storybook/server.mjs +0 -8
- package/demo/index-3dish.html +0 -38
- package/demo/index-angle.html +0 -36
- package/demo/index-barcode.html +0 -68
- package/demo/index-button-radio.html +0 -42
- package/demo/index-checkbox.html +0 -69
- package/demo/index-code.html +0 -61
- package/demo/index-color-gradient.html +0 -35
- package/demo/index-color-stops.html +0 -62
- package/demo/index-color.html +0 -35
- package/demo/index-crontab.html +0 -37
- package/demo/index-file.html +0 -41
- package/demo/index-image.html +0 -40
- package/demo/index-multiple-colors.html +0 -52
- package/demo/index-options.html +0 -43
- package/demo/index-partition-keys.html +0 -79
- package/demo/index-range.html +0 -40
- package/demo/index-select.html +0 -136
- package/demo/index-stack.html +0 -33
- package/demo/index-table.html +0 -50
- package/demo/index-value-map.html +0 -80
- package/demo/index-value-ranges.html +0 -80
- package/demo/index-work-shift.html +0 -59
- package/demo/index.html +0 -54
- package/src/index.ts +0 -35
- package/src/locale/locale-codes.ts +0 -18
- package/src/locale/locale-picker.ts +0 -43
- package/src/locale/localization.ts +0 -15
- package/src/locales/en.ts +0 -30
- package/src/locales/ko.ts +0 -30
- package/src/locales/ms.ts +0 -30
- package/src/locales/zh.ts +0 -30
- package/src/ox-buttons-radio.ts +0 -140
- package/src/ox-checkbox.ts +0 -181
- package/src/ox-form-field.ts +0 -53
- package/src/ox-input-3axis.ts +0 -77
- package/src/ox-input-3dish.ts +0 -211
- package/src/ox-input-angle.ts +0 -73
- package/src/ox-input-barcode.ts +0 -318
- package/src/ox-input-code.ts +0 -139
- package/src/ox-input-color-gradient.ts +0 -349
- package/src/ox-input-color-stops.ts +0 -525
- package/src/ox-input-color.ts +0 -338
- package/src/ox-input-container.ts +0 -32
- package/src/ox-input-crontab.ts +0 -595
- package/src/ox-input-data.ts +0 -219
- package/src/ox-input-direction.ts +0 -92
- package/src/ox-input-duration.ts +0 -175
- package/src/ox-input-file.ts +0 -209
- package/src/ox-input-hashtags.ts +0 -185
- package/src/ox-input-i18n-label.ts +0 -140
- package/src/ox-input-image.ts +0 -168
- package/src/ox-input-key-values.ts +0 -301
- package/src/ox-input-layout/ox-input-card-layout.ts +0 -58
- package/src/ox-input-layout/ox-input-grid-layout.ts +0 -64
- package/src/ox-input-layout/ox-input-layout.ts +0 -77
- package/src/ox-input-mass-fraction.ts +0 -437
- package/src/ox-input-multiple-colors.ts +0 -135
- package/src/ox-input-options.ts +0 -216
- package/src/ox-input-partition-keys.ts +0 -303
- package/src/ox-input-privilege.ts +0 -163
- package/src/ox-input-quantifier.ts +0 -62
- package/src/ox-input-range.ts +0 -146
- package/src/ox-input-scene-component-id.ts +0 -73
- package/src/ox-input-search.ts +0 -126
- package/src/ox-input-select-buttons.ts +0 -75
- package/src/ox-input-signature.ts +0 -208
- package/src/ox-input-stack.ts +0 -136
- package/src/ox-input-switch.ts +0 -117
- package/src/ox-input-table-column-config.ts +0 -211
- package/src/ox-input-table.ts +0 -404
- package/src/ox-input-textarea.ts +0 -86
- package/src/ox-input-unit-number.ts +0 -354
- package/src/ox-input-value-map.ts +0 -342
- package/src/ox-input-value-ranges.ts +0 -363
- package/src/ox-input-work-shift.ts +0 -290
- package/src/ox-select-floor.ts +0 -246
- package/src/ox-select.ts +0 -219
- package/stories/image-for-select-floor.ts +0 -2
- package/stories/ox-buttons-radio.stories.ts +0 -89
- package/stories/ox-checkbox.stories.ts +0 -111
- package/stories/ox-input-3axis.stories.ts +0 -77
- package/stories/ox-input-3dish.stories.ts +0 -106
- package/stories/ox-input-angle.stories.ts +0 -84
- package/stories/ox-input-barcode.stories.ts +0 -117
- package/stories/ox-input-code.stories.ts +0 -99
- package/stories/ox-input-crontab.stories.ts +0 -82
- package/stories/ox-input-data.stories.ts +0 -82
- package/stories/ox-input-direction.stories.ts +0 -91
- package/stories/ox-input-duration.stories.ts +0 -84
- package/stories/ox-input-file.stories.ts +0 -111
- package/stories/ox-input-hashtags.stories.ts +0 -82
- package/stories/ox-input-i18n-label.stories.ts +0 -103
- package/stories/ox-input-key-values.stories.ts +0 -97
- package/stories/ox-input-mass-fraction.stories.ts +0 -102
- package/stories/ox-input-multiple-colors.stories.ts +0 -72
- package/stories/ox-input-options.stories.ts +0 -80
- package/stories/ox-input-partition-keys.stories.ts +0 -84
- package/stories/ox-input-privilege.stories.ts +0 -108
- package/stories/ox-input-quantifier.stories.ts +0 -80
- package/stories/ox-input-range.stories.ts +0 -89
- package/stories/ox-input-search.stories.ts +0 -91
- package/stories/ox-input-select-buttons.stories.ts +0 -118
- package/stories/ox-input-signature.stories.ts +0 -75
- package/stories/ox-input-switch.stories.ts +0 -91
- package/stories/ox-input-table-column-config.stories.ts +0 -109
- package/stories/ox-input-unit.stories.ts +0 -151
- package/stories/ox-input-value-map.stories.ts +0 -92
- package/stories/ox-input-value-ranges.stories.ts +0 -92
- package/stories/ox-input-work-shift.stories.ts +0 -106
- package/stories/ox-select-floor.stories.ts +0 -197
- package/stories/ox-select-set-options.stories.ts +0 -208
- package/stories/ox-select.stories.ts +0 -181
- package/tsconfig.json +0 -25
- package/web-dev-server.config.mjs +0 -27
- package/web-test-runner.config.mjs +0 -41
package/src/ox-input-stack.ts
DELETED
@@ -1,136 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @license Copyright © HatioLab Inc. All rights reserved.
|
3
|
-
*/
|
4
|
-
|
5
|
-
import { css, html } from 'lit'
|
6
|
-
import { customElement, property } from 'lit/decorators.js'
|
7
|
-
|
8
|
-
import { OxFormField } from './ox-form-field'
|
9
|
-
|
10
|
-
@customElement('ox-input-stack')
|
11
|
-
export class OxInputStack extends OxFormField {
|
12
|
-
static styles = [
|
13
|
-
css`
|
14
|
-
:host {
|
15
|
-
display: block;
|
16
|
-
}
|
17
|
-
|
18
|
-
#add-floor {
|
19
|
-
width: 100%;
|
20
|
-
height: 20px;
|
21
|
-
background-color: blue;
|
22
|
-
color: white;
|
23
|
-
}
|
24
|
-
|
25
|
-
div {
|
26
|
-
background-color: blue;
|
27
|
-
width: calc(100% - 40px);
|
28
|
-
width: -webkit-calc(100% - 40px);
|
29
|
-
min-height: 20px;
|
30
|
-
}
|
31
|
-
|
32
|
-
div[active] {
|
33
|
-
background-color: red;
|
34
|
-
}
|
35
|
-
|
36
|
-
div button {
|
37
|
-
position: absolute;
|
38
|
-
right: 10px;
|
39
|
-
width: 30px;
|
40
|
-
min-height: 20px;
|
41
|
-
}
|
42
|
-
`
|
43
|
-
]
|
44
|
-
|
45
|
-
/**
|
46
|
-
* `stack`은 stack에 의해 만들어진 층의 배열을 유지한다.
|
47
|
-
*/
|
48
|
-
@property({ type: Array }) stack: { name: string; active?: boolean }[] = []
|
49
|
-
|
50
|
-
/**
|
51
|
-
* `activeIndex`은 현재 active된 층의 인덱스를 유지한다.
|
52
|
-
*/
|
53
|
-
// @property({ type: Number }) activeIndex: number = 0
|
54
|
-
|
55
|
-
render() {
|
56
|
-
const stack = [...this.stack].reverse()
|
57
|
-
const length = stack.length
|
58
|
-
|
59
|
-
return html`
|
60
|
-
<button id="add-floor" @click=${(e: Event) => this._onClickAddFloor(e)} ?disabled=${this.disabled}>+</button>
|
61
|
-
|
62
|
-
${stack.map(
|
63
|
-
(item, index) => html`
|
64
|
-
<div
|
65
|
-
floor
|
66
|
-
?active=${item.active}
|
67
|
-
@click=${(e: Event) => !this.disabled && this._onClickToActive(e)}
|
68
|
-
idx=${length - index - 1}
|
69
|
-
>
|
70
|
-
${item.name}
|
71
|
-
<button @click=${(e: Event) => this._onClickRemoveFloor(e)} ?disabled=${this.disabled}>-</button>
|
72
|
-
</div>
|
73
|
-
`
|
74
|
-
)}
|
75
|
-
`
|
76
|
-
}
|
77
|
-
|
78
|
-
_notifyChange() {
|
79
|
-
this.value = this.stack
|
80
|
-
|
81
|
-
this.dispatchEvent(
|
82
|
-
new CustomEvent('change', {
|
83
|
-
detail: this.value,
|
84
|
-
bubbles: true,
|
85
|
-
composed: true
|
86
|
-
})
|
87
|
-
)
|
88
|
-
}
|
89
|
-
|
90
|
-
_onClickAddFloor(e: Event) {
|
91
|
-
this.stack.push({ name: String(this.stack.length + 1) })
|
92
|
-
this.requestUpdate()
|
93
|
-
|
94
|
-
this._notifyChange()
|
95
|
-
}
|
96
|
-
|
97
|
-
_onClickToActive(e: Event) {
|
98
|
-
const floor = (e.target as HTMLElement).closest('[floor]')
|
99
|
-
|
100
|
-
if (!floor) {
|
101
|
-
return
|
102
|
-
}
|
103
|
-
|
104
|
-
e.stopPropagation()
|
105
|
-
|
106
|
-
const activeIndex = Number(floor.getAttribute('idx'))
|
107
|
-
this.stack = this.stack.map((floor, index) => {
|
108
|
-
return activeIndex === index
|
109
|
-
? {
|
110
|
-
name: floor.name,
|
111
|
-
active: true
|
112
|
-
}
|
113
|
-
: { name: floor.name }
|
114
|
-
})
|
115
|
-
|
116
|
-
this._notifyChange()
|
117
|
-
}
|
118
|
-
|
119
|
-
_onClickRemoveFloor(e: Event) {
|
120
|
-
const floor = (e.target as HTMLElement).closest('[floor]')
|
121
|
-
|
122
|
-
if (!floor) {
|
123
|
-
return
|
124
|
-
}
|
125
|
-
|
126
|
-
e.stopPropagation()
|
127
|
-
|
128
|
-
const idx = Number(floor.getAttribute('idx'))
|
129
|
-
|
130
|
-
this.stack.splice(idx, 1)
|
131
|
-
|
132
|
-
this.requestUpdate()
|
133
|
-
|
134
|
-
this._notifyChange()
|
135
|
-
}
|
136
|
-
}
|
package/src/ox-input-switch.ts
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
|
-
import { customElement, property } from 'lit/decorators.js'
|
3
|
-
|
4
|
-
import { OxFormField } from './ox-form-field'
|
5
|
-
|
6
|
-
@customElement('ox-input-switch')
|
7
|
-
export class OxInputSwitch extends OxFormField {
|
8
|
-
static styles = css`
|
9
|
-
:host {
|
10
|
-
--ox-simple-switch-fullwidth: 2em;
|
11
|
-
--ox-simple-switch-fullheight: 1em;
|
12
|
-
--ox-simple-switch-thumbnail-size: 1em;
|
13
|
-
}
|
14
|
-
|
15
|
-
label {
|
16
|
-
position: relative;
|
17
|
-
display: inline-block;
|
18
|
-
width: 100%;
|
19
|
-
height: 100%;
|
20
|
-
}
|
21
|
-
|
22
|
-
label input {
|
23
|
-
opacity: 0;
|
24
|
-
width: 0;
|
25
|
-
height: 0;
|
26
|
-
}
|
27
|
-
|
28
|
-
span {
|
29
|
-
position: absolute;
|
30
|
-
cursor: pointer;
|
31
|
-
width: var(--ox-simple-switch-fullwidth);
|
32
|
-
height: var(--ox-simple-switch-fullheight);
|
33
|
-
top: calc(0 - var(--ox-simple-switch-thumbnail-size));
|
34
|
-
left: 0;
|
35
|
-
background-color: var(--ox-simple-switch-off-color, #ccc);
|
36
|
-
-webkit-transition: 0.4s;
|
37
|
-
transition: 0.4s;
|
38
|
-
}
|
39
|
-
|
40
|
-
span:before {
|
41
|
-
position: absolute;
|
42
|
-
content: '';
|
43
|
-
height: calc(var(--ox-simple-switch-thumbnail-size) - 8px);
|
44
|
-
width: calc(var(--ox-simple-switch-thumbnail-size) - 8px);
|
45
|
-
left: 4px;
|
46
|
-
top: 4px;
|
47
|
-
background-color: var(--ox-simple-switch-thumbnail-color, white);
|
48
|
-
-webkit-transition: 0.4s;
|
49
|
-
transition: 0.4s;
|
50
|
-
}
|
51
|
-
|
52
|
-
input:checked + span {
|
53
|
-
background-color: var(--ox-simple-switch-on-color, #2196f3);
|
54
|
-
}
|
55
|
-
|
56
|
-
input + span:before {
|
57
|
-
-webkit-transform: translateY(
|
58
|
-
calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)
|
59
|
-
);
|
60
|
-
-ms-transform: translateY(
|
61
|
-
calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2)
|
62
|
-
);
|
63
|
-
transform: translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
64
|
-
}
|
65
|
-
|
66
|
-
input:checked + span:before {
|
67
|
-
-webkit-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
|
68
|
-
translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
69
|
-
-ms-transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
|
70
|
-
translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
71
|
-
transform: translateX(calc(var(--ox-simple-switch-fullwidth) - var(--ox-simple-switch-thumbnail-size)))
|
72
|
-
translateY(calc((var(--ox-simple-switch-fullheight) - var(--ox-simple-switch-thumbnail-size)) / 2));
|
73
|
-
}
|
74
|
-
|
75
|
-
/* Rounded sliders */
|
76
|
-
span[round] {
|
77
|
-
border-radius: calc(var(--ox-simple-switch-thumbnail-size) / 2);
|
78
|
-
}
|
79
|
-
|
80
|
-
span[round]:before {
|
81
|
-
border-radius: calc((var(--ox-simple-switch-thumbnail-size) - 8px) / 2);
|
82
|
-
}
|
83
|
-
`
|
84
|
-
|
85
|
-
@property({ type: Boolean }) round: boolean = false
|
86
|
-
@property({ type: Boolean }) value: boolean = false
|
87
|
-
@property({ type: Boolean }) disabled: boolean = false
|
88
|
-
|
89
|
-
render() {
|
90
|
-
return html`
|
91
|
-
<label>
|
92
|
-
<input type="checkbox" .checked=${this.value} ?disabled=${this.disabled} />
|
93
|
-
<span ?round=${this.round}></span>
|
94
|
-
</label>
|
95
|
-
`
|
96
|
-
}
|
97
|
-
|
98
|
-
firstUpdated() {
|
99
|
-
this.renderRoot.addEventListener('change', (e: Event) => {
|
100
|
-
e.preventDefault()
|
101
|
-
e.stopPropagation()
|
102
|
-
|
103
|
-
this.value = (e.target as HTMLInputElement)?.checked
|
104
|
-
this.dispatchEvent(
|
105
|
-
new CustomEvent('change', {
|
106
|
-
bubbles: true,
|
107
|
-
composed: true,
|
108
|
-
detail: this.value
|
109
|
-
})
|
110
|
-
)
|
111
|
-
})
|
112
|
-
}
|
113
|
-
|
114
|
-
protected appendFormData({ formData }: FormDataEvent): void {
|
115
|
-
this.name && formData.append(this.name, this.value ? 'true' : 'false')
|
116
|
-
}
|
117
|
-
}
|
@@ -1,211 +0,0 @@
|
|
1
|
-
import { css, html } from 'lit'
|
2
|
-
import { customElement, property } from 'lit/decorators.js'
|
3
|
-
import { OxFormField } from './ox-form-field'
|
4
|
-
import '@material/web/icon/icon.js'
|
5
|
-
|
6
|
-
export interface ColumnConfig {
|
7
|
-
name: string
|
8
|
-
label: string
|
9
|
-
visible: boolean
|
10
|
-
width: number
|
11
|
-
order: number
|
12
|
-
}
|
13
|
-
|
14
|
-
@customElement('ox-input-table-column-config')
|
15
|
-
export class OxInputTableColumnConfig extends OxFormField {
|
16
|
-
static styles = [
|
17
|
-
css`
|
18
|
-
:host {
|
19
|
-
display: block;
|
20
|
-
padding: 4px;
|
21
|
-
border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
|
22
|
-
background-color: var(--ox-input-table-column-config-background-color, var(--md-sys-color-surface));
|
23
|
-
color: var(--ox-input-table-column-config-color, var(--md-sys-color-on-surface));
|
24
|
-
}
|
25
|
-
|
26
|
-
table {
|
27
|
-
width: auto;
|
28
|
-
border-collapse: collapse;
|
29
|
-
font-size: 12px;
|
30
|
-
border: 0;
|
31
|
-
}
|
32
|
-
|
33
|
-
tr {
|
34
|
-
border-bottom: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
|
35
|
-
}
|
36
|
-
|
37
|
-
th,
|
38
|
-
td {
|
39
|
-
padding: 0 var(--spacing-small, 2px);
|
40
|
-
text-align: left;
|
41
|
-
}
|
42
|
-
|
43
|
-
th {
|
44
|
-
text-transform: capitalize;
|
45
|
-
text-align: center;
|
46
|
-
background-color: var(
|
47
|
-
--ox-input-table-column-config-header-background-color,
|
48
|
-
var(--md-sys-color-secondary-container)
|
49
|
-
);
|
50
|
-
color: var(--ox-input-table-column-config-header-background-color, var(--md-sys-color-on-secondary-container));
|
51
|
-
white-space: nowrap;
|
52
|
-
}
|
53
|
-
|
54
|
-
th *,
|
55
|
-
td * {
|
56
|
-
vertical-align: middle;
|
57
|
-
}
|
58
|
-
|
59
|
-
td[width] {
|
60
|
-
width: 60px;
|
61
|
-
text-align: right;
|
62
|
-
}
|
63
|
-
|
64
|
-
input {
|
65
|
-
font-size: 12px;
|
66
|
-
padding: 0;
|
67
|
-
margin: 0;
|
68
|
-
border: none;
|
69
|
-
width: 100%;
|
70
|
-
box-sizing: border-box;
|
71
|
-
outline: none;
|
72
|
-
background-color: var(--ox-input-table-column-config-input-background-color, var(--md-sys-color-surface));
|
73
|
-
color: var(--ox-input-table-column-config-input-color, var(--md-sys-color-on-surface));
|
74
|
-
}
|
75
|
-
|
76
|
-
input[type='number'] {
|
77
|
-
text-align: right;
|
78
|
-
}
|
79
|
-
|
80
|
-
md-icon {
|
81
|
-
cursor: pointer;
|
82
|
-
padding: 0;
|
83
|
-
margin: 0;
|
84
|
-
border: none;
|
85
|
-
background: none;
|
86
|
-
|
87
|
-
--md-icon-size: 16px;
|
88
|
-
}
|
89
|
-
|
90
|
-
md-icon[disabled] {
|
91
|
-
cursor: not-allowed;
|
92
|
-
color: var(--ox-input-table-column-config-disabled-color, var(--md-sys-color-surface-variant, #ccc));
|
93
|
-
}
|
94
|
-
`
|
95
|
-
]
|
96
|
-
|
97
|
-
@property({ type: Array }) value: ColumnConfig[] = []
|
98
|
-
|
99
|
-
render() {
|
100
|
-
console.log('this.value', this.value)
|
101
|
-
return html`
|
102
|
-
<table>
|
103
|
-
<thead>
|
104
|
-
<tr>
|
105
|
-
<th></th>
|
106
|
-
<th>name</th>
|
107
|
-
<th>label</th>
|
108
|
-
<th>width</th>
|
109
|
-
<th></th>
|
110
|
-
</tr>
|
111
|
-
</thead>
|
112
|
-
<tbody>
|
113
|
-
${(this.value || []).map(
|
114
|
-
(col, index) => html`
|
115
|
-
<tr name=${col.name}>
|
116
|
-
<td>
|
117
|
-
<input
|
118
|
-
type="checkbox"
|
119
|
-
.checked=${col.visible}
|
120
|
-
@change=${(e: Event) => this._updateVisibility(e, index)}
|
121
|
-
/>
|
122
|
-
</td>
|
123
|
-
<td name>${col.name}</td>
|
124
|
-
<td>
|
125
|
-
<input type="text" .value=${col.label} @input=${(e: Event) => this._updateLabel(e, index)} />
|
126
|
-
</td>
|
127
|
-
<td width>
|
128
|
-
<input
|
129
|
-
type="number"
|
130
|
-
.value=${String(col.width)}
|
131
|
-
@input=${(e: Event) => this._updateWidth(e, index)}
|
132
|
-
/>
|
133
|
-
</td>
|
134
|
-
<td buttons>
|
135
|
-
<md-icon class="icon-button" @click=${() => this._moveUp(index)} ?disabled=${index === 0}>
|
136
|
-
arrow_upward
|
137
|
-
</md-icon>
|
138
|
-
<md-icon
|
139
|
-
class="icon-button"
|
140
|
-
@click=${() => this._moveDown(index)}
|
141
|
-
?disabled=${index === this.value.length - 1}
|
142
|
-
>
|
143
|
-
arrow_downward
|
144
|
-
</md-icon>
|
145
|
-
</td>
|
146
|
-
</tr>
|
147
|
-
`
|
148
|
-
)}
|
149
|
-
</tbody>
|
150
|
-
</table>
|
151
|
-
`
|
152
|
-
}
|
153
|
-
|
154
|
-
private _updateVisibility(event: Event, index: number) {
|
155
|
-
const target = event.target as HTMLInputElement
|
156
|
-
this.value[index].visible = target.checked
|
157
|
-
this.requestUpdate()
|
158
|
-
this._notifyChange()
|
159
|
-
}
|
160
|
-
|
161
|
-
private _updateLabel(event: Event, index: number) {
|
162
|
-
const target = event.target as HTMLInputElement
|
163
|
-
this.value[index].label = target.value
|
164
|
-
this.requestUpdate()
|
165
|
-
this._notifyChange()
|
166
|
-
}
|
167
|
-
|
168
|
-
private _updateWidth(event: Event, index: number) {
|
169
|
-
const target = event.target as HTMLInputElement
|
170
|
-
this.value[index].width = target.valueAsNumber
|
171
|
-
this.requestUpdate()
|
172
|
-
this._notifyChange()
|
173
|
-
}
|
174
|
-
|
175
|
-
private _moveUp(index: number) {
|
176
|
-
if (index === 0) return
|
177
|
-
const temp = this.value[index]
|
178
|
-
this.value[index] = this.value[index - 1]
|
179
|
-
this.value[index - 1] = temp
|
180
|
-
this._updateOrder()
|
181
|
-
this.requestUpdate()
|
182
|
-
this._notifyChange()
|
183
|
-
}
|
184
|
-
|
185
|
-
private _moveDown(index: number) {
|
186
|
-
if (index === this.value.length - 1) return
|
187
|
-
const temp = this.value[index]
|
188
|
-
this.value[index] = this.value[index + 1]
|
189
|
-
this.value[index + 1] = temp
|
190
|
-
this._updateOrder()
|
191
|
-
this.requestUpdate()
|
192
|
-
this._notifyChange()
|
193
|
-
}
|
194
|
-
|
195
|
-
private _updateOrder() {
|
196
|
-
this.value = this.value.map((col, index) => ({
|
197
|
-
...col,
|
198
|
-
order: index + 1
|
199
|
-
}))
|
200
|
-
}
|
201
|
-
|
202
|
-
private _notifyChange() {
|
203
|
-
this.dispatchEvent(
|
204
|
-
new CustomEvent('change', {
|
205
|
-
detail: this.value,
|
206
|
-
bubbles: true,
|
207
|
-
composed: true
|
208
|
-
})
|
209
|
-
)
|
210
|
-
}
|
211
|
-
}
|