sas-ui 0.8.181 → 0.8.182
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/dist/cjs/sas-alert_30.cjs.entry.js +62 -10
- package/dist/collection/components/sas-date-field/sas-date-field.js +1 -1
- package/dist/collection/components/sas-date-range/sas-date-range.css +10 -2
- package/dist/collection/components/sas-date-range/sas-date-range.js +63 -8
- package/dist/collection/components/sas-input/sas-input.css +4 -0
- package/dist/collection/components/sas-input/sas-input.js +1 -1
- package/dist/collection/components/sas-input/sas-input.stories.js +2 -0
- package/dist/custom-elements/index.js +62 -10
- package/dist/esm/sas-alert_30.entry.js +62 -10
- package/dist/sas-ui/p-318379f0.entry.js +1 -0
- package/dist/sas-ui/sas-ui.esm.js +1 -1
- package/dist/types/components/sas-date-range/sas-date-range.d.ts +2 -0
- package/package.json +1 -1
- package/dist/sas-ui/p-75ee23dd.entry.js +0 -1
|
@@ -1179,7 +1179,7 @@ let SasDateField = class {
|
|
|
1179
1179
|
formInputTemplate.error = !this.validity.valid;
|
|
1180
1180
|
}
|
|
1181
1181
|
if (!this.validity.valid) {
|
|
1182
|
-
this.message = this.getErrorMessage();
|
|
1182
|
+
this.message = this.message !== "" ? this.message : this.getErrorMessage();
|
|
1183
1183
|
}
|
|
1184
1184
|
}
|
|
1185
1185
|
/**
|
|
@@ -1381,7 +1381,7 @@ let SasDateField = class {
|
|
|
1381
1381
|
};
|
|
1382
1382
|
SasDateField.style = sasDateFieldCss;
|
|
1383
1383
|
|
|
1384
|
-
const sasDateRangeCss = ":host{display:block}:host .container{position:relative;display:
|
|
1384
|
+
const sasDateRangeCss = ":host{display:block}:host .container{position:relative;display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--s-300);border-radius:5px;box-sizing:border-box;--input-border:none;--input-focus-border:none;--input-focus-box-shadow:none}:host .container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .container:focus-within{border:1px solid var(--s-400);outline:none;box-shadow:0px 0px 5px #0000001A}:host .container:not([data-message=\"\"]){border-color:var(--li-2)}:host .dateDiv{display:flex;justify-content:space-between}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .date-field{min-width:0;width:100%;width:-moz-available;width:-webkit-fill-available}:host .icon{align-self:center;padding-right:9px}:host([outside]:not([outside=false]):not([label=\"\"])) .container{margin-top:30px}:host([disabled]:not([disabled=false])) .container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}";
|
|
1385
1385
|
|
|
1386
1386
|
let SasDateRange = class {
|
|
1387
1387
|
constructor(hostRef) {
|
|
@@ -1451,6 +1451,18 @@ let SasDateRange = class {
|
|
|
1451
1451
|
this.labelIconClickHandler = () => {
|
|
1452
1452
|
this.labeliconclicked.emit();
|
|
1453
1453
|
};
|
|
1454
|
+
this.getClearIcon = () => {
|
|
1455
|
+
if (this.from !== "" || this.to !== "")
|
|
1456
|
+
return 'fa-solid fa-circle-xmark';
|
|
1457
|
+
else
|
|
1458
|
+
return 'far fa-calendar-alt';
|
|
1459
|
+
};
|
|
1460
|
+
this.clearDates = () => {
|
|
1461
|
+
if (this.from !== "" || this.to !== "") {
|
|
1462
|
+
this.from = "";
|
|
1463
|
+
this.to = "";
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1454
1466
|
}
|
|
1455
1467
|
watchFromHandler() {
|
|
1456
1468
|
this.resetErrorStatus();
|
|
@@ -1462,13 +1474,52 @@ let SasDateRange = class {
|
|
|
1462
1474
|
* Validate
|
|
1463
1475
|
*/
|
|
1464
1476
|
async validate() {
|
|
1465
|
-
let
|
|
1466
|
-
|
|
1467
|
-
|
|
1477
|
+
let fromValueMissing = false;
|
|
1478
|
+
let toValueMissing = false;
|
|
1479
|
+
if (!Boolean(this.from)) {
|
|
1480
|
+
fromValueMissing = true;
|
|
1481
|
+
}
|
|
1482
|
+
if (!Boolean(this.to)) {
|
|
1483
|
+
toValueMissing = true;
|
|
1484
|
+
}
|
|
1485
|
+
let fromRangeUnderflow = false;
|
|
1486
|
+
if (Boolean(this.min) && Boolean(this.from)) {
|
|
1487
|
+
const inputDate = new Date(this.from);
|
|
1488
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
1489
|
+
if (inputDate < minDate) {
|
|
1490
|
+
fromRangeUnderflow = true;
|
|
1491
|
+
}
|
|
1492
|
+
}
|
|
1493
|
+
let fromRangeOverflow = false;
|
|
1494
|
+
if (Boolean(this.max) && Boolean(this.from)) {
|
|
1495
|
+
const inputDate = new Date(this.from);
|
|
1496
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
1497
|
+
if (inputDate > maxDate) {
|
|
1498
|
+
fromRangeOverflow = true;
|
|
1499
|
+
}
|
|
1468
1500
|
}
|
|
1501
|
+
let toRangeUnderflow = false;
|
|
1502
|
+
if (Boolean(this.min) && Boolean(this.to)) {
|
|
1503
|
+
const inputDate = new Date(this.to);
|
|
1504
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
1505
|
+
if (inputDate < minDate) {
|
|
1506
|
+
toRangeUnderflow = true;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
let toRangeOverflow = false;
|
|
1510
|
+
if (Boolean(this.max) && Boolean(this.to)) {
|
|
1511
|
+
const inputDate = new Date(this.to);
|
|
1512
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
1513
|
+
if (inputDate > maxDate) {
|
|
1514
|
+
toRangeOverflow = true;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
let valueMissing = false;
|
|
1518
|
+
if (this.required && (toValueMissing || fromValueMissing))
|
|
1519
|
+
valueMissing = true;
|
|
1469
1520
|
this.validity = {
|
|
1470
|
-
valid: !valueMissing,
|
|
1471
|
-
valueMissing:
|
|
1521
|
+
valid: !valueMissing && !fromRangeUnderflow && !fromRangeOverflow && !toRangeUnderflow && !toRangeOverflow,
|
|
1522
|
+
valueMissing: toValueMissing || fromValueMissing,
|
|
1472
1523
|
};
|
|
1473
1524
|
}
|
|
1474
1525
|
/**
|
|
@@ -1488,6 +1539,7 @@ let SasDateRange = class {
|
|
|
1488
1539
|
};
|
|
1489
1540
|
}
|
|
1490
1541
|
emitEvent() {
|
|
1542
|
+
this.validate();
|
|
1491
1543
|
this.daterangeupdate.emit({
|
|
1492
1544
|
from: this.from,
|
|
1493
1545
|
to: this.to,
|
|
@@ -1508,7 +1560,7 @@ let SasDateRange = class {
|
|
|
1508
1560
|
? index.h("label", { class: this.outside ? 'outside-label' : 'inside-label' }, this.label, this.required
|
|
1509
1561
|
? index.h("span", { class: "required-symbol" }, "*")
|
|
1510
1562
|
: null, index.h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
1511
|
-
: null, index.h("sas-date-field", { class: "date-field", icon: "", value: this.from, min: this.min, max: Boolean(this.to) ? this.to : this.max, position: this.position, onDatefieldupdate: this.fromDateUpdateHander }), index.h("sas-icon", { class: "icon", icon: "far fa-long-arrow-alt-right" }), index.h("sas-date-field", { class: "date-field", icon: "", value: this.to, min: Boolean(this.from) ? this.from : this.min, max: this.max, position: this.position, "position-h": "right", onDatefieldupdate: this.toDateUpdateHander }))));
|
|
1563
|
+
: null, index.h("div", { class: "dateDiv" }, index.h("sas-date-field", { class: "date-field", icon: "", value: this.from, min: this.min, max: Boolean(this.to) ? this.to : this.max, position: this.position, onDatefieldupdate: this.fromDateUpdateHander }), index.h("sas-icon", { class: "icon", icon: "far fa-long-arrow-alt-right" })), index.h("div", { class: "dateDiv" }, index.h("sas-date-field", { class: "date-field", icon: "", value: this.to, min: Boolean(this.from) ? this.from : this.min, max: this.max, position: this.position, "position-h": "right", onDatefieldupdate: this.toDateUpdateHander }), index.h("sas-icon", { class: "icon", icon: this.getClearIcon(), onClick: this.clearDates })))));
|
|
1512
1564
|
}
|
|
1513
1565
|
get el() { return index.getElement(this); }
|
|
1514
1566
|
static get watchers() { return {
|
|
@@ -2347,7 +2399,7 @@ let SasImage = class {
|
|
|
2347
2399
|
};
|
|
2348
2400
|
SasImage.style = sasImageCss;
|
|
2349
2401
|
|
|
2350
|
-
const sasInputCss = ":host{display:flex}:host .input-container{position:relative;height:var(--input-height, 40px);width:100%;max-width:100%;background-color:var(--input-background-color, white);border:var(--input-border, 1px solid var(--s-300));border-radius:5px;box-sizing:border-box;display:flex;gap:5px;padding:var(--input-padding, 0)}:host .input-container:focus-within{border:var(--input-border, 1px solid var(--s-400));outline:none;box-shadow:var(--input-focus-box-shadow, 0px 0px 5px #0000001A)}:host .input-container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .input{border:none;color:var(--input-color, var(--s-500));background-color:var(--input-background-color, white);height:100%;min-width:0;font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;flex-shrink:1;margin:0 10px;box-sizing:border-box}:host .input:focus{outline:none}:host .input:required{box-shadow:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host input[type=date],:host input[type=time]{-webkit-appearance:none}:host input[type=date]::-webkit-calendar-picker-indicator{display:none}:host input[type=time]::-webkit-calendar-picker-indicator{display:none}:host .input-date-container{position:relative;flex-grow:1;display:flex}:host .input-date-cover{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}:host input[readonly]:not([readonly=false]){cursor:initial}:host .right-icon-container{display:flex;align-items:center}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;box-shadow:none;margin-right:10px}:host .input-right-icon{--icon-color:var(--input-right-icon-color, var(--s-500));--icon-size:var(--input-right-icon-size, 14px);--icon-background-height:38px;margin-right:10px;padding:var(--input-right-icon-padding, 0)}:host .input-error{border:1px solid var(--li-2)}:host(:focus){outline:none}:host([type=textarea]) .input-container{height:var(--input-height, auto)}:host([type=textarea]) .right-icon-container{align-items:flex-start}:host([type=textarea]) .clear-icon{margin-top:10px;margin-right:10px}:host(:not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 5px)}:host([outside]:not([outside=false]):not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 30px)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .input-container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}:host-context([error]:not([error=false])) .input-container,:host([error]:not([error=false])) .input-container{border-color:var(--li-2)}";
|
|
2402
|
+
const sasInputCss = ":host{display:flex}:host .input-container{position:relative;height:var(--input-height, 40px);width:100%;max-width:100%;background-color:var(--input-background-color, white);border:var(--input-border, 1px solid var(--s-300));border-radius:5px;box-sizing:border-box;display:flex;gap:5px;padding:var(--input-padding, 0)}:host .input-container:focus-within{border:var(--input-border, 1px solid var(--s-400));outline:none;box-shadow:var(--input-focus-box-shadow, 0px 0px 5px #0000001A)}:host .input-container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .input{border:none;color:var(--input-color, var(--s-500));background-color:var(--input-background-color, white);height:100%;min-width:0;font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;flex-shrink:1;margin:0 10px;box-sizing:border-box}:host .input:focus{outline:none}:host .input:required{box-shadow:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host input[type=date],:host input[type=time]{-webkit-appearance:none}:host input[type=date]::-webkit-calendar-picker-indicator{display:none}:host input[type=time]::-webkit-calendar-picker-indicator{display:none}:host .input-date-container{position:relative;flex-grow:1;display:flex}:host .input-date-cover{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}:host input[readonly]:not([readonly=false]){cursor:initial}:host .iconLabel{padding-left:5px;cursor:pointer}:host .right-icon-container{display:flex;align-items:center}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;box-shadow:none;margin-right:10px}:host .input-right-icon{--icon-color:var(--input-right-icon-color, var(--s-500));--icon-size:var(--input-right-icon-size, 14px);--icon-background-height:38px;margin-right:10px;padding:var(--input-right-icon-padding, 0)}:host .input-error{border:1px solid var(--li-2)}:host(:focus){outline:none}:host([type=textarea]) .input-container{height:var(--input-height, auto)}:host([type=textarea]) .right-icon-container{align-items:flex-start}:host([type=textarea]) .clear-icon{margin-top:10px;margin-right:10px}:host(:not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 5px)}:host([outside]:not([outside=false]):not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 30px)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .input-container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}:host-context([error]:not([error=false])) .input-container,:host([error]:not([error=false])) .input-container{border-color:var(--li-2)}";
|
|
2351
2403
|
|
|
2352
2404
|
let SasInput = class {
|
|
2353
2405
|
constructor(hostRef) {
|
|
@@ -2686,7 +2738,7 @@ let SasInput = class {
|
|
|
2686
2738
|
, null, index.h("div", { class: "input-container", "data-message": this.message }, Boolean(this.label)
|
|
2687
2739
|
? index.h("label", { class: this.outside ? 'outside-label' : 'inside-label' }, this.label, this.required
|
|
2688
2740
|
? index.h("span", { class: "required-symbol" }, "*")
|
|
2689
|
-
: null, index.h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
2741
|
+
: null, index.h("sas-icon", { class: "iconLabel", icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
2690
2742
|
: null, this.type === 'tel'
|
|
2691
2743
|
? index.h("sas-input-tel", { "data-country": this.country, "data-value": this.value, "data-placeholder": this.placeholder, "data-placeholderNumberType": this.placeholderNumberType })
|
|
2692
2744
|
: null, this.type === 'textarea'
|
|
@@ -216,7 +216,7 @@ export class SasDateField {
|
|
|
216
216
|
formInputTemplate.error = !this.validity.valid;
|
|
217
217
|
}
|
|
218
218
|
if (!this.validity.valid) {
|
|
219
|
-
this.message = this.getErrorMessage();
|
|
219
|
+
this.message = this.message !== "" ? this.message : this.getErrorMessage();
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
}
|
|
4
4
|
:host .container {
|
|
5
5
|
position: relative;
|
|
6
|
-
display:
|
|
7
|
-
|
|
6
|
+
display: grid;
|
|
7
|
+
grid-template-columns: 1fr 1fr;
|
|
8
8
|
border: 1px solid var(--s-300);
|
|
9
9
|
border-radius: 5px;
|
|
10
10
|
box-sizing: border-box;
|
|
@@ -29,6 +29,10 @@
|
|
|
29
29
|
:host .container:not([data-message=""]) {
|
|
30
30
|
border-color: var(--li-2);
|
|
31
31
|
}
|
|
32
|
+
:host .dateDiv {
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
}
|
|
32
36
|
:host .outside-label {
|
|
33
37
|
color: var(--secondary);
|
|
34
38
|
font-size: 14px;
|
|
@@ -53,9 +57,13 @@
|
|
|
53
57
|
}
|
|
54
58
|
:host .date-field {
|
|
55
59
|
min-width: 0;
|
|
60
|
+
width: 100%;
|
|
61
|
+
width: -moz-available;
|
|
62
|
+
width: -webkit-fill-available;
|
|
56
63
|
}
|
|
57
64
|
:host .icon {
|
|
58
65
|
align-self: center;
|
|
66
|
+
padding-right: 9px;
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
:host([outside]:not([outside=false]):not([label=""])) .container {
|
|
@@ -64,6 +64,18 @@ export class SasDateRange {
|
|
|
64
64
|
this.labelIconClickHandler = () => {
|
|
65
65
|
this.labeliconclicked.emit();
|
|
66
66
|
};
|
|
67
|
+
this.getClearIcon = () => {
|
|
68
|
+
if (this.from !== "" || this.to !== "")
|
|
69
|
+
return 'fa-solid fa-circle-xmark';
|
|
70
|
+
else
|
|
71
|
+
return 'far fa-calendar-alt';
|
|
72
|
+
};
|
|
73
|
+
this.clearDates = () => {
|
|
74
|
+
if (this.from !== "" || this.to !== "") {
|
|
75
|
+
this.from = "";
|
|
76
|
+
this.to = "";
|
|
77
|
+
}
|
|
78
|
+
};
|
|
67
79
|
}
|
|
68
80
|
watchFromHandler() {
|
|
69
81
|
this.resetErrorStatus();
|
|
@@ -75,13 +87,52 @@ export class SasDateRange {
|
|
|
75
87
|
* Validate
|
|
76
88
|
*/
|
|
77
89
|
async validate() {
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
|
|
90
|
+
let fromValueMissing = false;
|
|
91
|
+
let toValueMissing = false;
|
|
92
|
+
if (!Boolean(this.from)) {
|
|
93
|
+
fromValueMissing = true;
|
|
94
|
+
}
|
|
95
|
+
if (!Boolean(this.to)) {
|
|
96
|
+
toValueMissing = true;
|
|
97
|
+
}
|
|
98
|
+
let fromRangeUnderflow = false;
|
|
99
|
+
if (Boolean(this.min) && Boolean(this.from)) {
|
|
100
|
+
const inputDate = new Date(this.from);
|
|
101
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
102
|
+
if (inputDate < minDate) {
|
|
103
|
+
fromRangeUnderflow = true;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
let fromRangeOverflow = false;
|
|
107
|
+
if (Boolean(this.max) && Boolean(this.from)) {
|
|
108
|
+
const inputDate = new Date(this.from);
|
|
109
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
110
|
+
if (inputDate > maxDate) {
|
|
111
|
+
fromRangeOverflow = true;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
let toRangeUnderflow = false;
|
|
115
|
+
if (Boolean(this.min) && Boolean(this.to)) {
|
|
116
|
+
const inputDate = new Date(this.to);
|
|
117
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
118
|
+
if (inputDate < minDate) {
|
|
119
|
+
toRangeUnderflow = true;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
let toRangeOverflow = false;
|
|
123
|
+
if (Boolean(this.max) && Boolean(this.to)) {
|
|
124
|
+
const inputDate = new Date(this.to);
|
|
125
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
126
|
+
if (inputDate > maxDate) {
|
|
127
|
+
toRangeOverflow = true;
|
|
128
|
+
}
|
|
81
129
|
}
|
|
130
|
+
let valueMissing = false;
|
|
131
|
+
if (this.required && (toValueMissing || fromValueMissing))
|
|
132
|
+
valueMissing = true;
|
|
82
133
|
this.validity = {
|
|
83
|
-
valid: !valueMissing,
|
|
84
|
-
valueMissing:
|
|
134
|
+
valid: !valueMissing && !fromRangeUnderflow && !fromRangeOverflow && !toRangeUnderflow && !toRangeOverflow,
|
|
135
|
+
valueMissing: toValueMissing || fromValueMissing,
|
|
85
136
|
};
|
|
86
137
|
}
|
|
87
138
|
/**
|
|
@@ -101,6 +152,7 @@ export class SasDateRange {
|
|
|
101
152
|
};
|
|
102
153
|
}
|
|
103
154
|
emitEvent() {
|
|
155
|
+
this.validate();
|
|
104
156
|
this.daterangeupdate.emit({
|
|
105
157
|
from: this.from,
|
|
106
158
|
to: this.to,
|
|
@@ -127,9 +179,12 @@ export class SasDateRange {
|
|
|
127
179
|
: null,
|
|
128
180
|
h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
129
181
|
: null,
|
|
130
|
-
h("
|
|
131
|
-
|
|
132
|
-
|
|
182
|
+
h("div", { class: "dateDiv" },
|
|
183
|
+
h("sas-date-field", { class: "date-field", icon: "", value: this.from, min: this.min, max: Boolean(this.to) ? this.to : this.max, position: this.position, onDatefieldupdate: this.fromDateUpdateHander }),
|
|
184
|
+
h("sas-icon", { class: "icon", icon: "far fa-long-arrow-alt-right" })),
|
|
185
|
+
h("div", { class: "dateDiv" },
|
|
186
|
+
h("sas-date-field", { class: "date-field", icon: "", value: this.to, min: Boolean(this.from) ? this.from : this.min, max: this.max, position: this.position, "position-h": "right", onDatefieldupdate: this.toDateUpdateHander }),
|
|
187
|
+
h("sas-icon", { class: "icon", icon: this.getClearIcon(), onClick: this.clearDates })))));
|
|
133
188
|
}
|
|
134
189
|
static get is() { return "sas-date-range"; }
|
|
135
190
|
static get encapsulation() { return "shadow"; }
|
|
@@ -334,7 +334,7 @@ export class SasInput {
|
|
|
334
334
|
this.required
|
|
335
335
|
? h("span", { class: "required-symbol" }, "*")
|
|
336
336
|
: null,
|
|
337
|
-
h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
337
|
+
h("sas-icon", { class: "iconLabel", icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
338
338
|
: null,
|
|
339
339
|
this.type === 'tel'
|
|
340
340
|
? h("sas-input-tel", { "data-country": this.country, "data-value": this.value, "data-placeholder": this.placeholder, "data-placeholderNumberType": this.placeholderNumberType })
|
|
@@ -30,6 +30,7 @@ export const TypeText = (args) => `
|
|
|
30
30
|
clear="${args.clear}"
|
|
31
31
|
maxlength="${args.maxlength}"
|
|
32
32
|
minlength="${args.minlength}"
|
|
33
|
+
icon-label="${args.iconLabel}"
|
|
33
34
|
>
|
|
34
35
|
</sas-input>
|
|
35
36
|
`;
|
|
@@ -47,6 +48,7 @@ TypeText.args = {
|
|
|
47
48
|
clear: false,
|
|
48
49
|
maxlength: 100,
|
|
49
50
|
minlength: 0,
|
|
51
|
+
iconLabel: "fa-regular fa-circle-question"
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
export const TypeTextarea = (args) => `
|
|
@@ -6386,7 +6386,7 @@ let SasDateField$1 = class extends H {
|
|
|
6386
6386
|
formInputTemplate.error = !this.validity.valid;
|
|
6387
6387
|
}
|
|
6388
6388
|
if (!this.validity.valid) {
|
|
6389
|
-
this.message = this.getErrorMessage();
|
|
6389
|
+
this.message = this.message !== "" ? this.message : this.getErrorMessage();
|
|
6390
6390
|
}
|
|
6391
6391
|
}
|
|
6392
6392
|
/**
|
|
@@ -6588,7 +6588,7 @@ let SasDateField$1 = class extends H {
|
|
|
6588
6588
|
static get style() { return sasDateFieldCss; }
|
|
6589
6589
|
};
|
|
6590
6590
|
|
|
6591
|
-
const sasDateRangeCss = ":host{display:block}:host .container{position:relative;display:
|
|
6591
|
+
const sasDateRangeCss = ":host{display:block}:host .container{position:relative;display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--s-300);border-radius:5px;box-sizing:border-box;--input-border:none;--input-focus-border:none;--input-focus-box-shadow:none}:host .container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .container:focus-within{border:1px solid var(--s-400);outline:none;box-shadow:0px 0px 5px #0000001A}:host .container:not([data-message=\"\"]){border-color:var(--li-2)}:host .dateDiv{display:flex;justify-content:space-between}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .date-field{min-width:0;width:100%;width:-moz-available;width:-webkit-fill-available}:host .icon{align-self:center;padding-right:9px}:host([outside]:not([outside=false]):not([label=\"\"])) .container{margin-top:30px}:host([disabled]:not([disabled=false])) .container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}";
|
|
6592
6592
|
|
|
6593
6593
|
let SasDateRange$1 = class extends H {
|
|
6594
6594
|
constructor() {
|
|
@@ -6660,6 +6660,18 @@ let SasDateRange$1 = class extends H {
|
|
|
6660
6660
|
this.labelIconClickHandler = () => {
|
|
6661
6661
|
this.labeliconclicked.emit();
|
|
6662
6662
|
};
|
|
6663
|
+
this.getClearIcon = () => {
|
|
6664
|
+
if (this.from !== "" || this.to !== "")
|
|
6665
|
+
return 'fa-solid fa-circle-xmark';
|
|
6666
|
+
else
|
|
6667
|
+
return 'far fa-calendar-alt';
|
|
6668
|
+
};
|
|
6669
|
+
this.clearDates = () => {
|
|
6670
|
+
if (this.from !== "" || this.to !== "") {
|
|
6671
|
+
this.from = "";
|
|
6672
|
+
this.to = "";
|
|
6673
|
+
}
|
|
6674
|
+
};
|
|
6663
6675
|
}
|
|
6664
6676
|
watchFromHandler() {
|
|
6665
6677
|
this.resetErrorStatus();
|
|
@@ -6671,13 +6683,52 @@ let SasDateRange$1 = class extends H {
|
|
|
6671
6683
|
* Validate
|
|
6672
6684
|
*/
|
|
6673
6685
|
async validate() {
|
|
6674
|
-
let
|
|
6675
|
-
|
|
6676
|
-
|
|
6686
|
+
let fromValueMissing = false;
|
|
6687
|
+
let toValueMissing = false;
|
|
6688
|
+
if (!Boolean(this.from)) {
|
|
6689
|
+
fromValueMissing = true;
|
|
6690
|
+
}
|
|
6691
|
+
if (!Boolean(this.to)) {
|
|
6692
|
+
toValueMissing = true;
|
|
6693
|
+
}
|
|
6694
|
+
let fromRangeUnderflow = false;
|
|
6695
|
+
if (Boolean(this.min) && Boolean(this.from)) {
|
|
6696
|
+
const inputDate = new Date(this.from);
|
|
6697
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
6698
|
+
if (inputDate < minDate) {
|
|
6699
|
+
fromRangeUnderflow = true;
|
|
6700
|
+
}
|
|
6701
|
+
}
|
|
6702
|
+
let fromRangeOverflow = false;
|
|
6703
|
+
if (Boolean(this.max) && Boolean(this.from)) {
|
|
6704
|
+
const inputDate = new Date(this.from);
|
|
6705
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
6706
|
+
if (inputDate > maxDate) {
|
|
6707
|
+
fromRangeOverflow = true;
|
|
6708
|
+
}
|
|
6677
6709
|
}
|
|
6710
|
+
let toRangeUnderflow = false;
|
|
6711
|
+
if (Boolean(this.min) && Boolean(this.to)) {
|
|
6712
|
+
const inputDate = new Date(this.to);
|
|
6713
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
6714
|
+
if (inputDate < minDate) {
|
|
6715
|
+
toRangeUnderflow = true;
|
|
6716
|
+
}
|
|
6717
|
+
}
|
|
6718
|
+
let toRangeOverflow = false;
|
|
6719
|
+
if (Boolean(this.max) && Boolean(this.to)) {
|
|
6720
|
+
const inputDate = new Date(this.to);
|
|
6721
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
6722
|
+
if (inputDate > maxDate) {
|
|
6723
|
+
toRangeOverflow = true;
|
|
6724
|
+
}
|
|
6725
|
+
}
|
|
6726
|
+
let valueMissing = false;
|
|
6727
|
+
if (this.required && (toValueMissing || fromValueMissing))
|
|
6728
|
+
valueMissing = true;
|
|
6678
6729
|
this.validity = {
|
|
6679
|
-
valid: !valueMissing,
|
|
6680
|
-
valueMissing:
|
|
6730
|
+
valid: !valueMissing && !fromRangeUnderflow && !fromRangeOverflow && !toRangeUnderflow && !toRangeOverflow,
|
|
6731
|
+
valueMissing: toValueMissing || fromValueMissing,
|
|
6681
6732
|
};
|
|
6682
6733
|
}
|
|
6683
6734
|
/**
|
|
@@ -6697,6 +6748,7 @@ let SasDateRange$1 = class extends H {
|
|
|
6697
6748
|
};
|
|
6698
6749
|
}
|
|
6699
6750
|
emitEvent() {
|
|
6751
|
+
this.validate();
|
|
6700
6752
|
this.daterangeupdate.emit({
|
|
6701
6753
|
from: this.from,
|
|
6702
6754
|
to: this.to,
|
|
@@ -6717,7 +6769,7 @@ let SasDateRange$1 = class extends H {
|
|
|
6717
6769
|
? h("label", { class: this.outside ? 'outside-label' : 'inside-label' }, this.label, this.required
|
|
6718
6770
|
? h("span", { class: "required-symbol" }, "*")
|
|
6719
6771
|
: null, h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
6720
|
-
: null, h("sas-date-field", { class: "date-field", icon: "", value: this.from, min: this.min, max: Boolean(this.to) ? this.to : this.max, position: this.position, onDatefieldupdate: this.fromDateUpdateHander }), h("sas-icon", { class: "icon", icon: "far fa-long-arrow-alt-right" }), h("sas-date-field", { class: "date-field", icon: "", value: this.to, min: Boolean(this.from) ? this.from : this.min, max: this.max, position: this.position, "position-h": "right", onDatefieldupdate: this.toDateUpdateHander }))));
|
|
6772
|
+
: null, h("div", { class: "dateDiv" }, h("sas-date-field", { class: "date-field", icon: "", value: this.from, min: this.min, max: Boolean(this.to) ? this.to : this.max, position: this.position, onDatefieldupdate: this.fromDateUpdateHander }), h("sas-icon", { class: "icon", icon: "far fa-long-arrow-alt-right" })), h("div", { class: "dateDiv" }, h("sas-date-field", { class: "date-field", icon: "", value: this.to, min: Boolean(this.from) ? this.from : this.min, max: this.max, position: this.position, "position-h": "right", onDatefieldupdate: this.toDateUpdateHander }), h("sas-icon", { class: "icon", icon: this.getClearIcon(), onClick: this.clearDates })))));
|
|
6721
6773
|
}
|
|
6722
6774
|
get el() { return this; }
|
|
6723
6775
|
static get watchers() { return {
|
|
@@ -7572,7 +7624,7 @@ let SasImage$1 = class extends H {
|
|
|
7572
7624
|
static get style() { return sasImageCss; }
|
|
7573
7625
|
};
|
|
7574
7626
|
|
|
7575
|
-
const sasInputCss = ":host{display:flex}:host .input-container{position:relative;height:var(--input-height, 40px);width:100%;max-width:100%;background-color:var(--input-background-color, white);border:var(--input-border, 1px solid var(--s-300));border-radius:5px;box-sizing:border-box;display:flex;gap:5px;padding:var(--input-padding, 0)}:host .input-container:focus-within{border:var(--input-border, 1px solid var(--s-400));outline:none;box-shadow:var(--input-focus-box-shadow, 0px 0px 5px #0000001A)}:host .input-container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .input{border:none;color:var(--input-color, var(--s-500));background-color:var(--input-background-color, white);height:100%;min-width:0;font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;flex-shrink:1;margin:0 10px;box-sizing:border-box}:host .input:focus{outline:none}:host .input:required{box-shadow:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host input[type=date],:host input[type=time]{-webkit-appearance:none}:host input[type=date]::-webkit-calendar-picker-indicator{display:none}:host input[type=time]::-webkit-calendar-picker-indicator{display:none}:host .input-date-container{position:relative;flex-grow:1;display:flex}:host .input-date-cover{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}:host input[readonly]:not([readonly=false]){cursor:initial}:host .right-icon-container{display:flex;align-items:center}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;box-shadow:none;margin-right:10px}:host .input-right-icon{--icon-color:var(--input-right-icon-color, var(--s-500));--icon-size:var(--input-right-icon-size, 14px);--icon-background-height:38px;margin-right:10px;padding:var(--input-right-icon-padding, 0)}:host .input-error{border:1px solid var(--li-2)}:host(:focus){outline:none}:host([type=textarea]) .input-container{height:var(--input-height, auto)}:host([type=textarea]) .right-icon-container{align-items:flex-start}:host([type=textarea]) .clear-icon{margin-top:10px;margin-right:10px}:host(:not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 5px)}:host([outside]:not([outside=false]):not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 30px)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .input-container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}:host-context([error]:not([error=false])) .input-container,:host([error]:not([error=false])) .input-container{border-color:var(--li-2)}";
|
|
7627
|
+
const sasInputCss = ":host{display:flex}:host .input-container{position:relative;height:var(--input-height, 40px);width:100%;max-width:100%;background-color:var(--input-background-color, white);border:var(--input-border, 1px solid var(--s-300));border-radius:5px;box-sizing:border-box;display:flex;gap:5px;padding:var(--input-padding, 0)}:host .input-container:focus-within{border:var(--input-border, 1px solid var(--s-400));outline:none;box-shadow:var(--input-focus-box-shadow, 0px 0px 5px #0000001A)}:host .input-container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .input{border:none;color:var(--input-color, var(--s-500));background-color:var(--input-background-color, white);height:100%;min-width:0;font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;flex-shrink:1;margin:0 10px;box-sizing:border-box}:host .input:focus{outline:none}:host .input:required{box-shadow:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host input[type=date],:host input[type=time]{-webkit-appearance:none}:host input[type=date]::-webkit-calendar-picker-indicator{display:none}:host input[type=time]::-webkit-calendar-picker-indicator{display:none}:host .input-date-container{position:relative;flex-grow:1;display:flex}:host .input-date-cover{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}:host input[readonly]:not([readonly=false]){cursor:initial}:host .iconLabel{padding-left:5px;cursor:pointer}:host .right-icon-container{display:flex;align-items:center}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;box-shadow:none;margin-right:10px}:host .input-right-icon{--icon-color:var(--input-right-icon-color, var(--s-500));--icon-size:var(--input-right-icon-size, 14px);--icon-background-height:38px;margin-right:10px;padding:var(--input-right-icon-padding, 0)}:host .input-error{border:1px solid var(--li-2)}:host(:focus){outline:none}:host([type=textarea]) .input-container{height:var(--input-height, auto)}:host([type=textarea]) .right-icon-container{align-items:flex-start}:host([type=textarea]) .clear-icon{margin-top:10px;margin-right:10px}:host(:not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 5px)}:host([outside]:not([outside=false]):not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 30px)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .input-container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}:host-context([error]:not([error=false])) .input-container,:host([error]:not([error=false])) .input-container{border-color:var(--li-2)}";
|
|
7576
7628
|
|
|
7577
7629
|
let SasInput$1 = class extends H {
|
|
7578
7630
|
constructor() {
|
|
@@ -7913,7 +7965,7 @@ let SasInput$1 = class extends H {
|
|
|
7913
7965
|
, null, h("div", { class: "input-container", "data-message": this.message }, Boolean(this.label)
|
|
7914
7966
|
? h("label", { class: this.outside ? 'outside-label' : 'inside-label' }, this.label, this.required
|
|
7915
7967
|
? h("span", { class: "required-symbol" }, "*")
|
|
7916
|
-
: null, h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
7968
|
+
: null, h("sas-icon", { class: "iconLabel", icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
7917
7969
|
: null, this.type === 'tel'
|
|
7918
7970
|
? h("sas-input-tel", { "data-country": this.country, "data-value": this.value, "data-placeholder": this.placeholder, "data-placeholderNumberType": this.placeholderNumberType })
|
|
7919
7971
|
: null, this.type === 'textarea'
|
|
@@ -1175,7 +1175,7 @@ let SasDateField = class {
|
|
|
1175
1175
|
formInputTemplate.error = !this.validity.valid;
|
|
1176
1176
|
}
|
|
1177
1177
|
if (!this.validity.valid) {
|
|
1178
|
-
this.message = this.getErrorMessage();
|
|
1178
|
+
this.message = this.message !== "" ? this.message : this.getErrorMessage();
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
1181
|
/**
|
|
@@ -1377,7 +1377,7 @@ let SasDateField = class {
|
|
|
1377
1377
|
};
|
|
1378
1378
|
SasDateField.style = sasDateFieldCss;
|
|
1379
1379
|
|
|
1380
|
-
const sasDateRangeCss = ":host{display:block}:host .container{position:relative;display:
|
|
1380
|
+
const sasDateRangeCss = ":host{display:block}:host .container{position:relative;display:grid;grid-template-columns:1fr 1fr;border:1px solid var(--s-300);border-radius:5px;box-sizing:border-box;--input-border:none;--input-focus-border:none;--input-focus-box-shadow:none}:host .container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .container:focus-within{border:1px solid var(--s-400);outline:none;box-shadow:0px 0px 5px #0000001A}:host .container:not([data-message=\"\"]){border-color:var(--li-2)}:host .dateDiv{display:flex;justify-content:space-between}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .date-field{min-width:0;width:100%;width:-moz-available;width:-webkit-fill-available}:host .icon{align-self:center;padding-right:9px}:host([outside]:not([outside=false]):not([label=\"\"])) .container{margin-top:30px}:host([disabled]:not([disabled=false])) .container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}";
|
|
1381
1381
|
|
|
1382
1382
|
let SasDateRange = class {
|
|
1383
1383
|
constructor(hostRef) {
|
|
@@ -1447,6 +1447,18 @@ let SasDateRange = class {
|
|
|
1447
1447
|
this.labelIconClickHandler = () => {
|
|
1448
1448
|
this.labeliconclicked.emit();
|
|
1449
1449
|
};
|
|
1450
|
+
this.getClearIcon = () => {
|
|
1451
|
+
if (this.from !== "" || this.to !== "")
|
|
1452
|
+
return 'fa-solid fa-circle-xmark';
|
|
1453
|
+
else
|
|
1454
|
+
return 'far fa-calendar-alt';
|
|
1455
|
+
};
|
|
1456
|
+
this.clearDates = () => {
|
|
1457
|
+
if (this.from !== "" || this.to !== "") {
|
|
1458
|
+
this.from = "";
|
|
1459
|
+
this.to = "";
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1450
1462
|
}
|
|
1451
1463
|
watchFromHandler() {
|
|
1452
1464
|
this.resetErrorStatus();
|
|
@@ -1458,13 +1470,52 @@ let SasDateRange = class {
|
|
|
1458
1470
|
* Validate
|
|
1459
1471
|
*/
|
|
1460
1472
|
async validate() {
|
|
1461
|
-
let
|
|
1462
|
-
|
|
1463
|
-
|
|
1473
|
+
let fromValueMissing = false;
|
|
1474
|
+
let toValueMissing = false;
|
|
1475
|
+
if (!Boolean(this.from)) {
|
|
1476
|
+
fromValueMissing = true;
|
|
1477
|
+
}
|
|
1478
|
+
if (!Boolean(this.to)) {
|
|
1479
|
+
toValueMissing = true;
|
|
1480
|
+
}
|
|
1481
|
+
let fromRangeUnderflow = false;
|
|
1482
|
+
if (Boolean(this.min) && Boolean(this.from)) {
|
|
1483
|
+
const inputDate = new Date(this.from);
|
|
1484
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
1485
|
+
if (inputDate < minDate) {
|
|
1486
|
+
fromRangeUnderflow = true;
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
let fromRangeOverflow = false;
|
|
1490
|
+
if (Boolean(this.max) && Boolean(this.from)) {
|
|
1491
|
+
const inputDate = new Date(this.from);
|
|
1492
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
1493
|
+
if (inputDate > maxDate) {
|
|
1494
|
+
fromRangeOverflow = true;
|
|
1495
|
+
}
|
|
1464
1496
|
}
|
|
1497
|
+
let toRangeUnderflow = false;
|
|
1498
|
+
if (Boolean(this.min) && Boolean(this.to)) {
|
|
1499
|
+
const inputDate = new Date(this.to);
|
|
1500
|
+
const minDate = new Date(`${this.min}T00:00:00`);
|
|
1501
|
+
if (inputDate < minDate) {
|
|
1502
|
+
toRangeUnderflow = true;
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
let toRangeOverflow = false;
|
|
1506
|
+
if (Boolean(this.max) && Boolean(this.to)) {
|
|
1507
|
+
const inputDate = new Date(this.to);
|
|
1508
|
+
const maxDate = new Date(`${this.max}T23:59:59`);
|
|
1509
|
+
if (inputDate > maxDate) {
|
|
1510
|
+
toRangeOverflow = true;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
let valueMissing = false;
|
|
1514
|
+
if (this.required && (toValueMissing || fromValueMissing))
|
|
1515
|
+
valueMissing = true;
|
|
1465
1516
|
this.validity = {
|
|
1466
|
-
valid: !valueMissing,
|
|
1467
|
-
valueMissing:
|
|
1517
|
+
valid: !valueMissing && !fromRangeUnderflow && !fromRangeOverflow && !toRangeUnderflow && !toRangeOverflow,
|
|
1518
|
+
valueMissing: toValueMissing || fromValueMissing,
|
|
1468
1519
|
};
|
|
1469
1520
|
}
|
|
1470
1521
|
/**
|
|
@@ -1484,6 +1535,7 @@ let SasDateRange = class {
|
|
|
1484
1535
|
};
|
|
1485
1536
|
}
|
|
1486
1537
|
emitEvent() {
|
|
1538
|
+
this.validate();
|
|
1487
1539
|
this.daterangeupdate.emit({
|
|
1488
1540
|
from: this.from,
|
|
1489
1541
|
to: this.to,
|
|
@@ -1504,7 +1556,7 @@ let SasDateRange = class {
|
|
|
1504
1556
|
? h("label", { class: this.outside ? 'outside-label' : 'inside-label' }, this.label, this.required
|
|
1505
1557
|
? h("span", { class: "required-symbol" }, "*")
|
|
1506
1558
|
: null, h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
1507
|
-
: null, h("sas-date-field", { class: "date-field", icon: "", value: this.from, min: this.min, max: Boolean(this.to) ? this.to : this.max, position: this.position, onDatefieldupdate: this.fromDateUpdateHander }), h("sas-icon", { class: "icon", icon: "far fa-long-arrow-alt-right" }), h("sas-date-field", { class: "date-field", icon: "", value: this.to, min: Boolean(this.from) ? this.from : this.min, max: this.max, position: this.position, "position-h": "right", onDatefieldupdate: this.toDateUpdateHander }))));
|
|
1559
|
+
: null, h("div", { class: "dateDiv" }, h("sas-date-field", { class: "date-field", icon: "", value: this.from, min: this.min, max: Boolean(this.to) ? this.to : this.max, position: this.position, onDatefieldupdate: this.fromDateUpdateHander }), h("sas-icon", { class: "icon", icon: "far fa-long-arrow-alt-right" })), h("div", { class: "dateDiv" }, h("sas-date-field", { class: "date-field", icon: "", value: this.to, min: Boolean(this.from) ? this.from : this.min, max: this.max, position: this.position, "position-h": "right", onDatefieldupdate: this.toDateUpdateHander }), h("sas-icon", { class: "icon", icon: this.getClearIcon(), onClick: this.clearDates })))));
|
|
1508
1560
|
}
|
|
1509
1561
|
get el() { return getElement(this); }
|
|
1510
1562
|
static get watchers() { return {
|
|
@@ -2343,7 +2395,7 @@ let SasImage = class {
|
|
|
2343
2395
|
};
|
|
2344
2396
|
SasImage.style = sasImageCss;
|
|
2345
2397
|
|
|
2346
|
-
const sasInputCss = ":host{display:flex}:host .input-container{position:relative;height:var(--input-height, 40px);width:100%;max-width:100%;background-color:var(--input-background-color, white);border:var(--input-border, 1px solid var(--s-300));border-radius:5px;box-sizing:border-box;display:flex;gap:5px;padding:var(--input-padding, 0)}:host .input-container:focus-within{border:var(--input-border, 1px solid var(--s-400));outline:none;box-shadow:var(--input-focus-box-shadow, 0px 0px 5px #0000001A)}:host .input-container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .input{border:none;color:var(--input-color, var(--s-500));background-color:var(--input-background-color, white);height:100%;min-width:0;font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;flex-shrink:1;margin:0 10px;box-sizing:border-box}:host .input:focus{outline:none}:host .input:required{box-shadow:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host input[type=date],:host input[type=time]{-webkit-appearance:none}:host input[type=date]::-webkit-calendar-picker-indicator{display:none}:host input[type=time]::-webkit-calendar-picker-indicator{display:none}:host .input-date-container{position:relative;flex-grow:1;display:flex}:host .input-date-cover{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}:host input[readonly]:not([readonly=false]){cursor:initial}:host .right-icon-container{display:flex;align-items:center}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;box-shadow:none;margin-right:10px}:host .input-right-icon{--icon-color:var(--input-right-icon-color, var(--s-500));--icon-size:var(--input-right-icon-size, 14px);--icon-background-height:38px;margin-right:10px;padding:var(--input-right-icon-padding, 0)}:host .input-error{border:1px solid var(--li-2)}:host(:focus){outline:none}:host([type=textarea]) .input-container{height:var(--input-height, auto)}:host([type=textarea]) .right-icon-container{align-items:flex-start}:host([type=textarea]) .clear-icon{margin-top:10px;margin-right:10px}:host(:not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 5px)}:host([outside]:not([outside=false]):not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 30px)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .input-container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}:host-context([error]:not([error=false])) .input-container,:host([error]:not([error=false])) .input-container{border-color:var(--li-2)}";
|
|
2398
|
+
const sasInputCss = ":host{display:flex}:host .input-container{position:relative;height:var(--input-height, 40px);width:100%;max-width:100%;background-color:var(--input-background-color, white);border:var(--input-border, 1px solid var(--s-300));border-radius:5px;box-sizing:border-box;display:flex;gap:5px;padding:var(--input-padding, 0)}:host .input-container:focus-within{border:var(--input-border, 1px solid var(--s-400));outline:none;box-shadow:var(--input-focus-box-shadow, 0px 0px 5px #0000001A)}:host .input-container:after{content:attr(data-message);position:absolute;top:calc(100% + 5px);right:10px;color:var(--li-2);font-size:12px;text-align:right}:host .outside-label{color:var(--secondary);font-size:14px;position:absolute;left:0;bottom:100%;transform:translateY(-10px)}:host .inside-label{color:var(--s-400);left:10px;position:absolute;z-index:1;font-size:12px;transform:translateY(-65%);background-color:white;padding:0 2px}:host .required-symbol{margin-left:5px;color:var(--primary)}:host .input{border:none;color:var(--input-color, var(--s-500));background-color:var(--input-background-color, white);height:100%;min-width:0;font-family:roboto, \"Font Awesome 6 Pro\";font-size:14px;text-overflow:ellipsis;flex-grow:1;flex-shrink:1;margin:0 10px;box-sizing:border-box}:host .input:focus{outline:none}:host .input:required{box-shadow:none}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host input[type=date],:host input[type=time]{-webkit-appearance:none}:host input[type=date]::-webkit-calendar-picker-indicator{display:none}:host input[type=time]::-webkit-calendar-picker-indicator{display:none}:host .input-date-container{position:relative;flex-grow:1;display:flex}:host .input-date-cover{position:absolute;left:0;right:0;top:0;bottom:0;z-index:1}:host input[readonly]:not([readonly=false]){cursor:initial}:host .iconLabel{padding-left:5px;cursor:pointer}:host .right-icon-container{display:flex;align-items:center}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;box-shadow:none;margin-right:10px}:host .input-right-icon{--icon-color:var(--input-right-icon-color, var(--s-500));--icon-size:var(--input-right-icon-size, 14px);--icon-background-height:38px;margin-right:10px;padding:var(--input-right-icon-padding, 0)}:host .input-error{border:1px solid var(--li-2)}:host(:focus){outline:none}:host([type=textarea]) .input-container{height:var(--input-height, auto)}:host([type=textarea]) .right-icon-container{align-items:flex-start}:host([type=textarea]) .clear-icon{margin-top:10px;margin-right:10px}:host(:not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 5px)}:host([outside]:not([outside=false]):not([label=\"\"])) .input-container{margin-top:var(--input-margin-top, 30px)}:host([disabled]:not([disabled=false])) .input-container{cursor:not-allowed}:host([disabled]:not([disabled=false])) label{cursor:default}:host([disabled]:not([disabled=false])) .input-container:before{content:\"\";background-color:var(--s-200);left:0;right:0;top:0;bottom:0;position:absolute;border-radius:5px;opacity:0.3;z-index:10}:host-context([error]:not([error=false])) .input-container,:host([error]:not([error=false])) .input-container{border-color:var(--li-2)}";
|
|
2347
2399
|
|
|
2348
2400
|
let SasInput = class {
|
|
2349
2401
|
constructor(hostRef) {
|
|
@@ -2682,7 +2734,7 @@ let SasInput = class {
|
|
|
2682
2734
|
, null, h("div", { class: "input-container", "data-message": this.message }, Boolean(this.label)
|
|
2683
2735
|
? h("label", { class: this.outside ? 'outside-label' : 'inside-label' }, this.label, this.required
|
|
2684
2736
|
? h("span", { class: "required-symbol" }, "*")
|
|
2685
|
-
: null, h("sas-icon", { icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
2737
|
+
: null, h("sas-icon", { class: "iconLabel", icon: this.iconLabel, onClick: this.labelIconClickHandler }))
|
|
2686
2738
|
: null, this.type === 'tel'
|
|
2687
2739
|
? h("sas-input-tel", { "data-country": this.country, "data-value": this.value, "data-placeholder": this.placeholder, "data-placeholderNumberType": this.placeholderNumberType })
|
|
2688
2740
|
: null, this.type === 'textarea'
|