inviton-powerduck 0.0.26 → 0.0.28
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/app/powerduck-initializer.ts +21 -2
- package/app/powerduck-state.ts +4 -0
- package/app/powerduck-system-resources.ts +5 -0
- package/components/chart-js/line-chart-flot.tsx +3 -3
- package/components/chart-js/line-chart.tsx +75 -85
- package/components/chart-js/pie-chart.tsx +28 -22
- package/components/input/numeric-input.tsx +7 -3
- package/package.json +12 -3
|
@@ -5,8 +5,9 @@ import moment from "moment";
|
|
|
5
5
|
import select2 from "select2";
|
|
6
6
|
import { Language } from '../common/enums/language';
|
|
7
7
|
import { LanguageUtils } from '../common/utils/language-utils';
|
|
8
|
+
import { isNullOrEmpty } from '../common/utils/is-null-or-empty';
|
|
8
9
|
|
|
9
|
-
export interface PoweduckInitFrameworkArgs
|
|
10
|
+
export interface PoweduckInitFrameworkArgs {
|
|
10
11
|
supportedLanguages?: Language[]
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -17,6 +18,24 @@ export default class PowerduckInitializer {
|
|
|
17
18
|
window["moment"] = moment;
|
|
18
19
|
window["select2"] = select2();
|
|
19
20
|
|
|
21
|
+
if ((window as any).__viteErrHandlerBound != true) {
|
|
22
|
+
(window as any).__viteErrHandlerBound = true;
|
|
23
|
+
|
|
24
|
+
window.addEventListener('vite:preloadError', (event) => {
|
|
25
|
+
const key = PowerduckState.getAppPrefix() + 'errLastReload';
|
|
26
|
+
const lastTry = Number(localStorage.getItem(key) || "0");
|
|
27
|
+
if (new Date().getTime() - lastTry > 3000) {
|
|
28
|
+
localStorage.setItem(key, new Date().getTime().toString());
|
|
29
|
+
|
|
30
|
+
if ((window as any).__routerNextTo != null && !isNullOrEmpty((window as any).__routerNextTo.path)) {
|
|
31
|
+
location.href = (window as any).__routerNextTo.path;
|
|
32
|
+
} else {
|
|
33
|
+
location.reload();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
20
39
|
if (args != null) {
|
|
21
40
|
if (args.supportedLanguages?.length as number > 0) {
|
|
22
41
|
LanguageUtils.supportedLanguages = args.supportedLanguages as Language[];
|
|
@@ -25,6 +44,6 @@ export default class PowerduckInitializer {
|
|
|
25
44
|
}
|
|
26
45
|
|
|
27
46
|
static initState<TResoures extends IPowerduckSystemResources>(resources: TResoures, args?: PowerduckStateInitArgs) {
|
|
28
|
-
PowerduckState.initialize(resources, args);
|
|
47
|
+
PowerduckState.initialize(resources, args);
|
|
29
48
|
}
|
|
30
49
|
}
|
package/app/powerduck-state.ts
CHANGED
|
@@ -62,6 +62,9 @@ export interface IPowerduckSystemResources {
|
|
|
62
62
|
|
|
63
63
|
errorsOnForm: string;
|
|
64
64
|
validationErrorRequired: string;
|
|
65
|
+
validationErrorNumeric: string;
|
|
66
|
+
validationErrorInteger: string;
|
|
67
|
+
validationErrorDecimal: string;
|
|
65
68
|
validationErrorMinValue: string;
|
|
66
69
|
validationErrorMaxValue: string;
|
|
67
70
|
validationErrorMinLength: string;
|
|
@@ -71,5 +74,7 @@ export interface IPowerduckSystemResources {
|
|
|
71
74
|
validationErrorAlpha: string;
|
|
72
75
|
validationErrorAlphaNum: string;
|
|
73
76
|
validationErrorUrl: string;
|
|
77
|
+
validationErrorIpAddress: string;
|
|
78
|
+
validationErrorMacAddress: string;
|
|
74
79
|
validationErrorGeneric: string;
|
|
75
80
|
}
|
|
@@ -16,8 +16,8 @@ import { PortalUtils } from "../../common/utils/utils";
|
|
|
16
16
|
|
|
17
17
|
import arrowLeftIcon from './img/arrow-left.gif';
|
|
18
18
|
import arrowRightIcon from './img/arrow-right.gif';
|
|
19
|
-
import arrowTopIcon from './img/arrow-
|
|
20
|
-
import arrowBottomIcon from './img/arrow-
|
|
19
|
+
import arrowTopIcon from './img/arrow-up.gif';
|
|
20
|
+
import arrowBottomIcon from './img/arrow-down.gif';
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
@Component
|
|
@@ -58,7 +58,7 @@ class LineChartFlotComponent extends TsxComponent<LineChartArgs> implements Line
|
|
|
58
58
|
|
|
59
59
|
bindFlot() {
|
|
60
60
|
var elem = $(this.$el as HTMLElement);
|
|
61
|
-
var dataParam = this.chartData
|
|
61
|
+
var dataParam = this.chartData?.dataSets;
|
|
62
62
|
var itemData = new Array();
|
|
63
63
|
var performCreation = true;
|
|
64
64
|
var hasData = false;
|
|
@@ -43,7 +43,15 @@ class LineChartComponent extends TsxComponent<LineChartArgs> implements LineChar
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
bindChart() {
|
|
46
|
-
this
|
|
46
|
+
this.$nextTick(() => {
|
|
47
|
+
const canvas = document.getElementById(this._uuid) as HTMLCanvasElement;
|
|
48
|
+
canvas.width = canvas.parentElement.offsetWidth;
|
|
49
|
+
const ctx = canvas.getContext('2d');
|
|
50
|
+
this._chart = new Chart(ctx, this.getChartBindingData());
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getChartBindingData() {
|
|
47
55
|
let data = this.getData();
|
|
48
56
|
let datasets: any[] = [];
|
|
49
57
|
let labels: string[] = [];
|
|
@@ -84,99 +92,81 @@ class LineChartComponent extends TsxComponent<LineChartArgs> implements LineChar
|
|
|
84
92
|
};
|
|
85
93
|
}
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
options: {
|
|
99
|
-
elements: {
|
|
100
|
-
line: {
|
|
101
|
-
tension: 0.2,
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
legend: {
|
|
105
|
-
display: showLegend,
|
|
106
|
-
},
|
|
107
|
-
responsive: true,
|
|
108
|
-
maintainAspectRatio: false,
|
|
109
|
-
title: {
|
|
110
|
-
display: false,
|
|
111
|
-
text: "",
|
|
95
|
+
return {
|
|
96
|
+
type: "line",
|
|
97
|
+
|
|
98
|
+
data: {
|
|
99
|
+
labels: labels,
|
|
100
|
+
datasets: datasets,
|
|
101
|
+
},
|
|
102
|
+
options: {
|
|
103
|
+
elements: {
|
|
104
|
+
line: {
|
|
105
|
+
tension: 0.2,
|
|
112
106
|
},
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
},
|
|
108
|
+
legend: {
|
|
109
|
+
display: showLegend,
|
|
110
|
+
},
|
|
111
|
+
responsive: true,
|
|
112
|
+
maintainAspectRatio: false,
|
|
113
|
+
title: {
|
|
114
|
+
display: false,
|
|
115
|
+
text: "",
|
|
116
|
+
},
|
|
117
|
+
tooltips: {
|
|
118
|
+
mode: "index",
|
|
119
|
+
intersect: false,
|
|
120
|
+
},
|
|
121
|
+
hover: {
|
|
122
|
+
mode: "nearest",
|
|
123
|
+
intersect: true,
|
|
124
|
+
},
|
|
125
|
+
scales: {
|
|
126
|
+
xAxes: [
|
|
127
|
+
{
|
|
128
|
+
display: true,
|
|
129
|
+
scaleLabel: {
|
|
124
130
|
display: true,
|
|
125
|
-
|
|
126
|
-
display: true,
|
|
127
|
-
labelString: "",
|
|
128
|
-
},
|
|
129
|
-
ticks: ticksX,
|
|
131
|
+
labelString: "",
|
|
130
132
|
},
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
133
|
+
ticks: ticksX,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
yAxes: [
|
|
137
|
+
{
|
|
138
|
+
display: true,
|
|
139
|
+
scaleLabel: {
|
|
134
140
|
display: true,
|
|
135
|
-
scaleLabel: {
|
|
136
|
-
display: true,
|
|
137
|
-
},
|
|
138
141
|
},
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
pan: {
|
|
142
|
-
enabled: true,
|
|
143
|
-
mode: "x",
|
|
144
|
-
},
|
|
145
|
-
zoom: {
|
|
146
|
-
enabled: true,
|
|
147
|
-
mode: "x",
|
|
148
|
-
speed: 75.5,
|
|
149
|
-
sensitivity: 0,
|
|
150
|
-
},
|
|
142
|
+
},
|
|
143
|
+
],
|
|
151
144
|
},
|
|
152
|
-
|
|
153
|
-
|
|
145
|
+
pan: {
|
|
146
|
+
enabled: true,
|
|
147
|
+
mode: "x",
|
|
148
|
+
},
|
|
149
|
+
zoom: {
|
|
150
|
+
enabled: true,
|
|
151
|
+
mode: "x",
|
|
152
|
+
speed: 75.5,
|
|
153
|
+
sensitivity: 0,
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
}
|
|
154
157
|
}
|
|
155
158
|
|
|
156
159
|
updateChartInstance() {
|
|
157
|
-
this.
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
//dataset.data = [];
|
|
168
|
-
//dataset.backgroundColor = [];
|
|
169
|
-
|
|
170
|
-
//newData.forEach((dataItem) => {
|
|
171
|
-
// chart.data.labels.push(dataItem.caption);
|
|
172
|
-
// dataset.data.push(dataItem.value);
|
|
173
|
-
//});
|
|
174
|
-
|
|
175
|
-
//this.getColors(newData.length).forEach((color) => {
|
|
176
|
-
// dataset.backgroundColor.push(color);
|
|
177
|
-
//});
|
|
178
|
-
|
|
179
|
-
//chart.update();
|
|
160
|
+
if (this._chart != null) {
|
|
161
|
+
setTimeout(() => {
|
|
162
|
+
const bindingData = this.getChartBindingData();
|
|
163
|
+
this._chart.data.labels = bindingData.data.labels;
|
|
164
|
+
this._chart.data.datasets = bindingData.data.datasets;
|
|
165
|
+
this._chart.update();
|
|
166
|
+
}, 10);
|
|
167
|
+
} else {
|
|
168
|
+
this.bindChart();
|
|
169
|
+
}
|
|
180
170
|
}
|
|
181
171
|
|
|
182
172
|
mounted() {
|
|
@@ -83,29 +83,33 @@ class PieChartComponent extends TsxComponent<PieArgs> implements PieArgs {
|
|
|
83
83
|
let data = this.getData();
|
|
84
84
|
this.destroyChart();
|
|
85
85
|
|
|
86
|
-
this
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
maintainAspectRatio: false,
|
|
101
|
-
animation: {
|
|
102
|
-
animateRotate: false,
|
|
103
|
-
animateScale: false,
|
|
86
|
+
this.$nextTick(() => {
|
|
87
|
+
console.log(this.getCanvasContext() == null);
|
|
88
|
+
|
|
89
|
+
this._chart = new Chart(this.getCanvasContext(), {
|
|
90
|
+
type: this.type || PieChartType.Doughnut,
|
|
91
|
+
data: {
|
|
92
|
+
labels: data.map((p) => p.caption),
|
|
93
|
+
datasets: [
|
|
94
|
+
{
|
|
95
|
+
label: "",
|
|
96
|
+
data: data.map((p) => p.value),
|
|
97
|
+
backgroundColor: this.getColors(data.length),
|
|
98
|
+
},
|
|
99
|
+
],
|
|
104
100
|
},
|
|
105
|
-
|
|
106
|
-
|
|
101
|
+
options: {
|
|
102
|
+
responsive: true,
|
|
103
|
+
maintainAspectRatio: false,
|
|
104
|
+
animation: {
|
|
105
|
+
animateRotate: false,
|
|
106
|
+
animateScale: false,
|
|
107
|
+
},
|
|
108
|
+
legend: {
|
|
109
|
+
display: false,
|
|
110
|
+
},
|
|
107
111
|
},
|
|
108
|
-
}
|
|
112
|
+
});
|
|
109
113
|
});
|
|
110
114
|
});
|
|
111
115
|
}
|
|
@@ -156,7 +160,9 @@ class PieChartComponent extends TsxComponent<PieArgs> implements PieArgs {
|
|
|
156
160
|
}
|
|
157
161
|
|
|
158
162
|
setSize() {
|
|
159
|
-
this.
|
|
163
|
+
if (this.getSize != null) {
|
|
164
|
+
this.size = this.getSize(window.innerWidth);
|
|
165
|
+
}
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
render(h) {
|
|
@@ -91,6 +91,10 @@ class NumericInputComponent extends TsxComponent<NumericInputArgs> implements Nu
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
getValue(): number {
|
|
95
|
+
return this.value ?? 0;
|
|
96
|
+
}
|
|
97
|
+
|
|
94
98
|
getDecimals(): number {
|
|
95
99
|
if (this.step != null) {
|
|
96
100
|
var step: string = String(this.step);
|
|
@@ -104,7 +108,7 @@ class NumericInputComponent extends TsxComponent<NumericInputArgs> implements Nu
|
|
|
104
108
|
render(h) {
|
|
105
109
|
var mode = this.getMode();
|
|
106
110
|
if (mode == NumericInputMode.Clasic) {
|
|
107
|
-
|
|
111
|
+
let inputValue = this.getValue();
|
|
108
112
|
if (this.decimalsAlwaysVisible == true && inputValue != null) {
|
|
109
113
|
inputValue = inputValue.toFixed(this.getDecimals()) as any;
|
|
110
114
|
}
|
|
@@ -167,7 +171,7 @@ class NumericInputComponent extends TsxComponent<NumericInputArgs> implements Nu
|
|
|
167
171
|
min={this.minValue}
|
|
168
172
|
max={this.maxValue}
|
|
169
173
|
step={this.step}
|
|
170
|
-
value={this.
|
|
174
|
+
value={this.getValue()}
|
|
171
175
|
placeholder={this.placeholder}
|
|
172
176
|
onChange={(e) => this.raiseChangeEvent(e)}
|
|
173
177
|
onInput={(e) => this.raiseChangeEvent(e)}
|
|
@@ -189,7 +193,7 @@ class NumericInputComponent extends TsxComponent<NumericInputArgs> implements Nu
|
|
|
189
193
|
}
|
|
190
194
|
|
|
191
195
|
updated() {
|
|
192
|
-
const newValue = this.
|
|
196
|
+
const newValue = this.getValue();
|
|
193
197
|
|
|
194
198
|
$(this.$el)
|
|
195
199
|
.find("input")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inviton-powerduck",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": " vite build && vue-tsc --declaration --emitDeclarationOnly",
|
|
@@ -8,13 +8,19 @@
|
|
|
8
8
|
"type-check": "vue-tsc --noEmit"
|
|
9
9
|
},
|
|
10
10
|
"peerDependencies": {
|
|
11
|
+
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
12
|
+
"@babel/plugin-proposal-decorators": "^7.25.9",
|
|
13
|
+
"@babel/plugin-transform-flow-strip-types": "^7.25.9",
|
|
11
14
|
"@fullcalendar/core": "4.4.0",
|
|
12
15
|
"@fullcalendar/interaction": "4.4.0",
|
|
13
16
|
"@fullcalendar/resource-timegrid": "4.4.0",
|
|
14
17
|
"@fullcalendar/resource-timeline": "4.4.0",
|
|
18
|
+
"@monaco-editor/loader": "^1.4.0",
|
|
19
|
+
"@vitejs/plugin-vue-jsx": "^4.1.0",
|
|
15
20
|
"@vue-leaflet/vue-leaflet": "^0.10.1",
|
|
16
21
|
"@vuelidate/core": "^2.0.3",
|
|
17
22
|
"@vuelidate/validators": "^2.0.4",
|
|
23
|
+
"animate.css": "4.1.1",
|
|
18
24
|
"bootstrap": "5.3.3",
|
|
19
25
|
"bootstrap-datetime-picker": "2.4.4",
|
|
20
26
|
"bootstrap-notify": "3.1.3",
|
|
@@ -26,6 +32,7 @@
|
|
|
26
32
|
"exceljs": "4.4.0",
|
|
27
33
|
"fast-deep-equal": "3.1.3",
|
|
28
34
|
"geojson": "^0.5.0",
|
|
35
|
+
"google-maps": "4.3.3",
|
|
29
36
|
"highlight.js": "11.10.0",
|
|
30
37
|
"jquery": "^3.7.1",
|
|
31
38
|
"jquery-contextmenu": "2.9.2",
|
|
@@ -38,11 +45,13 @@
|
|
|
38
45
|
"moment": "^2.30.1",
|
|
39
46
|
"nprogress": "0.2.0",
|
|
40
47
|
"select2": "4.0.5",
|
|
48
|
+
"simple-line-icons": "2.5.5",
|
|
41
49
|
"sortablejs": "1.15.3",
|
|
50
|
+
"sweetalert2": "11.14.5",
|
|
42
51
|
"swiper": "^11.0.6",
|
|
43
52
|
"trumbowyg": "2.28.0",
|
|
44
53
|
"vue": "3.5.12",
|
|
45
|
-
|
|
54
|
+
"vue-easy-lightbox": "^1.19.0",
|
|
46
55
|
"vue-facing-decorator": "3.0.4",
|
|
47
56
|
"xlsx": "^0.18.5"
|
|
48
57
|
},
|
|
@@ -68,4 +77,4 @@
|
|
|
68
77
|
"components/",
|
|
69
78
|
"data/"
|
|
70
79
|
]
|
|
71
|
-
}
|
|
80
|
+
}
|