zek 14.2.49 → 14.2.50
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/esm2020/lib/modules/progress/progress.mjs +14 -32
- package/esm2020/lib/utils/convert.mjs +9 -6
- package/esm2020/lib/utils/math-helper.mjs +1 -1
- package/esm2020/lib/utils/object-helper.mjs +1 -4
- package/fesm2015/zek.mjs +20 -38
- package/fesm2015/zek.mjs.map +1 -1
- package/fesm2020/zek.mjs +20 -38
- package/fesm2020/zek.mjs.map +1 -1
- package/lib/modules/progress/progress.d.ts +11 -14
- package/lib/utils/convert.d.ts +2 -1
- package/lib/utils/object-helper.d.ts +0 -1
- package/package.json +1 -1
package/fesm2020/zek.mjs
CHANGED
|
@@ -335,11 +335,14 @@ class Convert {
|
|
|
335
335
|
}
|
|
336
336
|
return false;
|
|
337
337
|
}
|
|
338
|
-
static toNumber(value) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
338
|
+
static toNumber(value, defaultValue = 0) {
|
|
339
|
+
return this.isNumber(value) ? Number(value) : defaultValue;
|
|
340
|
+
}
|
|
341
|
+
static isNumber(value) {
|
|
342
|
+
// parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,
|
|
343
|
+
// and other non-number values as NaN, where Number just uses 0) but it considers the string
|
|
344
|
+
// '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.
|
|
345
|
+
return !isNaN(parseFloat(value)) && !isNaN(Number(value));
|
|
343
346
|
}
|
|
344
347
|
}
|
|
345
348
|
|
|
@@ -788,9 +791,6 @@ class ObjectHelper {
|
|
|
788
791
|
}
|
|
789
792
|
}
|
|
790
793
|
;
|
|
791
|
-
static isBoolean(val) {
|
|
792
|
-
return val === false || val === true;
|
|
793
|
-
}
|
|
794
794
|
static deepCopy(value) {
|
|
795
795
|
if (!this.isObject(value))
|
|
796
796
|
return value;
|
|
@@ -4854,39 +4854,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImpor
|
|
|
4854
4854
|
}]
|
|
4855
4855
|
}] });
|
|
4856
4856
|
|
|
4857
|
-
function
|
|
4858
|
-
|
|
4859
|
-
if (n > 100) {
|
|
4860
|
-
return 100;
|
|
4861
|
-
}
|
|
4862
|
-
else if (n < 0) {
|
|
4863
|
-
return 0;
|
|
4864
|
-
}
|
|
4865
|
-
return n;
|
|
4857
|
+
function clamp(v, min = 0, max = 100) {
|
|
4858
|
+
return Math.max(min, Math.min(max, v));
|
|
4866
4859
|
}
|
|
4867
4860
|
class ZekProgress {
|
|
4868
4861
|
constructor() {
|
|
4869
|
-
this._max = 100;
|
|
4870
4862
|
this._value = 0;
|
|
4871
|
-
this._normalizedValue = 0;
|
|
4872
4863
|
this._showValue = false;
|
|
4873
4864
|
this._striped = false;
|
|
4874
4865
|
this._animated = false;
|
|
4875
4866
|
this._label = null;
|
|
4876
4867
|
this._height = null;
|
|
4877
|
-
|
|
4878
|
-
get max() {
|
|
4879
|
-
return this._max;
|
|
4880
|
-
}
|
|
4881
|
-
set max(v) {
|
|
4882
|
-
this._max = toPercent(v);
|
|
4868
|
+
this._background = 'primary';
|
|
4883
4869
|
}
|
|
4884
4870
|
get value() {
|
|
4885
4871
|
return this._value;
|
|
4886
4872
|
}
|
|
4887
4873
|
set value(v) {
|
|
4888
|
-
this._value = Convert.toNumber(v);
|
|
4889
|
-
this._normalizedValue = toPercent(this._value);
|
|
4874
|
+
this._value = clamp(Convert.toNumber(v) || 0);
|
|
4890
4875
|
}
|
|
4891
4876
|
get showValue() {
|
|
4892
4877
|
return this._showValue;
|
|
@@ -4910,19 +4895,14 @@ class ZekProgress {
|
|
|
4910
4895
|
return this._label;
|
|
4911
4896
|
}
|
|
4912
4897
|
set label(v) {
|
|
4913
|
-
|
|
4914
|
-
this._label = v;
|
|
4898
|
+
this._label = v ? v : null;
|
|
4915
4899
|
}
|
|
4916
4900
|
get height() {
|
|
4917
4901
|
return this._height;
|
|
4918
4902
|
}
|
|
4919
4903
|
set height(v) {
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
}
|
|
4923
|
-
else {
|
|
4924
|
-
this._height = null;
|
|
4925
|
-
}
|
|
4904
|
+
let tmp = Convert.toNumber(v) || 0;
|
|
4905
|
+
this._height = tmp > 0 ? tmp : null;
|
|
4926
4906
|
}
|
|
4927
4907
|
get background() {
|
|
4928
4908
|
return this._background;
|
|
@@ -4932,11 +4912,13 @@ class ZekProgress {
|
|
|
4932
4912
|
}
|
|
4933
4913
|
}
|
|
4934
4914
|
ZekProgress.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ZekProgress, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4935
|
-
ZekProgress.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ZekProgress, selector: "zek-progress", inputs: {
|
|
4915
|
+
ZekProgress.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.0", type: ZekProgress, selector: "zek-progress", inputs: { value: "value", showValue: "showValue", striped: "striped", animated: "animated", label: "label", height: "height", background: "background" }, ngImport: i0, template: "<div class=\"progress\">\r\n <div class=\"progress-bar\" role=\"progressbar\"\r\n [class.progress-bar-striped]=\"striped || animated\"\r\n [class.progress-bar-animated]=\"animated\"\r\n [style.height.px]=\"height\"\r\n [style.width.%]=\"value\"\r\n [attr.aria-valuenow]=\"value\"\r\n aria-valuemin=\"0\"\r\n aria-valuemax=\"100\">\r\n <ng-container *ngIf=\"showValue\">{{value}}%</ng-container>\r\n {{label}}\r\n </div>\r\n</div>", styles: [":host{display:block}\n"], dependencies: [{ kind: "directive", type: i1$3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
4936
4916
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.0", ngImport: i0, type: ZekProgress, decorators: [{
|
|
4937
4917
|
type: Component,
|
|
4938
|
-
args: [{ selector: 'zek-progress', template: "<div class=\"progress\">\r\n <div class=\"progress-bar\" role=\"progressbar\"\r\n [class.progress-bar-striped]=\"striped || animated\"\r\n [class.progress-bar-animated]=\"animated\"\r\n [style.height.px]=\"height\"\r\n [style.width.%]=\"
|
|
4939
|
-
}], propDecorators: {
|
|
4918
|
+
args: [{ selector: 'zek-progress', template: "<div class=\"progress\">\r\n <div class=\"progress-bar\" role=\"progressbar\"\r\n [class.progress-bar-striped]=\"striped || animated\"\r\n [class.progress-bar-animated]=\"animated\"\r\n [style.height.px]=\"height\"\r\n [style.width.%]=\"value\"\r\n [attr.aria-valuenow]=\"value\"\r\n aria-valuemin=\"0\"\r\n aria-valuemax=\"100\">\r\n <ng-container *ngIf=\"showValue\">{{value}}%</ng-container>\r\n {{label}}\r\n </div>\r\n</div>", styles: [":host{display:block}\n"] }]
|
|
4919
|
+
}], propDecorators: { value: [{
|
|
4920
|
+
type: Input
|
|
4921
|
+
}], showValue: [{
|
|
4940
4922
|
type: Input
|
|
4941
4923
|
}], striped: [{
|
|
4942
4924
|
type: Input
|