@sankhyalabs/ezui 4.11.4 → 4.12.1
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/dist/cjs/ApplicationUtils-8cc2f37b.js +161 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -1
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -1
- package/dist/cjs/ez-combo-box.cjs.entry.js +24 -23
- package/dist/cjs/ez-form.cjs.entry.js +2 -2
- package/dist/cjs/ez-text-edit.cjs.entry.js +1 -1
- package/dist/cjs/ez-upload.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/ez-combo-box/ez-combo-box.js +23 -22
- package/dist/collection/utils/ApplicationUtils.js +28 -0
- package/dist/collection/utils/form/FormMetadata.js +1 -1
- package/dist/custom-elements/index.js +116 -23
- package/dist/esm/ApplicationUtils-19857f60.js +159 -0
- package/dist/esm/ez-actions-button.entry.js +1 -1
- package/dist/esm/ez-collapsible-box.entry.js +1 -1
- package/dist/esm/ez-combo-box.entry.js +24 -23
- package/dist/esm/ez-form.entry.js +2 -2
- package/dist/esm/ez-text-edit.entry.js +1 -1
- package/dist/esm/ez-upload.entry.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-be09b541.entry.js → p-18d7de85.entry.js} +1 -1
- package/dist/ezui/{p-4f9931d8.entry.js → p-22b106d7.entry.js} +1 -1
- package/dist/ezui/{p-5844ec15.entry.js → p-370ad5c9.entry.js} +1 -1
- package/dist/ezui/p-41ce6f98.js +1 -0
- package/dist/ezui/{p-b8281997.entry.js → p-60e30f92.entry.js} +1 -1
- package/dist/ezui/{p-9af6c6ac.entry.js → p-805ee4c2.entry.js} +1 -1
- package/dist/ezui/p-bd1d887a.entry.js +1 -0
- package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -1
- package/dist/types/utils/ApplicationUtils.d.ts +12 -1
- package/package.json +3 -1
- package/dist/cjs/ApplicationUtils-d71aed06.js +0 -69
- package/dist/esm/ApplicationUtils-3d870a53.js +0 -67
- package/dist/ezui/p-a98176cb.entry.js +0 -1
- package/dist/ezui/p-ab2a3006.js +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const DialogType = require('./DialogType-2114c337.js');
|
|
4
|
+
|
|
5
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
6
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
7
|
+
// generators (like Math.random()).
|
|
8
|
+
let getRandomValues;
|
|
9
|
+
const rnds8 = new Uint8Array(16);
|
|
10
|
+
function rng() {
|
|
11
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
12
|
+
if (!getRandomValues) {
|
|
13
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
14
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
15
|
+
|
|
16
|
+
if (!getRandomValues) {
|
|
17
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return getRandomValues(rnds8);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
26
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
const byteToHex = [];
|
|
30
|
+
|
|
31
|
+
for (let i = 0; i < 256; ++i) {
|
|
32
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function unsafeStringify(arr, offset = 0) {
|
|
36
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
37
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
38
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
42
|
+
const native = {
|
|
43
|
+
randomUUID
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function v4(options, buf, offset) {
|
|
47
|
+
if (native.randomUUID && !buf && !options) {
|
|
48
|
+
return native.randomUUID();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
options = options || {};
|
|
52
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
53
|
+
|
|
54
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
55
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
56
|
+
|
|
57
|
+
if (buf) {
|
|
58
|
+
offset = offset || 0;
|
|
59
|
+
|
|
60
|
+
for (let i = 0; i < 16; ++i) {
|
|
61
|
+
buf[offset + i] = rnds[i];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return buf;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return unsafeStringify(rnds);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
class ApplicationUtils {
|
|
71
|
+
static async showDialog(title, message, icon = null, confirm, dialogType = DialogType.DialogType.DEFAULT, options) {
|
|
72
|
+
if (options) {
|
|
73
|
+
options = Object.assign(Object.assign({}, ApplicationUtils.defaultMessageOptions), options);
|
|
74
|
+
}
|
|
75
|
+
return new Promise(resolve => {
|
|
76
|
+
let dialog = document.querySelector("ez-dialog");
|
|
77
|
+
if (!dialog) {
|
|
78
|
+
dialog = document.createElement("ez-dialog");
|
|
79
|
+
window.document.body.appendChild(dialog);
|
|
80
|
+
}
|
|
81
|
+
dialog.show(title, message, dialogType, confirm, icon, options.labelCancel, options.labelConfirm, options.btnConfirmDanger, options.beforeClose).then(ok => resolve(ok));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
static async alert(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
85
|
+
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.DialogType.WARN, options);
|
|
86
|
+
}
|
|
87
|
+
static async error(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
88
|
+
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.DialogType.CRITICAL, options);
|
|
89
|
+
}
|
|
90
|
+
static async success(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
91
|
+
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.DialogType.SUCCESS, options);
|
|
92
|
+
}
|
|
93
|
+
static async confirm(title, message, icon = null, dialogType = DialogType.DialogType.WARN, options = ApplicationUtils.defaultMessageOptions) {
|
|
94
|
+
return ApplicationUtils.showDialog(title, message, icon, true, dialogType, options);
|
|
95
|
+
}
|
|
96
|
+
static async message(title, message, icon = null, options = ApplicationUtils.defaultMessageOptions) {
|
|
97
|
+
return ApplicationUtils.showDialog(title, message, icon, false, DialogType.DialogType.DEFAULT, options);
|
|
98
|
+
}
|
|
99
|
+
static async info(message, options = ApplicationUtils.defaultMessageOptions) {
|
|
100
|
+
if (options !== ApplicationUtils.defaultMessageOptions) {
|
|
101
|
+
options = Object.assign(Object.assign({}, ApplicationUtils.defaultMessageOptions), options);
|
|
102
|
+
}
|
|
103
|
+
let useIcon = false;
|
|
104
|
+
let toast = document.querySelector("ez-toast");
|
|
105
|
+
if (!toast) {
|
|
106
|
+
toast = document.createElement("ez-toast");
|
|
107
|
+
const icon = document.createElement("ez-icon");
|
|
108
|
+
icon.className = "ez-margin-right--small";
|
|
109
|
+
icon.slot = "icon";
|
|
110
|
+
icon.style.setProperty("--ez-icon--color", "var(--color--success)");
|
|
111
|
+
toast.appendChild(icon);
|
|
112
|
+
window.document.body.appendChild(toast);
|
|
113
|
+
}
|
|
114
|
+
if (options.iconName) {
|
|
115
|
+
const iconElem = toast.querySelector("ez-icon");
|
|
116
|
+
if (iconElem) {
|
|
117
|
+
iconElem.iconName = options.iconName;
|
|
118
|
+
useIcon = true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
useIcon = false;
|
|
123
|
+
}
|
|
124
|
+
toast.show(message, 5000, useIcon, options.canClose);
|
|
125
|
+
}
|
|
126
|
+
static async showModal(modalProps) {
|
|
127
|
+
modalProps = Object.assign(Object.assign({}, ApplicationUtils.defaultModalProps), modalProps);
|
|
128
|
+
const modal = document.createElement("ez-modal");
|
|
129
|
+
window.document.body.appendChild(modal);
|
|
130
|
+
modal.setAttribute('id', v4());
|
|
131
|
+
modal.modalSize = modalProps.size;
|
|
132
|
+
modal.align = modalProps.position;
|
|
133
|
+
modal.heightMode = modalProps.heightMode;
|
|
134
|
+
modal.closeEsc = modalProps.closeEsc;
|
|
135
|
+
modal.closeOutsideClick = modalProps.closeOutsideClick;
|
|
136
|
+
if (modalProps.content instanceof String || typeof modalProps.content === 'string') {
|
|
137
|
+
modal.innerHTML = modalProps.content;
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
modal.appendChild(modalProps.content);
|
|
141
|
+
}
|
|
142
|
+
modal.opened = true;
|
|
143
|
+
return () => modal.remove();
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
ApplicationUtils.defaultMessageOptions = {
|
|
147
|
+
canClose: true,
|
|
148
|
+
labelCancel: 'Não',
|
|
149
|
+
labelConfirm: 'Sim',
|
|
150
|
+
btnConfirmDanger: false
|
|
151
|
+
};
|
|
152
|
+
ApplicationUtils.defaultModalProps = {
|
|
153
|
+
content: null,
|
|
154
|
+
position: 'right',
|
|
155
|
+
size: 'small',
|
|
156
|
+
heightMode: 'regular',
|
|
157
|
+
closeOutsideClick: true,
|
|
158
|
+
closeEsc: true
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
exports.ApplicationUtils = ApplicationUtils;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7854a33d.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
require('./ApplicationUtils-
|
|
7
|
+
require('./ApplicationUtils-8cc2f37b.js');
|
|
8
8
|
const CSSVarsUtils = require('./CSSVarsUtils-af809e73.js');
|
|
9
9
|
require('./DialogType-2114c337.js');
|
|
10
10
|
require('./CheckMode-ecb90b87.js');
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7854a33d.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const ApplicationUtils = require('./ApplicationUtils-
|
|
7
|
+
const ApplicationUtils = require('./ApplicationUtils-8cc2f37b.js');
|
|
8
8
|
require('./DialogType-2114c337.js');
|
|
9
9
|
require('./CheckMode-ecb90b87.js');
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7854a33d.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const ApplicationUtils = require('./ApplicationUtils-
|
|
7
|
+
const ApplicationUtils = require('./ApplicationUtils-8cc2f37b.js');
|
|
8
8
|
const CSSVarsUtils = require('./CSSVarsUtils-af809e73.js');
|
|
9
9
|
require('./DialogType-2114c337.js');
|
|
10
10
|
require('./CheckMode-ecb90b87.js');
|
|
@@ -23,6 +23,7 @@ const EzComboBox = class {
|
|
|
23
23
|
this._tabPressed = false;
|
|
24
24
|
this._textEmptyList = "Nenhum resultado encontrado";
|
|
25
25
|
this._textEmptySearch = "Nenhum resultado de {0} encontrado";
|
|
26
|
+
this._lookupMode = false;
|
|
26
27
|
this._preSelection = undefined;
|
|
27
28
|
this._visibleOptions = undefined;
|
|
28
29
|
this._startLoading = false;
|
|
@@ -53,24 +54,29 @@ const EzComboBox = class {
|
|
|
53
54
|
}
|
|
54
55
|
observeValue(newValue, oldValue) {
|
|
55
56
|
if (this._textInput && newValue != oldValue) {
|
|
56
|
-
|
|
57
|
-
this.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
|
|
66
|
-
if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
|
|
67
|
-
this.setInputValue();
|
|
68
|
-
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
69
|
-
if (!this.isLookUpSearch(newValue, oldValue)) {
|
|
70
|
-
this.ezChange.emit(valueEmitted);
|
|
57
|
+
try {
|
|
58
|
+
if (this.searchMode && typeof newValue === "string") {
|
|
59
|
+
this.setInputValue();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const newValueSelected = this.getSelectedOption(newValue);
|
|
63
|
+
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
64
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
65
|
+
if (this.isDifferentValues(currentValue, newValueSelected)) {
|
|
66
|
+
this.value = newValueSelected;
|
|
71
67
|
}
|
|
68
|
+
if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
|
|
69
|
+
this.setInputValue();
|
|
70
|
+
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
71
|
+
if (!this._lookupMode) {
|
|
72
|
+
this.ezChange.emit(valueEmitted);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
this.resetOptions();
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
this._lookupMode = false;
|
|
72
79
|
}
|
|
73
|
-
this.resetOptions();
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
/**
|
|
@@ -383,6 +389,7 @@ const EzComboBox = class {
|
|
|
383
389
|
if (!value.label) {
|
|
384
390
|
value.label = `<SEM ${this.getFieldLabel()}>`;
|
|
385
391
|
}
|
|
392
|
+
this._lookupMode = true;
|
|
386
393
|
this.value = value;
|
|
387
394
|
}
|
|
388
395
|
loadOptionValue(argument) {
|
|
@@ -552,12 +559,6 @@ const EzComboBox = class {
|
|
|
552
559
|
onTextInputFocusOutHandler() {
|
|
553
560
|
this.cancelPreselection();
|
|
554
561
|
}
|
|
555
|
-
isLookUpSearch(newValue, oldValue) {
|
|
556
|
-
return this.searchMode &&
|
|
557
|
-
typeof oldValue !== "object" &&
|
|
558
|
-
typeof newValue === "object" &&
|
|
559
|
-
oldValue == newValue.value;
|
|
560
|
-
}
|
|
561
562
|
render() {
|
|
562
563
|
var _a;
|
|
563
564
|
core.ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7854a33d.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const ApplicationUtils = require('./ApplicationUtils-
|
|
7
|
+
const ApplicationUtils = require('./ApplicationUtils-8cc2f37b.js');
|
|
8
8
|
require('./DialogType-2114c337.js');
|
|
9
9
|
|
|
10
10
|
const DETAIL_PATTERN = /child\[([^\]]+)\]/;
|
|
@@ -118,7 +118,7 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
118
118
|
cleanOnCopyFields.push(field.name);
|
|
119
119
|
}
|
|
120
120
|
let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
|
|
121
|
-
if (defaultValue) {
|
|
121
|
+
if (defaultValue && defaultValue.value != undefined) {
|
|
122
122
|
const { type, value } = defaultValue;
|
|
123
123
|
if (type) {
|
|
124
124
|
if (type === "V") {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7854a33d.js');
|
|
6
6
|
const core = require('@sankhyalabs/core');
|
|
7
|
-
const ApplicationUtils = require('./ApplicationUtils-
|
|
7
|
+
const ApplicationUtils = require('./ApplicationUtils-8cc2f37b.js');
|
|
8
8
|
require('./DialogType-2114c337.js');
|
|
9
9
|
require('./CheckMode-ecb90b87.js');
|
|
10
10
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-7854a33d.js');
|
|
6
|
-
const ApplicationUtils = require('./ApplicationUtils-
|
|
6
|
+
const ApplicationUtils = require('./ApplicationUtils-8cc2f37b.js');
|
|
7
7
|
const core = require('@sankhyalabs/core');
|
|
8
8
|
require('./DialogType-2114c337.js');
|
|
9
9
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"entries": [
|
|
3
|
+
"./components/ez-modal/ez-modal.js",
|
|
3
4
|
"./components/ez-actions-button/ez-actions-button.js",
|
|
4
5
|
"./components/ez-breadcrumb/ez-breadcrumb.js",
|
|
5
6
|
"./components/ez-card-item/ez-card-item.js",
|
|
@@ -29,7 +30,6 @@
|
|
|
29
30
|
"./components/ez-guide-navigator/ez-guide-navigator.js",
|
|
30
31
|
"./components/ez-icon/ez-icon.js",
|
|
31
32
|
"./components/ez-loading-bar/ez-loading-bar.js",
|
|
32
|
-
"./components/ez-modal/ez-modal.js",
|
|
33
33
|
"./components/ez-modal-container/ez-modal-container.js",
|
|
34
34
|
"./components/ez-number-input/ez-number-input.js",
|
|
35
35
|
"./components/ez-popover/ez-popover.js",
|
|
@@ -11,6 +11,7 @@ export class EzComboBox {
|
|
|
11
11
|
this._tabPressed = false;
|
|
12
12
|
this._textEmptyList = "Nenhum resultado encontrado";
|
|
13
13
|
this._textEmptySearch = "Nenhum resultado de {0} encontrado";
|
|
14
|
+
this._lookupMode = false;
|
|
14
15
|
this._preSelection = undefined;
|
|
15
16
|
this._visibleOptions = undefined;
|
|
16
17
|
this._startLoading = false;
|
|
@@ -41,24 +42,29 @@ export class EzComboBox {
|
|
|
41
42
|
}
|
|
42
43
|
observeValue(newValue, oldValue) {
|
|
43
44
|
if (this._textInput && newValue != oldValue) {
|
|
44
|
-
|
|
45
|
-
this.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
|
|
55
|
-
this.setInputValue();
|
|
56
|
-
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
57
|
-
if (!this.isLookUpSearch(newValue, oldValue)) {
|
|
58
|
-
this.ezChange.emit(valueEmitted);
|
|
45
|
+
try {
|
|
46
|
+
if (this.searchMode && typeof newValue === "string") {
|
|
47
|
+
this.setInputValue();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const newValueSelected = this.getSelectedOption(newValue);
|
|
51
|
+
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
52
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
53
|
+
if (this.isDifferentValues(currentValue, newValueSelected)) {
|
|
54
|
+
this.value = newValueSelected;
|
|
59
55
|
}
|
|
56
|
+
if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
|
|
57
|
+
this.setInputValue();
|
|
58
|
+
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
59
|
+
if (!this._lookupMode) {
|
|
60
|
+
this.ezChange.emit(valueEmitted);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
this.resetOptions();
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
this._lookupMode = false;
|
|
60
67
|
}
|
|
61
|
-
this.resetOptions();
|
|
62
68
|
}
|
|
63
69
|
}
|
|
64
70
|
/**
|
|
@@ -371,6 +377,7 @@ export class EzComboBox {
|
|
|
371
377
|
if (!value.label) {
|
|
372
378
|
value.label = `<SEM ${this.getFieldLabel()}>`;
|
|
373
379
|
}
|
|
380
|
+
this._lookupMode = true;
|
|
374
381
|
this.value = value;
|
|
375
382
|
}
|
|
376
383
|
loadOptionValue(argument) {
|
|
@@ -540,12 +547,6 @@ export class EzComboBox {
|
|
|
540
547
|
onTextInputFocusOutHandler() {
|
|
541
548
|
this.cancelPreselection();
|
|
542
549
|
}
|
|
543
|
-
isLookUpSearch(newValue, oldValue) {
|
|
544
|
-
return this.searchMode &&
|
|
545
|
-
typeof oldValue !== "object" &&
|
|
546
|
-
typeof newValue === "object" &&
|
|
547
|
-
oldValue == newValue.value;
|
|
548
|
-
}
|
|
549
550
|
render() {
|
|
550
551
|
var _a;
|
|
551
552
|
ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { v4 as uuid } from "uuid";
|
|
1
2
|
import { DialogType } from "../components/ez-dialog/DialogType";
|
|
2
3
|
export default class ApplicationUtils {
|
|
3
4
|
static async showDialog(title, message, icon = null, confirm, dialogType = DialogType.DEFAULT, options) {
|
|
@@ -55,6 +56,25 @@ export default class ApplicationUtils {
|
|
|
55
56
|
}
|
|
56
57
|
toast.show(message, 5000, useIcon, options.canClose);
|
|
57
58
|
}
|
|
59
|
+
static async showModal(modalProps) {
|
|
60
|
+
modalProps = Object.assign(Object.assign({}, ApplicationUtils.defaultModalProps), modalProps);
|
|
61
|
+
const modal = document.createElement("ez-modal");
|
|
62
|
+
window.document.body.appendChild(modal);
|
|
63
|
+
modal.setAttribute('id', uuid());
|
|
64
|
+
modal.modalSize = modalProps.size;
|
|
65
|
+
modal.align = modalProps.position;
|
|
66
|
+
modal.heightMode = modalProps.heightMode;
|
|
67
|
+
modal.closeEsc = modalProps.closeEsc;
|
|
68
|
+
modal.closeOutsideClick = modalProps.closeOutsideClick;
|
|
69
|
+
if (modalProps.content instanceof String || typeof modalProps.content === 'string') {
|
|
70
|
+
modal.innerHTML = modalProps.content;
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
modal.appendChild(modalProps.content);
|
|
74
|
+
}
|
|
75
|
+
modal.opened = true;
|
|
76
|
+
return () => modal.remove();
|
|
77
|
+
}
|
|
58
78
|
}
|
|
59
79
|
ApplicationUtils.defaultMessageOptions = {
|
|
60
80
|
canClose: true,
|
|
@@ -62,4 +82,12 @@ ApplicationUtils.defaultMessageOptions = {
|
|
|
62
82
|
labelConfirm: 'Sim',
|
|
63
83
|
btnConfirmDanger: false
|
|
64
84
|
};
|
|
85
|
+
ApplicationUtils.defaultModalProps = {
|
|
86
|
+
content: null,
|
|
87
|
+
position: 'right',
|
|
88
|
+
size: 'small',
|
|
89
|
+
heightMode: 'regular',
|
|
90
|
+
closeOutsideClick: true,
|
|
91
|
+
closeEsc: true
|
|
92
|
+
};
|
|
65
93
|
;
|
|
@@ -110,7 +110,7 @@ export const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
110
110
|
cleanOnCopyFields.push(field.name);
|
|
111
111
|
}
|
|
112
112
|
let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
|
|
113
|
-
if (defaultValue) {
|
|
113
|
+
if (defaultValue && defaultValue.value != undefined) {
|
|
114
114
|
const { type, value } = defaultValue;
|
|
115
115
|
if (type) {
|
|
116
116
|
if (type === "V") {
|
|
@@ -3,6 +3,71 @@ export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client'
|
|
|
3
3
|
import { UserInterface, DateUtils as DateUtils$1, Action, WaitingChangeException, ApplicationContext, DataUnitAction, FloatingManager, ElementIDUtils, ObjectUtils as ObjectUtils$1, JSUtils, StringUtils as StringUtils$1, TimeFormatter, DataUnit, NumberUtils as NumberUtils$1, DataType, SortMode, MaskFormatter } from '@sankhyalabs/core';
|
|
4
4
|
import { SelectionMode } from '@sankhyalabs/core/dist/dataunit/DataUnit';
|
|
5
5
|
|
|
6
|
+
// Unique ID creation requires a high quality random # generator. In the browser we therefore
|
|
7
|
+
// require the crypto API and do not support built-in fallback to lower quality random number
|
|
8
|
+
// generators (like Math.random()).
|
|
9
|
+
let getRandomValues;
|
|
10
|
+
const rnds8 = new Uint8Array(16);
|
|
11
|
+
function rng() {
|
|
12
|
+
// lazy load so that environments that need to polyfill have a chance to do so
|
|
13
|
+
if (!getRandomValues) {
|
|
14
|
+
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation.
|
|
15
|
+
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
16
|
+
|
|
17
|
+
if (!getRandomValues) {
|
|
18
|
+
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return getRandomValues(rnds8);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
27
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
const byteToHex = [];
|
|
31
|
+
|
|
32
|
+
for (let i = 0; i < 256; ++i) {
|
|
33
|
+
byteToHex.push((i + 0x100).toString(16).slice(1));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function unsafeStringify(arr, offset = 0) {
|
|
37
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
38
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
39
|
+
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const randomUUID = typeof crypto !== 'undefined' && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
43
|
+
const native = {
|
|
44
|
+
randomUUID
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
function v4(options, buf, offset) {
|
|
48
|
+
if (native.randomUUID && !buf && !options) {
|
|
49
|
+
return native.randomUUID();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
options = options || {};
|
|
53
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
54
|
+
|
|
55
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
56
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
57
|
+
|
|
58
|
+
if (buf) {
|
|
59
|
+
offset = offset || 0;
|
|
60
|
+
|
|
61
|
+
for (let i = 0; i < 16; ++i) {
|
|
62
|
+
buf[offset + i] = rnds[i];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return buf;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return unsafeStringify(rnds);
|
|
69
|
+
}
|
|
70
|
+
|
|
6
71
|
var DialogType;
|
|
7
72
|
(function (DialogType) {
|
|
8
73
|
DialogType["WARN"] = "warn";
|
|
@@ -67,6 +132,25 @@ class ApplicationUtils {
|
|
|
67
132
|
}
|
|
68
133
|
toast.show(message, 5000, useIcon, options.canClose);
|
|
69
134
|
}
|
|
135
|
+
static async showModal(modalProps) {
|
|
136
|
+
modalProps = Object.assign(Object.assign({}, ApplicationUtils.defaultModalProps), modalProps);
|
|
137
|
+
const modal = document.createElement("ez-modal");
|
|
138
|
+
window.document.body.appendChild(modal);
|
|
139
|
+
modal.setAttribute('id', v4());
|
|
140
|
+
modal.modalSize = modalProps.size;
|
|
141
|
+
modal.align = modalProps.position;
|
|
142
|
+
modal.heightMode = modalProps.heightMode;
|
|
143
|
+
modal.closeEsc = modalProps.closeEsc;
|
|
144
|
+
modal.closeOutsideClick = modalProps.closeOutsideClick;
|
|
145
|
+
if (modalProps.content instanceof String || typeof modalProps.content === 'string') {
|
|
146
|
+
modal.innerHTML = modalProps.content;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
modal.appendChild(modalProps.content);
|
|
150
|
+
}
|
|
151
|
+
modal.opened = true;
|
|
152
|
+
return () => modal.remove();
|
|
153
|
+
}
|
|
70
154
|
}
|
|
71
155
|
ApplicationUtils.defaultMessageOptions = {
|
|
72
156
|
canClose: true,
|
|
@@ -74,6 +158,14 @@ ApplicationUtils.defaultMessageOptions = {
|
|
|
74
158
|
labelConfirm: 'Sim',
|
|
75
159
|
btnConfirmDanger: false
|
|
76
160
|
};
|
|
161
|
+
ApplicationUtils.defaultModalProps = {
|
|
162
|
+
content: null,
|
|
163
|
+
position: 'right',
|
|
164
|
+
size: 'small',
|
|
165
|
+
heightMode: 'regular',
|
|
166
|
+
closeOutsideClick: true,
|
|
167
|
+
closeEsc: true
|
|
168
|
+
};
|
|
77
169
|
|
|
78
170
|
class CSSVarsUtils {
|
|
79
171
|
static applyCSSVars(document, host, child) {
|
|
@@ -261,7 +353,7 @@ const buildFormMetadata = (config, dataUnit, includeDetails = false) => {
|
|
|
261
353
|
cleanOnCopyFields.push(field.name);
|
|
262
354
|
}
|
|
263
355
|
let defaultValue = field.defaultValue == undefined ? (_c = descriptor.properties) === null || _c === void 0 ? void 0 : _c.defaultValue : field.defaultValue;
|
|
264
|
-
if (defaultValue) {
|
|
356
|
+
if (defaultValue && defaultValue.value != undefined) {
|
|
265
357
|
const { type, value } = defaultValue;
|
|
266
358
|
if (type) {
|
|
267
359
|
if (type === "V") {
|
|
@@ -1977,6 +2069,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
1977
2069
|
this._tabPressed = false;
|
|
1978
2070
|
this._textEmptyList = "Nenhum resultado encontrado";
|
|
1979
2071
|
this._textEmptySearch = "Nenhum resultado de {0} encontrado";
|
|
2072
|
+
this._lookupMode = false;
|
|
1980
2073
|
this._preSelection = undefined;
|
|
1981
2074
|
this._visibleOptions = undefined;
|
|
1982
2075
|
this._startLoading = false;
|
|
@@ -2007,24 +2100,29 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
2007
2100
|
}
|
|
2008
2101
|
observeValue(newValue, oldValue) {
|
|
2009
2102
|
if (this._textInput && newValue != oldValue) {
|
|
2010
|
-
|
|
2011
|
-
this.
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
const newValueSelected = this.getSelectedOption(newValue);
|
|
2015
|
-
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
2016
|
-
const currentValue = this.getSelectedOption(this.value);
|
|
2017
|
-
if (this.isDifferentValues(currentValue, newValueSelected)) {
|
|
2018
|
-
this.value = newValueSelected;
|
|
2019
|
-
}
|
|
2020
|
-
if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
|
|
2021
|
-
this.setInputValue();
|
|
2022
|
-
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
2023
|
-
if (!this.isLookUpSearch(newValue, oldValue)) {
|
|
2024
|
-
this.ezChange.emit(valueEmitted);
|
|
2103
|
+
try {
|
|
2104
|
+
if (this.searchMode && typeof newValue === "string") {
|
|
2105
|
+
this.setInputValue();
|
|
2106
|
+
return;
|
|
2025
2107
|
}
|
|
2108
|
+
const newValueSelected = this.getSelectedOption(newValue);
|
|
2109
|
+
const oldValueSelected = this.getSelectedOption(oldValue);
|
|
2110
|
+
const currentValue = this.getSelectedOption(this.value);
|
|
2111
|
+
if (this.isDifferentValues(currentValue, newValueSelected)) {
|
|
2112
|
+
this.value = newValueSelected;
|
|
2113
|
+
}
|
|
2114
|
+
if (this.isDifferentValues(newValueSelected, oldValueSelected)) {
|
|
2115
|
+
this.setInputValue();
|
|
2116
|
+
const valueEmitted = newValueSelected === null ? undefined : newValueSelected;
|
|
2117
|
+
if (!this._lookupMode) {
|
|
2118
|
+
this.ezChange.emit(valueEmitted);
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
this.resetOptions();
|
|
2122
|
+
}
|
|
2123
|
+
finally {
|
|
2124
|
+
this._lookupMode = false;
|
|
2026
2125
|
}
|
|
2027
|
-
this.resetOptions();
|
|
2028
2126
|
}
|
|
2029
2127
|
}
|
|
2030
2128
|
/**
|
|
@@ -2337,6 +2435,7 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
2337
2435
|
if (!value.label) {
|
|
2338
2436
|
value.label = `<SEM ${this.getFieldLabel()}>`;
|
|
2339
2437
|
}
|
|
2438
|
+
this._lookupMode = true;
|
|
2340
2439
|
this.value = value;
|
|
2341
2440
|
}
|
|
2342
2441
|
loadOptionValue(argument) {
|
|
@@ -2506,12 +2605,6 @@ const EzComboBox$1 = class extends HTMLElement$1 {
|
|
|
2506
2605
|
onTextInputFocusOutHandler() {
|
|
2507
2606
|
this.cancelPreselection();
|
|
2508
2607
|
}
|
|
2509
|
-
isLookUpSearch(newValue, oldValue) {
|
|
2510
|
-
return this.searchMode &&
|
|
2511
|
-
typeof oldValue !== "object" &&
|
|
2512
|
-
typeof newValue === "object" &&
|
|
2513
|
-
oldValue == newValue.value;
|
|
2514
|
-
}
|
|
2515
2608
|
render() {
|
|
2516
2609
|
var _a;
|
|
2517
2610
|
ElementIDUtils.addIDInfoIfNotExists(this.el, 'input');
|