@aquera/nile-elements 0.0.29 → 0.0.30
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/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +43 -6
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.d.ts +30 -17
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +143 -110
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +378 -317
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.esm.js +1 -0
- package/dist/nile-switcher/index.cjs.js +1 -1
- package/dist/nile-switcher/index.esm.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.esm.js +45 -8
- package/dist/nile-switcher/nile-switcher.esm.js +72 -44
- package/dist/src/nile-content-editor/nile-content-editor.css.js +1 -0
- package/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.css.js +43 -6
- package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +30 -17
- package/dist/src/nile-switcher/nile-switcher.js +143 -110
- package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-content-editor/nile-content-editor.css.ts +1 -0
- package/src/nile-switcher/nile-switcher.css.ts +43 -6
- package/src/nile-switcher/nile-switcher.ts +167 -172
package/package.json
CHANGED
@@ -16,27 +16,64 @@ export const styles = css`
|
|
16
16
|
box-sizing: border-box;
|
17
17
|
}
|
18
18
|
|
19
|
-
.
|
19
|
+
.switcher-icon-container {
|
20
20
|
cursor: pointer;
|
21
|
+
justify-content: center;
|
22
|
+
display: flex;
|
23
|
+
align-items: center;
|
24
|
+
margin-bottom: 6px;
|
25
|
+
height: 28px;
|
26
|
+
width: 28px;
|
27
|
+
border-radius: 4px;
|
28
|
+
}
|
29
|
+
|
30
|
+
.switcher-icon-container.current {
|
31
|
+
background: var(--nile-colors-blue-400);
|
21
32
|
}
|
22
|
-
|
33
|
+
|
34
|
+
.switcher-input-container {
|
23
35
|
display: flex;
|
36
|
+
}
|
37
|
+
|
38
|
+
.switcher-inline {
|
24
39
|
gap: 0.5rem;
|
25
40
|
}
|
26
41
|
|
27
|
-
.
|
28
|
-
|
29
|
-
|
42
|
+
.switcher-block {
|
43
|
+
flex-direction: column;
|
44
|
+
}
|
45
|
+
|
46
|
+
.switcher-block > :first-child {
|
47
|
+
align-self: end;
|
48
|
+
}
|
49
|
+
|
50
|
+
.switcher-inline > :nth-child(2) {
|
51
|
+
flex: 1;
|
30
52
|
}
|
31
53
|
|
32
|
-
|
54
|
+
.switcher-input-container > :first-child {
|
55
|
+
display: flex;
|
56
|
+
gap: 0.5rem;
|
33
57
|
max-height: 38px;
|
58
|
+
align-items: center;
|
34
59
|
}
|
35
60
|
|
36
61
|
nile-radio {
|
37
62
|
display: inline-block;
|
38
63
|
padding-right: 10px;
|
39
64
|
}
|
65
|
+
|
66
|
+
.switcher-object-mapper::part(input) {
|
67
|
+
color: var(--nile-colors-primary-600);
|
68
|
+
cursor: pointer;
|
69
|
+
}
|
70
|
+
|
71
|
+
.switcher-input--noborder::part(base) {
|
72
|
+
border: none;
|
73
|
+
}
|
74
|
+
.switcher-object-mapper--noborder::part(base) {
|
75
|
+
border: none;
|
76
|
+
}
|
40
77
|
`;
|
41
78
|
|
42
79
|
export default [styles];
|
@@ -12,20 +12,19 @@ import NileElement from '../internal/nile-element';
|
|
12
12
|
import { CSSResultGroup } from 'lit';
|
13
13
|
import { choose } from 'lit/directives/choose.js';
|
14
14
|
import { classMap } from 'lit/directives/class-map.js';
|
15
|
+
import { repeat } from 'lit/directives/repeat.js';
|
15
16
|
|
16
17
|
/**
|
17
18
|
* @summary Allows you to switch between nile elements
|
18
|
-
|
19
|
+
*
|
19
20
|
* @dependency nile-icon
|
20
21
|
* @dependency nile-input
|
21
22
|
* @dependency nile-checkbox
|
22
23
|
* @dependency nile-dropdown
|
23
24
|
* @dependency nile-textarea
|
24
25
|
*
|
25
|
-
|
26
26
|
* @event nile-change - Emitted when the control's value changes.
|
27
27
|
* @event nile-switch - Emitted when the nile component is being switched.
|
28
|
-
|
29
28
|
*/
|
30
29
|
|
31
30
|
export interface switchconfig {
|
@@ -33,8 +32,9 @@ export interface switchconfig {
|
|
33
32
|
toggleSwitch: boolean;
|
34
33
|
disable?: boolean;
|
35
34
|
confirmation?: boolean;
|
36
|
-
|
37
|
-
|
35
|
+
current: number;
|
36
|
+
align: 'block' | 'inline';
|
37
|
+
inputs: switchInputType[];
|
38
38
|
}
|
39
39
|
|
40
40
|
export interface switchInputType {
|
@@ -44,11 +44,15 @@ export interface switchInputType {
|
|
44
44
|
| INPUT_TYPE_NAMES.CHECKBOX
|
45
45
|
| INPUT_TYPE_NAMES.TEXTAREA
|
46
46
|
| INPUT_TYPE_NAMES.RADIO
|
47
|
-
| INPUT_TYPE_NAMES.CONTENTEDITOR
|
47
|
+
| INPUT_TYPE_NAMES.CONTENTEDITOR
|
48
|
+
| INPUT_TYPE_NAMES.OBJECT_MAPPER;
|
48
49
|
value?: String | boolean;
|
49
50
|
label?: String;
|
50
51
|
readonly?: boolean;
|
52
|
+
order: number;
|
51
53
|
type?: string;
|
54
|
+
icon: string;
|
55
|
+
mode?: string;
|
52
56
|
placeholder?: string;
|
53
57
|
disabled?: boolean;
|
54
58
|
required?: boolean;
|
@@ -60,6 +64,11 @@ export interface switchInputType {
|
|
60
64
|
noborder?: boolean;
|
61
65
|
}
|
62
66
|
|
67
|
+
export enum POSITIONS {
|
68
|
+
INLINE = 'inline',
|
69
|
+
BLOCK = 'block',
|
70
|
+
}
|
71
|
+
|
63
72
|
export enum INPUT_TYPE {
|
64
73
|
DEFAULT = 'defaultInput',
|
65
74
|
SWITCH = 'switchInput',
|
@@ -72,6 +81,12 @@ export enum INPUT_TYPE_NAMES {
|
|
72
81
|
TEXTAREA = 'text-area',
|
73
82
|
RADIO = 'radio',
|
74
83
|
CONTENTEDITOR = 'content-editor',
|
84
|
+
OBJECT_MAPPER = 'object-mapper',
|
85
|
+
}
|
86
|
+
|
87
|
+
export enum MODE {
|
88
|
+
CREATE = 'create',
|
89
|
+
EDIT = 'edit',
|
75
90
|
}
|
76
91
|
|
77
92
|
@customElement('nile-switcher')
|
@@ -81,9 +96,12 @@ export class NileSwitcher extends NileElement {
|
|
81
96
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
82
97
|
*/
|
83
98
|
static styles: CSSResultGroup = styles;
|
99
|
+
|
84
100
|
@property({ type: Object }) nileSwitchConfig: switchconfig;
|
101
|
+
@property() currentInput: switchInputType;
|
85
102
|
|
86
103
|
connectedCallback() {
|
104
|
+
this.currentInput = this.nileSwitchConfig.inputs[0];
|
87
105
|
super.connectedCallback();
|
88
106
|
this.emit('nile-init');
|
89
107
|
}
|
@@ -93,7 +111,7 @@ export class NileSwitcher extends NileElement {
|
|
93
111
|
this.emit('nile-destroy');
|
94
112
|
}
|
95
113
|
|
96
|
-
renderNileText(Input: switchInputType
|
114
|
+
renderNileText(Input: switchInputType) {
|
97
115
|
const {
|
98
116
|
value,
|
99
117
|
label,
|
@@ -102,9 +120,14 @@ export class NileSwitcher extends NileElement {
|
|
102
120
|
required,
|
103
121
|
error,
|
104
122
|
errorMessage,
|
105
|
-
inputType
|
123
|
+
inputType,
|
124
|
+
noborder,
|
106
125
|
} = Input;
|
107
126
|
return html`<nile-input
|
127
|
+
class=${classMap({
|
128
|
+
'switcher-input': true,
|
129
|
+
'switcher-input--noborder': !!noborder,
|
130
|
+
})}
|
108
131
|
.value=${value}
|
109
132
|
.label=${label}
|
110
133
|
.disabled=${disabled}
|
@@ -113,12 +136,12 @@ export class NileSwitcher extends NileElement {
|
|
113
136
|
.placeholder=${placeholder}
|
114
137
|
.error=${error}
|
115
138
|
@nile-input=${(e: CustomEvent) => {
|
116
|
-
this.handleChange(e, inputType
|
139
|
+
this.handleChange(e, inputType);
|
117
140
|
}}
|
118
141
|
></nile-input>`;
|
119
142
|
}
|
120
143
|
|
121
|
-
renderDropdown(Input: switchInputType
|
144
|
+
renderDropdown(Input: switchInputType) {
|
122
145
|
const {
|
123
146
|
options,
|
124
147
|
multiple,
|
@@ -127,10 +150,11 @@ export class NileSwitcher extends NileElement {
|
|
127
150
|
value,
|
128
151
|
error,
|
129
152
|
errorMessage,
|
130
|
-
inputType
|
153
|
+
inputType,
|
131
154
|
} = Input;
|
132
155
|
|
133
156
|
return html`<nile-select
|
157
|
+
class="switcher-dropdown"
|
134
158
|
.placeholder=${placeholder}
|
135
159
|
.disabled="${disabled}"
|
136
160
|
.multiple="${multiple}"
|
@@ -138,7 +162,7 @@ export class NileSwitcher extends NileElement {
|
|
138
162
|
.error="${error}"
|
139
163
|
.errorMessage="${errorMessage}"
|
140
164
|
@nile-change=${(e: CustomEvent) => {
|
141
|
-
this.handleChange(e, inputType
|
165
|
+
this.handleChange(e, inputType);
|
142
166
|
}}
|
143
167
|
>
|
144
168
|
${options?.map((option: any) => {
|
@@ -147,58 +171,48 @@ export class NileSwitcher extends NileElement {
|
|
147
171
|
</nile-select>`;
|
148
172
|
}
|
149
173
|
|
150
|
-
renderNileTextArea(Input: switchInputType
|
151
|
-
const {
|
152
|
-
value,
|
153
|
-
disabled,
|
154
|
-
readonly,
|
155
|
-
errorMessage,
|
156
|
-
error,
|
157
|
-
inputType: inputTypeName,
|
158
|
-
} = Input;
|
174
|
+
renderNileTextArea(Input: switchInputType) {
|
175
|
+
const { value, disabled, readonly, errorMessage, error, inputType } = Input;
|
159
176
|
|
160
177
|
return html`<nile-textarea
|
178
|
+
class="switcher-textarea"
|
161
179
|
.value=${value}
|
162
180
|
.disabled=${disabled}
|
163
181
|
?readonly=${readonly}
|
164
182
|
.error=${error}
|
165
183
|
.errorMessage=${errorMessage}
|
166
184
|
@nile-input=${(e: CustomEvent) => {
|
167
|
-
this.handleChange(e, inputType
|
185
|
+
this.handleChange(e, inputType);
|
168
186
|
}}
|
169
187
|
></nile-textarea>`;
|
170
188
|
}
|
171
189
|
|
172
|
-
renderNileCheckBox(Input: switchInputType
|
173
|
-
const { value, label, disabled, inputType
|
190
|
+
renderNileCheckBox(Input: switchInputType) {
|
191
|
+
const { value, label, disabled, inputType } = Input;
|
174
192
|
|
175
193
|
return html`<nile-checkbox
|
194
|
+
class="switcher-checkbox"
|
176
195
|
.checked=${value}
|
177
196
|
.label=${label}
|
178
197
|
.disabled=${disabled}
|
179
198
|
@valueChange=${(e: CustomEvent) => {
|
180
|
-
this.handleChange(e, inputType
|
199
|
+
this.handleChange(e, inputType);
|
181
200
|
}}
|
182
201
|
></nile-checkbox
|
183
202
|
>; `;
|
184
203
|
}
|
185
204
|
|
186
|
-
renderNileRadio(Input: switchInputType
|
187
|
-
const {
|
188
|
-
options,
|
189
|
-
value,
|
190
|
-
disabled,
|
191
|
-
inputType: inputTypeName,
|
192
|
-
errorMessage,
|
193
|
-
} = Input;
|
205
|
+
renderNileRadio(Input: switchInputType) {
|
206
|
+
const { options, value, disabled, errorMessage, inputType } = Input;
|
194
207
|
|
195
208
|
const haserrorMessage = !!errorMessage;
|
196
209
|
|
197
210
|
return html`<nile-radio-group
|
211
|
+
class="switcher-radio-group"
|
198
212
|
.value=${value}
|
199
213
|
.disabled=${disabled}
|
200
214
|
@change=${(e: CustomEvent) => {
|
201
|
-
this.handleChange(e, inputType
|
215
|
+
this.handleChange(e, inputType);
|
202
216
|
}}
|
203
217
|
>
|
204
218
|
${options &&
|
@@ -215,17 +229,11 @@ export class NileSwitcher extends NileElement {
|
|
215
229
|
`;
|
216
230
|
}
|
217
231
|
|
218
|
-
renderContentEditor(Input: switchInputType
|
219
|
-
let {
|
220
|
-
|
221
|
-
inputType: inputTypeName,
|
222
|
-
errorMessage,
|
223
|
-
type,
|
224
|
-
readonly,
|
225
|
-
noborder,
|
226
|
-
value,
|
227
|
-
} = Input;
|
232
|
+
renderContentEditor(Input: switchInputType) {
|
233
|
+
let { options, inputType, errorMessage, type, readonly, noborder, value } =
|
234
|
+
Input;
|
228
235
|
return html`<nile-content-editor
|
236
|
+
class="switcher-content-editor"
|
229
237
|
.value=${value}
|
230
238
|
.options=${options}
|
231
239
|
.type=${type}
|
@@ -233,154 +241,141 @@ export class NileSwitcher extends NileElement {
|
|
233
241
|
.noborder=${noborder}
|
234
242
|
.errorMessage=${errorMessage}
|
235
243
|
@nile-change=${(e: CustomEvent) => {
|
236
|
-
this.handleChange(e, inputType
|
244
|
+
this.handleChange(e, inputType);
|
237
245
|
}}
|
238
246
|
>
|
239
247
|
</nile-content-editor>`;
|
240
248
|
}
|
241
249
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
}
|
250
|
-
event.stopPropagation();
|
251
|
-
this.emit('nile-change', { config: this.nileSwitchConfig });
|
252
|
-
}
|
253
|
-
|
254
|
-
renderIcon(defaultInput: switchInputType, switchInput: switchInputType) {
|
255
|
-
const defaultHelperText = defaultInput.helperText;
|
256
|
-
const switchHelperText = switchInput.helperText;
|
257
|
-
|
258
|
-
const icon = !this.nileSwitchConfig.toggleSwitch
|
259
|
-
? 'header-functions'
|
260
|
-
: 'stringinput';
|
250
|
+
renderObjectMapper() {
|
251
|
+
const noborder = this.currentInput.noborder;
|
252
|
+
const mode = this.currentInput.mode;
|
253
|
+
const value =
|
254
|
+
this.currentInput.mode === MODE.CREATE
|
255
|
+
? 'Click to Create - Not Mapped'
|
256
|
+
: '';
|
261
257
|
|
262
|
-
|
263
|
-
? !!switchHelperText
|
264
|
-
? switchHelperText
|
265
|
-
: `switch to ${switchInput.inputType}`
|
266
|
-
: !!defaultHelperText
|
267
|
-
? defaultHelperText
|
268
|
-
: `switch to ${defaultInput.inputType}`;
|
269
|
-
|
270
|
-
return html` <nile-tooltip
|
258
|
+
return html`<nile-input
|
271
259
|
class=${classMap({
|
272
|
-
'
|
260
|
+
'switcher-object-mapper': true,
|
261
|
+
'switcher-object-mapper--noborder': !!noborder,
|
273
262
|
})}
|
274
|
-
|
275
|
-
|
263
|
+
.value=${value}
|
264
|
+
readonly="true"
|
265
|
+
@click="${(e: CustomEvent) =>
|
266
|
+
this.handleChange(e, INPUT_TYPE_NAMES.OBJECT_MAPPER)}"
|
276
267
|
>
|
277
268
|
<nile-icon
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
})}
|
282
|
-
.name=${icon}
|
269
|
+
class="pointer-cursor switcher-object-mapper-icon"
|
270
|
+
slot="suffix"
|
271
|
+
name="collapse"
|
283
272
|
color="#005EA6"
|
284
|
-
|
285
|
-
|
286
|
-
|
273
|
+
size="16"
|
274
|
+
>
|
275
|
+
</nile-icon>
|
276
|
+
</nile-input>`;
|
287
277
|
}
|
288
278
|
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
279
|
+
handleChange(event: CustomEvent, inputType: string) {
|
280
|
+
switch (inputType) {
|
281
|
+
case INPUT_TYPE_NAMES.OBJECT_MAPPER:
|
282
|
+
this.currentInput.value = 'clicked';
|
283
|
+
break;
|
284
|
+
case INPUT_TYPE_NAMES.CHECKBOX:
|
285
|
+
this.currentInput.value = event.detail.checked;
|
286
|
+
break;
|
287
|
+
default:
|
288
|
+
this.currentInput.value = event.detail.value;
|
295
289
|
}
|
296
|
-
|
290
|
+
event.stopPropagation();
|
291
|
+
this.emit('nile-change', { input: this.currentInput });
|
297
292
|
}
|
298
293
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
) {
|
305
|
-
const defaultInputType = defaultInput.inputType;
|
306
|
-
const switchInputType = switchInput.inputType;
|
294
|
+
renderIcon() {
|
295
|
+
const inputs = this.nileSwitchConfig.inputs;
|
296
|
+
const toolTipPosition =
|
297
|
+
this.nileSwitchConfig.align === POSITIONS.BLOCK ? 'top' : 'bottom';
|
298
|
+
|
307
299
|
return html`
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
[
|
337
|
-
INPUT_TYPE_NAMES.CONTENTEDITOR,
|
338
|
-
() =>
|
339
|
-
this.renderContentEditor(
|
340
|
-
this.nileSwitchConfig.defaultInput,
|
341
|
-
INPUT_TYPE.DEFAULT
|
342
|
-
),
|
343
|
-
],
|
344
|
-
],
|
345
|
-
() => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT)
|
346
|
-
)
|
347
|
-
: choose(
|
348
|
-
switchInputType,
|
349
|
-
[
|
350
|
-
[
|
351
|
-
INPUT_TYPE_NAMES.TEXTAREA,
|
352
|
-
() => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH),
|
353
|
-
],
|
354
|
-
[
|
355
|
-
INPUT_TYPE_NAMES.TEXT,
|
356
|
-
() => this.renderNileText(switchInput, INPUT_TYPE.SWITCH),
|
357
|
-
],
|
358
|
-
[
|
359
|
-
INPUT_TYPE_NAMES.CONTENTEDITOR,
|
360
|
-
() => this.renderContentEditor(switchInput, INPUT_TYPE.SWITCH),
|
361
|
-
],
|
362
|
-
],
|
363
|
-
|
364
|
-
() => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH)
|
365
|
-
)}
|
366
|
-
${!disable ? this.renderIcon(defaultInput, switchInput) : ''}
|
300
|
+
<div class="switcher-icons-container">
|
301
|
+
${repeat(
|
302
|
+
inputs,
|
303
|
+
input => html` <nile-tooltip
|
304
|
+
class=${classMap({
|
305
|
+
'switcher-tooltip-container': true,
|
306
|
+
})}
|
307
|
+
content=${input.helperText}
|
308
|
+
placement=${toolTipPosition}
|
309
|
+
>
|
310
|
+
<div class=${classMap({
|
311
|
+
'switcher-icon-container': true,
|
312
|
+
current: input.order === this.currentInput.order,
|
313
|
+
})}>
|
314
|
+
<nile-icon
|
315
|
+
size="16"
|
316
|
+
class=${classMap({
|
317
|
+
'pointer-cursor': true,
|
318
|
+
})}
|
319
|
+
.name=${input.icon}
|
320
|
+
color="#000000"
|
321
|
+
@click=${() => this.toggleField(input)}
|
322
|
+
></nile-icon>
|
323
|
+
<div>
|
324
|
+
|
325
|
+
</nile-tooltip>`
|
326
|
+
)}
|
327
|
+
</div>
|
367
328
|
`;
|
368
329
|
}
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
330
|
+
|
331
|
+
toggleField(currentInput: switchInputType) {
|
332
|
+
this.currentInput = currentInput;
|
333
|
+
this.emit('nile-switch', { input: this.currentInput });
|
334
|
+
}
|
335
|
+
|
336
|
+
singleFieldSwitcher() {
|
337
|
+
return html`
|
338
|
+
${choose(
|
339
|
+
this.currentInput.inputType,
|
340
|
+
[
|
341
|
+
[INPUT_TYPE_NAMES.TEXT, () => this.renderNileText(this.currentInput)],
|
342
|
+
[
|
343
|
+
INPUT_TYPE_NAMES.CHECKBOX,
|
344
|
+
() => this.renderNileCheckBox(this.currentInput),
|
345
|
+
],
|
346
|
+
[
|
347
|
+
INPUT_TYPE_NAMES.TEXTAREA,
|
348
|
+
() => this.renderNileTextArea(this.currentInput),
|
349
|
+
],
|
350
|
+
[
|
351
|
+
INPUT_TYPE_NAMES.RADIO,
|
352
|
+
() => this.renderNileRadio(this.currentInput),
|
353
|
+
],
|
354
|
+
[
|
355
|
+
INPUT_TYPE_NAMES.DROPDOWN,
|
356
|
+
() => this.renderDropdown(this.currentInput),
|
357
|
+
],
|
358
|
+
[
|
359
|
+
INPUT_TYPE_NAMES.CONTENTEDITOR,
|
360
|
+
() => this.renderContentEditor(this.currentInput),
|
361
|
+
],
|
362
|
+
[INPUT_TYPE_NAMES.OBJECT_MAPPER, () => this.renderObjectMapper()],
|
363
|
+
],
|
364
|
+
() => this.renderNileText(this.currentInput)
|
383
365
|
)}
|
366
|
+
`;
|
367
|
+
}
|
368
|
+
|
369
|
+
public render(): TemplateResult {
|
370
|
+
const align = this.nileSwitchConfig.align;
|
371
|
+
return html`<div
|
372
|
+
class=${classMap({
|
373
|
+
'switcher-block': align === POSITIONS.BLOCK,
|
374
|
+
'switcher-inline': align === POSITIONS.INLINE,
|
375
|
+
'switcher-input-container': true,
|
376
|
+
})}
|
377
|
+
>
|
378
|
+
${this.renderIcon()} ${this.singleFieldSwitcher()}
|
384
379
|
</div>`;
|
385
380
|
}
|
386
381
|
}
|