@sankhyalabs/ezui 1.1.118 → 1.1.121

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 (49) hide show
  1. package/dist/cjs/ez-check.cjs.entry.js +1 -1
  2. package/dist/cjs/ez-form.cjs.entry.js +59 -15
  3. package/dist/cjs/ez-grid.cjs.entry.js +45 -12
  4. package/dist/cjs/ez-popover.cjs.entry.js +41 -22
  5. package/dist/cjs/ez-upload.cjs.entry.js +10 -3
  6. package/dist/cjs/ezui.cjs.js +1 -1
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/test-du.cjs.entry.js +39 -46
  9. package/dist/collection/components/ez-check/ez-check.css +28 -10
  10. package/dist/collection/components/ez-form/DataBinder.js +59 -15
  11. package/dist/collection/components/ez-form/fieldbuilder/tpl/FileInput.tpl.js +1 -1
  12. package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +27 -9
  13. package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +6 -3
  14. package/dist/collection/components/ez-grid/ez-grid.js +47 -0
  15. package/dist/collection/components/ez-popover/ez-popover.css +3 -5
  16. package/dist/collection/components/ez-popover/ez-popover.js +62 -28
  17. package/dist/collection/components/ez-upload/ez-upload.js +29 -3
  18. package/dist/collection/components/test-du/test-du.js +47 -48
  19. package/dist/custom-elements/index.js +197 -102
  20. package/dist/esm/ez-check.entry.js +1 -1
  21. package/dist/esm/ez-form.entry.js +60 -16
  22. package/dist/esm/ez-grid.entry.js +45 -12
  23. package/dist/esm/ez-popover.entry.js +41 -22
  24. package/dist/esm/ez-upload.entry.js +10 -3
  25. package/dist/esm/ezui.js +1 -1
  26. package/dist/esm/loader.js +1 -1
  27. package/dist/esm/test-du.entry.js +40 -47
  28. package/dist/ezui/ezui.esm.js +1 -1
  29. package/dist/ezui/p-68c509a7.entry.js +1 -0
  30. package/dist/ezui/p-76b64956.entry.js +1 -0
  31. package/dist/ezui/p-8793a124.entry.js +1 -0
  32. package/dist/ezui/p-a6e28794.entry.js +1 -0
  33. package/dist/ezui/{p-3cd17150.entry.js → p-c86cd69e.entry.js} +1 -1
  34. package/dist/ezui/p-f8d3c04d.entry.js +1 -0
  35. package/dist/types/components/ez-form/DataBinder.d.ts +2 -0
  36. package/dist/types/components/ez-grid/controller/EzGridController.d.ts +6 -2
  37. package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +5 -2
  38. package/dist/types/components/ez-grid/controller/ag-grid/DataSource.d.ts +2 -0
  39. package/dist/types/components/ez-grid/ez-grid.d.ts +8 -0
  40. package/dist/types/components/ez-popover/ez-popover.d.ts +7 -0
  41. package/dist/types/components/ez-upload/ez-upload.d.ts +5 -0
  42. package/dist/types/components/test-du/test-du.d.ts +2 -0
  43. package/dist/types/components.d.ts +21 -1
  44. package/package.json +1 -1
  45. package/dist/ezui/p-080045a0.entry.js +0 -1
  46. package/dist/ezui/p-126d33e2.entry.js +0 -1
  47. package/dist/ezui/p-1339fde7.entry.js +0 -1
  48. package/dist/ezui/p-73d3f767.entry.js +0 -1
  49. package/dist/ezui/p-f3f9c7e6.entry.js +0 -1
@@ -1,65 +1,61 @@
1
- import { Component, h } from '@stencil/core';
2
- import { DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
1
+ import { Component, h, State } from '@stencil/core';
2
+ import { DataUnit, DataType, UserInterface, ApplicationContext } from '@sankhyalabs/core';
3
+ import { ApplicationUtils } from '../../utils';
3
4
  export class TestDu {
4
- /*private _ezButton// : HTMLEzButton;
5
- private _ezComboBox// : HTMLEzComboBox;
6
- private _ezDateInput// : HTMLEzDateInput;
7
- private _ezDateTimeInput// : HTMLEzDateTimeInput;
8
- private _ezNumberInput// : HTMLEzNumberInput
9
- private _ezSearch// : HTMLEzSearch
10
- private _ezUpload// : HTMLEzUpload
11
- private _ezFilterInput// : HTMLEzFilterInput*/
12
5
  componentWillLoad() {
6
+ ApplicationContext.setContextValue("__EZUI__UPLOAD__ADD__URL__", "http://localhost:8080/mge/ez.uploading");
13
7
  this.dataUnit = new DataUnit("testes_com_formulario");
8
+ this.dataUnit.subscribe(() => this.isDirty = this.dataUnit.isDirty());
14
9
  this.dataUnit.metadata = {
15
10
  name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
16
11
  label: "Parceiro",
17
12
  fields: [
18
13
  {
19
- name: "CODPARC",
20
- label: "Parceiro",
21
- dataType: DataType.NUMBER,
22
- userInterface: UserInterface.SEARCH,
23
- required: true,
24
- properties: {}
25
- },
26
- {
27
- name: "RECDESP",
28
- label: "Receita/Despesa",
29
- dataType: DataType.TEXT,
30
- userInterface: UserInterface.OPTIONSELECTOR,
31
- required: true,
32
- properties: { options: `{"-1": "Despesa", "1": "Receita"}` }
33
- },
34
- {
35
- name: "P",
36
- label: "pera",
37
- dataType: DataType.TEXT,
38
- userInterface: UserInterface.OPTIONSELECTOR,
39
- properties: { options: `{"M": "Madura", "V": "Verde", "P": "Passada"}` }
40
- },
41
- {
42
- name: "ME",
43
- label: "ME",
44
- dataType: DataType.NUMBER,
45
- userInterface: UserInterface.DECIMALNUMBER,
46
- properties: { precision: 4, prettyPrecision: 1 }
14
+ name: "ANEXO",
15
+ label: "Anexo",
16
+ dataType: DataType.OBJECT,
17
+ userInterface: UserInterface.FILE,
18
+ properties: {
19
+ DESTINATION: "MULTIFILE",
20
+ MAX_FILES: "2"
21
+ }
47
22
  }
48
23
  ]
49
24
  };
50
- this.dataUnit.dataLoader = () => new Promise(accept => accept([
51
- {
52
- __record__id__: "1321321321321321",
53
- CODPARC: 10,
54
- NOMEPARC: "Parceiro 10",
55
- P: "M",
56
- L: "Bagaço",
57
- LI: "Azedo"
25
+ this.dataUnit.dataLoader = () => new Promise(accept => accept({
26
+ records: [{
27
+ __record__id__: "1321321321321321",
28
+ CODPARC: 10,
29
+ NOMEPARC: "Parceiro 10",
30
+ P: "M",
31
+ L: "Bagaço",
32
+ LI: "Azedo"
33
+ }],
34
+ limit: 0,
35
+ offset: 2,
36
+ total: 100,
37
+ hasMore: true
38
+ }));
39
+ this.dataUnit.saveLoader = (_dataUnit, changes) => {
40
+ const savedRecords = [];
41
+ changes.forEach(change => {
42
+ savedRecords.push(Object.assign(Object.assign({}, change.record), change.updatingFields));
43
+ });
44
+ return Promise.resolve(savedRecords);
45
+ };
46
+ }
47
+ save() {
48
+ this.dataUnit.saveData().catch(e => {
49
+ if (e.kind === "WAITING_CHANGE_ERROR") {
50
+ ApplicationUtils.alert(`Alterando campo ${e.fieldName}`, e.message);
58
51
  }
59
- ]));
52
+ });
60
53
  }
61
54
  render() {
62
- return (h("ez-form", { dataUnit: this.dataUnit }));
55
+ return (h("div", null,
56
+ h("button", { onClick: () => this.dataUnit.loadData() }, "Carregar"),
57
+ h("button", { onClick: () => this.save(), disabled: !this.isDirty }, "Salvar"),
58
+ h("ez-form", { dataUnit: this.dataUnit })));
63
59
  }
64
60
  static get is() { return "test-du"; }
65
61
  static get originalStyleUrls() { return {
@@ -68,4 +64,7 @@ export class TestDu {
68
64
  static get styleUrls() { return {
69
65
  "$": ["test-du.css"]
70
66
  }; }
67
+ static get states() { return {
68
+ "isDirty": {}
69
+ }; }
71
70
  }