@operato/input 1.13.9 → 1.13.11

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.
@@ -131,11 +131,16 @@ export class OxInputMassFraction extends OxFormField {
131
131
  display: block;
132
132
  text-align: center;
133
133
  }
134
+
135
+ [right-end] {
136
+ margin-left: auto;
137
+ }
134
138
  `
135
139
  ]
136
140
 
137
141
  @property({ type: Object }) defaultValue: MassFraction = {}
138
142
  @property({ type: Object }) value: MassFraction = {}
143
+ @property({ type: Boolean, attribute: true }) composable: boolean = false
139
144
 
140
145
  @queryAll('[data-record]') records!: NodeListOf<HTMLElement>
141
146
 
@@ -168,14 +173,18 @@ export class OxInputMassFraction extends OxFormField {
168
173
  list="value-template"
169
174
  ?disabled=${this.disabled}
170
175
  />
171
- <button
172
- class="record-action"
173
- @click=${(e: MouseEvent) => this._delete(e)}
174
- tabindex="-1"
175
- ?disabled=${this.disabled}
176
- >
177
- <mwc-icon>remove</mwc-icon>
178
- </button>
176
+ ${this.composable
177
+ ? html`
178
+ <button
179
+ class="record-action"
180
+ @click=${(e: MouseEvent) => this._delete(e)}
181
+ tabindex="-1"
182
+ ?disabled=${this.disabled}
183
+ >
184
+ <mwc-icon>remove</mwc-icon>
185
+ </button>
186
+ `
187
+ : nothing}
179
188
  <button
180
189
  class="record-action"
181
190
  @click=${(e: MouseEvent) => this._up(e)}
@@ -202,36 +211,41 @@ export class OxInputMassFraction extends OxFormField {
202
211
  ? nothing
203
212
  : html`
204
213
  <div data-record-new>
205
- <ox-select
206
- data-key
207
- placeholder="Fluid"
208
- .value=${live('')}
209
- @change=${(e: Event) => {
210
- e.stopPropagation()
211
- }}
212
- >
213
- <ox-popup-list with-search> ${this.options} </ox-popup-list>
214
- </ox-select>
215
-
216
- <input
217
- type="number"
218
- data-value
219
- placeholder="proportion"
220
- min="0"
221
- max="1"
222
- step="0.01"
223
- value=""
224
- list="value-template"
225
- />
226
- <button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
227
- <mwc-icon>add</mwc-icon>
228
- </button>
214
+ ${this.composable
215
+ ? html`
216
+ <ox-select
217
+ data-key
218
+ placeholder="Fluid"
219
+ .value=${live('')}
220
+ @change=${(e: Event) => {
221
+ e.stopPropagation()
222
+ }}
223
+ >
224
+ <ox-popup-list with-search> ${this.options} </ox-popup-list>
225
+ </ox-select>
226
+
227
+ <input
228
+ type="number"
229
+ data-value
230
+ placeholder="proportion"
231
+ min="0"
232
+ max="1"
233
+ step="0.01"
234
+ value=""
235
+ list="value-template"
236
+ />
237
+ <button class="record-action" @click=${(e: MouseEvent) => this._add()} tabindex="-1">
238
+ <mwc-icon>add</mwc-icon>
239
+ </button>
240
+ `
241
+ : nothing}
229
242
  <button
230
243
  title="fill with the values suggested"
231
244
  @click=${() => {
232
245
  this.value = { ...this.defaultValue }
233
246
  this.dispatchChangeEvent()
234
247
  }}
248
+ right-end
235
249
  >
236
250
  <mwc-icon>settings_suggest</mwc-icon>
237
251
  </button>
@@ -9,6 +9,7 @@ export default {
9
9
  name: { control: 'text' },
10
10
  value: { control: 'object' },
11
11
  defaultValue: { control: 'object' },
12
+ composable: { control: 'boolean' },
12
13
  disabled: { control: 'boolean' }
13
14
  }
14
15
  }
@@ -23,6 +24,7 @@ interface ArgTypes {
23
24
  name?: string
24
25
  value?: object
25
26
  defaultValue?: object
27
+ composable?: boolean
26
28
  disabled?: boolean
27
29
  }
28
30
 
@@ -30,6 +32,7 @@ const Template: Story<ArgTypes> = ({
30
32
  name = 'mass-fraction',
31
33
  value = {},
32
34
  defaultValue = {},
35
+ composable = true,
33
36
  disabled
34
37
  }: ArgTypes) => html`
35
38
  <link href="/themes/app-theme.css" rel="stylesheet" />
@@ -46,6 +49,7 @@ const Template: Story<ArgTypes> = ({
46
49
  name=${name}
47
50
  .value=${value}
48
51
  .defaultValue=${defaultValue}
52
+ ?composable=${composable}
49
53
  ?disabled=${disabled}
50
54
  >
51
55
  </ox-input-mass-fraction>
@@ -54,7 +58,12 @@ const Template: Story<ArgTypes> = ({
54
58
  export const Regular = Template.bind({})
55
59
  Regular.args = {
56
60
  name: 'mass-fraction',
57
- value: {},
61
+ value: {
62
+ H2O: 0.8,
63
+ N2O: 0.1,
64
+ CO2: 0.1
65
+ },
66
+ composable: true,
58
67
  defaultValue: {
59
68
  H2O: 0.8,
60
69
  N2O: 0.1,