@sankhyalabs/ezui 1.1.136 → 1.1.137

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.
Files changed (110) hide show
  1. package/dist/cjs/ez-calendar.cjs.entry.js +2 -2
  2. package/dist/cjs/ez-check.cjs.entry.js +3 -3
  3. package/dist/cjs/ez-combo-box.cjs.entry.js +5 -5
  4. package/dist/cjs/ez-date-input.cjs.entry.js +10 -10
  5. package/dist/cjs/ez-date-time-input.cjs.entry.js +8 -8
  6. package/dist/cjs/ez-filter-input.cjs.entry.js +6 -6
  7. package/dist/cjs/ez-form.cjs.entry.js +36 -5
  8. package/dist/cjs/ez-grid.cjs.entry.js +4 -4
  9. package/dist/cjs/ez-modal.cjs.entry.js +3 -3
  10. package/dist/cjs/ez-number-input.cjs.entry.js +25 -18
  11. package/dist/cjs/ez-popover.cjs.entry.js +2 -2
  12. package/dist/cjs/ez-search.cjs.entry.js +2 -2
  13. package/dist/cjs/ez-text-area.cjs.entry.js +11 -11
  14. package/dist/cjs/ez-text-input.cjs.entry.js +22 -15
  15. package/dist/cjs/ez-time-input.cjs.entry.js +36 -30
  16. package/dist/cjs/ez-upload.cjs.entry.js +4 -4
  17. package/dist/cjs/ezui.cjs.js +1 -1
  18. package/dist/cjs/loader.cjs.js +1 -1
  19. package/dist/cjs/test-du.cjs.entry.js +43 -10
  20. package/dist/collection/components/ez-calendar/ez-calendar.js +2 -2
  21. package/dist/collection/components/ez-check/ez-check.js +3 -3
  22. package/dist/collection/components/ez-combo-box/ez-combo-box.js +5 -5
  23. package/dist/collection/components/ez-date-input/ez-date-input.js +10 -10
  24. package/dist/collection/components/ez-date-time-input/ez-date-time-input.js +8 -8
  25. package/dist/collection/components/ez-filter-input/ez-filter-input.js +6 -6
  26. package/dist/collection/components/ez-form/ez-form.js +17 -2
  27. package/dist/collection/components/ez-form/structure/FormSheetMetadata.js +19 -3
  28. package/dist/collection/components/ez-grid/ez-grid.js +4 -4
  29. package/dist/collection/components/ez-modal/ez-modal.js +3 -3
  30. package/dist/collection/components/ez-number-input/ez-number-input.js +26 -19
  31. package/dist/collection/components/ez-popover/ez-popover.js +2 -2
  32. package/dist/collection/components/ez-search/ez-search.js +2 -2
  33. package/dist/collection/components/ez-text-area/ez-text-area.js +11 -11
  34. package/dist/collection/components/ez-text-input/ez-text-input.js +40 -15
  35. package/dist/collection/components/ez-time-input/ez-time-input.js +52 -31
  36. package/dist/collection/components/ez-upload/ez-upload.js +4 -4
  37. package/dist/collection/components/test-du/test-du.js +44 -10
  38. package/dist/custom-elements/index.js +223 -139
  39. package/dist/esm/ez-calendar.entry.js +2 -2
  40. package/dist/esm/ez-check.entry.js +3 -3
  41. package/dist/esm/ez-combo-box.entry.js +5 -5
  42. package/dist/esm/ez-date-input.entry.js +10 -10
  43. package/dist/esm/ez-date-time-input.entry.js +8 -8
  44. package/dist/esm/ez-filter-input.entry.js +6 -6
  45. package/dist/esm/ez-form.entry.js +36 -5
  46. package/dist/esm/ez-grid.entry.js +4 -4
  47. package/dist/esm/ez-modal.entry.js +3 -3
  48. package/dist/esm/ez-number-input.entry.js +25 -18
  49. package/dist/esm/ez-popover.entry.js +2 -2
  50. package/dist/esm/ez-search.entry.js +2 -2
  51. package/dist/esm/ez-text-area.entry.js +11 -11
  52. package/dist/esm/ez-text-input.entry.js +22 -15
  53. package/dist/esm/ez-time-input.entry.js +37 -31
  54. package/dist/esm/ez-upload.entry.js +4 -4
  55. package/dist/esm/ezui.js +1 -1
  56. package/dist/esm/loader.js +1 -1
  57. package/dist/esm/test-du.entry.js +43 -10
  58. package/dist/ezui/ezui.esm.js +1 -1
  59. package/dist/ezui/p-248361f5.entry.js +1 -0
  60. package/dist/ezui/p-30e3793f.entry.js +1 -0
  61. package/dist/ezui/p-4c3cd534.entry.js +1 -0
  62. package/dist/ezui/{p-5f2add6f.entry.js → p-51cdfa9e.entry.js} +1 -1
  63. package/dist/ezui/p-659df655.entry.js +1 -0
  64. package/dist/ezui/p-6d4b1628.entry.js +1 -0
  65. package/dist/ezui/p-8be1a4d6.entry.js +1 -0
  66. package/dist/ezui/p-b65e22a1.entry.js +1 -0
  67. package/dist/ezui/p-b8d64970.entry.js +1 -0
  68. package/dist/ezui/{p-c6c91589.entry.js → p-c246e251.entry.js} +1 -1
  69. package/dist/ezui/p-c2de757f.entry.js +1 -0
  70. package/dist/ezui/p-c620258b.entry.js +1 -0
  71. package/dist/ezui/p-cb73bee7.entry.js +1 -0
  72. package/dist/ezui/p-db0981c1.entry.js +1 -0
  73. package/dist/ezui/p-dd6f4872.entry.js +1 -0
  74. package/dist/ezui/p-ec8419f1.entry.js +1 -0
  75. package/dist/ezui/p-fc9b9487.entry.js +1 -0
  76. package/dist/types/components/ez-calendar/ez-calendar.d.ts +1 -1
  77. package/dist/types/components/ez-check/ez-check.d.ts +1 -1
  78. package/dist/types/components/ez-combo-box/ez-combo-box.d.ts +1 -1
  79. package/dist/types/components/ez-date-input/ez-date-input.d.ts +3 -3
  80. package/dist/types/components/ez-date-time-input/ez-date-time-input.d.ts +3 -3
  81. package/dist/types/components/ez-filter-input/ez-filter-input.d.ts +3 -3
  82. package/dist/types/components/ez-form/ez-form.d.ts +1 -1
  83. package/dist/types/components/ez-form/structure/FormSheetMetadata.d.ts +3 -0
  84. package/dist/types/components/ez-grid/ez-grid.d.ts +1 -1
  85. package/dist/types/components/ez-modal/ez-modal.d.ts +1 -1
  86. package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -3
  87. package/dist/types/components/ez-popover/ez-popover.d.ts +1 -1
  88. package/dist/types/components/ez-search/ez-search.d.ts +1 -1
  89. package/dist/types/components/ez-text-area/ez-text-area.d.ts +4 -4
  90. package/dist/types/components/ez-text-input/ez-text-input.d.ts +8 -4
  91. package/dist/types/components/ez-time-input/ez-time-input.d.ts +9 -3
  92. package/dist/types/components/ez-upload/ez-upload.d.ts +2 -2
  93. package/dist/types/components/test-du/test-du.d.ts +1 -0
  94. package/dist/types/components.d.ts +12 -0
  95. package/package.json +1 -1
  96. package/dist/ezui/p-097d5dc6.entry.js +0 -1
  97. package/dist/ezui/p-0fd2624d.entry.js +0 -1
  98. package/dist/ezui/p-1587cbbc.entry.js +0 -1
  99. package/dist/ezui/p-18d67107.entry.js +0 -1
  100. package/dist/ezui/p-49f70be3.entry.js +0 -1
  101. package/dist/ezui/p-50038ae3.entry.js +0 -1
  102. package/dist/ezui/p-53110643.entry.js +0 -1
  103. package/dist/ezui/p-685a35b3.entry.js +0 -1
  104. package/dist/ezui/p-699c31d1.entry.js +0 -1
  105. package/dist/ezui/p-6c22c9f9.entry.js +0 -1
  106. package/dist/ezui/p-a1304302.entry.js +0 -1
  107. package/dist/ezui/p-b2cc27e5.entry.js +0 -1
  108. package/dist/ezui/p-b71d454d.entry.js +0 -1
  109. package/dist/ezui/p-cbb62e2c.entry.js +0 -1
  110. package/dist/ezui/p-dcf5f013.entry.js +0 -1
@@ -1,4 +1,4 @@
1
- import { Element, Component, Prop, h, Watch, Host, Method } from "@stencil/core";
1
+ import { Element, Component, Prop, h, Watch, Host, Method, Event } from "@stencil/core";
2
2
  import { TimeFormatter, MaskFormatter, NumberUtils } from "@sankhyalabs/core";
3
3
  import CSSVarsUtils from "../../utils/CSSVarsUtils";
4
4
  export class EzTimeInput {
@@ -16,28 +16,28 @@ export class EzTimeInput {
16
16
  */
17
17
  this.mode = "regular";
18
18
  }
19
- prepareMask() {
19
+ observeShowSeconds() {
20
20
  if (this.showSeconds) {
21
- if (this._maskFormatter == undefined) {
22
- this._maskFormatter = new MaskFormatter("##:##:##");
23
- }
24
- else {
25
- this._maskFormatter.mask = "##:##:##";
26
- }
21
+ this.prepareMask("##:##:##");
27
22
  }
28
23
  else {
29
- if (this._maskFormatter == undefined) {
30
- this._maskFormatter = new MaskFormatter("##:##");
31
- }
32
- else {
33
- this._maskFormatter.mask = "##:##";
34
- }
24
+ this.prepareMask("##:##");
35
25
  }
36
26
  }
37
- onValueChanged() {
38
- if (this.value === NaN) {
27
+ observeValue() {
28
+ if (isNaN(this.value)) {
39
29
  this.value = undefined;
40
- this.handleFocusout();
30
+ }
31
+ }
32
+ //---------------------------------------------
33
+ // Private methods
34
+ //---------------------------------------------
35
+ prepareMask(mask) {
36
+ if (this._maskFormatter == undefined) {
37
+ this._maskFormatter = new MaskFormatter(mask);
38
+ }
39
+ else {
40
+ this._maskFormatter.mask = mask;
41
41
  }
42
42
  }
43
43
  //---------------------------------------------
@@ -47,13 +47,13 @@ export class EzTimeInput {
47
47
  * Faz o foco no componente de input
48
48
  */
49
49
  async setFocus() {
50
- this._inputElem.focus();
50
+ this._inputElem.setFocus();
51
51
  }
52
52
  /**
53
53
  * Remove o foco no componente de input
54
54
  */
55
55
  async setBlur() {
56
- this._inputElem.blur();
56
+ this._inputElem.setBlur();
57
57
  }
58
58
  //---------------------------------------------
59
59
  // Event handlers
@@ -61,24 +61,29 @@ export class EzTimeInput {
61
61
  handleFocusout() {
62
62
  this.errorMessage = "";
63
63
  this.prepareValue(this.viewValue);
64
- if (!TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
65
- this.clearField();
64
+ if (this.viewValue && !TimeFormatter.validateTime(this.viewValue, this.showSeconds)) {
65
+ this._oldViewValue = this.viewValue;
66
66
  this.errorMessage = "Favor inserir um horário válido.";
67
67
  }
68
+ else {
69
+ if (this.viewValue === this._oldViewValue) {
70
+ return;
71
+ }
72
+ this._oldViewValue = this.viewValue;
73
+ if (this.viewValue === "00:00" && this.value == undefined) {
74
+ this.value = 0;
75
+ }
76
+ this.ezChange.emit(this.value);
77
+ }
68
78
  }
69
79
  prepareValue(value) {
70
80
  try {
71
81
  this.viewValue = TimeFormatter.prepareValue(value, this.showSeconds);
72
82
  }
73
83
  catch (e) {
74
- this.clearField();
75
84
  this.errorMessage = e.message;
76
85
  }
77
86
  }
78
- clearField() {
79
- this.viewValue = '';
80
- this.value = undefined;
81
- }
82
87
  handleChange() {
83
88
  this.viewValue = this._inputElem.value;
84
89
  this.value = NumberUtils.stringToNumber(this.viewValue.replace(/\D/g, ""));
@@ -87,11 +92,11 @@ export class EzTimeInput {
87
92
  // Lifecycle web component
88
93
  //---------------------------------------------
89
94
  componentDidLoad() {
90
- this.onValueChanged();
95
+ this.observeValue();
91
96
  CSSVarsUtils.applyVarsTextInput(this._elem, this._inputElem);
92
97
  }
93
98
  componentWillLoad() {
94
- this.prepareMask();
99
+ this.observeShowSeconds();
95
100
  if (this.value) {
96
101
  this.prepareValue(this.value.toString());
97
102
  }
@@ -101,7 +106,7 @@ export class EzTimeInput {
101
106
  }
102
107
  render() {
103
108
  return (h(Host, null,
104
- h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage, mode: this.mode },
109
+ h("ez-text-input", { ref: (el) => this._inputElem = el, value: this.viewValue, enabled: this.enabled, label: this.label, restrict: "0123456789:", onInput: () => { this.handleChange(); }, onFocusout: () => { this.handleFocusout(); }, errorMessage: this.errorMessage, mode: this.mode, slaveMode: true },
105
110
  h("ez-icon", { slot: "leftIcon", iconName: "timer-outline" }))));
106
111
  }
107
112
  static get is() { return "ez-time-input"; }
@@ -237,6 +242,22 @@ export class EzTimeInput {
237
242
  "defaultValue": "\"regular\""
238
243
  }
239
244
  }; }
245
+ static get events() { return [{
246
+ "method": "ezChange",
247
+ "name": "ezChange",
248
+ "bubbles": true,
249
+ "cancelable": true,
250
+ "composed": true,
251
+ "docs": {
252
+ "tags": [],
253
+ "text": "Evento disparado quando o estado do componente \u00E9 alterado (onEzChange)."
254
+ },
255
+ "complexType": {
256
+ "original": "number",
257
+ "resolved": "number",
258
+ "references": {}
259
+ }
260
+ }]; }
240
261
  static get methods() { return {
241
262
  "setFocus": {
242
263
  "complexType": {
@@ -274,9 +295,9 @@ export class EzTimeInput {
274
295
  static get elementRef() { return "_elem"; }
275
296
  static get watchers() { return [{
276
297
  "propName": "showSeconds",
277
- "methodName": "prepareMask"
298
+ "methodName": "observeShowSeconds"
278
299
  }, {
279
300
  "propName": "value",
280
- "methodName": "onValueChanged"
301
+ "methodName": "observeValue"
281
302
  }]; }
282
303
  }
@@ -9,7 +9,7 @@ export class EzUpload {
9
9
  */
10
10
  this.enabled = true;
11
11
  }
12
- changeValue(newValue) {
12
+ observeValue(newValue) {
13
13
  //Observamos o mundo externo, se um novo valor foi atribuído,
14
14
  //precisamos cancelar a alteração anterior, isso envolve, percorrer
15
15
  //a lista de ponteiros e cancelar todos os uploads em andamento.
@@ -29,7 +29,7 @@ export class EzUpload {
29
29
  this.value.forEach(ezFile => this._filePointers.set(ezFile.name, ezFile));
30
30
  }
31
31
  }
32
- normalizeRequestHeaders() {
32
+ observeRequestHeaders() {
33
33
  this._requestHeaders = new Map();
34
34
  if (typeof this.requestHeaders == "string") {
35
35
  try {
@@ -524,9 +524,9 @@ export class EzUpload {
524
524
  static get elementRef() { return "_host"; }
525
525
  static get watchers() { return [{
526
526
  "propName": "value",
527
- "methodName": "changeValue"
527
+ "methodName": "observeValue"
528
528
  }, {
529
529
  "propName": "requestHeaders",
530
- "methodName": "normalizeRequestHeaders"
530
+ "methodName": "observeRequestHeaders"
531
531
  }]; }
532
532
  }
@@ -11,17 +11,50 @@ export class TestDu {
11
11
  label: "Parceiro",
12
12
  fields: [
13
13
  {
14
- name: "ANEXO",
15
- label: "Anexo",
16
- dataType: DataType.OBJECT,
17
- userInterface: UserInterface.FILE,
18
- properties: {
19
- DESTINATION: "MULTIFILE",
20
- MAX_FILES: "2"
21
- }
22
- }
14
+ name: "CODPARC",
15
+ label: "Parceiro",
16
+ dataType: DataType.NUMBER,
17
+ userInterface: UserInterface.INTEGERNUMBER,
18
+ defaultValue: 666,
19
+ required: false,
20
+ properties: {}
21
+ },
22
+ {
23
+ name: "RECDESP",
24
+ label: "Receita/Despesa",
25
+ dataType: DataType.TEXT,
26
+ userInterface: UserInterface.OPTIONSELECTOR,
27
+ required: true,
28
+ properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
29
+ },
30
+ {
31
+ name: "P",
32
+ label: "pera",
33
+ dataType: DataType.TEXT,
34
+ userInterface: UserInterface.OPTIONSELECTOR,
35
+ properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
36
+ },
23
37
  ]
24
38
  };
39
+ this.formConfig = [
40
+ {
41
+ name: "CODPARC",
42
+ label: "Parceiro",
43
+ dataType: DataType.NUMBER,
44
+ userInterface: UserInterface.INTEGERNUMBER,
45
+ defaultValue: 666,
46
+ required: false,
47
+ properties: {}
48
+ },
49
+ {
50
+ name: "RECDESP",
51
+ label: "Receita/Despesa",
52
+ dataType: DataType.TEXT,
53
+ userInterface: UserInterface.OPTIONSELECTOR,
54
+ required: true,
55
+ properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
56
+ }
57
+ ];
25
58
  this.dataUnit.dataLoader = () => new Promise(accept => accept({
26
59
  records: [{
27
60
  __record__id__: "1321321321321321",
@@ -53,9 +86,10 @@ export class TestDu {
53
86
  }
54
87
  render() {
55
88
  return (h("div", null,
89
+ h("button", { onClick: () => this.dataUnit.addRecord() }, "Novo"),
56
90
  h("button", { onClick: () => this.dataUnit.loadData() }, "Carregar"),
57
91
  h("button", { onClick: () => this.save(), disabled: !this.isDirty }, "Salvar"),
58
- h("ez-form", { dataUnit: this.dataUnit })));
92
+ h("ez-form", { dataUnit: this.dataUnit, config: this.formConfig })));
59
93
  }
60
94
  static get is() { return "test-du"; }
61
95
  static get originalStyleUrls() { return {