@sankhyalabs/ezui 5.21.0-dev.2 → 5.21.0-dev.20
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/README.md +1 -1
- package/dist/cjs/ICustomRender-6fafffce.js +13 -0
- package/dist/cjs/ez-actions-button.cjs.entry.js +1 -0
- package/dist/cjs/ez-alert-list.cjs.entry.js +6 -4
- package/dist/cjs/ez-button.cjs.entry.js +2 -2
- package/dist/cjs/ez-chart.cjs.entry.js +433 -0
- package/dist/cjs/ez-collapsible-box.cjs.entry.js +1 -0
- package/dist/cjs/ez-combo-box.cjs.entry.js +1 -0
- package/dist/cjs/{ez-text-edit.cjs.entry.js → ez-custom-form-input_2.cjs.entry.js} +94 -0
- package/dist/cjs/ez-form-view.cjs.entry.js +33 -3
- package/dist/cjs/ez-form.cjs.entry.js +77 -2
- package/dist/cjs/ez-grid.cjs.entry.js +332 -32
- package/dist/cjs/ez-list.cjs.entry.js +1 -1
- package/dist/cjs/ez-modal-container.cjs.entry.js +15 -4
- package/dist/cjs/ez-modal.cjs.entry.js +7 -8
- package/dist/cjs/ez-number-input.cjs.entry.js +34 -28
- package/dist/cjs/ez-popup.cjs.entry.js +14 -8
- package/dist/cjs/ez-search.cjs.entry.js +6 -2
- package/dist/cjs/ez-split-item.cjs.entry.js +1 -0
- package/dist/cjs/ez-split-panel.cjs.entry.js +1 -1
- package/dist/cjs/ezui.cjs.js +1 -1
- package/dist/cjs/index-a7b0c73d.js +8 -4
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/ez-alert-list/ez-alert-list.js +6 -4
- package/dist/collection/components/ez-button/ez-button.css +7 -0
- package/dist/collection/components/ez-button/ez-button.js +1 -1
- package/dist/collection/components/ez-chart/components/BarChart.js +27 -0
- package/dist/collection/components/ez-chart/components/ColumnChart.js +27 -0
- package/dist/collection/components/ez-chart/components/DonutChart.js +42 -0
- package/dist/collection/components/ez-chart/components/LineChart.js +27 -0
- package/dist/collection/components/ez-chart/components/PieChart.js +45 -0
- package/dist/collection/components/ez-chart/components/index.js +5 -0
- package/dist/collection/components/ez-chart/ez-chart.css +5 -0
- package/dist/collection/components/ez-chart/ez-chart.js +284 -0
- package/dist/collection/components/ez-chart/interfaces/ChartAxis.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartContext.js +14 -0
- package/dist/collection/components/ez-chart/interfaces/ChartOptions.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartSerie.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartStrategies.js +1 -0
- package/dist/collection/components/ez-chart/interfaces/ChartType.js +8 -0
- package/dist/collection/components/ez-chart/interfaces/index.js +5 -0
- package/dist/collection/components/ez-chart/test/mock-chart.js +137 -0
- package/dist/collection/components/ez-chart/types/BaseHighChartsRender.js +146 -0
- package/dist/collection/components/ez-form/ez-form.js +130 -4
- package/dist/collection/components/ez-form-view/custom-input/ez-custom-form-input.js +253 -0
- package/dist/collection/components/ez-form-view/ez-form-view.js +89 -1
- package/dist/collection/components/ez-form-view/fieldbuilder/templates/NumberInput.tpl.js +3 -2
- package/dist/collection/components/ez-grid/controller/ag-grid/AgGridController.js +56 -5
- package/dist/collection/components/ez-grid/controller/ag-grid/DataSource.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/GridEditionManager.js +35 -1
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.js +58 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.js +11 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.js +11 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellEditor.js +6 -3
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/EzCellRender.js +40 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/IUICellRender.js +1 -0
- package/dist/collection/components/ez-grid/controller/ag-grid/editor/templates/NumberInput.tpl.js +3 -2
- package/dist/collection/components/ez-grid/ez-grid.css +1 -0
- package/dist/collection/components/ez-grid/ez-grid.js +233 -11
- package/dist/collection/components/ez-grid/interfaces/ICustomFormatter.js +1 -0
- package/dist/collection/components/ez-grid/interfaces/index.js +1 -0
- package/dist/collection/components/ez-grid/subcomponents/selection-counter.js +3 -11
- package/dist/collection/components/ez-grid/subcomponents/utils/selectionCounterUtils.js +22 -0
- package/dist/collection/components/ez-grid/test/resources/gridDataUnit.js +19 -0
- package/dist/collection/components/ez-list/ez-list.css +6 -2
- package/dist/collection/components/ez-modal/ez-modal.js +22 -9
- package/dist/collection/components/ez-modal-container/ez-modal-container.css +4 -0
- package/dist/collection/components/ez-modal-container/ez-modal-container.js +23 -3
- package/dist/collection/components/ez-number-input/ez-number-input.js +42 -27
- package/dist/collection/components/ez-popup/ez-popup.js +14 -8
- package/dist/collection/components/ez-search/ez-search.js +5 -2
- package/dist/collection/components/ez-split-panel/ez-split-panel.css +1 -0
- package/dist/collection/utils/customEditor/interfaces/ICustomEditor.js +5 -0
- package/dist/collection/utils/customEditor/interfaces/ICustomEditorInfo.js +1 -0
- package/dist/collection/utils/customRender/interfaces/ICustomRender.js +5 -0
- package/dist/collection/utils/customRender/interfaces/ICustomRenderInfo.js +1 -0
- package/dist/collection/utils/form/DataBinder.js +26 -0
- package/dist/collection/utils/form/test/DataBinder.test.js +41 -4
- package/dist/collection/utils/form/test/resources/metadataTest.js +15 -0
- package/dist/collection/utils/index.js +2 -0
- package/dist/custom-elements/index.d.ts +12 -0
- package/dist/custom-elements/index.js +1070 -102
- package/dist/esm/ICustomRender-875b5a40.js +13 -0
- package/dist/esm/ez-actions-button.entry.js +1 -0
- package/dist/esm/ez-alert-list.entry.js +6 -4
- package/dist/esm/ez-button.entry.js +2 -2
- package/dist/esm/ez-chart.entry.js +429 -0
- package/dist/esm/ez-collapsible-box.entry.js +1 -0
- package/dist/esm/ez-combo-box.entry.js +1 -0
- package/dist/esm/{ez-text-edit.entry.js → ez-custom-form-input_2.entry.js} +96 -3
- package/dist/esm/ez-form-view.entry.js +33 -3
- package/dist/esm/ez-form.entry.js +78 -3
- package/dist/esm/ez-grid.entry.js +332 -32
- package/dist/esm/ez-list.entry.js +1 -1
- package/dist/esm/ez-modal-container.entry.js +16 -5
- package/dist/esm/ez-modal.entry.js +9 -10
- package/dist/esm/ez-number-input.entry.js +34 -28
- package/dist/esm/ez-popup.entry.js +15 -9
- package/dist/esm/ez-search.entry.js +6 -2
- package/dist/esm/ez-split-item.entry.js +1 -0
- package/dist/esm/ez-split-panel.entry.js +1 -1
- package/dist/esm/ezui.js +1 -1
- package/dist/esm/index-baa5e267.js +8 -4
- package/dist/esm/loader.js +1 -1
- package/dist/ezui/ezui.esm.js +1 -1
- package/dist/ezui/{p-b44741b0.entry.js → p-065e735d.entry.js} +2 -2
- package/dist/ezui/p-09de35a2.entry.js +1 -0
- package/dist/ezui/{p-af2ecb1b.entry.js → p-1285c902.entry.js} +1 -1
- package/dist/ezui/p-13d2fe2d.entry.js +1 -0
- package/dist/ezui/p-1a35324b.entry.js +1 -0
- package/dist/ezui/p-1ee2479b.entry.js +1 -0
- package/dist/ezui/p-30775e7f.entry.js +1 -0
- package/dist/ezui/p-3b56d2ef.entry.js +1 -0
- package/dist/ezui/p-4607fb89.js +1 -0
- package/dist/ezui/{p-8defa6d3.entry.js → p-786559c5.entry.js} +1 -1
- package/dist/ezui/p-7922142b.entry.js +1 -0
- package/dist/ezui/p-84e439b9.entry.js +1 -0
- package/dist/ezui/p-922ac38b.entry.js +1 -0
- package/dist/ezui/p-93a19a8c.entry.js +1 -0
- package/dist/ezui/p-bcb53f27.entry.js +1 -0
- package/dist/ezui/p-c942e4a7.entry.js +1 -0
- package/dist/ezui/p-d9401ea0.entry.js +1 -0
- package/dist/ezui/p-f3c526cc.entry.js +1 -0
- package/dist/ezui/p-ffef392d.entry.js +1 -0
- package/dist/types/components/ez-alert-list/ez-alert-list.d.ts +2 -2
- package/dist/types/components/ez-chart/components/BarChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/ColumnChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/DonutChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/LineChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/PieChart.d.ts +9 -0
- package/dist/types/components/ez-chart/components/index.d.ts +5 -0
- package/dist/types/components/ez-chart/ez-chart.d.ts +58 -0
- package/dist/types/components/ez-chart/interfaces/ChartAxis.d.ts +7 -0
- package/dist/types/components/ez-chart/interfaces/ChartContext.d.ts +11 -0
- package/dist/types/components/ez-chart/interfaces/ChartOptions.d.ts +10 -0
- package/dist/types/components/ez-chart/interfaces/ChartSerie.d.ts +20 -0
- package/dist/types/components/ez-chart/interfaces/ChartStrategies.d.ts +7 -0
- package/dist/types/components/ez-chart/interfaces/ChartType.d.ts +7 -0
- package/dist/types/components/ez-chart/interfaces/index.d.ts +5 -0
- package/dist/types/components/ez-chart/types/BaseHighChartsRender.d.ts +15 -0
- package/dist/types/components/ez-form/ez-form.d.ts +20 -1
- package/dist/types/components/ez-form-view/custom-input/ez-custom-form-input.d.ts +43 -0
- package/dist/types/components/ez-form-view/ez-form-view.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/EzGridController.d.ts +30 -0
- package/dist/types/components/ez-grid/controller/ag-grid/AgGridController.d.ts +13 -0
- package/dist/types/components/ez-grid/controller/ag-grid/GridEditionManager.d.ts +7 -1
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellEditor.d.ts +19 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/EzGridCustomCellRender.d.ts +14 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellEditorConstants.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/components/test/constants/EzGridCustomCellRenderConstants.d.ts +11 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellEditor.d.ts +3 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/EzCellRender.d.ts +15 -0
- package/dist/types/components/ez-grid/controller/ag-grid/editor/IUICellRender.d.ts +10 -0
- package/dist/types/components/ez-grid/ez-grid.d.ts +34 -1
- package/dist/types/components/ez-grid/interfaces/ICustomFormatter.d.ts +5 -0
- package/dist/types/components/ez-grid/interfaces/index.d.ts +1 -0
- package/dist/types/components/ez-grid/subcomponents/utils/selectionCounterUtils.d.ts +4 -0
- package/dist/types/components/ez-grid/test/resources/gridDataUnit.d.ts +2 -0
- package/dist/types/components/ez-modal/ez-modal.d.ts +9 -1
- package/dist/types/components/ez-modal-container/ez-modal-container.d.ts +3 -0
- package/dist/types/components/ez-number-input/ez-number-input.d.ts +3 -0
- package/dist/types/components/ez-popup/ez-popup.d.ts +3 -3
- package/dist/types/components.d.ts +223 -4
- package/dist/types/utils/customEditor/interfaces/ICustomEditor.d.ts +29 -0
- package/dist/types/utils/customEditor/interfaces/ICustomEditorInfo.d.ts +5 -0
- package/dist/types/utils/customRender/interfaces/ICustomRender.d.ts +29 -0
- package/dist/types/utils/customRender/interfaces/ICustomRenderInfo.d.ts +5 -0
- package/dist/types/utils/form/DataBinder.d.ts +3 -0
- package/dist/types/utils/form/test/resources/metadataTest.d.ts +2 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/package.json +2 -1
- package/react/components.d.ts +2 -0
- package/react/components.js +2 -0
- package/react/components.js.map +1 -1
- package/dist/ezui/p-0447d17c.entry.js +0 -1
- package/dist/ezui/p-20ec22c0.entry.js +0 -1
- package/dist/ezui/p-2a1a0e04.entry.js +0 -1
- package/dist/ezui/p-5e1d036e.entry.js +0 -1
- package/dist/ezui/p-5ef056ce.entry.js +0 -1
- package/dist/ezui/p-637f69f2.entry.js +0 -1
- package/dist/ezui/p-701231f0.entry.js +0 -1
- package/dist/ezui/p-99ead599.entry.js +0 -1
- package/dist/ezui/p-9aefaa52.entry.js +0 -1
- package/dist/ezui/p-a1ec32ef.entry.js +0 -1
- package/dist/ezui/p-b041333c.entry.js +0 -1
- package/dist/ezui/p-b567fa8c.entry.js +0 -1
- package/dist/ezui/p-bae3d0aa.entry.js +0 -1
- package/dist/ezui/p-db77a984.entry.js +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export const mockChartProp = {
|
|
2
|
+
chartTitle: "Titulo do gráfico",
|
|
3
|
+
chartSubTitle: "Sub-titulo do gráfico",
|
|
4
|
+
series: [{
|
|
5
|
+
name: 'Qtd. Vendas',
|
|
6
|
+
data: [23, 20, 22, 26, 24, 28],
|
|
7
|
+
yAxis: 1,
|
|
8
|
+
showDataLabel: true,
|
|
9
|
+
}, {
|
|
10
|
+
name: 'Vlr. Vendas',
|
|
11
|
+
data: [25600, 21600, 24500, 26890, 20560, 22508],
|
|
12
|
+
yAxis: 0,
|
|
13
|
+
toolTipFormatter: jest.fn(),
|
|
14
|
+
}],
|
|
15
|
+
yAxis: [{
|
|
16
|
+
text: 'Valor das vendas no semestre',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
text: 'Quantidade de itens vendidos',
|
|
20
|
+
invertedPosition: true,
|
|
21
|
+
}],
|
|
22
|
+
xAxis: {
|
|
23
|
+
text: 'Defina uma descrição para o eixo',
|
|
24
|
+
formatter: jest.fn(),
|
|
25
|
+
color: '#008561',
|
|
26
|
+
categories: ['Jan', 'Feb', 'Mar', 'Abr', 'Mai', 'Jun']
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const expectChart = {
|
|
31
|
+
title: { text: "Titulo do gráfico" },
|
|
32
|
+
subtitle: { text: "Sub-titulo do gráfico" },
|
|
33
|
+
tooltip: { formatter: function () { return jest.fn(); } },
|
|
34
|
+
yAxis: [
|
|
35
|
+
{
|
|
36
|
+
title: { text: "Valor das vendas no semestre" }
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: { text: "Quantidade de itens vendidos" },
|
|
40
|
+
opposite: true,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
xAxis: {
|
|
44
|
+
categories: ["Jan", "Feb", "Mar", "Abr", "Mai", "Jun"],
|
|
45
|
+
title: {
|
|
46
|
+
text: "Defina uma descrição para o eixo",
|
|
47
|
+
style: { color: "#008561" }
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
series: [{
|
|
51
|
+
name: "Qtd. Vendas",
|
|
52
|
+
data: [23, 20, 22, 26, 24, 28],
|
|
53
|
+
dataLabels: { enabled: true },
|
|
54
|
+
yAxis: 1,
|
|
55
|
+
}, {
|
|
56
|
+
name: "Vlr. Vendas",
|
|
57
|
+
data: [25600, 21600, 24500, 26890, 20560, 22508],
|
|
58
|
+
yAxis: 0,
|
|
59
|
+
}],
|
|
60
|
+
rules: [
|
|
61
|
+
{
|
|
62
|
+
condition: { maxWidth: 500 },
|
|
63
|
+
chartOptions: {
|
|
64
|
+
legend: { enabled: false },
|
|
65
|
+
xAxis: {
|
|
66
|
+
labels: { enabled: false },
|
|
67
|
+
gridLineWidth: 0,
|
|
68
|
+
},
|
|
69
|
+
yAxis: {
|
|
70
|
+
labels: { enabled: false },
|
|
71
|
+
gridLineWidth: 0,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
condition: { maxWidth: 600 },
|
|
77
|
+
chartOptions: {
|
|
78
|
+
xAxis: {
|
|
79
|
+
labels: {
|
|
80
|
+
style: { fontSize: "10px" },
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
yAxis: {
|
|
84
|
+
labels: {
|
|
85
|
+
style: { fontSize: "10px" },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
title: {
|
|
89
|
+
style: { fontSize: "14px" },
|
|
90
|
+
},
|
|
91
|
+
subtitle: {
|
|
92
|
+
style: { fontSize: "12px" },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
condition: { maxWidth: 400 },
|
|
98
|
+
chartOptions: {
|
|
99
|
+
chart: { margin: [10, 10, 15, 10] },
|
|
100
|
+
subtitle: { text: null },
|
|
101
|
+
title: { text: null },
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
credits: { enabled: false },
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
export const mockChartPieProp = {
|
|
110
|
+
chartTitle: "Titulo do gráfico",
|
|
111
|
+
chartSubTitle: "Sub-titulo do gráfico",
|
|
112
|
+
series: {
|
|
113
|
+
name: 'venda',
|
|
114
|
+
data: [
|
|
115
|
+
{ name: 'Chrome', y: 74.03 },
|
|
116
|
+
{ name: 'Edge', y: 12.66 },
|
|
117
|
+
{ name: 'Firefox', y: 4 },
|
|
118
|
+
{ name: 'Internet Explorer', y: 2 },
|
|
119
|
+
{ name: 'Other', y: 3 }
|
|
120
|
+
],
|
|
121
|
+
showDataLabel: true,
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export const expectPieChart = {
|
|
126
|
+
series: [{
|
|
127
|
+
name: "venda",
|
|
128
|
+
data: [
|
|
129
|
+
{ name: 'Chrome', y: 74.03 },
|
|
130
|
+
{ name: 'Edge', y: 12.66 },
|
|
131
|
+
{ name: 'Firefox', y: 4 },
|
|
132
|
+
{ name: 'Internet Explorer', y: 2 },
|
|
133
|
+
{ name: 'Other', y: 3 }
|
|
134
|
+
],
|
|
135
|
+
dataLabels: { enabled: true },
|
|
136
|
+
}],
|
|
137
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export class BaseHighChartsRender {
|
|
2
|
+
parseSerie(series) {
|
|
3
|
+
if (Array.isArray(series)) {
|
|
4
|
+
const seriesOptions = series.map(serie => this.chartSerieToSeriesOptions(serie));
|
|
5
|
+
return seriesOptions;
|
|
6
|
+
}
|
|
7
|
+
const seriesOptions = this.chartSerieToSeriesOptions(series);
|
|
8
|
+
return [seriesOptions];
|
|
9
|
+
}
|
|
10
|
+
parseAxis(axis) {
|
|
11
|
+
if (Array.isArray(axis)) {
|
|
12
|
+
const axisOptions = axis.map(value => this.chartAxisToAxisOptions(value));
|
|
13
|
+
return axisOptions;
|
|
14
|
+
}
|
|
15
|
+
const axisOptions = this.chartAxisToAxisOptions(axis);
|
|
16
|
+
return axisOptions;
|
|
17
|
+
}
|
|
18
|
+
parseTitle(title) {
|
|
19
|
+
return {
|
|
20
|
+
text: title,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
parseSubTitle(subTtile) {
|
|
24
|
+
return {
|
|
25
|
+
text: subTtile,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
buildFormatterTooltip(series) {
|
|
29
|
+
const seriesArray = Array.isArray(series) ? series : [series];
|
|
30
|
+
return {
|
|
31
|
+
formatter: function (tooltip) {
|
|
32
|
+
const indexSerie = seriesArray.findIndex(serie => serie.name === this.series.name && serie.toolTipFormatter);
|
|
33
|
+
if (indexSerie !== -1) {
|
|
34
|
+
return seriesArray[indexSerie].toolTipFormatter(this.series.name, this.x, this.y, this.point.name, this.point.percentage);
|
|
35
|
+
}
|
|
36
|
+
return tooltip.defaultFormatter.call(this, tooltip);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
buildOnClickCallBack(evt) {
|
|
41
|
+
return function (_e) {
|
|
42
|
+
evt.emit({
|
|
43
|
+
name: this.series.name,
|
|
44
|
+
data: this.series.data,
|
|
45
|
+
type: this.series.type,
|
|
46
|
+
yAxis: this.x,
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
buildResposiveConfig() {
|
|
51
|
+
return {
|
|
52
|
+
rules: [
|
|
53
|
+
{
|
|
54
|
+
condition: {
|
|
55
|
+
maxWidth: 500
|
|
56
|
+
},
|
|
57
|
+
chartOptions: {
|
|
58
|
+
legend: {
|
|
59
|
+
enabled: false
|
|
60
|
+
},
|
|
61
|
+
xAxis: {
|
|
62
|
+
labels: {
|
|
63
|
+
enabled: false
|
|
64
|
+
},
|
|
65
|
+
gridLineWidth: 0
|
|
66
|
+
},
|
|
67
|
+
yAxis: {
|
|
68
|
+
labels: {
|
|
69
|
+
enabled: false
|
|
70
|
+
},
|
|
71
|
+
gridLineWidth: 0
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
condition: {
|
|
77
|
+
maxWidth: 600
|
|
78
|
+
},
|
|
79
|
+
chartOptions: {
|
|
80
|
+
xAxis: {
|
|
81
|
+
labels: {
|
|
82
|
+
style: {
|
|
83
|
+
fontSize: '10px'
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
yAxis: {
|
|
88
|
+
labels: {
|
|
89
|
+
style: {
|
|
90
|
+
fontSize: '10px'
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
title: {
|
|
95
|
+
style: {
|
|
96
|
+
fontSize: '14px'
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
subtitle: {
|
|
100
|
+
style: {
|
|
101
|
+
fontSize: '12px'
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
condition: {
|
|
108
|
+
maxWidth: 400
|
|
109
|
+
},
|
|
110
|
+
chartOptions: {
|
|
111
|
+
chart: {
|
|
112
|
+
margin: [10, 10, 15, 10],
|
|
113
|
+
},
|
|
114
|
+
subtitle: {
|
|
115
|
+
text: null
|
|
116
|
+
},
|
|
117
|
+
title: {
|
|
118
|
+
text: null
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
buildDefaultChartOptions() {
|
|
126
|
+
return {
|
|
127
|
+
credits: {
|
|
128
|
+
enabled: false
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
chartSerieToSeriesOptions(serie) {
|
|
133
|
+
const { name, data, color, showDataLabel, type, yAxis } = serie;
|
|
134
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (name && { name })), (type && { type })), (data && { data })), (color && { color })), (showDataLabel && { dataLabels: { enabled: showDataLabel } })), (yAxis !== undefined && { yAxis }));
|
|
135
|
+
}
|
|
136
|
+
chartAxisToAxisOptions(axis) {
|
|
137
|
+
const { categories, color, text, invertedPosition, formatter } = axis;
|
|
138
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, (categories && { categories })), (text && {
|
|
139
|
+
title: Object.assign({ text }, (color && { style: { color } }))
|
|
140
|
+
})), (formatter && {
|
|
141
|
+
labels: {
|
|
142
|
+
formatter: function () { return formatter(this.value); },
|
|
143
|
+
}
|
|
144
|
+
})), (invertedPosition && { opposite: invertedPosition }));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { Action, DataUnit, ElementIDUtils, StringUtils } from "@sankhyalabs/core";
|
|
2
2
|
import { Host, forceUpdate, h } from "@stencil/core";
|
|
3
3
|
import { createStore } from "redux";
|
|
4
|
-
import { changeTab, formReducer, loadMetadata, selectCurrentSheet, selectFormMetadata } from "./store/form.slice";
|
|
5
|
-
import { buildFormMetadata } from "../../utils/form/FormMetadata";
|
|
6
4
|
import DataBinder from "../../utils/form/DataBinder";
|
|
5
|
+
import { buildFormMetadata } from "../../utils/form/FormMetadata";
|
|
6
|
+
import { changeTab, formReducer, loadMetadata, selectCurrentSheet, selectFormMetadata } from "./store/form.slice";
|
|
7
7
|
export class EzForm {
|
|
8
8
|
constructor() {
|
|
9
|
+
this._customEditors = new Map();
|
|
9
10
|
this.onDataUnitAction = (action) => {
|
|
10
11
|
if (action.type === Action.METADATA_LOADED) {
|
|
11
12
|
this.processMetadata();
|
|
12
13
|
}
|
|
13
14
|
};
|
|
15
|
+
this._fieldsProps = new Map();
|
|
14
16
|
this.dataUnit = undefined;
|
|
15
17
|
this.config = undefined;
|
|
16
18
|
this.recordsValidator = undefined;
|
|
17
19
|
this.fieldToFocus = undefined;
|
|
20
|
+
this.onlyStaticFields = false;
|
|
18
21
|
}
|
|
19
22
|
/**
|
|
20
23
|
* Realiza validação no conteúdo de todos os campos.
|
|
@@ -22,9 +25,30 @@ export class EzForm {
|
|
|
22
25
|
validate() {
|
|
23
26
|
return this._dataBinder.validate();
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Registra um editor customizado para campos da grade e formulário.
|
|
30
|
+
*/
|
|
31
|
+
async addCustomEditor(fieldName, customEditor, detailContext) {
|
|
32
|
+
if (this._formView) {
|
|
33
|
+
this._formView.addCustomEditor(fieldName, customEditor, detailContext);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const newCustomEditors = new Map(this._customEditors);
|
|
37
|
+
newCustomEditors.set(fieldName, { customEditor, detailContext });
|
|
38
|
+
this._customEditors = newCustomEditors;
|
|
39
|
+
}
|
|
25
40
|
observeConfig() {
|
|
26
41
|
this.processMetadata();
|
|
27
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Altera/adiciona uma propriedade nos metadados do campo.
|
|
45
|
+
*/
|
|
46
|
+
async setFieldProp(fieldName, propName, value) {
|
|
47
|
+
const newCustomFieldProps = new Map(this._fieldsProps);
|
|
48
|
+
const currentProps = this._fieldsProps.get(fieldName);
|
|
49
|
+
newCustomFieldProps.set(fieldName, Object.assign(Object.assign({}, currentProps), { [propName]: value }));
|
|
50
|
+
this._fieldsProps = newCustomFieldProps;
|
|
51
|
+
}
|
|
28
52
|
getDynamicContent() {
|
|
29
53
|
var _a;
|
|
30
54
|
const formMD = selectFormMetadata(this._store.getState());
|
|
@@ -51,10 +75,10 @@ export class EzForm {
|
|
|
51
75
|
}
|
|
52
76
|
this.ezFormSetFields.emit(fields);
|
|
53
77
|
const idFormSheet = `${StringUtils.replaceAccentuatedChars(StringUtils.toCamelCase(currentSheet === null || currentSheet === void 0 ? void 0 : currentSheet.label), false)}_selectorContainer`;
|
|
54
|
-
return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { class: "ez-row ez-padding-vertical--small", fields: fields })));
|
|
78
|
+
return (h("div", { class: "dynamic-content", "data-element-id": idFormSheet }, h("ez-form-view", { ref: (element) => (this._formView = element), class: "ez-row ez-padding-vertical--small", fields: fields })));
|
|
55
79
|
}
|
|
56
80
|
processMetadata() {
|
|
57
|
-
if (
|
|
81
|
+
if (this.bindFields() && this.dataUnit && this._store) {
|
|
58
82
|
const metadata = buildFormMetadata(this.config, this.dataUnit);
|
|
59
83
|
this._store.dispatch(loadMetadata(metadata));
|
|
60
84
|
}
|
|
@@ -63,6 +87,9 @@ export class EzForm {
|
|
|
63
87
|
var _a;
|
|
64
88
|
return ((_a = this._staticFields) === null || _a === void 0 ? void 0 : _a.length) > 0;
|
|
65
89
|
}
|
|
90
|
+
bindFields() {
|
|
91
|
+
return !this.isStatic() || this.onlyStaticFields === false;
|
|
92
|
+
}
|
|
66
93
|
componentWillLoad() {
|
|
67
94
|
if (this.dataUnit === undefined) {
|
|
68
95
|
this.dataUnit = new DataUnit("ez-form");
|
|
@@ -82,6 +109,17 @@ export class EzForm {
|
|
|
82
109
|
this._dataBinder.bind(Array.from(this._element.querySelectorAll("[data-field-name]")), this.dataUnit.dataUnitId, metadata, this.recordsValidator);
|
|
83
110
|
this.ezReady.emit();
|
|
84
111
|
this.handleFieldToFocus();
|
|
112
|
+
this.setCustomEditors();
|
|
113
|
+
this.setFieldsProps();
|
|
114
|
+
}
|
|
115
|
+
setCustomEditors() {
|
|
116
|
+
if (!this._formView) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
for (const [fieldName, customEditorProps] of this._customEditors) {
|
|
120
|
+
this._formView.addCustomEditor(fieldName, customEditorProps.customEditor, customEditorProps.detailContext);
|
|
121
|
+
this._customEditors.delete(fieldName);
|
|
122
|
+
}
|
|
85
123
|
}
|
|
86
124
|
handleFieldToFocus() {
|
|
87
125
|
var _a;
|
|
@@ -98,6 +136,17 @@ export class EzForm {
|
|
|
98
136
|
this.ezFormRequestClearFieldToFocus.emit();
|
|
99
137
|
});
|
|
100
138
|
}
|
|
139
|
+
setFieldsProps() {
|
|
140
|
+
if (!this._formView) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
for (const [fieldName, props] of this._fieldsProps) {
|
|
144
|
+
for (const prop in props) {
|
|
145
|
+
this._formView.setFieldProp(fieldName, prop, props[prop]);
|
|
146
|
+
}
|
|
147
|
+
this._fieldsProps.delete(fieldName);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
101
150
|
disconnectedCallback() {
|
|
102
151
|
this.dataUnit.unsubscribe(this.onDataUnitAction);
|
|
103
152
|
this._dataBinder.onDisconnectedCallback();
|
|
@@ -201,9 +250,32 @@ export class EzForm {
|
|
|
201
250
|
},
|
|
202
251
|
"attribute": "field-to-focus",
|
|
203
252
|
"reflect": false
|
|
253
|
+
},
|
|
254
|
+
"onlyStaticFields": {
|
|
255
|
+
"type": "boolean",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "boolean",
|
|
259
|
+
"resolved": "boolean",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Define se os campos que ser\u00E3o apresentados s\u00E3o todos est\u00E1ticos. Quando verdadeira, ocorrer\u00E1 no DataBinder o bind dos campos com o DataUnit."
|
|
267
|
+
},
|
|
268
|
+
"attribute": "only-static-fields",
|
|
269
|
+
"reflect": false,
|
|
270
|
+
"defaultValue": "false"
|
|
204
271
|
}
|
|
205
272
|
};
|
|
206
273
|
}
|
|
274
|
+
static get states() {
|
|
275
|
+
return {
|
|
276
|
+
"_fieldsProps": {}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
207
279
|
static get events() {
|
|
208
280
|
return [{
|
|
209
281
|
"method": "ezFormRequestClearFieldToFocus",
|
|
@@ -297,6 +369,60 @@ export class EzForm {
|
|
|
297
369
|
"text": "Realiza valida\u00E7\u00E3o no conte\u00FAdo de todos os campos.",
|
|
298
370
|
"tags": []
|
|
299
371
|
}
|
|
372
|
+
},
|
|
373
|
+
"addCustomEditor": {
|
|
374
|
+
"complexType": {
|
|
375
|
+
"signature": "(fieldName: string, customEditor: ICustomEditor, detailContext?: string) => Promise<void>",
|
|
376
|
+
"parameters": [{
|
|
377
|
+
"tags": [],
|
|
378
|
+
"text": ""
|
|
379
|
+
}, {
|
|
380
|
+
"tags": [],
|
|
381
|
+
"text": ""
|
|
382
|
+
}, {
|
|
383
|
+
"tags": [],
|
|
384
|
+
"text": ""
|
|
385
|
+
}],
|
|
386
|
+
"references": {
|
|
387
|
+
"Promise": {
|
|
388
|
+
"location": "global"
|
|
389
|
+
},
|
|
390
|
+
"ICustomEditor": {
|
|
391
|
+
"location": "import",
|
|
392
|
+
"path": "../../utils/customEditor/interfaces/ICustomEditor"
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"return": "Promise<void>"
|
|
396
|
+
},
|
|
397
|
+
"docs": {
|
|
398
|
+
"text": "Registra um editor customizado para campos da grade e formul\u00E1rio.",
|
|
399
|
+
"tags": []
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
"setFieldProp": {
|
|
403
|
+
"complexType": {
|
|
404
|
+
"signature": "(fieldName: string, propName: string, value: any) => Promise<void>",
|
|
405
|
+
"parameters": [{
|
|
406
|
+
"tags": [],
|
|
407
|
+
"text": ""
|
|
408
|
+
}, {
|
|
409
|
+
"tags": [],
|
|
410
|
+
"text": ""
|
|
411
|
+
}, {
|
|
412
|
+
"tags": [],
|
|
413
|
+
"text": ""
|
|
414
|
+
}],
|
|
415
|
+
"references": {
|
|
416
|
+
"Promise": {
|
|
417
|
+
"location": "global"
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"return": "Promise<void>"
|
|
421
|
+
},
|
|
422
|
+
"docs": {
|
|
423
|
+
"text": "Altera/adiciona uma propriedade nos metadados do campo.",
|
|
424
|
+
"tags": []
|
|
425
|
+
}
|
|
300
426
|
}
|
|
301
427
|
};
|
|
302
428
|
}
|