@supersoniks/concorde 2.0.4 → 2.0.6
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/cli.js +0 -0
- package/concorde-core.bundle.js +175 -175
- package/concorde-core.es.js +1374 -1372
- package/decorators.d.ts +3 -0
- package/decorators.js +8 -0
- package/directives.d.ts +40 -0
- package/directives.js +16 -0
- package/package.json +6 -2
- package/utils.d.ts +1 -0
- package/utils.js +3 -0
package/concorde-core.es.js
CHANGED
|
@@ -621,7 +621,7 @@ var require_concorde_core_es = __commonJS({
|
|
|
621
621
|
return new TextDecoder().decode(result);
|
|
622
622
|
}
|
|
623
623
|
};
|
|
624
|
-
_PublisherManager.buildDate = "Thu Apr 04 2024
|
|
624
|
+
_PublisherManager.buildDate = "Thu Apr 04 2024 13:07:46 GMT+0200 (Central European Summer Time)";
|
|
625
625
|
_PublisherManager.changed = false;
|
|
626
626
|
_PublisherManager.saving = false;
|
|
627
627
|
_PublisherManager.saveId = 0;
|
|
@@ -3659,563 +3659,1006 @@ var require_concorde_core_es = __commonJS({
|
|
|
3659
3659
|
}
|
|
3660
3660
|
/*eslint-enable @typescript-eslint/no-explicit-any*/
|
|
3661
3661
|
};
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3662
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
3663
|
+
function getDefaultExportFromCjs(x2) {
|
|
3664
|
+
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
3665
|
+
}
|
|
3666
|
+
var urlPattern = { exports: {} };
|
|
3667
|
+
(function(module2, exports2) {
|
|
3668
|
+
var slice = [].slice;
|
|
3669
|
+
(function(root, factory) {
|
|
3670
|
+
if (exports2 !== null) {
|
|
3671
|
+
return module2.exports = factory();
|
|
3672
|
+
} else {
|
|
3673
|
+
return root.UrlPattern = factory();
|
|
3674
|
+
}
|
|
3675
|
+
})(commonjsGlobal, function() {
|
|
3676
|
+
var P2, UrlPattern2, astNodeContainsSegmentsForProvidedParams, astNodeToNames, astNodeToRegexString, baseAstNodeToRegexString, concatMap, defaultOptions, escapeForRegex, getParam, keysAndValuesToObject, newParser, regexGroupCount, stringConcatMap, stringify;
|
|
3677
|
+
escapeForRegex = function(string) {
|
|
3678
|
+
return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
3679
|
+
};
|
|
3680
|
+
concatMap = function(array, f2) {
|
|
3681
|
+
var i2, length, results;
|
|
3682
|
+
results = [];
|
|
3683
|
+
i2 = -1;
|
|
3684
|
+
length = array.length;
|
|
3685
|
+
while (++i2 < length) {
|
|
3686
|
+
results = results.concat(f2(array[i2]));
|
|
3687
|
+
}
|
|
3688
|
+
return results;
|
|
3689
|
+
};
|
|
3690
|
+
stringConcatMap = function(array, f2) {
|
|
3691
|
+
var i2, length, result;
|
|
3692
|
+
result = "";
|
|
3693
|
+
i2 = -1;
|
|
3694
|
+
length = array.length;
|
|
3695
|
+
while (++i2 < length) {
|
|
3696
|
+
result += f2(array[i2]);
|
|
3697
|
+
}
|
|
3698
|
+
return result;
|
|
3699
|
+
};
|
|
3700
|
+
regexGroupCount = function(regex) {
|
|
3701
|
+
return new RegExp(regex.toString() + "|").exec("").length - 1;
|
|
3702
|
+
};
|
|
3703
|
+
keysAndValuesToObject = function(keys, values) {
|
|
3704
|
+
var i2, key, length, object, value;
|
|
3705
|
+
object = {};
|
|
3706
|
+
i2 = -1;
|
|
3707
|
+
length = keys.length;
|
|
3708
|
+
while (++i2 < length) {
|
|
3709
|
+
key = keys[i2];
|
|
3710
|
+
value = values[i2];
|
|
3711
|
+
if (value == null) {
|
|
3712
|
+
continue;
|
|
3713
|
+
}
|
|
3714
|
+
if (object[key] != null) {
|
|
3715
|
+
if (!Array.isArray(object[key])) {
|
|
3716
|
+
object[key] = [object[key]];
|
|
3717
|
+
}
|
|
3718
|
+
object[key].push(value);
|
|
3719
|
+
} else {
|
|
3720
|
+
object[key] = value;
|
|
3721
|
+
}
|
|
3722
|
+
}
|
|
3723
|
+
return object;
|
|
3724
|
+
};
|
|
3725
|
+
P2 = {};
|
|
3726
|
+
P2.Result = function(value, rest) {
|
|
3727
|
+
this.value = value;
|
|
3728
|
+
this.rest = rest;
|
|
3729
|
+
};
|
|
3730
|
+
P2.Tagged = function(tag, value) {
|
|
3731
|
+
this.tag = tag;
|
|
3732
|
+
this.value = value;
|
|
3733
|
+
};
|
|
3734
|
+
P2.tag = function(tag, parser) {
|
|
3735
|
+
return function(input) {
|
|
3736
|
+
var result, tagged;
|
|
3737
|
+
result = parser(input);
|
|
3738
|
+
if (result == null) {
|
|
3711
3739
|
return;
|
|
3712
3740
|
}
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3741
|
+
tagged = new P2.Tagged(tag, result.value);
|
|
3742
|
+
return new P2.Result(tagged, result.rest);
|
|
3743
|
+
};
|
|
3744
|
+
};
|
|
3745
|
+
P2.regex = function(regex) {
|
|
3746
|
+
return function(input) {
|
|
3747
|
+
var matches, result;
|
|
3748
|
+
matches = regex.exec(input);
|
|
3749
|
+
if (matches == null) {
|
|
3750
|
+
return;
|
|
3751
|
+
}
|
|
3752
|
+
result = matches[0];
|
|
3753
|
+
return new P2.Result(result, input.slice(result.length));
|
|
3754
|
+
};
|
|
3755
|
+
};
|
|
3756
|
+
P2.sequence = function() {
|
|
3757
|
+
var parsers;
|
|
3758
|
+
parsers = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
3759
|
+
return function(input) {
|
|
3760
|
+
var i2, length, parser, rest, result, values;
|
|
3761
|
+
i2 = -1;
|
|
3762
|
+
length = parsers.length;
|
|
3763
|
+
values = [];
|
|
3764
|
+
rest = input;
|
|
3765
|
+
while (++i2 < length) {
|
|
3766
|
+
parser = parsers[i2];
|
|
3767
|
+
result = parser(rest);
|
|
3768
|
+
if (result == null) {
|
|
3716
3769
|
return;
|
|
3717
|
-
} else if (this.checked === null) {
|
|
3718
|
-
checkAllPublisher.checkMode = "someUnchecked";
|
|
3719
|
-
} else if (checkAllPublisher.checkMode.get() == "noneChecked" || checkAllPublisher.checkMode.get() == null) {
|
|
3720
|
-
checkAllPublisher.checkMode = "someUnchecked";
|
|
3721
|
-
}
|
|
3722
|
-
const currentValues = formPublisher[name].get();
|
|
3723
|
-
const allValues = checkAllPublisher.values.get();
|
|
3724
|
-
if (allValues && allValues.length) {
|
|
3725
|
-
let checkedCount = allValues.length;
|
|
3726
|
-
for (const p2 of allValues) {
|
|
3727
|
-
if (currentValues.indexOf(p2) == -1) {
|
|
3728
|
-
checkedCount -= 1;
|
|
3729
|
-
}
|
|
3730
|
-
}
|
|
3731
|
-
if (checkedCount == allValues.length) {
|
|
3732
|
-
checkAllPublisher.checkMode = "allChecked";
|
|
3733
|
-
}
|
|
3734
|
-
if (checkedCount == 0) {
|
|
3735
|
-
checkAllPublisher.checkMode = "noneChecked";
|
|
3736
|
-
}
|
|
3737
|
-
}
|
|
3738
|
-
if (allValues.indexOf(this.value) == -1) {
|
|
3739
|
-
this.checked = null;
|
|
3740
3770
|
}
|
|
3771
|
+
values.push(result.value);
|
|
3772
|
+
rest = result.rest;
|
|
3741
3773
|
}
|
|
3774
|
+
return new P2.Result(values, rest);
|
|
3742
3775
|
};
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3776
|
+
};
|
|
3777
|
+
P2.pick = function() {
|
|
3778
|
+
var indexes, parsers;
|
|
3779
|
+
indexes = arguments[0], parsers = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
|
3780
|
+
return function(input) {
|
|
3781
|
+
var array, result;
|
|
3782
|
+
result = P2.sequence.apply(P2, parsers)(input);
|
|
3783
|
+
if (result == null) {
|
|
3784
|
+
return;
|
|
3749
3785
|
}
|
|
3750
|
-
|
|
3751
|
-
|
|
3786
|
+
array = result.value;
|
|
3787
|
+
result.value = array[indexes];
|
|
3788
|
+
return result;
|
|
3789
|
+
};
|
|
3790
|
+
};
|
|
3791
|
+
P2.string = function(string) {
|
|
3792
|
+
var length;
|
|
3793
|
+
length = string.length;
|
|
3794
|
+
return function(input) {
|
|
3795
|
+
if (input.slice(0, length) === string) {
|
|
3796
|
+
return new P2.Result(string, input.slice(length));
|
|
3752
3797
|
}
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3798
|
+
};
|
|
3799
|
+
};
|
|
3800
|
+
P2.lazy = function(fn) {
|
|
3801
|
+
var cached;
|
|
3802
|
+
cached = null;
|
|
3803
|
+
return function(input) {
|
|
3804
|
+
if (cached == null) {
|
|
3805
|
+
cached = fn();
|
|
3757
3806
|
}
|
|
3807
|
+
return cached(input);
|
|
3758
3808
|
};
|
|
3759
|
-
}
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
if (newValue == null)
|
|
3771
|
-
return;
|
|
3772
|
-
this._value = newValue;
|
|
3773
|
-
if (!this.value)
|
|
3774
|
-
return;
|
|
3775
|
-
const formPublisher = this.getFormPublisher();
|
|
3776
|
-
if (formPublisher && this.name) {
|
|
3777
|
-
let currentValue = formPublisher[this.name].get();
|
|
3778
|
-
if (this.radio || this.unique) {
|
|
3779
|
-
this.checked = currentValue == newValue ? true : null;
|
|
3809
|
+
};
|
|
3810
|
+
P2.baseMany = function(parser, end, stringResult, atLeastOneResultRequired, input) {
|
|
3811
|
+
var endResult, parserResult, rest, results;
|
|
3812
|
+
rest = input;
|
|
3813
|
+
results = stringResult ? "" : [];
|
|
3814
|
+
while (true) {
|
|
3815
|
+
if (end != null) {
|
|
3816
|
+
endResult = end(rest);
|
|
3817
|
+
if (endResult != null) {
|
|
3818
|
+
break;
|
|
3819
|
+
}
|
|
3780
3820
|
}
|
|
3781
|
-
|
|
3782
|
-
|
|
3821
|
+
parserResult = parser(rest);
|
|
3822
|
+
if (parserResult == null) {
|
|
3823
|
+
break;
|
|
3783
3824
|
}
|
|
3784
|
-
if (
|
|
3785
|
-
|
|
3825
|
+
if (stringResult) {
|
|
3826
|
+
results += parserResult.value;
|
|
3827
|
+
} else {
|
|
3828
|
+
results.push(parserResult.value);
|
|
3829
|
+
}
|
|
3830
|
+
rest = parserResult.rest;
|
|
3786
3831
|
}
|
|
3787
|
-
if (
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3832
|
+
if (atLeastOneResultRequired && results.length === 0) {
|
|
3833
|
+
return;
|
|
3834
|
+
}
|
|
3835
|
+
return new P2.Result(results, rest);
|
|
3836
|
+
};
|
|
3837
|
+
P2.many1 = function(parser) {
|
|
3838
|
+
return function(input) {
|
|
3839
|
+
return P2.baseMany(parser, null, false, true, input);
|
|
3840
|
+
};
|
|
3841
|
+
};
|
|
3842
|
+
P2.concatMany1Till = function(parser, end) {
|
|
3843
|
+
return function(input) {
|
|
3844
|
+
return P2.baseMany(parser, end, true, true, input);
|
|
3845
|
+
};
|
|
3846
|
+
};
|
|
3847
|
+
P2.firstChoice = function() {
|
|
3848
|
+
var parsers;
|
|
3849
|
+
parsers = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
3850
|
+
return function(input) {
|
|
3851
|
+
var i2, length, parser, result;
|
|
3852
|
+
i2 = -1;
|
|
3853
|
+
length = parsers.length;
|
|
3854
|
+
while (++i2 < length) {
|
|
3855
|
+
parser = parsers[i2];
|
|
3856
|
+
result = parser(input);
|
|
3857
|
+
if (result != null) {
|
|
3858
|
+
return result;
|
|
3807
3859
|
}
|
|
3808
3860
|
}
|
|
3861
|
+
};
|
|
3862
|
+
};
|
|
3863
|
+
newParser = function(options) {
|
|
3864
|
+
var U;
|
|
3865
|
+
U = {};
|
|
3866
|
+
U.wildcard = P2.tag("wildcard", P2.string(options.wildcardChar));
|
|
3867
|
+
U.optional = P2.tag("optional", P2.pick(1, P2.string(options.optionalSegmentStartChar), P2.lazy(function() {
|
|
3868
|
+
return U.pattern;
|
|
3869
|
+
}), P2.string(options.optionalSegmentEndChar)));
|
|
3870
|
+
U.name = P2.regex(new RegExp("^[" + options.segmentNameCharset + "]+"));
|
|
3871
|
+
U.named = P2.tag("named", P2.pick(1, P2.string(options.segmentNameStartChar), P2.lazy(function() {
|
|
3872
|
+
return U.name;
|
|
3873
|
+
})));
|
|
3874
|
+
U.escapedChar = P2.pick(1, P2.string(options.escapeChar), P2.regex(/^./));
|
|
3875
|
+
U["static"] = P2.tag("static", P2.concatMany1Till(P2.firstChoice(P2.lazy(function() {
|
|
3876
|
+
return U.escapedChar;
|
|
3877
|
+
}), P2.regex(/^./)), P2.firstChoice(P2.string(options.segmentNameStartChar), P2.string(options.optionalSegmentStartChar), P2.string(options.optionalSegmentEndChar), U.wildcard)));
|
|
3878
|
+
U.token = P2.lazy(function() {
|
|
3879
|
+
return P2.firstChoice(U.wildcard, U.optional, U.named, U["static"]);
|
|
3880
|
+
});
|
|
3881
|
+
U.pattern = P2.many1(P2.lazy(function() {
|
|
3882
|
+
return U.token;
|
|
3883
|
+
}));
|
|
3884
|
+
return U;
|
|
3885
|
+
};
|
|
3886
|
+
defaultOptions = {
|
|
3887
|
+
escapeChar: "\\",
|
|
3888
|
+
segmentNameStartChar: ":",
|
|
3889
|
+
segmentValueCharset: "a-zA-Z0-9-_~ %",
|
|
3890
|
+
segmentNameCharset: "a-zA-Z0-9",
|
|
3891
|
+
optionalSegmentStartChar: "(",
|
|
3892
|
+
optionalSegmentEndChar: ")",
|
|
3893
|
+
wildcardChar: "*"
|
|
3894
|
+
};
|
|
3895
|
+
baseAstNodeToRegexString = function(astNode, segmentValueCharset) {
|
|
3896
|
+
if (Array.isArray(astNode)) {
|
|
3897
|
+
return stringConcatMap(astNode, function(node) {
|
|
3898
|
+
return baseAstNodeToRegexString(node, segmentValueCharset);
|
|
3899
|
+
});
|
|
3809
3900
|
}
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
const value = formPublisher[this.name].get();
|
|
3820
|
-
if ((this.unique || this.radio) && value !== null && value.toString().length > 0)
|
|
3821
|
-
return;
|
|
3822
|
-
formPublisher.isFormValid = false;
|
|
3823
|
-
input.reportValidity();
|
|
3901
|
+
switch (astNode.tag) {
|
|
3902
|
+
case "wildcard":
|
|
3903
|
+
return "(.*?)";
|
|
3904
|
+
case "named":
|
|
3905
|
+
return "([" + segmentValueCharset + "]+)";
|
|
3906
|
+
case "static":
|
|
3907
|
+
return escapeForRegex(astNode.value);
|
|
3908
|
+
case "optional":
|
|
3909
|
+
return "(?:" + baseAstNodeToRegexString(astNode.value, segmentValueCharset) + ")?";
|
|
3824
3910
|
}
|
|
3825
|
-
}
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
setCheckedValue(checked) {
|
|
3830
|
-
if (this._checked == checked)
|
|
3831
|
-
return;
|
|
3832
|
-
this._checked = checked;
|
|
3833
|
-
this.updateDataValue();
|
|
3834
|
-
this.requestUpdate();
|
|
3835
|
-
setTimeout(() => this.updateAllChecked(), 1);
|
|
3836
|
-
}
|
|
3837
|
-
handleChange() {
|
|
3838
|
-
const newCheckedValue = this.checked === true ? !this.radio ? null : true : true;
|
|
3839
|
-
this.checked = newCheckedValue;
|
|
3840
|
-
const event = new Event("change");
|
|
3841
|
-
this.dispatchEvent(event);
|
|
3842
|
-
}
|
|
3843
|
-
/**
|
|
3844
|
-
* Voir la mixin FormElement
|
|
3845
|
-
* Le comportement est ici modifié fonction de son mode (checkbox, radio, unique)
|
|
3846
|
-
*/
|
|
3847
|
-
getValueForFormPublisher() {
|
|
3848
|
-
const formPublisher = this.getFormPublisher();
|
|
3849
|
-
if (!formPublisher)
|
|
3850
|
-
return null;
|
|
3851
|
-
let currentValue = formPublisher[this.name].get();
|
|
3852
|
-
if (this.radio) {
|
|
3853
|
-
return this.checked === true && this.value != null ? this.value : currentValue;
|
|
3911
|
+
};
|
|
3912
|
+
astNodeToRegexString = function(astNode, segmentValueCharset) {
|
|
3913
|
+
if (segmentValueCharset == null) {
|
|
3914
|
+
segmentValueCharset = defaultOptions.segmentValueCharset;
|
|
3854
3915
|
}
|
|
3855
|
-
|
|
3856
|
-
|
|
3916
|
+
return "^" + baseAstNodeToRegexString(astNode, segmentValueCharset) + "$";
|
|
3917
|
+
};
|
|
3918
|
+
astNodeToNames = function(astNode) {
|
|
3919
|
+
if (Array.isArray(astNode)) {
|
|
3920
|
+
return concatMap(astNode, astNodeToNames);
|
|
3857
3921
|
}
|
|
3858
|
-
|
|
3859
|
-
|
|
3922
|
+
switch (astNode.tag) {
|
|
3923
|
+
case "wildcard":
|
|
3924
|
+
return ["_"];
|
|
3925
|
+
case "named":
|
|
3926
|
+
return [astNode.value];
|
|
3927
|
+
case "static":
|
|
3928
|
+
return [];
|
|
3929
|
+
case "optional":
|
|
3930
|
+
return astNodeToNames(astNode.value);
|
|
3860
3931
|
}
|
|
3861
|
-
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
currentValue.splice(idx, 1);
|
|
3932
|
+
};
|
|
3933
|
+
getParam = function(params, key, nextIndexes, sideEffects) {
|
|
3934
|
+
var index, maxIndex, result, value;
|
|
3935
|
+
if (sideEffects == null) {
|
|
3936
|
+
sideEffects = false;
|
|
3867
3937
|
}
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3874
|
-
|
|
3875
|
-
setFormValueFromPublisher(value) {
|
|
3876
|
-
if (this.unique || this.radio) {
|
|
3877
|
-
this.checked = this.value == value ? true : null;
|
|
3878
|
-
return;
|
|
3938
|
+
value = params[key];
|
|
3939
|
+
if (value == null) {
|
|
3940
|
+
if (sideEffects) {
|
|
3941
|
+
throw new Error("no values provided for key `" + key + "`");
|
|
3942
|
+
} else {
|
|
3943
|
+
return;
|
|
3944
|
+
}
|
|
3879
3945
|
}
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
if (
|
|
3883
|
-
|
|
3946
|
+
index = nextIndexes[key] || 0;
|
|
3947
|
+
maxIndex = Array.isArray(value) ? value.length - 1 : 0;
|
|
3948
|
+
if (index > maxIndex) {
|
|
3949
|
+
if (sideEffects) {
|
|
3950
|
+
throw new Error("too few values provided for key `" + key + "`");
|
|
3951
|
+
} else {
|
|
3952
|
+
return;
|
|
3953
|
+
}
|
|
3884
3954
|
}
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
if (!this.formDataProvider)
|
|
3889
|
-
this.formDataProvider = this.getAncestorAttributeValue("formDataProvider");
|
|
3890
|
-
const formDataProvider = this.formDataProvider;
|
|
3891
|
-
const name = this.getAttribute("name");
|
|
3892
|
-
if (!formDataProvider || !name) {
|
|
3893
|
-
return null;
|
|
3955
|
+
result = Array.isArray(value) ? value[index] : value;
|
|
3956
|
+
if (sideEffects) {
|
|
3957
|
+
nextIndexes[key] = index + 1;
|
|
3894
3958
|
}
|
|
3895
|
-
return
|
|
3896
|
-
}
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
if (idx != -1) {
|
|
3906
|
-
values.splice(idx, 1);
|
|
3907
|
-
checkAllPublisher.values = values;
|
|
3959
|
+
return result;
|
|
3960
|
+
};
|
|
3961
|
+
astNodeContainsSegmentsForProvidedParams = function(astNode, params, nextIndexes) {
|
|
3962
|
+
var i2, length;
|
|
3963
|
+
if (Array.isArray(astNode)) {
|
|
3964
|
+
i2 = -1;
|
|
3965
|
+
length = astNode.length;
|
|
3966
|
+
while (++i2 < length) {
|
|
3967
|
+
if (astNodeContainsSegmentsForProvidedParams(astNode[i2], params, nextIndexes)) {
|
|
3968
|
+
return true;
|
|
3908
3969
|
}
|
|
3909
3970
|
}
|
|
3971
|
+
return false;
|
|
3910
3972
|
}
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
}
|
|
3973
|
+
switch (astNode.tag) {
|
|
3974
|
+
case "wildcard":
|
|
3975
|
+
return getParam(params, "_", nextIndexes, false) != null;
|
|
3976
|
+
case "named":
|
|
3977
|
+
return getParam(params, astNode.value, nextIndexes, false) != null;
|
|
3978
|
+
case "static":
|
|
3979
|
+
return false;
|
|
3980
|
+
case "optional":
|
|
3981
|
+
return astNodeContainsSegmentsForProvidedParams(astNode.value, params, nextIndexes);
|
|
3921
3982
|
}
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
}
|
|
3928
|
-
if (!checkAllPublisher.values.get()) {
|
|
3929
|
-
checkAllPublisher.values = [];
|
|
3930
|
-
}
|
|
3931
|
-
if (!this.checksAll()) {
|
|
3932
|
-
checkAllPublisher.values = [...checkAllPublisher.values.get(), this.value];
|
|
3933
|
-
}
|
|
3983
|
+
};
|
|
3984
|
+
stringify = function(astNode, params, nextIndexes) {
|
|
3985
|
+
if (Array.isArray(astNode)) {
|
|
3986
|
+
return stringConcatMap(astNode, function(node) {
|
|
3987
|
+
return stringify(node, params, nextIndexes);
|
|
3988
|
+
});
|
|
3934
3989
|
}
|
|
3935
|
-
|
|
3990
|
+
switch (astNode.tag) {
|
|
3991
|
+
case "wildcard":
|
|
3992
|
+
return getParam(params, "_", nextIndexes, true);
|
|
3993
|
+
case "named":
|
|
3994
|
+
return getParam(params, astNode.value, nextIndexes, true);
|
|
3995
|
+
case "static":
|
|
3996
|
+
return astNode.value;
|
|
3997
|
+
case "optional":
|
|
3998
|
+
if (astNodeContainsSegmentsForProvidedParams(astNode.value, params, nextIndexes)) {
|
|
3999
|
+
return stringify(astNode.value, params, nextIndexes);
|
|
4000
|
+
} else {
|
|
4001
|
+
return "";
|
|
4002
|
+
}
|
|
4003
|
+
}
|
|
4004
|
+
};
|
|
4005
|
+
UrlPattern2 = function(arg1, arg2) {
|
|
4006
|
+
var groupCount, options, parsed, parser, withoutWhitespace;
|
|
4007
|
+
if (arg1 instanceof UrlPattern2) {
|
|
4008
|
+
this.isRegex = arg1.isRegex;
|
|
4009
|
+
this.regex = arg1.regex;
|
|
4010
|
+
this.ast = arg1.ast;
|
|
4011
|
+
this.names = arg1.names;
|
|
3936
4012
|
return;
|
|
3937
4013
|
}
|
|
3938
|
-
|
|
3939
|
-
|
|
4014
|
+
this.isRegex = arg1 instanceof RegExp;
|
|
4015
|
+
if (!("string" === typeof arg1 || this.isRegex)) {
|
|
4016
|
+
throw new TypeError("argument must be a regex or a string");
|
|
3940
4017
|
}
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
4018
|
+
if (this.isRegex) {
|
|
4019
|
+
this.regex = arg1;
|
|
4020
|
+
if (arg2 != null) {
|
|
4021
|
+
if (!Array.isArray(arg2)) {
|
|
4022
|
+
throw new Error("if first argument is a regex the second argument may be an array of group names but you provided something else");
|
|
4023
|
+
}
|
|
4024
|
+
groupCount = regexGroupCount(this.regex);
|
|
4025
|
+
if (arg2.length !== groupCount) {
|
|
4026
|
+
throw new Error("regex contains " + groupCount + " groups but array of group names contains " + arg2.length);
|
|
4027
|
+
}
|
|
4028
|
+
this.names = arg2;
|
|
4029
|
+
}
|
|
4030
|
+
return;
|
|
4031
|
+
}
|
|
4032
|
+
if (arg1 === "") {
|
|
4033
|
+
throw new Error("argument must not be the empty string");
|
|
4034
|
+
}
|
|
4035
|
+
withoutWhitespace = arg1.replace(/\s+/g, "");
|
|
4036
|
+
if (withoutWhitespace !== arg1) {
|
|
4037
|
+
throw new Error("argument must not contain whitespace");
|
|
4038
|
+
}
|
|
4039
|
+
options = {
|
|
4040
|
+
escapeChar: (arg2 != null ? arg2.escapeChar : void 0) || defaultOptions.escapeChar,
|
|
4041
|
+
segmentNameStartChar: (arg2 != null ? arg2.segmentNameStartChar : void 0) || defaultOptions.segmentNameStartChar,
|
|
4042
|
+
segmentNameCharset: (arg2 != null ? arg2.segmentNameCharset : void 0) || defaultOptions.segmentNameCharset,
|
|
4043
|
+
segmentValueCharset: (arg2 != null ? arg2.segmentValueCharset : void 0) || defaultOptions.segmentValueCharset,
|
|
4044
|
+
optionalSegmentStartChar: (arg2 != null ? arg2.optionalSegmentStartChar : void 0) || defaultOptions.optionalSegmentStartChar,
|
|
4045
|
+
optionalSegmentEndChar: (arg2 != null ? arg2.optionalSegmentEndChar : void 0) || defaultOptions.optionalSegmentEndChar,
|
|
4046
|
+
wildcardChar: (arg2 != null ? arg2.wildcardChar : void 0) || defaultOptions.wildcardChar
|
|
4047
|
+
};
|
|
4048
|
+
parser = newParser(options);
|
|
4049
|
+
parsed = parser.pattern(arg1);
|
|
4050
|
+
if (parsed == null) {
|
|
4051
|
+
throw new Error("couldn't parse pattern");
|
|
4052
|
+
}
|
|
4053
|
+
if (parsed.rest !== "") {
|
|
4054
|
+
throw new Error("could only partially parse pattern");
|
|
4055
|
+
}
|
|
4056
|
+
this.ast = parsed.value;
|
|
4057
|
+
this.regex = new RegExp(astNodeToRegexString(this.ast, options.segmentValueCharset));
|
|
4058
|
+
this.names = astNodeToNames(this.ast);
|
|
4059
|
+
};
|
|
4060
|
+
UrlPattern2.prototype.match = function(url) {
|
|
4061
|
+
var groups, match;
|
|
4062
|
+
match = this.regex.exec(url);
|
|
4063
|
+
if (match == null) {
|
|
4064
|
+
return null;
|
|
4065
|
+
}
|
|
4066
|
+
groups = match.slice(1);
|
|
4067
|
+
if (this.names) {
|
|
4068
|
+
return keysAndValuesToObject(this.names, groups);
|
|
4069
|
+
} else {
|
|
4070
|
+
return groups;
|
|
4071
|
+
}
|
|
4072
|
+
};
|
|
4073
|
+
UrlPattern2.prototype.stringify = function(params) {
|
|
4074
|
+
if (params == null) {
|
|
4075
|
+
params = {};
|
|
4076
|
+
}
|
|
4077
|
+
if (this.isRegex) {
|
|
4078
|
+
throw new Error("can't stringify patterns generated from a regex");
|
|
4079
|
+
}
|
|
4080
|
+
if (params !== Object(params)) {
|
|
4081
|
+
throw new Error("argument must be an object or undefined");
|
|
4082
|
+
}
|
|
4083
|
+
return stringify(this.ast, params, {});
|
|
4084
|
+
};
|
|
4085
|
+
UrlPattern2.escapeForRegex = escapeForRegex;
|
|
4086
|
+
UrlPattern2.concatMap = concatMap;
|
|
4087
|
+
UrlPattern2.stringConcatMap = stringConcatMap;
|
|
4088
|
+
UrlPattern2.regexGroupCount = regexGroupCount;
|
|
4089
|
+
UrlPattern2.keysAndValuesToObject = keysAndValuesToObject;
|
|
4090
|
+
UrlPattern2.P = P2;
|
|
4091
|
+
UrlPattern2.newParser = newParser;
|
|
4092
|
+
UrlPattern2.defaultOptions = defaultOptions;
|
|
4093
|
+
UrlPattern2.astNodeToRegexString = astNodeToRegexString;
|
|
4094
|
+
UrlPattern2.astNodeToNames = astNodeToNames;
|
|
4095
|
+
UrlPattern2.getParam = getParam;
|
|
4096
|
+
UrlPattern2.astNodeContainsSegmentsForProvidedParams = astNodeContainsSegmentsForProvidedParams;
|
|
4097
|
+
UrlPattern2.stringify = stringify;
|
|
4098
|
+
return UrlPattern2;
|
|
4099
|
+
});
|
|
4100
|
+
})(urlPattern, urlPattern.exports);
|
|
4101
|
+
var urlPatternExports = urlPattern.exports;
|
|
4102
|
+
const UrlPattern = /* @__PURE__ */ getDefaultExportFromCjs(urlPatternExports);
|
|
4103
|
+
const Utils = Utils$1;
|
|
4104
|
+
const Arrays = Arrays$1;
|
|
4105
|
+
const DataBindObserver = DataBindObserver$1;
|
|
4106
|
+
const Format = Format$1;
|
|
4107
|
+
const HTML = HTML$1;
|
|
4108
|
+
const LocationHandler = LocationHandler$1;
|
|
4109
|
+
const Objects = Objects$1;
|
|
4110
|
+
const PublisherProxy = Publisher;
|
|
4111
|
+
const PublisherManager = PublisherManager$1;
|
|
4112
|
+
const api = API;
|
|
4113
|
+
const URLPattern = UrlPattern;
|
|
4114
|
+
window["concorde-utils"] = window["concorde-utils"] || {};
|
|
4115
|
+
window["concorde-utils"] = {
|
|
4116
|
+
Utils,
|
|
4117
|
+
Arrays,
|
|
4118
|
+
DataBindObserver,
|
|
4119
|
+
Format,
|
|
4120
|
+
HTML,
|
|
4121
|
+
LocationHandler,
|
|
4122
|
+
Objects,
|
|
4123
|
+
PublisherProxy,
|
|
4124
|
+
PublisherManager,
|
|
4125
|
+
api,
|
|
4126
|
+
URLPattern
|
|
3962
4127
|
};
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
*/
|
|
3968
|
-
const o$3 = (o2) => o2 ?? T;
|
|
3969
|
-
const fontSize = i$5`
|
|
3970
|
-
/*SIZES*/
|
|
3971
|
-
:host {
|
|
3972
|
-
--sc-fs: 1rem;
|
|
3973
|
-
--sc-lh: 1.15;
|
|
3974
|
-
font-size: var(--sc-fs);
|
|
3975
|
-
line-height: var(--sc-lh);
|
|
3976
|
-
}
|
|
3977
|
-
:host([size="2xs"]) {
|
|
3978
|
-
--sc-fs: 0.625rem;
|
|
3979
|
-
}
|
|
3980
|
-
:host([size="xs"]) {
|
|
3981
|
-
--sc-fs: 0.75rem;
|
|
3982
|
-
}
|
|
3983
|
-
:host([size="sm"]) {
|
|
3984
|
-
--sc-fs: 0.875rem;
|
|
3985
|
-
}
|
|
3986
|
-
:host([size="lg"]) {
|
|
3987
|
-
--sc-fs: 1.125rem;
|
|
3988
|
-
}
|
|
3989
|
-
:host([size="xl"]) {
|
|
3990
|
-
--sc-fs: 1.25rem;
|
|
3991
|
-
}
|
|
3992
|
-
:host([size="2xl"]) {
|
|
3993
|
-
--sc-fs: 1.5rem;
|
|
3994
|
-
}
|
|
3995
|
-
`;
|
|
3996
|
-
var __defProp$12 = Object.defineProperty;
|
|
3997
|
-
var __getOwnPropDesc$12 = Object.getOwnPropertyDescriptor;
|
|
3998
|
-
var __decorateClass$12 = (decorators, target, key, kind) => {
|
|
3999
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$12(target, key) : target;
|
|
4128
|
+
var __defProp$13 = Object.defineProperty;
|
|
4129
|
+
var __getOwnPropDesc$13 = Object.getOwnPropertyDescriptor;
|
|
4130
|
+
var __decorateClass$13 = (decorators, target, key, kind) => {
|
|
4131
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$13(target, key) : target;
|
|
4000
4132
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
4001
4133
|
if (decorator = decorators[i2])
|
|
4002
4134
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4003
4135
|
if (kind && result)
|
|
4004
|
-
__defProp$
|
|
4136
|
+
__defProp$13(target, key, result);
|
|
4005
4137
|
return result;
|
|
4006
4138
|
};
|
|
4007
|
-
const
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4139
|
+
const Form$1 = (superClass) => {
|
|
4140
|
+
class FormCheckable2 extends superClass {
|
|
4141
|
+
constructor() {
|
|
4142
|
+
super(...arguments);
|
|
4143
|
+
this._value = "";
|
|
4144
|
+
this.forceAutoFill = false;
|
|
4145
|
+
this.unique = null;
|
|
4146
|
+
this.radio = null;
|
|
4147
|
+
this.unCheckOnDisconnect = false;
|
|
4148
|
+
this._checked = null;
|
|
4149
|
+
this.updateAllChecked = () => {
|
|
4150
|
+
const name = this.getAttribute("name");
|
|
4151
|
+
const checkAllPublisher = this.getCheckAllPublisher();
|
|
4152
|
+
const formPublisher = this.getFormPublisher();
|
|
4153
|
+
if (!(checkAllPublisher == null ? void 0 : checkAllPublisher.hasCheckAll.get())) {
|
|
4154
|
+
return;
|
|
4155
|
+
}
|
|
4156
|
+
if (!this.checksAll() && checkAllPublisher && formPublisher && name) {
|
|
4157
|
+
if (!formPublisher[this.name].get().length) {
|
|
4158
|
+
checkAllPublisher.checkMode = "noneChecked";
|
|
4159
|
+
return;
|
|
4160
|
+
} else if (this.checked === null) {
|
|
4161
|
+
checkAllPublisher.checkMode = "someUnchecked";
|
|
4162
|
+
} else if (checkAllPublisher.checkMode.get() == "noneChecked" || checkAllPublisher.checkMode.get() == null) {
|
|
4163
|
+
checkAllPublisher.checkMode = "someUnchecked";
|
|
4164
|
+
}
|
|
4165
|
+
const currentValues = formPublisher[name].get();
|
|
4166
|
+
const allValues = checkAllPublisher.values.get();
|
|
4167
|
+
if (allValues && allValues.length) {
|
|
4168
|
+
let checkedCount = allValues.length;
|
|
4169
|
+
for (const p2 of allValues) {
|
|
4170
|
+
if (currentValues.indexOf(p2) == -1) {
|
|
4171
|
+
checkedCount -= 1;
|
|
4172
|
+
}
|
|
4173
|
+
}
|
|
4174
|
+
if (checkedCount == allValues.length) {
|
|
4175
|
+
checkAllPublisher.checkMode = "allChecked";
|
|
4176
|
+
}
|
|
4177
|
+
if (checkedCount == 0) {
|
|
4178
|
+
checkAllPublisher.checkMode = "noneChecked";
|
|
4179
|
+
}
|
|
4180
|
+
}
|
|
4181
|
+
if (allValues.indexOf(this.value) == -1) {
|
|
4182
|
+
this.checked = null;
|
|
4183
|
+
}
|
|
4184
|
+
}
|
|
4185
|
+
};
|
|
4186
|
+
this.onChecksAllRequest = (value) => {
|
|
4187
|
+
this.removeAttribute("allChecked");
|
|
4188
|
+
this.removeAttribute("indeterminate");
|
|
4189
|
+
if (value == "allChecked") {
|
|
4190
|
+
this.checked = true;
|
|
4191
|
+
this.setAttribute("allChecked", "");
|
|
4192
|
+
}
|
|
4193
|
+
if (value == "noneChecked") {
|
|
4194
|
+
this.checked = null;
|
|
4195
|
+
}
|
|
4196
|
+
if (value == "someUnchecked") {
|
|
4197
|
+
if (this.checksAll())
|
|
4198
|
+
this.checked = "indeterminate";
|
|
4199
|
+
this.setAttribute("indeterminate", "");
|
|
4200
|
+
}
|
|
4201
|
+
};
|
|
4202
|
+
}
|
|
4203
|
+
get value() {
|
|
4204
|
+
return this._value;
|
|
4205
|
+
}
|
|
4206
|
+
set value(newValue) {
|
|
4207
|
+
if (this.value == newValue)
|
|
4208
|
+
return;
|
|
4209
|
+
if (this.hasAttribute("value") && !this.forceAutoFill)
|
|
4210
|
+
newValue = this.getAttribute("value");
|
|
4211
|
+
if (this._value == newValue)
|
|
4212
|
+
return;
|
|
4213
|
+
if (newValue == null)
|
|
4214
|
+
return;
|
|
4215
|
+
this._value = newValue;
|
|
4216
|
+
if (!this.value)
|
|
4217
|
+
return;
|
|
4218
|
+
const formPublisher = this.getFormPublisher();
|
|
4219
|
+
if (formPublisher && this.name) {
|
|
4220
|
+
let currentValue = formPublisher[this.name].get();
|
|
4221
|
+
if (this.radio || this.unique) {
|
|
4222
|
+
this.checked = currentValue == newValue ? true : null;
|
|
4223
|
+
}
|
|
4224
|
+
if (!Array.isArray(currentValue)) {
|
|
4225
|
+
currentValue = [];
|
|
4226
|
+
}
|
|
4227
|
+
if (currentValue.indexOf(newValue) != -1)
|
|
4228
|
+
this.checked = true;
|
|
4037
4229
|
}
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
set href(value) {
|
|
4042
|
-
this._href = value;
|
|
4043
|
-
if (this.href && this.href.indexOf("http") != 0) {
|
|
4044
|
-
LocationHandler$1.onChange(this);
|
|
4045
|
-
} else
|
|
4046
|
-
LocationHandler$1.offChange(this);
|
|
4047
|
-
this.requestUpdate();
|
|
4048
|
-
}
|
|
4049
|
-
get href() {
|
|
4050
|
-
return this._href;
|
|
4051
|
-
}
|
|
4052
|
-
handleNavigation(e2) {
|
|
4053
|
-
e2.preventDefault();
|
|
4054
|
-
LocationHandler$1.changeFromComponent(this);
|
|
4055
|
-
}
|
|
4056
|
-
handleChange(e2) {
|
|
4057
|
-
if ((e2 == null ? void 0 : e2.type) == "click" && this.autoRepeat)
|
|
4058
|
-
return;
|
|
4059
|
-
super.handleChange();
|
|
4060
|
-
if (this.pushState || this.goBack !== null) {
|
|
4061
|
-
e2 == null ? void 0 : e2.preventDefault();
|
|
4062
|
-
e2 == null ? void 0 : e2.stopPropagation();
|
|
4063
|
-
LocationHandler$1.changeFromComponent(this);
|
|
4230
|
+
if (this.checked == true)
|
|
4231
|
+
this.updateDataValue();
|
|
4232
|
+
this.requestUpdate();
|
|
4064
4233
|
}
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
const formPublisher = resetDataProvider ? PublisherManager.get(resetDataProvider) : this.getFormPublisher();
|
|
4068
|
-
if (formPublisher)
|
|
4069
|
-
formPublisher.set({});
|
|
4234
|
+
get checked() {
|
|
4235
|
+
return this._checked;
|
|
4070
4236
|
}
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4237
|
+
set checked(checked) {
|
|
4238
|
+
this.setCheckedValue(checked);
|
|
4239
|
+
if (this.checksAll()) {
|
|
4240
|
+
const checkAllPublisher = this.getCheckAllPublisher();
|
|
4241
|
+
if (checkAllPublisher) {
|
|
4242
|
+
if (this.checked === true)
|
|
4243
|
+
checkAllPublisher.checkMode = "allChecked";
|
|
4244
|
+
else if (this.checked === null) {
|
|
4245
|
+
checkAllPublisher.checkMode = "noneChecked";
|
|
4246
|
+
const formPublisher = this.getFormPublisher();
|
|
4247
|
+
if (formPublisher) {
|
|
4248
|
+
formPublisher[this.name] = [];
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
this.requestUpdate();
|
|
4078
4254
|
}
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4255
|
+
validateFormElement() {
|
|
4256
|
+
var _a2;
|
|
4257
|
+
const input = (_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector("input");
|
|
4258
|
+
if (!input || input.checkValidity())
|
|
4259
|
+
return;
|
|
4260
|
+
const formPublisher = this.getFormPublisher();
|
|
4261
|
+
if (formPublisher) {
|
|
4262
|
+
const value = formPublisher[this.name].get();
|
|
4263
|
+
if ((this.unique || this.radio) && value !== null && value.toString().length > 0)
|
|
4264
|
+
return;
|
|
4265
|
+
formPublisher.isFormValid = false;
|
|
4266
|
+
input.reportValidity();
|
|
4267
|
+
}
|
|
4088
4268
|
}
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
this.handleChange();
|
|
4095
|
-
this.lastRepeatTime = Date.now();
|
|
4096
|
-
}
|
|
4097
|
-
connectedCallback() {
|
|
4098
|
-
super.connectedCallback();
|
|
4099
|
-
}
|
|
4100
|
-
setCheckedValue(checked) {
|
|
4101
|
-
if (this.name) {
|
|
4102
|
-
if (checked)
|
|
4103
|
-
this.setAttribute("active", "true");
|
|
4104
|
-
else
|
|
4105
|
-
this.removeAttribute("active");
|
|
4106
|
-
if (checked == this._checked)
|
|
4269
|
+
checksAll() {
|
|
4270
|
+
return this.hasAttribute("checksAll");
|
|
4271
|
+
}
|
|
4272
|
+
setCheckedValue(checked) {
|
|
4273
|
+
if (this._checked == checked)
|
|
4107
4274
|
return;
|
|
4108
|
-
|
|
4275
|
+
this._checked = checked;
|
|
4276
|
+
this.updateDataValue();
|
|
4277
|
+
this.requestUpdate();
|
|
4278
|
+
setTimeout(() => this.updateAllChecked(), 1);
|
|
4109
4279
|
}
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
willUpdate(changedProperties) {
|
|
4116
|
-
if (changedProperties.has("href") || changedProperties.has("autoActive")) {
|
|
4117
|
-
LocationHandler$1.updateComponentActiveState(this);
|
|
4280
|
+
handleChange() {
|
|
4281
|
+
const newCheckedValue = this.checked === true ? !this.radio ? null : true : true;
|
|
4282
|
+
this.checked = newCheckedValue;
|
|
4283
|
+
const event = new Event("change");
|
|
4284
|
+
this.dispatchEvent(event);
|
|
4118
4285
|
}
|
|
4119
|
-
|
|
4120
|
-
|
|
4286
|
+
/**
|
|
4287
|
+
* Voir la mixin FormElement
|
|
4288
|
+
* Le comportement est ici modifié fonction de son mode (checkbox, radio, unique)
|
|
4289
|
+
*/
|
|
4290
|
+
getValueForFormPublisher() {
|
|
4291
|
+
const formPublisher = this.getFormPublisher();
|
|
4292
|
+
if (!formPublisher)
|
|
4293
|
+
return null;
|
|
4294
|
+
let currentValue = formPublisher[this.name].get();
|
|
4295
|
+
if (this.radio) {
|
|
4296
|
+
return this.checked === true && this.value != null ? this.value : currentValue;
|
|
4297
|
+
}
|
|
4298
|
+
if (this.unique) {
|
|
4299
|
+
return this.checked === true && this.value != null ? this.value : null;
|
|
4300
|
+
}
|
|
4301
|
+
if (!Array.isArray(currentValue)) {
|
|
4302
|
+
currentValue = [];
|
|
4303
|
+
}
|
|
4304
|
+
currentValue = currentValue.slice(0);
|
|
4305
|
+
const idx = currentValue.indexOf(this.value);
|
|
4306
|
+
if (this.checked === true && idx === -1 && !this.checksAll())
|
|
4307
|
+
currentValue.push(this.value);
|
|
4308
|
+
if (this.checked === null && idx !== -1) {
|
|
4309
|
+
currentValue.splice(idx, 1);
|
|
4310
|
+
}
|
|
4311
|
+
return currentValue;
|
|
4312
|
+
}
|
|
4313
|
+
/**
|
|
4314
|
+
* Voir la mixin FormElement
|
|
4315
|
+
* Le comportement est modifié de la manière suivante :
|
|
4316
|
+
* L'état du composant (checked) est mis à jour en fonction de la valeur fournie par le publisher associé au composant / en fonction de sont mode (radio, unique)
|
|
4317
|
+
*/
|
|
4318
|
+
setFormValueFromPublisher(value) {
|
|
4319
|
+
if (this.unique || this.radio) {
|
|
4320
|
+
this.checked = this.value == value ? true : null;
|
|
4321
|
+
return;
|
|
4322
|
+
}
|
|
4323
|
+
if (!Array.isArray(value))
|
|
4324
|
+
value = [];
|
|
4325
|
+
if (this.checksAll()) {
|
|
4326
|
+
return;
|
|
4327
|
+
}
|
|
4328
|
+
this.checked = value.indexOf(this.value) !== -1 ? true : null;
|
|
4329
|
+
}
|
|
4330
|
+
getCheckAllPublisher() {
|
|
4331
|
+
if (!this.formDataProvider)
|
|
4332
|
+
this.formDataProvider = this.getAncestorAttributeValue("formDataProvider");
|
|
4333
|
+
const formDataProvider = this.formDataProvider;
|
|
4334
|
+
const name = this.getAttribute("name");
|
|
4335
|
+
if (!formDataProvider || !name) {
|
|
4336
|
+
return null;
|
|
4337
|
+
}
|
|
4338
|
+
return PublisherManager.get(formDataProvider + "/" + name + "/_available_values_");
|
|
4339
|
+
}
|
|
4340
|
+
disconnectedCallback() {
|
|
4341
|
+
super.disconnectedCallback();
|
|
4342
|
+
const checkAllPublisher = this.getCheckAllPublisher();
|
|
4343
|
+
if (checkAllPublisher) {
|
|
4344
|
+
checkAllPublisher.checkMode.offAssign(this.onChecksAllRequest);
|
|
4345
|
+
if (!this.checksAll()) {
|
|
4346
|
+
const values = checkAllPublisher.values.get().slice(0);
|
|
4347
|
+
const idx = values.indexOf(this.value);
|
|
4348
|
+
if (idx != -1) {
|
|
4349
|
+
values.splice(idx, 1);
|
|
4350
|
+
checkAllPublisher.values = values;
|
|
4351
|
+
}
|
|
4352
|
+
}
|
|
4353
|
+
}
|
|
4354
|
+
setTimeout(() => this.updateAllChecked(), 1);
|
|
4355
|
+
}
|
|
4356
|
+
connectedCallback() {
|
|
4357
|
+
super.connectedCallback();
|
|
4358
|
+
const formPublisher = this.getFormPublisher();
|
|
4359
|
+
if (formPublisher && this.name) {
|
|
4360
|
+
const publisherValueForName = formPublisher[this.name].get();
|
|
4361
|
+
if (publisherValueForName && Array.isArray(publisherValueForName) && publisherValueForName.indexOf(this.value) !== -1) {
|
|
4362
|
+
this.checked = true;
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
const checkAllPublisher = this.getCheckAllPublisher();
|
|
4366
|
+
if (checkAllPublisher) {
|
|
4367
|
+
checkAllPublisher.checkMode.onAssign(this.onChecksAllRequest);
|
|
4368
|
+
if (this.checksAll()) {
|
|
4369
|
+
checkAllPublisher.hasCheckAll = true;
|
|
4370
|
+
}
|
|
4371
|
+
if (!checkAllPublisher.values.get()) {
|
|
4372
|
+
checkAllPublisher.values = [];
|
|
4373
|
+
}
|
|
4374
|
+
if (!this.checksAll()) {
|
|
4375
|
+
checkAllPublisher.values = [...checkAllPublisher.values.get(), this.value];
|
|
4376
|
+
}
|
|
4377
|
+
}
|
|
4378
|
+
if (!this.hasAttribute("checked")) {
|
|
4379
|
+
return;
|
|
4380
|
+
}
|
|
4381
|
+
if (!this.publisher || this.publisher.get().checked !== false) {
|
|
4382
|
+
setTimeout(() => this.checked = true, 1);
|
|
4383
|
+
}
|
|
4121
4384
|
}
|
|
4122
4385
|
}
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
}
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
>
|
|
4143
|
-
<slot @slotchange=${this.onSlotChange} part="prefix" name="prefix"></slot>
|
|
4144
|
-
<slot part="main" class="main-slot"></slot>
|
|
4145
|
-
<slot @slotchange=${this.onSlotChange} part="suffix" name="suffix"></slot>
|
|
4146
|
-
${this.loading == true ? x$1`<sonic-icon name="loader" class="loader"></sonic-icon>` : ""}
|
|
4147
|
-
</button>
|
|
4148
|
-
`;
|
|
4149
|
-
return this.href ? x$1`<a
|
|
4150
|
-
href="${this.href}"
|
|
4151
|
-
download=${o$3(this.download)}
|
|
4152
|
-
target=${o$3(this.target)}
|
|
4153
|
-
aria-label=${o$3(this.ariaLabel)}
|
|
4154
|
-
aria-labelledby=${o$3(this.ariaLabelledby)}
|
|
4155
|
-
@click=${this.pushState || this.goBack !== null ? this.handleNavigation : null}
|
|
4156
|
-
>${btn}</a
|
|
4157
|
-
>` : x$1`${btn}`;
|
|
4158
|
-
}
|
|
4159
|
-
onSlotChange() {
|
|
4160
|
-
var _a2, _b2;
|
|
4161
|
-
this.hasPrefix = !!((_a2 = this.prefixes) == null ? void 0 : _a2.length);
|
|
4162
|
-
this.hasSuffix = !!((_b2 = this.suffixes) == null ? void 0 : _b2.length);
|
|
4163
|
-
}
|
|
4386
|
+
__decorateClass$13([
|
|
4387
|
+
n$5()
|
|
4388
|
+
], FormCheckable2.prototype, "value", 1);
|
|
4389
|
+
__decorateClass$13([
|
|
4390
|
+
n$5()
|
|
4391
|
+
], FormCheckable2.prototype, "forceAutoFill", 2);
|
|
4392
|
+
__decorateClass$13([
|
|
4393
|
+
n$5({ type: Boolean })
|
|
4394
|
+
], FormCheckable2.prototype, "unique", 2);
|
|
4395
|
+
__decorateClass$13([
|
|
4396
|
+
n$5({ type: Boolean })
|
|
4397
|
+
], FormCheckable2.prototype, "radio", 2);
|
|
4398
|
+
__decorateClass$13([
|
|
4399
|
+
n$5({ type: Boolean })
|
|
4400
|
+
], FormCheckable2.prototype, "unCheckOnDisconnect", 2);
|
|
4401
|
+
__decorateClass$13([
|
|
4402
|
+
n$5()
|
|
4403
|
+
], FormCheckable2.prototype, "checked", 1);
|
|
4404
|
+
return FormCheckable2;
|
|
4164
4405
|
};
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4406
|
+
/**
|
|
4407
|
+
* @license
|
|
4408
|
+
* Copyright 2018 Google LLC
|
|
4409
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4410
|
+
*/
|
|
4411
|
+
const o$3 = (o2) => o2 ?? T;
|
|
4412
|
+
const fontSize = i$5`
|
|
4413
|
+
/*SIZES*/
|
|
4414
|
+
:host {
|
|
4415
|
+
--sc-fs: 1rem;
|
|
4416
|
+
--sc-lh: 1.15;
|
|
4417
|
+
font-size: var(--sc-fs);
|
|
4418
|
+
line-height: var(--sc-lh);
|
|
4419
|
+
}
|
|
4420
|
+
:host([size="2xs"]) {
|
|
4421
|
+
--sc-fs: 0.625rem;
|
|
4422
|
+
}
|
|
4423
|
+
:host([size="xs"]) {
|
|
4424
|
+
--sc-fs: 0.75rem;
|
|
4425
|
+
}
|
|
4426
|
+
:host([size="sm"]) {
|
|
4427
|
+
--sc-fs: 0.875rem;
|
|
4428
|
+
}
|
|
4429
|
+
:host([size="lg"]) {
|
|
4430
|
+
--sc-fs: 1.125rem;
|
|
4431
|
+
}
|
|
4432
|
+
:host([size="xl"]) {
|
|
4433
|
+
--sc-fs: 1.25rem;
|
|
4434
|
+
}
|
|
4435
|
+
:host([size="2xl"]) {
|
|
4436
|
+
--sc-fs: 1.5rem;
|
|
4437
|
+
}
|
|
4438
|
+
`;
|
|
4439
|
+
var __defProp$12 = Object.defineProperty;
|
|
4440
|
+
var __getOwnPropDesc$12 = Object.getOwnPropertyDescriptor;
|
|
4441
|
+
var __decorateClass$12 = (decorators, target, key, kind) => {
|
|
4442
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$12(target, key) : target;
|
|
4443
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
4444
|
+
if (decorator = decorators[i2])
|
|
4445
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4446
|
+
if (kind && result)
|
|
4447
|
+
__defProp$12(target, key, result);
|
|
4448
|
+
return result;
|
|
4449
|
+
};
|
|
4450
|
+
const tagName$Z = "sonic-button";
|
|
4451
|
+
let Button = class extends Form$1(Form$2(Subscriber$1(s$1))) {
|
|
4452
|
+
constructor() {
|
|
4453
|
+
super(...arguments);
|
|
4454
|
+
this.type = "default";
|
|
4455
|
+
this.variant = "default";
|
|
4456
|
+
this.shape = "default";
|
|
4457
|
+
this.direction = "row";
|
|
4458
|
+
this.alignItems = "center";
|
|
4459
|
+
this.justify = "center";
|
|
4460
|
+
this.minWidth = "0";
|
|
4461
|
+
this.icon = false;
|
|
4462
|
+
this.download = null;
|
|
4463
|
+
this.autoActive = "partial";
|
|
4464
|
+
this.loading = false;
|
|
4465
|
+
this.hasPrefix = false;
|
|
4466
|
+
this.hasSuffix = false;
|
|
4467
|
+
this._href = "";
|
|
4468
|
+
this.goBack = null;
|
|
4469
|
+
this.pushState = false;
|
|
4470
|
+
this.active = false;
|
|
4471
|
+
this.autoRepeat = false;
|
|
4472
|
+
this.pointerDownTime = 0;
|
|
4473
|
+
this.lastRepeatTime = 0;
|
|
4474
|
+
this.isRepeating = false;
|
|
4475
|
+
this.handleRepeatend = () => {
|
|
4476
|
+
window.removeEventListener("pointerup", this.handleRepeatend);
|
|
4477
|
+
window.removeEventListener("blur", this.handleRepeatend);
|
|
4478
|
+
if (this.autoRepeat) {
|
|
4479
|
+
this.isRepeating = false;
|
|
4480
|
+
}
|
|
4481
|
+
};
|
|
4482
|
+
this.location = "";
|
|
4170
4483
|
}
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
--sc-btn-fw: var(--sc-btn-font-weight);
|
|
4179
|
-
|
|
4180
|
-
--sc-btn-height: var(--sc-form-height);
|
|
4181
|
-
--btn-color: var(--sc-btn-color, var(--sc-base-content));
|
|
4182
|
-
--btn-bg: var(--sc-btn-bg, var(--sc-base-100));
|
|
4183
|
-
|
|
4184
|
-
--sc-btn-border-style: solid;
|
|
4185
|
-
--sc-btn-border-width: var(--sc-form-border-width);
|
|
4186
|
-
--sc-btn-border-color: transparent;
|
|
4187
|
-
|
|
4188
|
-
--btn-outline-bg-hover: var(--sc-btn-outline-bg-hover, var(--sc-base-100));
|
|
4189
|
-
--sc-btn-ghost-bg-hover: var(--sc-base-100);
|
|
4190
|
-
|
|
4191
|
-
--sc-btn-active-color: var(--sc-base);
|
|
4192
|
-
--sc-btn-hover-filter: brightness(0.98);
|
|
4193
|
-
--sc-btn-active-filter: brightness(0.97);
|
|
4194
|
-
--sc-btn-active-bg: var(--sc-base-content);
|
|
4195
|
-
|
|
4196
|
-
--sc-item-rounded-tr: var(--sc-btn-rounded);
|
|
4197
|
-
--sc-item-rounded-tl: var(--sc-btn-rounded);
|
|
4198
|
-
--sc-item-rounded-bl: var(--sc-btn-rounded);
|
|
4199
|
-
--sc-item-rounded-br: var(--sc-btn-rounded);
|
|
4200
|
-
|
|
4201
|
-
display: inline-flex;
|
|
4202
|
-
vertical-align: middle;
|
|
4203
|
-
box-sizing: border-box;
|
|
4204
|
-
-webkit-print-color-adjust: exact;
|
|
4484
|
+
set href(value) {
|
|
4485
|
+
this._href = value;
|
|
4486
|
+
if (this.href && this.href.indexOf("http") != 0) {
|
|
4487
|
+
LocationHandler$1.onChange(this);
|
|
4488
|
+
} else
|
|
4489
|
+
LocationHandler$1.offChange(this);
|
|
4490
|
+
this.requestUpdate();
|
|
4205
4491
|
}
|
|
4206
|
-
|
|
4207
|
-
|
|
4208
|
-
display: contents;
|
|
4209
|
-
color: unset;
|
|
4492
|
+
get href() {
|
|
4493
|
+
return this._href;
|
|
4210
4494
|
}
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4495
|
+
handleNavigation(e2) {
|
|
4496
|
+
e2.preventDefault();
|
|
4497
|
+
LocationHandler$1.changeFromComponent(this);
|
|
4498
|
+
}
|
|
4499
|
+
handleChange(e2) {
|
|
4500
|
+
if ((e2 == null ? void 0 : e2.type) == "click" && this.autoRepeat)
|
|
4501
|
+
return;
|
|
4502
|
+
super.handleChange();
|
|
4503
|
+
if (this.pushState || this.goBack !== null) {
|
|
4504
|
+
e2 == null ? void 0 : e2.preventDefault();
|
|
4505
|
+
e2 == null ? void 0 : e2.stopPropagation();
|
|
4506
|
+
LocationHandler$1.changeFromComponent(this);
|
|
4507
|
+
}
|
|
4508
|
+
if (this.hasAttribute("reset")) {
|
|
4509
|
+
const resetDataProvider = this.getAttribute("reset");
|
|
4510
|
+
const formPublisher = resetDataProvider ? PublisherManager.get(resetDataProvider) : this.getFormPublisher();
|
|
4511
|
+
if (formPublisher)
|
|
4512
|
+
formPublisher.set({});
|
|
4513
|
+
}
|
|
4514
|
+
}
|
|
4515
|
+
handleRepeatStart(e2) {
|
|
4516
|
+
if (this.autoRepeat) {
|
|
4517
|
+
this.handleChange(e2);
|
|
4518
|
+
this.pointerDownTime = Date.now();
|
|
4519
|
+
this.isRepeating = true;
|
|
4520
|
+
this.repeat();
|
|
4521
|
+
}
|
|
4522
|
+
window.addEventListener("pointerup", this.handleRepeatend);
|
|
4523
|
+
window.addEventListener("blur", this.handleRepeatend);
|
|
4524
|
+
}
|
|
4525
|
+
repeat() {
|
|
4526
|
+
if (!this.isRepeating)
|
|
4527
|
+
return;
|
|
4528
|
+
if (this.hasAttribute("disabled")) {
|
|
4529
|
+
this.isRepeating = false;
|
|
4530
|
+
return;
|
|
4531
|
+
}
|
|
4532
|
+
window.requestAnimationFrame(this.repeat.bind(this));
|
|
4533
|
+
if (Date.now() - this.pointerDownTime < 500)
|
|
4534
|
+
return;
|
|
4535
|
+
if (Date.now() - this.lastRepeatTime < 100)
|
|
4536
|
+
return;
|
|
4537
|
+
this.handleChange();
|
|
4538
|
+
this.lastRepeatTime = Date.now();
|
|
4539
|
+
}
|
|
4540
|
+
connectedCallback() {
|
|
4541
|
+
super.connectedCallback();
|
|
4542
|
+
}
|
|
4543
|
+
setCheckedValue(checked) {
|
|
4544
|
+
if (this.name) {
|
|
4545
|
+
if (checked)
|
|
4546
|
+
this.setAttribute("active", "true");
|
|
4547
|
+
else
|
|
4548
|
+
this.removeAttribute("active");
|
|
4549
|
+
if (checked == this._checked)
|
|
4550
|
+
return;
|
|
4551
|
+
super.setCheckedValue(checked);
|
|
4552
|
+
}
|
|
4553
|
+
}
|
|
4554
|
+
disconnectedCallback() {
|
|
4555
|
+
LocationHandler$1.offChange(this);
|
|
4556
|
+
super.disconnectedCallback();
|
|
4557
|
+
}
|
|
4558
|
+
willUpdate(changedProperties) {
|
|
4559
|
+
if (changedProperties.has("href") || changedProperties.has("autoActive")) {
|
|
4560
|
+
LocationHandler$1.updateComponentActiveState(this);
|
|
4561
|
+
}
|
|
4562
|
+
if (changedProperties.has("location")) {
|
|
4563
|
+
LocationHandler$1.updateComponentActiveState(this);
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
render() {
|
|
4567
|
+
const btnStyles = {
|
|
4568
|
+
flexDirection: this.direction,
|
|
4569
|
+
alignItems: this.alignItems,
|
|
4570
|
+
justifyContent: this.justify,
|
|
4571
|
+
align: this.align,
|
|
4572
|
+
minWidth: this.minWidth
|
|
4573
|
+
};
|
|
4574
|
+
const btn = x$1`
|
|
4575
|
+
<button
|
|
4576
|
+
part="button"
|
|
4577
|
+
class=${this.hasPrefix || this.hasSuffix ? "has-prefix-or-suffix" : ""}
|
|
4578
|
+
style=${o$4(btnStyles)}
|
|
4579
|
+
aria-controls=${o$3(this.ariaControls)}
|
|
4580
|
+
aria-expanded=${o$3(this.sonicAriaExpanded)}
|
|
4581
|
+
aria-label=${o$3(this.ariaLabel)}
|
|
4582
|
+
aria-labelledby=${o$3(this.ariaLabelledby)}
|
|
4583
|
+
@click=${this.handleChange}
|
|
4584
|
+
@pointerdown=${this.handleRepeatStart}
|
|
4585
|
+
>
|
|
4586
|
+
<slot @slotchange=${this.onSlotChange} part="prefix" name="prefix"></slot>
|
|
4587
|
+
<slot part="main" class="main-slot"></slot>
|
|
4588
|
+
<slot @slotchange=${this.onSlotChange} part="suffix" name="suffix"></slot>
|
|
4589
|
+
${this.loading == true ? x$1`<sonic-icon name="loader" class="loader"></sonic-icon>` : ""}
|
|
4590
|
+
</button>
|
|
4591
|
+
`;
|
|
4592
|
+
return this.href ? x$1`<a
|
|
4593
|
+
href="${this.href}"
|
|
4594
|
+
download=${o$3(this.download)}
|
|
4595
|
+
target=${o$3(this.target)}
|
|
4596
|
+
aria-label=${o$3(this.ariaLabel)}
|
|
4597
|
+
aria-labelledby=${o$3(this.ariaLabelledby)}
|
|
4598
|
+
@click=${this.pushState || this.goBack !== null ? this.handleNavigation : null}
|
|
4599
|
+
>${btn}</a
|
|
4600
|
+
>` : x$1`${btn}`;
|
|
4601
|
+
}
|
|
4602
|
+
onSlotChange() {
|
|
4603
|
+
var _a2, _b2;
|
|
4604
|
+
this.hasPrefix = !!((_a2 = this.prefixes) == null ? void 0 : _a2.length);
|
|
4605
|
+
this.hasSuffix = !!((_b2 = this.suffixes) == null ? void 0 : _b2.length);
|
|
4606
|
+
}
|
|
4607
|
+
};
|
|
4608
|
+
Button.styles = [
|
|
4609
|
+
fontSize,
|
|
4610
|
+
i$5`
|
|
4611
|
+
* {
|
|
4612
|
+
box-sizing: border-box;
|
|
4613
|
+
}
|
|
4614
|
+
:host {
|
|
4615
|
+
--sc-btn-gap: 0.35em;
|
|
4616
|
+
--sc-btn-py: 0.25em;
|
|
4617
|
+
--sc-btn-px: 1.1em;
|
|
4618
|
+
--sc-btn-fs: var(--sc-fs, 1rem);
|
|
4619
|
+
--sc-btn-fw: var(--sc-btn-font-weight);
|
|
4620
|
+
--sc-btn-ff: var(--sc-btn-font-family);
|
|
4621
|
+
--sc-btn-fw: var(--sc-btn-font-weight);
|
|
4622
|
+
|
|
4623
|
+
--sc-btn-height: var(--sc-form-height);
|
|
4624
|
+
--btn-color: var(--sc-btn-color, var(--sc-base-content));
|
|
4625
|
+
--btn-bg: var(--sc-btn-bg, var(--sc-base-100));
|
|
4626
|
+
|
|
4627
|
+
--sc-btn-border-style: solid;
|
|
4628
|
+
--sc-btn-border-width: var(--sc-form-border-width);
|
|
4629
|
+
--sc-btn-border-color: transparent;
|
|
4630
|
+
|
|
4631
|
+
--btn-outline-bg-hover: var(--sc-btn-outline-bg-hover, var(--sc-base-100));
|
|
4632
|
+
--sc-btn-ghost-bg-hover: var(--sc-base-100);
|
|
4633
|
+
|
|
4634
|
+
--sc-btn-active-color: var(--sc-base);
|
|
4635
|
+
--sc-btn-hover-filter: brightness(0.98);
|
|
4636
|
+
--sc-btn-active-filter: brightness(0.97);
|
|
4637
|
+
--sc-btn-active-bg: var(--sc-base-content);
|
|
4638
|
+
|
|
4639
|
+
--sc-item-rounded-tr: var(--sc-btn-rounded);
|
|
4640
|
+
--sc-item-rounded-tl: var(--sc-btn-rounded);
|
|
4641
|
+
--sc-item-rounded-bl: var(--sc-btn-rounded);
|
|
4642
|
+
--sc-item-rounded-br: var(--sc-btn-rounded);
|
|
4643
|
+
|
|
4644
|
+
display: inline-flex;
|
|
4645
|
+
vertical-align: middle;
|
|
4646
|
+
box-sizing: border-box;
|
|
4647
|
+
-webkit-print-color-adjust: exact;
|
|
4648
|
+
}
|
|
4649
|
+
|
|
4650
|
+
:host a {
|
|
4651
|
+
display: contents;
|
|
4652
|
+
color: unset;
|
|
4653
|
+
}
|
|
4654
|
+
|
|
4655
|
+
:host button {
|
|
4656
|
+
display: flex;
|
|
4657
|
+
flex: 1;
|
|
4658
|
+
box-sizing: border-box;
|
|
4659
|
+
align-items: center;
|
|
4660
|
+
justify-content: center;
|
|
4661
|
+
|
|
4219
4662
|
font-family: var(--sc-btn-ff);
|
|
4220
4663
|
font-weight: var(--sc-btn-fw);
|
|
4221
4664
|
font-size: var(--sc-btn-fs);
|
|
@@ -6729,887 +7172,446 @@ var require_concorde_core_es = __commonJS({
|
|
|
6729
7172
|
const split = dataProvider.split("?");
|
|
6730
7173
|
split.shift();
|
|
6731
7174
|
const searchParams = new URLSearchParams(split.join("?"));
|
|
6732
|
-
const filterData = (_a2 = this.filterPublisher) == null ? void 0 : _a2.get();
|
|
6733
|
-
const filteredFieldsArray = this.filteredFields.split(" ");
|
|
6734
|
-
for (const f2 in filterData) {
|
|
6735
|
-
let value = filterData[f2];
|
|
6736
|
-
if (Array.isArray(value))
|
|
6737
|
-
value = value.filter((v2) => v2 !== null);
|
|
6738
|
-
if (this.filteredFields && !filteredFieldsArray.includes(f2) || value == null || value.toString() === "")
|
|
6739
|
-
continue;
|
|
6740
|
-
searchParams.set(f2, filterData[f2].toString());
|
|
6741
|
-
}
|
|
6742
|
-
const searchHash = searchParams.toString();
|
|
6743
|
-
if (searchHash == this.searchHash && !this.isFirstRequest)
|
|
6744
|
-
return;
|
|
6745
|
-
this.searchHash = searchHash;
|
|
6746
|
-
for (const dataProvider2 of this.listDataProviders) {
|
|
6747
|
-
PublisherManager$1.delete(dataProvider2);
|
|
6748
|
-
}
|
|
6749
|
-
this.listDataProviders = [];
|
|
6750
|
-
clearTimeout(this.filterTimeoutId);
|
|
6751
|
-
this.filterTimeoutId = setTimeout(
|
|
6752
|
-
async () => {
|
|
6753
|
-
const count = this.resultCount;
|
|
6754
|
-
this.props = null;
|
|
6755
|
-
this.requestId++;
|
|
6756
|
-
this.resultCount = count;
|
|
6757
|
-
await PublisherManager$1.getInstance().isLocalStrorageReady;
|
|
6758
|
-
window.requestAnimationFrame(() => this.next());
|
|
6759
|
-
},
|
|
6760
|
-
this.isFirstRequest ? 0 : this.filterTimeoutMs
|
|
6761
|
-
);
|
|
6762
|
-
this.isFirstRequest = false;
|
|
6763
|
-
};
|
|
6764
|
-
this.dataProviderExpression = "";
|
|
6765
|
-
this.idKey = "id";
|
|
6766
|
-
this.listDataProviders = [];
|
|
6767
|
-
this.nextHadEvent = false;
|
|
6768
|
-
}
|
|
6769
|
-
disconnectedCallback() {
|
|
6770
|
-
var _a2;
|
|
6771
|
-
for (const dataProvider of this.listDataProviders) {
|
|
6772
|
-
PublisherManager$1.delete(dataProvider);
|
|
6773
|
-
this.listDataProviders = [];
|
|
6774
|
-
}
|
|
6775
|
-
(_a2 = this.filterPublisher) == null ? void 0 : _a2.offInternalMutation(this.updateFilteredContent);
|
|
6776
|
-
this.props = null;
|
|
6777
|
-
this.limit = 5;
|
|
6778
|
-
this.offset = 0;
|
|
6779
|
-
this.resultCount = 0;
|
|
6780
|
-
this.searchHash = "";
|
|
6781
|
-
this.requestId = 0;
|
|
6782
|
-
this.isFirstRequest = true;
|
|
6783
|
-
this.nextHadEvent = false;
|
|
6784
|
-
this.publisher.set({});
|
|
6785
|
-
super.disconnectedCallback();
|
|
6786
|
-
return;
|
|
6787
|
-
}
|
|
6788
|
-
async connectedCallback() {
|
|
6789
|
-
this.instanceId = Queue.instanceCounter++;
|
|
6790
|
-
this.localStorage = this.getAttribute("localStorage") || this.localStorage;
|
|
6791
|
-
this.filterTimeoutMs = parseInt(this.getAttribute("filterTimeoutMs") || "400");
|
|
6792
|
-
this.removeAttribute("localStorage");
|
|
6793
|
-
this.noShadowDom = "";
|
|
6794
|
-
this.defferedDebug = this.hasAttribute("debug") || null;
|
|
6795
|
-
if (!this.dataProvider)
|
|
6796
|
-
this.dataProvider = this.dataProviderExpression || "sonic-queue-" + this.instanceId + "-" + Math.random().toString(36).substring(7);
|
|
6797
|
-
if (!this.dataProviderExpression) {
|
|
6798
|
-
this.dataProviderExpression = HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") || "";
|
|
6799
|
-
}
|
|
6800
|
-
super.connectedCallback();
|
|
6801
|
-
this.publisher.set({});
|
|
6802
|
-
this.key = this.getAttribute("key");
|
|
6803
|
-
await PublisherManager$1.getInstance().isLocalStrorageReady;
|
|
6804
|
-
if (!this.templates)
|
|
6805
|
-
this.templates = Array.from(this.querySelectorAll("template"));
|
|
6806
|
-
this.lastRequestTime = (/* @__PURE__ */ new Date()).getTime();
|
|
6807
|
-
this.configFilter();
|
|
6808
|
-
}
|
|
6809
|
-
configFilter() {
|
|
6810
|
-
var _a2;
|
|
6811
|
-
const dataFilterProvider = this.getAncestorAttributeValue("dataFilterProvider");
|
|
6812
|
-
if (!dataFilterProvider) {
|
|
6813
|
-
this.next();
|
|
6814
|
-
return;
|
|
6815
|
-
}
|
|
6816
|
-
this.filterPublisher = PublisherManager$1.getInstance().get(dataFilterProvider);
|
|
6817
|
-
(_a2 = this.filterPublisher) == null ? void 0 : _a2.onInternalMutation(this.updateFilteredContent);
|
|
6818
|
-
}
|
|
6819
|
-
resetDuration() {
|
|
6820
|
-
this.lastRequestTime = (/* @__PURE__ */ new Date()).getTime();
|
|
6821
|
-
}
|
|
6822
|
-
next(e2) {
|
|
6823
|
-
var _a2;
|
|
6824
|
-
let offset = this.offset;
|
|
6825
|
-
const newTime = (/* @__PURE__ */ new Date()).getTime();
|
|
6826
|
-
const requestDuration = newTime - this.lastRequestTime;
|
|
6827
|
-
if (!this.nextHadEvent && e2) {
|
|
6828
|
-
this.publisher.resultCount = 0;
|
|
6829
|
-
this.resultCount = 0;
|
|
6830
|
-
}
|
|
6831
|
-
this.nextHadEvent = !!e2;
|
|
6832
|
-
if (e2) {
|
|
6833
|
-
this.publisher.lastFetchedData = e2.detail.fetchedData;
|
|
6834
|
-
if (e2.detail.requestId < this.requestId)
|
|
6835
|
-
return;
|
|
6836
|
-
this.resultCount += e2.detail.props.length;
|
|
6837
|
-
if (!e2.detail.isFirstLoad || !e2.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
|
|
6838
|
-
this.publisher.resultCount = this.resultCount;
|
|
6839
|
-
return;
|
|
6840
|
-
}
|
|
6841
|
-
}
|
|
6842
|
-
if (!Array.isArray(this.props)) {
|
|
6843
|
-
const newProps2 = [];
|
|
6844
|
-
newProps2.resultCount = this.resultCount;
|
|
6845
|
-
newProps2.lastFetchedData = (e2 == null ? void 0 : e2.detail.fetchedData) || {};
|
|
6846
|
-
this.props = newProps2;
|
|
6847
|
-
} else {
|
|
6848
|
-
const props = this.props;
|
|
6849
|
-
const item = props[props.length - 1];
|
|
6850
|
-
offset = parseInt(item.offset.toString()) + parseInt(item.limit.toString());
|
|
6851
|
-
}
|
|
6852
|
-
if (requestDuration > 0 && e2 && !this.localStorage) {
|
|
6853
|
-
this.limit = Math.round(this.limit / requestDuration * this.targetRequestDuration);
|
|
6854
|
-
}
|
|
6855
|
-
if (this.limit < 1)
|
|
6856
|
-
this.limit = 1;
|
|
6857
|
-
if (this.limit > 15)
|
|
6858
|
-
this.limit = 15;
|
|
6859
|
-
let dataProvider = this.dataProviderExpression.replace("$offset", offset + "").replace("$limit", this.limit + "");
|
|
6860
|
-
const split = dataProvider.split("?");
|
|
6861
|
-
let endpoint = split.shift();
|
|
6862
|
-
const searchParams = new URLSearchParams(split.join("?"));
|
|
6863
|
-
const filterData = (_a2 = this.filterPublisher) == null ? void 0 : _a2.get();
|
|
6864
|
-
const filteredFieldsArray = this.filteredFields.split(" ");
|
|
6865
|
-
for (const f2 in filterData) {
|
|
6866
|
-
if (this.filteredFields && filteredFieldsArray.includes(f2) || filterData[f2] == null || filterData[f2] == "")
|
|
6867
|
-
continue;
|
|
6868
|
-
searchParams.set(f2, filterData[f2]);
|
|
6869
|
-
}
|
|
6870
|
-
if (!this.searchHash)
|
|
6871
|
-
this.searchHash = searchParams.toString();
|
|
6872
|
-
endpoint = endpoint + "?" + searchParams.toString();
|
|
6873
|
-
dataProvider = dataProvider + "_item_from_queue_" + this.instanceId;
|
|
6874
|
-
this.listDataProviders.push(dataProvider);
|
|
6875
|
-
const newProps = [
|
|
6876
|
-
...this.props,
|
|
6877
|
-
{
|
|
6878
|
-
id: searchParams.toString() + "/" + this.props.length,
|
|
6879
|
-
dataProvider,
|
|
6880
|
-
endPoint: endpoint,
|
|
6881
|
-
offset,
|
|
6882
|
-
limit: this.limit
|
|
6883
|
-
}
|
|
6884
|
-
];
|
|
6885
|
-
newProps.resultCount = this.resultCount;
|
|
6886
|
-
newProps.lastFetchedData = (e2 == null ? void 0 : e2.detail.fetchedData) || {};
|
|
6887
|
-
this.props = newProps;
|
|
6888
|
-
this.lastRequestTime = (/* @__PURE__ */ new Date()).getTime();
|
|
6889
|
-
}
|
|
6890
|
-
render() {
|
|
6891
|
-
if (!Array.isArray(this.props))
|
|
6892
|
-
return T;
|
|
6893
|
-
let lazyload = !this.noLazyload;
|
|
6894
|
-
if (this.props.length == 1) {
|
|
6895
|
-
lazyload = false;
|
|
6896
|
-
}
|
|
6897
|
-
return x$1`
|
|
6898
|
-
${o(this.props, (item, index) => {
|
|
6899
|
-
var _a2;
|
|
6900
|
-
const templates = index == 0 ? this.templates : (_a2 = this.templates) == null ? void 0 : _a2.filter((elt) => elt.getAttribute("data-value") != "no-item");
|
|
6901
|
-
return x$1`
|
|
6902
|
-
<sonic-list
|
|
6903
|
-
fetch
|
|
6904
|
-
loader="inline"
|
|
6905
|
-
cache=${this.cache}
|
|
6906
|
-
displayContents
|
|
6907
|
-
lazyBoundsRatio=${this.lazyBoundsRatio}
|
|
6908
|
-
?lazyload=${lazyload}
|
|
6909
|
-
localStorage=${this.localStorage}
|
|
6910
|
-
requestId=${this.requestId}
|
|
6911
|
-
.itemPropertyMap=${this.itemPropertyMap}
|
|
6912
|
-
?debug=${this.defferedDebug === true}
|
|
6913
|
-
@load=${this.next}
|
|
6914
|
-
key=${this.key}
|
|
6915
|
-
@loading=${this.resetDuration}
|
|
6916
|
-
dataProvider="${item.dataProvider}"
|
|
6917
|
-
endPoint="${item.endPoint}"
|
|
6918
|
-
idKey=${this.idKey}
|
|
6919
|
-
.templates=${templates}
|
|
6920
|
-
>
|
|
6921
|
-
</sonic-list>
|
|
6922
|
-
`;
|
|
6923
|
-
})}
|
|
6924
|
-
`;
|
|
6925
|
-
}
|
|
6926
|
-
};
|
|
6927
|
-
Queue.instanceCounter = 0;
|
|
6928
|
-
__decorateClass$S([
|
|
6929
|
-
n$5({ type: Array })
|
|
6930
|
-
], Queue.prototype, "templates", 2);
|
|
6931
|
-
__decorateClass$S([
|
|
6932
|
-
n$5({ type: Object })
|
|
6933
|
-
], Queue.prototype, "itemPropertyMap", 2);
|
|
6934
|
-
__decorateClass$S([
|
|
6935
|
-
n$5()
|
|
6936
|
-
], Queue.prototype, "cache", 2);
|
|
6937
|
-
__decorateClass$S([
|
|
6938
|
-
n$5()
|
|
6939
|
-
], Queue.prototype, "targetRequestDuration", 2);
|
|
6940
|
-
__decorateClass$S([
|
|
6941
|
-
n$5()
|
|
6942
|
-
], Queue.prototype, "limit", 2);
|
|
6943
|
-
__decorateClass$S([
|
|
6944
|
-
n$5()
|
|
6945
|
-
], Queue.prototype, "lazyBoundsRatio", 2);
|
|
6946
|
-
__decorateClass$S([
|
|
6947
|
-
n$5()
|
|
6948
|
-
], Queue.prototype, "offset", 2);
|
|
6949
|
-
__decorateClass$S([
|
|
6950
|
-
n$5()
|
|
6951
|
-
], Queue.prototype, "resultCount", 2);
|
|
6952
|
-
__decorateClass$S([
|
|
6953
|
-
n$5({ type: Boolean })
|
|
6954
|
-
], Queue.prototype, "noLazyload", 2);
|
|
6955
|
-
__decorateClass$S([
|
|
6956
|
-
n$5()
|
|
6957
|
-
], Queue.prototype, "filteredFields", 2);
|
|
6958
|
-
__decorateClass$S([
|
|
6959
|
-
n$5({ type: String })
|
|
6960
|
-
], Queue.prototype, "dataProviderExpression", 2);
|
|
6961
|
-
__decorateClass$S([
|
|
6962
|
-
n$5({ type: String })
|
|
6963
|
-
], Queue.prototype, "idKey", 2);
|
|
6964
|
-
Queue = __decorateClass$S([
|
|
6965
|
-
t$4(tagName$P)
|
|
6966
|
-
], Queue);
|
|
6967
|
-
var __defProp$R = Object.defineProperty;
|
|
6968
|
-
var __getOwnPropDesc$R = Object.getOwnPropertyDescriptor;
|
|
6969
|
-
var __decorateClass$R = (decorators, target, key, kind) => {
|
|
6970
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$R(target, key) : target;
|
|
6971
|
-
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
6972
|
-
if (decorator = decorators[i2])
|
|
6973
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6974
|
-
if (kind && result)
|
|
6975
|
-
__defProp$R(target, key, result);
|
|
6976
|
-
return result;
|
|
6977
|
-
};
|
|
6978
|
-
const tagName$O = "sonic-submit";
|
|
6979
|
-
let Submit = class extends Subscriber$1(s$1) {
|
|
6980
|
-
constructor() {
|
|
6981
|
-
super(...arguments);
|
|
6982
|
-
this.submitResultKey = null;
|
|
6983
|
-
this.disabled = false;
|
|
6984
|
-
this.endPoint = null;
|
|
6985
|
-
this.name = "";
|
|
6986
|
-
this.value = "";
|
|
6987
|
-
this.api = null;
|
|
6988
|
-
}
|
|
6989
|
-
connectedCallback() {
|
|
6990
|
-
if (this.hasAttribute("onClick")) {
|
|
6991
|
-
this.addEventListener("click", () => this.submit());
|
|
6992
|
-
}
|
|
6993
|
-
if (this.hasAttribute("onEnterKey")) {
|
|
6994
|
-
this.addEventListener("keydown", (e2) => {
|
|
6995
|
-
if (e2.key === "Enter")
|
|
6996
|
-
this.submit();
|
|
6997
|
-
});
|
|
6998
|
-
}
|
|
6999
|
-
super.connectedCallback();
|
|
7000
|
-
this.api = new API(this.getApiConfiguration());
|
|
7001
|
-
}
|
|
7002
|
-
submitNativeForm() {
|
|
7003
|
-
const form2 = HTML.getClosestForm(this);
|
|
7004
|
-
if (!form2)
|
|
7005
|
-
return;
|
|
7006
|
-
const formDataProvider = this.getAncestorAttributeValue("formDataProvider");
|
|
7007
|
-
const formData = PublisherManager$1.get(formDataProvider).get();
|
|
7008
|
-
for (const name in formData) {
|
|
7009
|
-
if (name == "isFormValid")
|
|
7010
|
-
continue;
|
|
7011
|
-
let control = form2.querySelector(
|
|
7012
|
-
'input[name="' + name + '"], select[name="' + name + '"], textarea[name="' + name + '"]'
|
|
7013
|
-
);
|
|
7014
|
-
if (!control) {
|
|
7015
|
-
control = document.createElement("input");
|
|
7016
|
-
control.type = "hidden";
|
|
7017
|
-
control.name = name;
|
|
7018
|
-
form2.appendChild(control);
|
|
7019
|
-
}
|
|
7020
|
-
let value = formData[name];
|
|
7021
|
-
if (Array.isArray(value))
|
|
7022
|
-
value = value.join(",");
|
|
7023
|
-
if (control.type === "checkbox" || control.type === "radio") {
|
|
7024
|
-
if (value)
|
|
7025
|
-
control.checked = true;
|
|
7026
|
-
} else {
|
|
7027
|
-
control.value = value;
|
|
7028
|
-
}
|
|
7029
|
-
}
|
|
7030
|
-
const submitButton = document.createElement("input");
|
|
7031
|
-
submitButton.name = this.name;
|
|
7032
|
-
submitButton.style.display = "none";
|
|
7033
|
-
submitButton.value = this.value;
|
|
7034
|
-
submitButton.type = "submit";
|
|
7035
|
-
form2.appendChild(submitButton);
|
|
7036
|
-
if (submitButton)
|
|
7037
|
-
submitButton.click();
|
|
7038
|
-
}
|
|
7039
|
-
async submit() {
|
|
7040
|
-
var _a2;
|
|
7041
|
-
const formPublisher = PublisherManager$1.getInstance().get(this.getAncestorAttributeValue("formDataProvider"));
|
|
7042
|
-
formPublisher.isFormValid = true;
|
|
7043
|
-
formPublisher.invalidate();
|
|
7044
|
-
if (!formPublisher.isFormValid.get())
|
|
7045
|
-
return;
|
|
7046
|
-
if (this.publisher)
|
|
7047
|
-
this.publisher.disabled = true;
|
|
7048
|
-
formPublisher.isFormValid;
|
|
7049
|
-
const native = this.hasAttribute("native");
|
|
7050
|
-
if (native) {
|
|
7051
|
-
this.submitNativeForm();
|
|
7052
|
-
return;
|
|
7053
|
-
}
|
|
7054
|
-
const method = ((_a2 = this.getAttribute("method")) == null ? void 0 : _a2.toLocaleLowerCase()) || "post";
|
|
7055
|
-
const sendAsFormData = this.hasAttribute("sendAsFormData");
|
|
7056
|
-
const formData = formPublisher.get();
|
|
7057
|
-
delete formData.isFormValid;
|
|
7058
|
-
const headesDataProvider = this.getAncestorAttributeValue("headersDataProvider");
|
|
7059
|
-
const headerPublisher = headesDataProvider ? PublisherManager$1.getInstance().get(headesDataProvider) : null;
|
|
7060
|
-
let headerData = {};
|
|
7061
|
-
if (headerPublisher)
|
|
7062
|
-
headerData = headerPublisher.get();
|
|
7063
|
-
let result = null;
|
|
7064
|
-
const dataProvider = this.getAncestorAttributeValue("dataProvider");
|
|
7065
|
-
const endPoint = this.endPoint || dataProvider;
|
|
7066
|
-
Loader.show();
|
|
7067
|
-
const sendData = async () => {
|
|
7068
|
-
var _a3, _b2, _c, _d, _e, _f, _g;
|
|
7069
|
-
if (sendAsFormData) {
|
|
7070
|
-
result = await ((_a3 = this.api) == null ? void 0 : _a3.submitFormData(endPoint, formData, method, headerData));
|
|
7071
|
-
} else {
|
|
7072
|
-
switch (method) {
|
|
7073
|
-
case "put":
|
|
7074
|
-
result = await ((_b2 = this.api) == null ? void 0 : _b2.put(endPoint, formData, headerData));
|
|
7075
|
-
break;
|
|
7076
|
-
case "delete":
|
|
7077
|
-
result = await ((_c = this.api) == null ? void 0 : _c.delete(endPoint, formData, headerData));
|
|
7078
|
-
break;
|
|
7079
|
-
case "get":
|
|
7080
|
-
const params = new URLSearchParams();
|
|
7081
|
-
if (formData) {
|
|
7082
|
-
for (const key in formData) {
|
|
7083
|
-
params.append(key, formData[key]);
|
|
7084
|
-
}
|
|
7085
|
-
}
|
|
7086
|
-
const paramString = "?" + params.toString();
|
|
7087
|
-
result = await ((_d = this.api) == null ? void 0 : _d.get(endPoint + paramString, headerData));
|
|
7088
|
-
break;
|
|
7089
|
-
default:
|
|
7090
|
-
result = await ((_e = this.api) == null ? void 0 : _e.post(endPoint, formData, headerData));
|
|
7091
|
-
break;
|
|
7092
|
-
}
|
|
7093
|
-
}
|
|
7094
|
-
Loader.hide();
|
|
7095
|
-
if (!result)
|
|
7096
|
-
result = { messages: [{ content: "Network Error", status: "error" }] };
|
|
7097
|
-
else if (result._sonic_http_response_ && !result._sonic_http_response_.ok && Object.keys(result).length === 1)
|
|
7098
|
-
result.messages = [{ content: "Network Error", status: "error" }];
|
|
7099
|
-
const clearedDataProvider = this.getAncestorAttributeValue("clearedDataOnSuccess");
|
|
7100
|
-
if (clearedDataProvider) {
|
|
7101
|
-
clearedDataProvider.split(" ").forEach((dataProvider2) => PublisherManager$1.get(dataProvider2).set({}));
|
|
7102
|
-
}
|
|
7103
|
-
const username_key = this.hasAttribute("usernameKey") ? this.getAttribute("usernameKey") : "username";
|
|
7104
|
-
const password_key = this.hasAttribute("passwordKey") ? this.getAttribute("passwordKey") : "password";
|
|
7105
|
-
if (((_g = (_f = this.api) == null ? void 0 : _f.lastResult) == null ? void 0 : _g.ok) && formData[username_key] && formData[password_key]) {
|
|
7106
|
-
this.saveCredentials(formData[username_key], formData[password_key]);
|
|
7107
|
-
}
|
|
7108
|
-
if (this.submitResultKey) {
|
|
7109
|
-
result = Objects$1.traverse(result, this.submitResultKey.split("."), true);
|
|
7110
|
-
}
|
|
7111
|
-
const submitResultDataProvider = this.getAncestorAttributeValue("submitResultDataProvider");
|
|
7112
|
-
if (submitResultDataProvider)
|
|
7113
|
-
PublisherManager$1.get(submitResultDataProvider).set(result);
|
|
7114
|
-
if (this.publisher)
|
|
7115
|
-
this.publisher.disabled = null;
|
|
7116
|
-
};
|
|
7117
|
-
const captchaPublisher = (headerPublisher == null ? void 0 : headerPublisher.needsCaptchaValidation.get()) ? headerPublisher : formPublisher.needsCaptchaValidation.get() ? formPublisher : null;
|
|
7118
|
-
if (captchaPublisher) {
|
|
7119
|
-
captchaPublisher.captchaMethod = method;
|
|
7120
|
-
captchaPublisher.captchaAction = (dataProvider == null ? void 0 : dataProvider.split("?")[0]) ?? this.getAncestorAttributeValue("formDataProvider") ?? "submit";
|
|
7121
|
-
captchaPublisher.captchaToken = "request_token";
|
|
7122
|
-
const captchaAssign = (token) => {
|
|
7123
|
-
if (token != "request_token" && token != "") {
|
|
7124
|
-
sendData();
|
|
7125
|
-
captchaPublisher.captchaToken.offAssign(captchaAssign);
|
|
7126
|
-
}
|
|
7127
|
-
};
|
|
7128
|
-
captchaPublisher.captchaToken.onAssign(captchaAssign);
|
|
7129
|
-
} else {
|
|
7130
|
-
sendData();
|
|
7131
|
-
}
|
|
7132
|
-
}
|
|
7133
|
-
async saveCredentials(username, password2) {
|
|
7134
|
-
if ("PasswordCredential" in window) {
|
|
7135
|
-
const credential = new window.PasswordCredential({
|
|
7136
|
-
id: username,
|
|
7137
|
-
// name: "Carina Anand", // In case of a login, the name comes from the server.
|
|
7138
|
-
password: password2
|
|
7139
|
-
});
|
|
7140
|
-
await navigator.credentials.store(credential);
|
|
7141
|
-
}
|
|
7142
|
-
}
|
|
7143
|
-
render() {
|
|
7144
|
-
return x$1`<div ?data-disabled=${this.disabled}><slot></slot></div>`;
|
|
7145
|
-
}
|
|
7146
|
-
};
|
|
7147
|
-
Submit.styles = i$5`
|
|
7148
|
-
[data-disabled] {
|
|
7149
|
-
opacity: 0.3;
|
|
7150
|
-
pointer-events: none;
|
|
7151
|
-
user-select: none;
|
|
7152
|
-
}
|
|
7153
|
-
`;
|
|
7154
|
-
__decorateClass$R([
|
|
7155
|
-
n$5({ type: String })
|
|
7156
|
-
], Submit.prototype, "submitResultKey", 2);
|
|
7157
|
-
__decorateClass$R([
|
|
7158
|
-
n$5({ type: Boolean })
|
|
7159
|
-
], Submit.prototype, "disabled", 2);
|
|
7160
|
-
__decorateClass$R([
|
|
7161
|
-
n$5({ type: String })
|
|
7162
|
-
], Submit.prototype, "endPoint", 2);
|
|
7163
|
-
__decorateClass$R([
|
|
7164
|
-
n$5()
|
|
7165
|
-
], Submit.prototype, "name", 2);
|
|
7166
|
-
__decorateClass$R([
|
|
7167
|
-
n$5()
|
|
7168
|
-
], Submit.prototype, "value", 2);
|
|
7169
|
-
Submit = __decorateClass$R([
|
|
7170
|
-
t$4(tagName$O)
|
|
7171
|
-
], Submit);
|
|
7172
|
-
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
7173
|
-
function getDefaultExportFromCjs(x2) {
|
|
7174
|
-
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
7175
|
-
}
|
|
7176
|
-
var urlPattern = { exports: {} };
|
|
7177
|
-
(function(module2, exports2) {
|
|
7178
|
-
var slice = [].slice;
|
|
7179
|
-
(function(root, factory) {
|
|
7180
|
-
if (exports2 !== null) {
|
|
7181
|
-
return module2.exports = factory();
|
|
7182
|
-
} else {
|
|
7183
|
-
return root.UrlPattern = factory();
|
|
7184
|
-
}
|
|
7185
|
-
})(commonjsGlobal, function() {
|
|
7186
|
-
var P2, UrlPattern2, astNodeContainsSegmentsForProvidedParams, astNodeToNames, astNodeToRegexString, baseAstNodeToRegexString, concatMap, defaultOptions, escapeForRegex, getParam, keysAndValuesToObject, newParser, regexGroupCount, stringConcatMap, stringify;
|
|
7187
|
-
escapeForRegex = function(string) {
|
|
7188
|
-
return string.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&");
|
|
7189
|
-
};
|
|
7190
|
-
concatMap = function(array, f2) {
|
|
7191
|
-
var i2, length, results;
|
|
7192
|
-
results = [];
|
|
7193
|
-
i2 = -1;
|
|
7194
|
-
length = array.length;
|
|
7195
|
-
while (++i2 < length) {
|
|
7196
|
-
results = results.concat(f2(array[i2]));
|
|
7197
|
-
}
|
|
7198
|
-
return results;
|
|
7199
|
-
};
|
|
7200
|
-
stringConcatMap = function(array, f2) {
|
|
7201
|
-
var i2, length, result;
|
|
7202
|
-
result = "";
|
|
7203
|
-
i2 = -1;
|
|
7204
|
-
length = array.length;
|
|
7205
|
-
while (++i2 < length) {
|
|
7206
|
-
result += f2(array[i2]);
|
|
7207
|
-
}
|
|
7208
|
-
return result;
|
|
7209
|
-
};
|
|
7210
|
-
regexGroupCount = function(regex) {
|
|
7211
|
-
return new RegExp(regex.toString() + "|").exec("").length - 1;
|
|
7212
|
-
};
|
|
7213
|
-
keysAndValuesToObject = function(keys, values) {
|
|
7214
|
-
var i2, key, length, object, value;
|
|
7215
|
-
object = {};
|
|
7216
|
-
i2 = -1;
|
|
7217
|
-
length = keys.length;
|
|
7218
|
-
while (++i2 < length) {
|
|
7219
|
-
key = keys[i2];
|
|
7220
|
-
value = values[i2];
|
|
7221
|
-
if (value == null) {
|
|
7222
|
-
continue;
|
|
7223
|
-
}
|
|
7224
|
-
if (object[key] != null) {
|
|
7225
|
-
if (!Array.isArray(object[key])) {
|
|
7226
|
-
object[key] = [object[key]];
|
|
7227
|
-
}
|
|
7228
|
-
object[key].push(value);
|
|
7229
|
-
} else {
|
|
7230
|
-
object[key] = value;
|
|
7231
|
-
}
|
|
7232
|
-
}
|
|
7233
|
-
return object;
|
|
7234
|
-
};
|
|
7235
|
-
P2 = {};
|
|
7236
|
-
P2.Result = function(value, rest) {
|
|
7237
|
-
this.value = value;
|
|
7238
|
-
this.rest = rest;
|
|
7239
|
-
};
|
|
7240
|
-
P2.Tagged = function(tag, value) {
|
|
7241
|
-
this.tag = tag;
|
|
7242
|
-
this.value = value;
|
|
7243
|
-
};
|
|
7244
|
-
P2.tag = function(tag, parser) {
|
|
7245
|
-
return function(input) {
|
|
7246
|
-
var result, tagged;
|
|
7247
|
-
result = parser(input);
|
|
7248
|
-
if (result == null) {
|
|
7249
|
-
return;
|
|
7250
|
-
}
|
|
7251
|
-
tagged = new P2.Tagged(tag, result.value);
|
|
7252
|
-
return new P2.Result(tagged, result.rest);
|
|
7253
|
-
};
|
|
7254
|
-
};
|
|
7255
|
-
P2.regex = function(regex) {
|
|
7256
|
-
return function(input) {
|
|
7257
|
-
var matches, result;
|
|
7258
|
-
matches = regex.exec(input);
|
|
7259
|
-
if (matches == null) {
|
|
7260
|
-
return;
|
|
7261
|
-
}
|
|
7262
|
-
result = matches[0];
|
|
7263
|
-
return new P2.Result(result, input.slice(result.length));
|
|
7264
|
-
};
|
|
7265
|
-
};
|
|
7266
|
-
P2.sequence = function() {
|
|
7267
|
-
var parsers;
|
|
7268
|
-
parsers = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
7269
|
-
return function(input) {
|
|
7270
|
-
var i2, length, parser, rest, result, values;
|
|
7271
|
-
i2 = -1;
|
|
7272
|
-
length = parsers.length;
|
|
7273
|
-
values = [];
|
|
7274
|
-
rest = input;
|
|
7275
|
-
while (++i2 < length) {
|
|
7276
|
-
parser = parsers[i2];
|
|
7277
|
-
result = parser(rest);
|
|
7278
|
-
if (result == null) {
|
|
7279
|
-
return;
|
|
7280
|
-
}
|
|
7281
|
-
values.push(result.value);
|
|
7282
|
-
rest = result.rest;
|
|
7283
|
-
}
|
|
7284
|
-
return new P2.Result(values, rest);
|
|
7285
|
-
};
|
|
7286
|
-
};
|
|
7287
|
-
P2.pick = function() {
|
|
7288
|
-
var indexes, parsers;
|
|
7289
|
-
indexes = arguments[0], parsers = 2 <= arguments.length ? slice.call(arguments, 1) : [];
|
|
7290
|
-
return function(input) {
|
|
7291
|
-
var array, result;
|
|
7292
|
-
result = P2.sequence.apply(P2, parsers)(input);
|
|
7293
|
-
if (result == null) {
|
|
7294
|
-
return;
|
|
7295
|
-
}
|
|
7296
|
-
array = result.value;
|
|
7297
|
-
result.value = array[indexes];
|
|
7298
|
-
return result;
|
|
7299
|
-
};
|
|
7300
|
-
};
|
|
7301
|
-
P2.string = function(string) {
|
|
7302
|
-
var length;
|
|
7303
|
-
length = string.length;
|
|
7304
|
-
return function(input) {
|
|
7305
|
-
if (input.slice(0, length) === string) {
|
|
7306
|
-
return new P2.Result(string, input.slice(length));
|
|
7307
|
-
}
|
|
7308
|
-
};
|
|
7309
|
-
};
|
|
7310
|
-
P2.lazy = function(fn) {
|
|
7311
|
-
var cached;
|
|
7312
|
-
cached = null;
|
|
7313
|
-
return function(input) {
|
|
7314
|
-
if (cached == null) {
|
|
7315
|
-
cached = fn();
|
|
7316
|
-
}
|
|
7317
|
-
return cached(input);
|
|
7318
|
-
};
|
|
7319
|
-
};
|
|
7320
|
-
P2.baseMany = function(parser, end, stringResult, atLeastOneResultRequired, input) {
|
|
7321
|
-
var endResult, parserResult, rest, results;
|
|
7322
|
-
rest = input;
|
|
7323
|
-
results = stringResult ? "" : [];
|
|
7324
|
-
while (true) {
|
|
7325
|
-
if (end != null) {
|
|
7326
|
-
endResult = end(rest);
|
|
7327
|
-
if (endResult != null) {
|
|
7328
|
-
break;
|
|
7329
|
-
}
|
|
7330
|
-
}
|
|
7331
|
-
parserResult = parser(rest);
|
|
7332
|
-
if (parserResult == null) {
|
|
7333
|
-
break;
|
|
7334
|
-
}
|
|
7335
|
-
if (stringResult) {
|
|
7336
|
-
results += parserResult.value;
|
|
7337
|
-
} else {
|
|
7338
|
-
results.push(parserResult.value);
|
|
7339
|
-
}
|
|
7340
|
-
rest = parserResult.rest;
|
|
7341
|
-
}
|
|
7342
|
-
if (atLeastOneResultRequired && results.length === 0) {
|
|
7343
|
-
return;
|
|
7344
|
-
}
|
|
7345
|
-
return new P2.Result(results, rest);
|
|
7346
|
-
};
|
|
7347
|
-
P2.many1 = function(parser) {
|
|
7348
|
-
return function(input) {
|
|
7349
|
-
return P2.baseMany(parser, null, false, true, input);
|
|
7350
|
-
};
|
|
7351
|
-
};
|
|
7352
|
-
P2.concatMany1Till = function(parser, end) {
|
|
7353
|
-
return function(input) {
|
|
7354
|
-
return P2.baseMany(parser, end, true, true, input);
|
|
7355
|
-
};
|
|
7356
|
-
};
|
|
7357
|
-
P2.firstChoice = function() {
|
|
7358
|
-
var parsers;
|
|
7359
|
-
parsers = 1 <= arguments.length ? slice.call(arguments, 0) : [];
|
|
7360
|
-
return function(input) {
|
|
7361
|
-
var i2, length, parser, result;
|
|
7362
|
-
i2 = -1;
|
|
7363
|
-
length = parsers.length;
|
|
7364
|
-
while (++i2 < length) {
|
|
7365
|
-
parser = parsers[i2];
|
|
7366
|
-
result = parser(input);
|
|
7367
|
-
if (result != null) {
|
|
7368
|
-
return result;
|
|
7369
|
-
}
|
|
7370
|
-
}
|
|
7371
|
-
};
|
|
7372
|
-
};
|
|
7373
|
-
newParser = function(options) {
|
|
7374
|
-
var U;
|
|
7375
|
-
U = {};
|
|
7376
|
-
U.wildcard = P2.tag("wildcard", P2.string(options.wildcardChar));
|
|
7377
|
-
U.optional = P2.tag("optional", P2.pick(1, P2.string(options.optionalSegmentStartChar), P2.lazy(function() {
|
|
7378
|
-
return U.pattern;
|
|
7379
|
-
}), P2.string(options.optionalSegmentEndChar)));
|
|
7380
|
-
U.name = P2.regex(new RegExp("^[" + options.segmentNameCharset + "]+"));
|
|
7381
|
-
U.named = P2.tag("named", P2.pick(1, P2.string(options.segmentNameStartChar), P2.lazy(function() {
|
|
7382
|
-
return U.name;
|
|
7383
|
-
})));
|
|
7384
|
-
U.escapedChar = P2.pick(1, P2.string(options.escapeChar), P2.regex(/^./));
|
|
7385
|
-
U["static"] = P2.tag("static", P2.concatMany1Till(P2.firstChoice(P2.lazy(function() {
|
|
7386
|
-
return U.escapedChar;
|
|
7387
|
-
}), P2.regex(/^./)), P2.firstChoice(P2.string(options.segmentNameStartChar), P2.string(options.optionalSegmentStartChar), P2.string(options.optionalSegmentEndChar), U.wildcard)));
|
|
7388
|
-
U.token = P2.lazy(function() {
|
|
7389
|
-
return P2.firstChoice(U.wildcard, U.optional, U.named, U["static"]);
|
|
7390
|
-
});
|
|
7391
|
-
U.pattern = P2.many1(P2.lazy(function() {
|
|
7392
|
-
return U.token;
|
|
7393
|
-
}));
|
|
7394
|
-
return U;
|
|
7395
|
-
};
|
|
7396
|
-
defaultOptions = {
|
|
7397
|
-
escapeChar: "\\",
|
|
7398
|
-
segmentNameStartChar: ":",
|
|
7399
|
-
segmentValueCharset: "a-zA-Z0-9-_~ %",
|
|
7400
|
-
segmentNameCharset: "a-zA-Z0-9",
|
|
7401
|
-
optionalSegmentStartChar: "(",
|
|
7402
|
-
optionalSegmentEndChar: ")",
|
|
7403
|
-
wildcardChar: "*"
|
|
7404
|
-
};
|
|
7405
|
-
baseAstNodeToRegexString = function(astNode, segmentValueCharset) {
|
|
7406
|
-
if (Array.isArray(astNode)) {
|
|
7407
|
-
return stringConcatMap(astNode, function(node) {
|
|
7408
|
-
return baseAstNodeToRegexString(node, segmentValueCharset);
|
|
7409
|
-
});
|
|
7410
|
-
}
|
|
7411
|
-
switch (astNode.tag) {
|
|
7412
|
-
case "wildcard":
|
|
7413
|
-
return "(.*?)";
|
|
7414
|
-
case "named":
|
|
7415
|
-
return "([" + segmentValueCharset + "]+)";
|
|
7416
|
-
case "static":
|
|
7417
|
-
return escapeForRegex(astNode.value);
|
|
7418
|
-
case "optional":
|
|
7419
|
-
return "(?:" + baseAstNodeToRegexString(astNode.value, segmentValueCharset) + ")?";
|
|
7420
|
-
}
|
|
7421
|
-
};
|
|
7422
|
-
astNodeToRegexString = function(astNode, segmentValueCharset) {
|
|
7423
|
-
if (segmentValueCharset == null) {
|
|
7424
|
-
segmentValueCharset = defaultOptions.segmentValueCharset;
|
|
7425
|
-
}
|
|
7426
|
-
return "^" + baseAstNodeToRegexString(astNode, segmentValueCharset) + "$";
|
|
7427
|
-
};
|
|
7428
|
-
astNodeToNames = function(astNode) {
|
|
7429
|
-
if (Array.isArray(astNode)) {
|
|
7430
|
-
return concatMap(astNode, astNodeToNames);
|
|
7431
|
-
}
|
|
7432
|
-
switch (astNode.tag) {
|
|
7433
|
-
case "wildcard":
|
|
7434
|
-
return ["_"];
|
|
7435
|
-
case "named":
|
|
7436
|
-
return [astNode.value];
|
|
7437
|
-
case "static":
|
|
7438
|
-
return [];
|
|
7439
|
-
case "optional":
|
|
7440
|
-
return astNodeToNames(astNode.value);
|
|
7441
|
-
}
|
|
7442
|
-
};
|
|
7443
|
-
getParam = function(params, key, nextIndexes, sideEffects) {
|
|
7444
|
-
var index, maxIndex, result, value;
|
|
7445
|
-
if (sideEffects == null) {
|
|
7446
|
-
sideEffects = false;
|
|
7447
|
-
}
|
|
7448
|
-
value = params[key];
|
|
7449
|
-
if (value == null) {
|
|
7450
|
-
if (sideEffects) {
|
|
7451
|
-
throw new Error("no values provided for key `" + key + "`");
|
|
7452
|
-
} else {
|
|
7453
|
-
return;
|
|
7454
|
-
}
|
|
7455
|
-
}
|
|
7456
|
-
index = nextIndexes[key] || 0;
|
|
7457
|
-
maxIndex = Array.isArray(value) ? value.length - 1 : 0;
|
|
7458
|
-
if (index > maxIndex) {
|
|
7459
|
-
if (sideEffects) {
|
|
7460
|
-
throw new Error("too few values provided for key `" + key + "`");
|
|
7461
|
-
} else {
|
|
7462
|
-
return;
|
|
7463
|
-
}
|
|
7464
|
-
}
|
|
7465
|
-
result = Array.isArray(value) ? value[index] : value;
|
|
7466
|
-
if (sideEffects) {
|
|
7467
|
-
nextIndexes[key] = index + 1;
|
|
7468
|
-
}
|
|
7469
|
-
return result;
|
|
7470
|
-
};
|
|
7471
|
-
astNodeContainsSegmentsForProvidedParams = function(astNode, params, nextIndexes) {
|
|
7472
|
-
var i2, length;
|
|
7473
|
-
if (Array.isArray(astNode)) {
|
|
7474
|
-
i2 = -1;
|
|
7475
|
-
length = astNode.length;
|
|
7476
|
-
while (++i2 < length) {
|
|
7477
|
-
if (astNodeContainsSegmentsForProvidedParams(astNode[i2], params, nextIndexes)) {
|
|
7478
|
-
return true;
|
|
7479
|
-
}
|
|
7480
|
-
}
|
|
7481
|
-
return false;
|
|
7482
|
-
}
|
|
7483
|
-
switch (astNode.tag) {
|
|
7484
|
-
case "wildcard":
|
|
7485
|
-
return getParam(params, "_", nextIndexes, false) != null;
|
|
7486
|
-
case "named":
|
|
7487
|
-
return getParam(params, astNode.value, nextIndexes, false) != null;
|
|
7488
|
-
case "static":
|
|
7489
|
-
return false;
|
|
7490
|
-
case "optional":
|
|
7491
|
-
return astNodeContainsSegmentsForProvidedParams(astNode.value, params, nextIndexes);
|
|
7492
|
-
}
|
|
7493
|
-
};
|
|
7494
|
-
stringify = function(astNode, params, nextIndexes) {
|
|
7495
|
-
if (Array.isArray(astNode)) {
|
|
7496
|
-
return stringConcatMap(astNode, function(node) {
|
|
7497
|
-
return stringify(node, params, nextIndexes);
|
|
7498
|
-
});
|
|
7499
|
-
}
|
|
7500
|
-
switch (astNode.tag) {
|
|
7501
|
-
case "wildcard":
|
|
7502
|
-
return getParam(params, "_", nextIndexes, true);
|
|
7503
|
-
case "named":
|
|
7504
|
-
return getParam(params, astNode.value, nextIndexes, true);
|
|
7505
|
-
case "static":
|
|
7506
|
-
return astNode.value;
|
|
7507
|
-
case "optional":
|
|
7508
|
-
if (astNodeContainsSegmentsForProvidedParams(astNode.value, params, nextIndexes)) {
|
|
7509
|
-
return stringify(astNode.value, params, nextIndexes);
|
|
7510
|
-
} else {
|
|
7511
|
-
return "";
|
|
7512
|
-
}
|
|
7175
|
+
const filterData = (_a2 = this.filterPublisher) == null ? void 0 : _a2.get();
|
|
7176
|
+
const filteredFieldsArray = this.filteredFields.split(" ");
|
|
7177
|
+
for (const f2 in filterData) {
|
|
7178
|
+
let value = filterData[f2];
|
|
7179
|
+
if (Array.isArray(value))
|
|
7180
|
+
value = value.filter((v2) => v2 !== null);
|
|
7181
|
+
if (this.filteredFields && !filteredFieldsArray.includes(f2) || value == null || value.toString() === "")
|
|
7182
|
+
continue;
|
|
7183
|
+
searchParams.set(f2, filterData[f2].toString());
|
|
7513
7184
|
}
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
var groupCount, options, parsed, parser, withoutWhitespace;
|
|
7517
|
-
if (arg1 instanceof UrlPattern2) {
|
|
7518
|
-
this.isRegex = arg1.isRegex;
|
|
7519
|
-
this.regex = arg1.regex;
|
|
7520
|
-
this.ast = arg1.ast;
|
|
7521
|
-
this.names = arg1.names;
|
|
7185
|
+
const searchHash = searchParams.toString();
|
|
7186
|
+
if (searchHash == this.searchHash && !this.isFirstRequest)
|
|
7522
7187
|
return;
|
|
7188
|
+
this.searchHash = searchHash;
|
|
7189
|
+
for (const dataProvider2 of this.listDataProviders) {
|
|
7190
|
+
PublisherManager$1.delete(dataProvider2);
|
|
7523
7191
|
}
|
|
7524
|
-
this.
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7192
|
+
this.listDataProviders = [];
|
|
7193
|
+
clearTimeout(this.filterTimeoutId);
|
|
7194
|
+
this.filterTimeoutId = setTimeout(
|
|
7195
|
+
async () => {
|
|
7196
|
+
const count = this.resultCount;
|
|
7197
|
+
this.props = null;
|
|
7198
|
+
this.requestId++;
|
|
7199
|
+
this.resultCount = count;
|
|
7200
|
+
await PublisherManager$1.getInstance().isLocalStrorageReady;
|
|
7201
|
+
window.requestAnimationFrame(() => this.next());
|
|
7202
|
+
},
|
|
7203
|
+
this.isFirstRequest ? 0 : this.filterTimeoutMs
|
|
7204
|
+
);
|
|
7205
|
+
this.isFirstRequest = false;
|
|
7206
|
+
};
|
|
7207
|
+
this.dataProviderExpression = "";
|
|
7208
|
+
this.idKey = "id";
|
|
7209
|
+
this.listDataProviders = [];
|
|
7210
|
+
this.nextHadEvent = false;
|
|
7211
|
+
}
|
|
7212
|
+
disconnectedCallback() {
|
|
7213
|
+
var _a2;
|
|
7214
|
+
for (const dataProvider of this.listDataProviders) {
|
|
7215
|
+
PublisherManager$1.delete(dataProvider);
|
|
7216
|
+
this.listDataProviders = [];
|
|
7217
|
+
}
|
|
7218
|
+
(_a2 = this.filterPublisher) == null ? void 0 : _a2.offInternalMutation(this.updateFilteredContent);
|
|
7219
|
+
this.props = null;
|
|
7220
|
+
this.limit = 5;
|
|
7221
|
+
this.offset = 0;
|
|
7222
|
+
this.resultCount = 0;
|
|
7223
|
+
this.searchHash = "";
|
|
7224
|
+
this.requestId = 0;
|
|
7225
|
+
this.isFirstRequest = true;
|
|
7226
|
+
this.nextHadEvent = false;
|
|
7227
|
+
this.publisher.set({});
|
|
7228
|
+
super.disconnectedCallback();
|
|
7229
|
+
return;
|
|
7230
|
+
}
|
|
7231
|
+
async connectedCallback() {
|
|
7232
|
+
this.instanceId = Queue.instanceCounter++;
|
|
7233
|
+
this.localStorage = this.getAttribute("localStorage") || this.localStorage;
|
|
7234
|
+
this.filterTimeoutMs = parseInt(this.getAttribute("filterTimeoutMs") || "400");
|
|
7235
|
+
this.removeAttribute("localStorage");
|
|
7236
|
+
this.noShadowDom = "";
|
|
7237
|
+
this.defferedDebug = this.hasAttribute("debug") || null;
|
|
7238
|
+
if (!this.dataProvider)
|
|
7239
|
+
this.dataProvider = this.dataProviderExpression || "sonic-queue-" + this.instanceId + "-" + Math.random().toString(36).substring(7);
|
|
7240
|
+
if (!this.dataProviderExpression) {
|
|
7241
|
+
this.dataProviderExpression = HTML.getAncestorAttributeValue(this.parentElement, "dataProvider") || "";
|
|
7242
|
+
}
|
|
7243
|
+
super.connectedCallback();
|
|
7244
|
+
this.publisher.set({});
|
|
7245
|
+
this.key = this.getAttribute("key");
|
|
7246
|
+
await PublisherManager$1.getInstance().isLocalStrorageReady;
|
|
7247
|
+
if (!this.templates)
|
|
7248
|
+
this.templates = Array.from(this.querySelectorAll("template"));
|
|
7249
|
+
this.lastRequestTime = (/* @__PURE__ */ new Date()).getTime();
|
|
7250
|
+
this.configFilter();
|
|
7251
|
+
}
|
|
7252
|
+
configFilter() {
|
|
7253
|
+
var _a2;
|
|
7254
|
+
const dataFilterProvider = this.getAncestorAttributeValue("dataFilterProvider");
|
|
7255
|
+
if (!dataFilterProvider) {
|
|
7256
|
+
this.next();
|
|
7257
|
+
return;
|
|
7258
|
+
}
|
|
7259
|
+
this.filterPublisher = PublisherManager$1.getInstance().get(dataFilterProvider);
|
|
7260
|
+
(_a2 = this.filterPublisher) == null ? void 0 : _a2.onInternalMutation(this.updateFilteredContent);
|
|
7261
|
+
}
|
|
7262
|
+
resetDuration() {
|
|
7263
|
+
this.lastRequestTime = (/* @__PURE__ */ new Date()).getTime();
|
|
7264
|
+
}
|
|
7265
|
+
next(e2) {
|
|
7266
|
+
var _a2;
|
|
7267
|
+
let offset = this.offset;
|
|
7268
|
+
const newTime = (/* @__PURE__ */ new Date()).getTime();
|
|
7269
|
+
const requestDuration = newTime - this.lastRequestTime;
|
|
7270
|
+
if (!this.nextHadEvent && e2) {
|
|
7271
|
+
this.publisher.resultCount = 0;
|
|
7272
|
+
this.resultCount = 0;
|
|
7273
|
+
}
|
|
7274
|
+
this.nextHadEvent = !!e2;
|
|
7275
|
+
if (e2) {
|
|
7276
|
+
this.publisher.lastFetchedData = e2.detail.fetchedData;
|
|
7277
|
+
if (e2.detail.requestId < this.requestId)
|
|
7278
|
+
return;
|
|
7279
|
+
this.resultCount += e2.detail.props.length;
|
|
7280
|
+
if (!e2.detail.isFirstLoad || !e2.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
|
|
7281
|
+
this.publisher.resultCount = this.resultCount;
|
|
7540
7282
|
return;
|
|
7541
7283
|
}
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7284
|
+
}
|
|
7285
|
+
if (!Array.isArray(this.props)) {
|
|
7286
|
+
const newProps2 = [];
|
|
7287
|
+
newProps2.resultCount = this.resultCount;
|
|
7288
|
+
newProps2.lastFetchedData = (e2 == null ? void 0 : e2.detail.fetchedData) || {};
|
|
7289
|
+
this.props = newProps2;
|
|
7290
|
+
} else {
|
|
7291
|
+
const props = this.props;
|
|
7292
|
+
const item = props[props.length - 1];
|
|
7293
|
+
offset = parseInt(item.offset.toString()) + parseInt(item.limit.toString());
|
|
7294
|
+
}
|
|
7295
|
+
if (requestDuration > 0 && e2 && !this.localStorage) {
|
|
7296
|
+
this.limit = Math.round(this.limit / requestDuration * this.targetRequestDuration);
|
|
7297
|
+
}
|
|
7298
|
+
if (this.limit < 1)
|
|
7299
|
+
this.limit = 1;
|
|
7300
|
+
if (this.limit > 15)
|
|
7301
|
+
this.limit = 15;
|
|
7302
|
+
let dataProvider = this.dataProviderExpression.replace("$offset", offset + "").replace("$limit", this.limit + "");
|
|
7303
|
+
const split = dataProvider.split("?");
|
|
7304
|
+
let endpoint = split.shift();
|
|
7305
|
+
const searchParams = new URLSearchParams(split.join("?"));
|
|
7306
|
+
const filterData = (_a2 = this.filterPublisher) == null ? void 0 : _a2.get();
|
|
7307
|
+
const filteredFieldsArray = this.filteredFields.split(" ");
|
|
7308
|
+
for (const f2 in filterData) {
|
|
7309
|
+
if (this.filteredFields && filteredFieldsArray.includes(f2) || filterData[f2] == null || filterData[f2] == "")
|
|
7310
|
+
continue;
|
|
7311
|
+
searchParams.set(f2, filterData[f2]);
|
|
7312
|
+
}
|
|
7313
|
+
if (!this.searchHash)
|
|
7314
|
+
this.searchHash = searchParams.toString();
|
|
7315
|
+
endpoint = endpoint + "?" + searchParams.toString();
|
|
7316
|
+
dataProvider = dataProvider + "_item_from_queue_" + this.instanceId;
|
|
7317
|
+
this.listDataProviders.push(dataProvider);
|
|
7318
|
+
const newProps = [
|
|
7319
|
+
...this.props,
|
|
7320
|
+
{
|
|
7321
|
+
id: searchParams.toString() + "/" + this.props.length,
|
|
7322
|
+
dataProvider,
|
|
7323
|
+
endPoint: endpoint,
|
|
7324
|
+
offset,
|
|
7325
|
+
limit: this.limit
|
|
7562
7326
|
}
|
|
7563
|
-
|
|
7564
|
-
|
|
7327
|
+
];
|
|
7328
|
+
newProps.resultCount = this.resultCount;
|
|
7329
|
+
newProps.lastFetchedData = (e2 == null ? void 0 : e2.detail.fetchedData) || {};
|
|
7330
|
+
this.props = newProps;
|
|
7331
|
+
this.lastRequestTime = (/* @__PURE__ */ new Date()).getTime();
|
|
7332
|
+
}
|
|
7333
|
+
render() {
|
|
7334
|
+
if (!Array.isArray(this.props))
|
|
7335
|
+
return T;
|
|
7336
|
+
let lazyload = !this.noLazyload;
|
|
7337
|
+
if (this.props.length == 1) {
|
|
7338
|
+
lazyload = false;
|
|
7339
|
+
}
|
|
7340
|
+
return x$1`
|
|
7341
|
+
${o(this.props, (item, index) => {
|
|
7342
|
+
var _a2;
|
|
7343
|
+
const templates = index == 0 ? this.templates : (_a2 = this.templates) == null ? void 0 : _a2.filter((elt) => elt.getAttribute("data-value") != "no-item");
|
|
7344
|
+
return x$1`
|
|
7345
|
+
<sonic-list
|
|
7346
|
+
fetch
|
|
7347
|
+
loader="inline"
|
|
7348
|
+
cache=${this.cache}
|
|
7349
|
+
displayContents
|
|
7350
|
+
lazyBoundsRatio=${this.lazyBoundsRatio}
|
|
7351
|
+
?lazyload=${lazyload}
|
|
7352
|
+
localStorage=${this.localStorage}
|
|
7353
|
+
requestId=${this.requestId}
|
|
7354
|
+
.itemPropertyMap=${this.itemPropertyMap}
|
|
7355
|
+
?debug=${this.defferedDebug === true}
|
|
7356
|
+
@load=${this.next}
|
|
7357
|
+
key=${this.key}
|
|
7358
|
+
@loading=${this.resetDuration}
|
|
7359
|
+
dataProvider="${item.dataProvider}"
|
|
7360
|
+
endPoint="${item.endPoint}"
|
|
7361
|
+
idKey=${this.idKey}
|
|
7362
|
+
.templates=${templates}
|
|
7363
|
+
>
|
|
7364
|
+
</sonic-list>
|
|
7365
|
+
`;
|
|
7366
|
+
})}
|
|
7367
|
+
`;
|
|
7368
|
+
}
|
|
7369
|
+
};
|
|
7370
|
+
Queue.instanceCounter = 0;
|
|
7371
|
+
__decorateClass$S([
|
|
7372
|
+
n$5({ type: Array })
|
|
7373
|
+
], Queue.prototype, "templates", 2);
|
|
7374
|
+
__decorateClass$S([
|
|
7375
|
+
n$5({ type: Object })
|
|
7376
|
+
], Queue.prototype, "itemPropertyMap", 2);
|
|
7377
|
+
__decorateClass$S([
|
|
7378
|
+
n$5()
|
|
7379
|
+
], Queue.prototype, "cache", 2);
|
|
7380
|
+
__decorateClass$S([
|
|
7381
|
+
n$5()
|
|
7382
|
+
], Queue.prototype, "targetRequestDuration", 2);
|
|
7383
|
+
__decorateClass$S([
|
|
7384
|
+
n$5()
|
|
7385
|
+
], Queue.prototype, "limit", 2);
|
|
7386
|
+
__decorateClass$S([
|
|
7387
|
+
n$5()
|
|
7388
|
+
], Queue.prototype, "lazyBoundsRatio", 2);
|
|
7389
|
+
__decorateClass$S([
|
|
7390
|
+
n$5()
|
|
7391
|
+
], Queue.prototype, "offset", 2);
|
|
7392
|
+
__decorateClass$S([
|
|
7393
|
+
n$5()
|
|
7394
|
+
], Queue.prototype, "resultCount", 2);
|
|
7395
|
+
__decorateClass$S([
|
|
7396
|
+
n$5({ type: Boolean })
|
|
7397
|
+
], Queue.prototype, "noLazyload", 2);
|
|
7398
|
+
__decorateClass$S([
|
|
7399
|
+
n$5()
|
|
7400
|
+
], Queue.prototype, "filteredFields", 2);
|
|
7401
|
+
__decorateClass$S([
|
|
7402
|
+
n$5({ type: String })
|
|
7403
|
+
], Queue.prototype, "dataProviderExpression", 2);
|
|
7404
|
+
__decorateClass$S([
|
|
7405
|
+
n$5({ type: String })
|
|
7406
|
+
], Queue.prototype, "idKey", 2);
|
|
7407
|
+
Queue = __decorateClass$S([
|
|
7408
|
+
t$4(tagName$P)
|
|
7409
|
+
], Queue);
|
|
7410
|
+
var __defProp$R = Object.defineProperty;
|
|
7411
|
+
var __getOwnPropDesc$R = Object.getOwnPropertyDescriptor;
|
|
7412
|
+
var __decorateClass$R = (decorators, target, key, kind) => {
|
|
7413
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$R(target, key) : target;
|
|
7414
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
7415
|
+
if (decorator = decorators[i2])
|
|
7416
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7417
|
+
if (kind && result)
|
|
7418
|
+
__defProp$R(target, key, result);
|
|
7419
|
+
return result;
|
|
7420
|
+
};
|
|
7421
|
+
const tagName$O = "sonic-submit";
|
|
7422
|
+
let Submit = class extends Subscriber$1(s$1) {
|
|
7423
|
+
constructor() {
|
|
7424
|
+
super(...arguments);
|
|
7425
|
+
this.submitResultKey = null;
|
|
7426
|
+
this.disabled = false;
|
|
7427
|
+
this.endPoint = null;
|
|
7428
|
+
this.name = "";
|
|
7429
|
+
this.value = "";
|
|
7430
|
+
this.api = null;
|
|
7431
|
+
}
|
|
7432
|
+
connectedCallback() {
|
|
7433
|
+
if (this.hasAttribute("onClick")) {
|
|
7434
|
+
this.addEventListener("click", () => this.submit());
|
|
7435
|
+
}
|
|
7436
|
+
if (this.hasAttribute("onEnterKey")) {
|
|
7437
|
+
this.addEventListener("keydown", (e2) => {
|
|
7438
|
+
if (e2.key === "Enter")
|
|
7439
|
+
this.submit();
|
|
7440
|
+
});
|
|
7441
|
+
}
|
|
7442
|
+
super.connectedCallback();
|
|
7443
|
+
this.api = new API(this.getApiConfiguration());
|
|
7444
|
+
}
|
|
7445
|
+
submitNativeForm() {
|
|
7446
|
+
const form2 = HTML.getClosestForm(this);
|
|
7447
|
+
if (!form2)
|
|
7448
|
+
return;
|
|
7449
|
+
const formDataProvider = this.getAncestorAttributeValue("formDataProvider");
|
|
7450
|
+
const formData = PublisherManager$1.get(formDataProvider).get();
|
|
7451
|
+
for (const name in formData) {
|
|
7452
|
+
if (name == "isFormValid")
|
|
7453
|
+
continue;
|
|
7454
|
+
let control = form2.querySelector(
|
|
7455
|
+
'input[name="' + name + '"], select[name="' + name + '"], textarea[name="' + name + '"]'
|
|
7456
|
+
);
|
|
7457
|
+
if (!control) {
|
|
7458
|
+
control = document.createElement("input");
|
|
7459
|
+
control.type = "hidden";
|
|
7460
|
+
control.name = name;
|
|
7461
|
+
form2.appendChild(control);
|
|
7565
7462
|
}
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
return null;
|
|
7463
|
+
let value = formData[name];
|
|
7464
|
+
if (Array.isArray(value))
|
|
7465
|
+
value = value.join(",");
|
|
7466
|
+
if (control.type === "checkbox" || control.type === "radio") {
|
|
7467
|
+
if (value)
|
|
7468
|
+
control.checked = true;
|
|
7469
|
+
} else {
|
|
7470
|
+
control.value = value;
|
|
7575
7471
|
}
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
7472
|
+
}
|
|
7473
|
+
const submitButton = document.createElement("input");
|
|
7474
|
+
submitButton.name = this.name;
|
|
7475
|
+
submitButton.style.display = "none";
|
|
7476
|
+
submitButton.value = this.value;
|
|
7477
|
+
submitButton.type = "submit";
|
|
7478
|
+
form2.appendChild(submitButton);
|
|
7479
|
+
if (submitButton)
|
|
7480
|
+
submitButton.click();
|
|
7481
|
+
}
|
|
7482
|
+
async submit() {
|
|
7483
|
+
var _a2;
|
|
7484
|
+
const formPublisher = PublisherManager$1.getInstance().get(this.getAncestorAttributeValue("formDataProvider"));
|
|
7485
|
+
formPublisher.isFormValid = true;
|
|
7486
|
+
formPublisher.invalidate();
|
|
7487
|
+
if (!formPublisher.isFormValid.get())
|
|
7488
|
+
return;
|
|
7489
|
+
if (this.publisher)
|
|
7490
|
+
this.publisher.disabled = true;
|
|
7491
|
+
formPublisher.isFormValid;
|
|
7492
|
+
const native = this.hasAttribute("native");
|
|
7493
|
+
if (native) {
|
|
7494
|
+
this.submitNativeForm();
|
|
7495
|
+
return;
|
|
7496
|
+
}
|
|
7497
|
+
const method = ((_a2 = this.getAttribute("method")) == null ? void 0 : _a2.toLocaleLowerCase()) || "post";
|
|
7498
|
+
const sendAsFormData = this.hasAttribute("sendAsFormData");
|
|
7499
|
+
const formData = formPublisher.get();
|
|
7500
|
+
delete formData.isFormValid;
|
|
7501
|
+
const headesDataProvider = this.getAncestorAttributeValue("headersDataProvider");
|
|
7502
|
+
const headerPublisher = headesDataProvider ? PublisherManager$1.getInstance().get(headesDataProvider) : null;
|
|
7503
|
+
let headerData = {};
|
|
7504
|
+
if (headerPublisher)
|
|
7505
|
+
headerData = headerPublisher.get();
|
|
7506
|
+
let result = null;
|
|
7507
|
+
const dataProvider = this.getAncestorAttributeValue("dataProvider");
|
|
7508
|
+
const endPoint = this.endPoint || dataProvider;
|
|
7509
|
+
Loader.show();
|
|
7510
|
+
const sendData = async () => {
|
|
7511
|
+
var _a3, _b2, _c, _d, _e, _f, _g;
|
|
7512
|
+
if (sendAsFormData) {
|
|
7513
|
+
result = await ((_a3 = this.api) == null ? void 0 : _a3.submitFormData(endPoint, formData, method, headerData));
|
|
7579
7514
|
} else {
|
|
7580
|
-
|
|
7515
|
+
switch (method) {
|
|
7516
|
+
case "put":
|
|
7517
|
+
result = await ((_b2 = this.api) == null ? void 0 : _b2.put(endPoint, formData, headerData));
|
|
7518
|
+
break;
|
|
7519
|
+
case "delete":
|
|
7520
|
+
result = await ((_c = this.api) == null ? void 0 : _c.delete(endPoint, formData, headerData));
|
|
7521
|
+
break;
|
|
7522
|
+
case "get":
|
|
7523
|
+
const params = new URLSearchParams();
|
|
7524
|
+
if (formData) {
|
|
7525
|
+
for (const key in formData) {
|
|
7526
|
+
params.append(key, formData[key]);
|
|
7527
|
+
}
|
|
7528
|
+
}
|
|
7529
|
+
const paramString = "?" + params.toString();
|
|
7530
|
+
result = await ((_d = this.api) == null ? void 0 : _d.get(endPoint + paramString, headerData));
|
|
7531
|
+
break;
|
|
7532
|
+
default:
|
|
7533
|
+
result = await ((_e = this.api) == null ? void 0 : _e.post(endPoint, formData, headerData));
|
|
7534
|
+
break;
|
|
7535
|
+
}
|
|
7581
7536
|
}
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7537
|
+
Loader.hide();
|
|
7538
|
+
if (!result)
|
|
7539
|
+
result = { messages: [{ content: "Network Error", status: "error" }] };
|
|
7540
|
+
else if (result._sonic_http_response_ && !result._sonic_http_response_.ok && Object.keys(result).length === 1)
|
|
7541
|
+
result.messages = [{ content: "Network Error", status: "error" }];
|
|
7542
|
+
const clearedDataProvider = this.getAncestorAttributeValue("clearedDataOnSuccess");
|
|
7543
|
+
if (clearedDataProvider) {
|
|
7544
|
+
clearedDataProvider.split(" ").forEach((dataProvider2) => PublisherManager$1.get(dataProvider2).set({}));
|
|
7586
7545
|
}
|
|
7587
|
-
|
|
7588
|
-
|
|
7546
|
+
const username_key = this.hasAttribute("usernameKey") ? this.getAttribute("usernameKey") : "username";
|
|
7547
|
+
const password_key = this.hasAttribute("passwordKey") ? this.getAttribute("passwordKey") : "password";
|
|
7548
|
+
if (((_g = (_f = this.api) == null ? void 0 : _f.lastResult) == null ? void 0 : _g.ok) && formData[username_key] && formData[password_key]) {
|
|
7549
|
+
this.saveCredentials(formData[username_key], formData[password_key]);
|
|
7589
7550
|
}
|
|
7590
|
-
if (
|
|
7591
|
-
|
|
7551
|
+
if (this.submitResultKey) {
|
|
7552
|
+
result = Objects$1.traverse(result, this.submitResultKey.split("."), true);
|
|
7592
7553
|
}
|
|
7593
|
-
|
|
7554
|
+
const submitResultDataProvider = this.getAncestorAttributeValue("submitResultDataProvider");
|
|
7555
|
+
if (submitResultDataProvider)
|
|
7556
|
+
PublisherManager$1.get(submitResultDataProvider).set(result);
|
|
7557
|
+
if (this.publisher)
|
|
7558
|
+
this.publisher.disabled = null;
|
|
7594
7559
|
};
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7560
|
+
const captchaPublisher = (headerPublisher == null ? void 0 : headerPublisher.needsCaptchaValidation.get()) ? headerPublisher : formPublisher.needsCaptchaValidation.get() ? formPublisher : null;
|
|
7561
|
+
if (captchaPublisher) {
|
|
7562
|
+
captchaPublisher.captchaMethod = method;
|
|
7563
|
+
captchaPublisher.captchaAction = (dataProvider == null ? void 0 : dataProvider.split("?")[0]) ?? this.getAncestorAttributeValue("formDataProvider") ?? "submit";
|
|
7564
|
+
captchaPublisher.captchaToken = "request_token";
|
|
7565
|
+
const captchaAssign = (token) => {
|
|
7566
|
+
if (token != "request_token" && token != "") {
|
|
7567
|
+
sendData();
|
|
7568
|
+
captchaPublisher.captchaToken.offAssign(captchaAssign);
|
|
7569
|
+
}
|
|
7570
|
+
};
|
|
7571
|
+
captchaPublisher.captchaToken.onAssign(captchaAssign);
|
|
7572
|
+
} else {
|
|
7573
|
+
sendData();
|
|
7574
|
+
}
|
|
7575
|
+
}
|
|
7576
|
+
async saveCredentials(username, password2) {
|
|
7577
|
+
if ("PasswordCredential" in window) {
|
|
7578
|
+
const credential = new window.PasswordCredential({
|
|
7579
|
+
id: username,
|
|
7580
|
+
// name: "Carina Anand", // In case of a login, the name comes from the server.
|
|
7581
|
+
password: password2
|
|
7582
|
+
});
|
|
7583
|
+
await navigator.credentials.store(credential);
|
|
7584
|
+
}
|
|
7585
|
+
}
|
|
7586
|
+
render() {
|
|
7587
|
+
return x$1`<div ?data-disabled=${this.disabled}><slot></slot></div>`;
|
|
7588
|
+
}
|
|
7589
|
+
};
|
|
7590
|
+
Submit.styles = i$5`
|
|
7591
|
+
[data-disabled] {
|
|
7592
|
+
opacity: 0.3;
|
|
7593
|
+
pointer-events: none;
|
|
7594
|
+
user-select: none;
|
|
7595
|
+
}
|
|
7596
|
+
`;
|
|
7597
|
+
__decorateClass$R([
|
|
7598
|
+
n$5({ type: String })
|
|
7599
|
+
], Submit.prototype, "submitResultKey", 2);
|
|
7600
|
+
__decorateClass$R([
|
|
7601
|
+
n$5({ type: Boolean })
|
|
7602
|
+
], Submit.prototype, "disabled", 2);
|
|
7603
|
+
__decorateClass$R([
|
|
7604
|
+
n$5({ type: String })
|
|
7605
|
+
], Submit.prototype, "endPoint", 2);
|
|
7606
|
+
__decorateClass$R([
|
|
7607
|
+
n$5()
|
|
7608
|
+
], Submit.prototype, "name", 2);
|
|
7609
|
+
__decorateClass$R([
|
|
7610
|
+
n$5()
|
|
7611
|
+
], Submit.prototype, "value", 2);
|
|
7612
|
+
Submit = __decorateClass$R([
|
|
7613
|
+
t$4(tagName$O)
|
|
7614
|
+
], Submit);
|
|
7613
7615
|
var __defProp$Q = Object.defineProperty;
|
|
7614
7616
|
var __getOwnPropDesc$Q = Object.getOwnPropertyDescriptor;
|
|
7615
7617
|
var __decorateClass$Q = (decorators, target, key, kind) => {
|