@operato/input 2.0.0-beta.17 → 2.0.0-beta.19

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 CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/input",
3
3
  "description": "Webcomponents for input following open-wc recommendations",
4
4
  "author": "heartyoh@hatiolab.com",
5
- "version": "2.0.0-beta.17",
5
+ "version": "2.0.0-beta.19",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "license": "MIT",
@@ -251,5 +251,5 @@
251
251
  "prettier --write"
252
252
  ]
253
253
  },
254
- "gitHead": "13e26c12f590b683fd6d9dc6c69526c869854780"
254
+ "gitHead": "9be58596129593e8a4819500ca132e3caa640795"
255
255
  }
@@ -1,14 +1,13 @@
1
1
  import { css, html } from 'lit'
2
2
  import { customElement, property } from 'lit/decorators.js'
3
3
  import { OxFormField } from './ox-form-field'
4
- import '@material/web/checkbox/checkbox.js'
5
4
  import '@material/web/icon/icon.js'
6
5
 
7
6
  export interface ColumnConfig {
8
7
  name: string
9
8
  label: string
10
9
  visible: boolean
11
- width: string
10
+ width: number
12
11
  order: number
13
12
  }
14
13
 
@@ -20,30 +19,48 @@ export class OxInputTableColumnConfig extends OxFormField {
20
19
  display: block;
21
20
  padding: 4px;
22
21
  border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
23
- background-color: var(--ox-input-table-column-config-background-color, white);
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
24
  }
25
25
 
26
26
  table {
27
27
  width: auto;
28
28
  border-collapse: collapse;
29
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));
30
35
  }
31
36
 
32
37
  th,
33
38
  td {
34
- border: 1px solid var(--ox-input-table-column-config-border-color, var(--md-sys-color-on-surface));
35
- padding: 0;
39
+ padding: 0 var(--spacing-small, 2px);
36
40
  text-align: left;
37
41
  }
38
42
 
39
43
  th {
44
+ text-transform: capitalize;
45
+ text-align: center;
40
46
  background-color: var(
41
47
  --ox-input-table-column-config-header-background-color,
42
48
  var(--md-sys-color-secondary-container)
43
49
  );
50
+ color: var(--ox-input-table-column-config-header-background-color, var(--md-sys-color-on-secondary-container));
44
51
  white-space: nowrap;
45
52
  }
46
53
 
54
+ th *,
55
+ td * {
56
+ vertical-align: middle;
57
+ }
58
+
59
+ td[width] {
60
+ width: 60px;
61
+ text-align: right;
62
+ }
63
+
47
64
  input {
48
65
  font-size: 12px;
49
66
  padding: 0;
@@ -51,25 +68,28 @@ export class OxInputTableColumnConfig extends OxFormField {
51
68
  border: none;
52
69
  width: 100%;
53
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));
54
74
  }
55
75
 
56
- .icon-button {
76
+ input[type='number'] {
77
+ text-align: right;
78
+ }
79
+
80
+ md-icon {
57
81
  cursor: pointer;
58
- display: inline-flex;
59
- align-items: center;
60
- justify-content: center;
61
82
  padding: 0;
62
83
  margin: 0;
63
84
  border: none;
64
85
  background: none;
65
- font-size: 16px;
66
- width: 24px;
67
- height: 24px;
68
- box-sizing: border-box;
86
+
87
+ --md-icon-size: 16px;
69
88
  }
70
89
 
71
- .icon-button[disabled] {
90
+ md-icon[disabled] {
72
91
  cursor: not-allowed;
92
+ color: var(--ox-input-table-column-config-disabled-color, var(--md-sys-color-surface-variant, #ccc));
73
93
  }
74
94
  `
75
95
  ]
@@ -82,10 +102,10 @@ export class OxInputTableColumnConfig extends OxFormField {
82
102
  <thead>
83
103
  <tr>
84
104
  <th></th>
85
- <th>Name</th>
86
- <th>Label</th>
87
- <th>Width</th>
88
- <th>Order</th>
105
+ <th>name</th>
106
+ <th>label</th>
107
+ <th>width</th>
108
+ <th></th>
89
109
  </tr>
90
110
  </thead>
91
111
  <tbody>
@@ -93,17 +113,24 @@ export class OxInputTableColumnConfig extends OxFormField {
93
113
  (col, index) => html`
94
114
  <tr name=${col.name}>
95
115
  <td>
96
- <md-checkbox .checked=${col.visible} @change=${(e: Event) => this._updateVisibility(e, index)}>
97
- </md-checkbox>
116
+ <input
117
+ type="checkbox"
118
+ .checked=${col.visible}
119
+ @change=${(e: Event) => this._updateVisibility(e, index)}
120
+ />
98
121
  </td>
99
- <td>${col.name}</td>
122
+ <td name>${col.name}</td>
100
123
  <td>
101
124
  <input type="text" .value=${col.label} @input=${(e: Event) => this._updateLabel(e, index)} />
102
125
  </td>
103
- <td>
104
- <input type="text" .value=${col.width} @input=${(e: Event) => this._updateWidth(e, index)} />
126
+ <td width>
127
+ <input
128
+ type="number"
129
+ .value=${String(col.width)}
130
+ @input=${(e: Event) => this._updateWidth(e, index)}
131
+ />
105
132
  </td>
106
- <td>
133
+ <td buttons>
107
134
  <md-icon class="icon-button" @click=${() => this._moveUp(index)} ?disabled=${index === 0}>
108
135
  arrow_upward
109
136
  </md-icon>
@@ -139,7 +166,7 @@ export class OxInputTableColumnConfig extends OxFormField {
139
166
 
140
167
  private _updateWidth(event: Event, index: number) {
141
168
  const target = event.target as HTMLInputElement
142
- this.value[index].width = target.value
169
+ this.value[index].width = target.valueAsNumber
143
170
  this.requestUpdate()
144
171
  this._notifyChange()
145
172
  }