Repository navigation
Expand file tree
/
Copy pathpin.js
More file actions
135 lines (131 loc) · 3.87 KB
/
Copy pathpin.js
File metadata and controls
135 lines (131 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import { _ as _decorate, s, i, e, y, a as e$1 } from './query-assigned-elements-5558b813.js';
const fire = (element, data) => {
const args = {
bubbles: true,
cancelable: false,
composed: true,
...data
};
console.log('fire!');
// the event name 'nintex-value-change' is required to tell the form engine to update the value
const event = new CustomEvent('ntx-value-change', args);
element.dispatchEvent(event);
return event;
};
let PINTextField = _decorate([e$1('pin-field-2')], function (_initialize, _LitElement) {
class PINTextField extends _LitElement {
constructor(...args) {
super(...args);
_initialize(this);
}
}
return {
F: PINTextField,
d: [{
kind: "field",
static: true,
key: "styles",
value() {
return i`
.form-control {
color: var(--ntx-form-theme-color-secondary);
background-color: var(
--ntx-form-theme-color-input-background,
transparent
);
font-size: var(--ntx-form-theme-text-input-size);
font-family: var(--ntx-form-theme-font-family);
border: 1px solid var(--ntx-form-theme-color-border);
border-radius: var(--ntx-form-theme-border-radius);
height: 30px;
padding-left: 12px;
width: 100%;
}
.form-control:focus {
outline: none;
border-color: var(--ntx-form-theme-color-primary);
}
`;
}
}, {
kind: "method",
key: "render",
value: function render() {
if (window.location.toString().toLowerCase().indexOf('/designer/') == -1) {
showHide('none', 'none');
}
return y`<input id="pinInput" class="form-control nx-input-control nx-theme-input-1" @keyup="${e => this.pinChange2(e)}" @change="${e => this.pinChange(e)}"></input>`;
}
}, {
kind: "method",
key: "pinChange",
value: function pinChange(e) {
console.log('pinChange');
const el = this.shadowRoot?.getElementById('pinInput');
if (el) {
fire(this, {
detail: el.value
});
}
}
}, {
kind: "method",
key: "pinChange2",
value: function pinChange2(e) {
console.log('pinChange2');
if (window.location.toString().toLowerCase().indexOf('/designer/') == -1) {
const el = this.shadowRoot?.getElementById('pinInput');
if (el) {
if (el.value == this.pinToMatch) {
showHide('block', 'flex');
}
else {
showHide('none', 'none');
}
}
}
}
}, {
kind: "method",
static: true,
key: "getMetaConfig",
value: function getMetaConfig() {
return {
controlName: 'pin-field',
fallbackDisableSubmit: false,
iconUrl: 'one-line-text',
version: '1',
properties: {
pinToMatch: {
type: 'string',
title: 'PIN to match'
},
value: {
type: 'string',
title: 'PIN',
isValueField: true,
defaultValue: ''
}
},
standardProperties: {
fieldLabel: true,
description: true,
defaultValue: true,
readOnly: true
}
};
}
}]
};
}, s);
function showHide(attr1, attr2) {
var eles = document.getElementsByClassName("mat-stepper-horizontal");
for (var i = 0; i < eles.length; i++) {
eles[i].style.display = attr1;
}
eles = document.getElementsByClassName("nx-action-panel");
for (var i = 0; i < eles.length; i++) {
eles[i].style.display = attr2;
}
}
export { PINTextField };