@esri/calcite-components 5.1.0-next.16 → 5.1.0-next.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{MXTI6FSG.js → 22PQT263.js} +1 -1
- package/dist/cdn/{3FL52ZND.js → 24C3KHYK.js} +1 -1
- package/dist/cdn/{CUSVTTUR.js → 26GDRJ2L.js} +1 -1
- package/dist/cdn/{GRBSTFCZ.js → 2HK44IRU.js} +1 -1
- package/dist/cdn/{LPD3GVQK.js → 32KAH62F.js} +1 -1
- package/dist/cdn/{XBMNTFUD.js → 35OURK5J.js} +1 -1
- package/dist/cdn/{R7QJ22GZ.js → 3UTOYDRU.js} +1 -1
- package/dist/cdn/42NWEV6Z.js +2 -0
- package/dist/cdn/{HQ4VQSWC.js → 4H4BZCL6.js} +1 -1
- package/dist/cdn/{BUFDX74V.js → 4OQITOGB.js} +1 -1
- package/dist/cdn/{GIHSUITL.js → 4TKTULYX.js} +1 -1
- package/dist/cdn/{VN6ZIHNO.js → 5AIKSJ2S.js} +1 -1
- package/dist/cdn/{CT6Q7KSN.js → 5BDXHQGH.js} +1 -1
- package/dist/cdn/{D7HRC4ZF.js → 5OENNBKE.js} +1 -1
- package/dist/cdn/{UMCWAM6U.js → 5TV76YXX.js} +1 -1
- package/dist/cdn/{RTQEH2GI.js → 623SRMWS.js} +1 -1
- package/dist/cdn/{SJDETR7P.js → 6DKVHOPA.js} +1 -1
- package/dist/cdn/{TM56DVXI.js → 736DRHW4.js} +1 -1
- package/dist/cdn/{VRN5P5H2.js → 77DSC2EX.js} +1 -1
- package/dist/cdn/{Q4EAVGXD.js → 7HYWLV2S.js} +1 -1
- package/dist/cdn/{VJPJSN5X.js → A6C4FF2U.js} +1 -1
- package/dist/cdn/{ROFUINHU.js → AHTEBJ5Z.js} +1 -1
- package/dist/cdn/{2I7SUD7B.js → AMXNQ3QU.js} +1 -1
- package/dist/cdn/{IDSCNNKO.js → AQHPEIUH.js} +1 -1
- package/dist/cdn/{DJU6QGEO.js → ASSK7AZ6.js} +1 -1
- package/dist/cdn/{XOSVBL4Q.js → B6CFL6NY.js} +1 -1
- package/dist/cdn/BB7S45XD.js +2 -0
- package/dist/cdn/BD3RMGKQ.js +2 -0
- package/dist/cdn/{FMBWQGBD.js → BEZFHBHG.js} +1 -1
- package/dist/cdn/{E4DUTEUJ.js → BI7YRL2Q.js} +1 -1
- package/dist/cdn/{Z4MO3QA3.js → BNICLT4M.js} +1 -1
- package/dist/cdn/{UUMSMAKL.js → C3DVAPZA.js} +1 -1
- package/dist/cdn/{FTZQSPJV.js → C6PEZF4U.js} +1 -1
- package/dist/cdn/{CCLZ2M6Y.js → CK3VYCGZ.js} +1 -1
- package/dist/cdn/{W3RPQ6MS.js → DDQGXVLN.js} +1 -1
- package/dist/cdn/{HJUPDBFP.js → DGAU5AKL.js} +1 -1
- package/dist/cdn/{IXGB4XHR.js → DHWDS2CM.js} +1 -1
- package/dist/cdn/{6JHQQFOY.js → DNXXRTLM.js} +1 -1
- package/dist/cdn/{FFHJEWMN.js → DO6MO2UO.js} +1 -1
- package/dist/cdn/{HNMZXQBU.js → DRIV3K36.js} +1 -1
- package/dist/cdn/{JAVQLJ7T.js → DUDSRKRT.js} +1 -1
- package/dist/cdn/{IXSYQNSX.js → DUVDJGX7.js} +1 -1
- package/dist/cdn/{QTKB6HQJ.js → EAEYA67W.js} +1 -1
- package/dist/cdn/{FOK55KL6.js → EMPXMHPJ.js} +1 -1
- package/dist/cdn/{WILNR5SN.js → ETSFQFNX.js} +1 -1
- package/dist/cdn/{7CFYSRPL.js → EXD4VLQ6.js} +1 -1
- package/dist/cdn/{IFMDATQK.js → F3VCECBU.js} +1 -1
- package/dist/cdn/{2RA3BQML.js → FC3BH35C.js} +1 -1
- package/dist/cdn/{JNUWJXXR.js → FH3PFJUY.js} +1 -1
- package/dist/cdn/{FA6DCP2J.js → FOMDWSQE.js} +1 -1
- package/dist/cdn/{PD2L5MT6.js → FWP7F6DX.js} +1 -1
- package/dist/cdn/{U26JLQXM.js → GZDBGP7N.js} +1 -1
- package/dist/cdn/{PQQ4547C.js → H5LBDYG7.js} +1 -1
- package/dist/cdn/{3IWXK4DE.js → H6WUBDPK.js} +1 -1
- package/dist/cdn/{4JPWYI6P.js → H73ZP5LD.js} +1 -1
- package/dist/cdn/{I2XVC2LX.js → H7QT3HBJ.js} +1 -1
- package/dist/cdn/{QF337ROB.js → HPJ5T73I.js} +1 -1
- package/dist/cdn/{X55DE45N.js → HXXXF7KO.js} +1 -1
- package/dist/cdn/{TPQ3ZNST.js → HZF3S4QF.js} +1 -1
- package/dist/cdn/{VRMSWTOS.js → I6LNGTRO.js} +1 -1
- package/dist/cdn/ILI77CFP.js +2 -0
- package/dist/cdn/{I7537AYI.js → IQ6JMSND.js} +1 -1
- package/dist/cdn/{4XY5BWMS.js → ISFW56FZ.js} +1 -1
- package/dist/cdn/{UZD5E73A.js → ITHCW3QL.js} +1 -1
- package/dist/cdn/{TG6GRZTK.js → IXW27ENW.js} +1 -1
- package/dist/cdn/{GKYHDFSD.js → JEMWDE6Y.js} +1 -1
- package/dist/cdn/JWSAQOVT.js +2 -0
- package/dist/cdn/{4OY5PUW5.js → K3PVB3LV.js} +1 -1
- package/dist/cdn/{3TX4PFQ2.js → KBBM67ZB.js} +1 -1
- package/dist/cdn/KL3A4A2N.js +2 -0
- package/dist/cdn/{3I42BHHS.js → KVPUYHTQ.js} +1 -1
- package/dist/cdn/{JAGBFPZN.js → L32WVMMX.js} +1 -1
- package/dist/cdn/{LTKLSUME.js → L6VY4IZH.js} +1 -1
- package/dist/cdn/{RGVVXWMZ.js → LA52VQPT.js} +1 -1
- package/dist/cdn/{IIIJEPLQ.js → LIHQ7PVA.js} +1 -1
- package/dist/cdn/{6YSO45WO.js → LN3LSI7S.js} +1 -1
- package/dist/cdn/{B3Q5JTJB.js → M3INYSTO.js} +1 -1
- package/dist/cdn/{BYL555XX.js → M6IUO6IZ.js} +1 -1
- package/dist/cdn/{XGLG45LP.js → MD6FZLNP.js} +1 -1
- package/dist/cdn/{BEHY4WA4.js → MENCU452.js} +1 -1
- package/dist/cdn/MQKGBGA3.js +2 -0
- package/dist/cdn/{QVP4MNIF.js → MV5ECLMR.js} +1 -1
- package/dist/cdn/{DJP5SNBS.js → MYGJ52YN.js} +1 -1
- package/dist/cdn/{VTWFWWDW.js → MZJKKFFI.js} +1 -1
- package/dist/cdn/NCMBGHKV.js +2 -0
- package/dist/cdn/{ISWH2HSE.js → NRVQA6UD.js} +1 -1
- package/dist/cdn/OPRN5CRW.js +2 -0
- package/dist/cdn/{4LH6SHX6.js → OQFMYWF3.js} +1 -1
- package/dist/cdn/{ZMUMATIQ.js → OT7XFDEB.js} +1 -1
- package/dist/cdn/{NGNFE76P.js → OVH566HY.js} +1 -1
- package/dist/cdn/{4EA4NN3Y.js → OWLHEGYR.js} +1 -1
- package/dist/cdn/{AMBA2EUA.js → P3EJMK3K.js} +1 -1
- package/dist/cdn/{LQ7KQDLQ.js → P64PZE5S.js} +1 -1
- package/dist/cdn/PEW5RZYH.js +2 -0
- package/dist/cdn/{WZMGO7LL.js → PFJV42H6.js} +1 -1
- package/dist/cdn/{AXJTRFKH.js → PJ6E2WWQ.js} +1 -1
- package/dist/cdn/{KNWNPJJO.js → PKL4RJ3I.js} +1 -1
- package/dist/cdn/Q2M6DFTT.js +2 -0
- package/dist/cdn/{KWDM6JLE.js → Q7KREJDD.js} +1 -1
- package/dist/cdn/{U7QOHO34.js → Q7N7YE7C.js} +1 -1
- package/dist/cdn/QI7OFLTX.js +2 -0
- package/dist/cdn/{JLF2KDUL.js → QLZHCTZM.js} +1 -1
- package/dist/cdn/{LTGUCBSN.js → QPIVL4MU.js} +1 -1
- package/dist/cdn/{TT7IUW6H.js → QVGQ7FVR.js} +1 -1
- package/dist/cdn/{SUABQCPU.js → R5KY2VYM.js} +1 -1
- package/dist/cdn/{LJVVEOJW.js → RLVITQ7L.js} +1 -1
- package/dist/cdn/{DBSSYOP5.js → ROWZY3RC.js} +1 -1
- package/dist/cdn/{HIIBFQXO.js → RPU52HDN.js} +1 -1
- package/dist/cdn/{EGC32ZE3.js → RYSRTRF6.js} +1 -1
- package/dist/cdn/{R6IKEF36.js → RZI54MXM.js} +1 -1
- package/dist/cdn/{YM7GNJYN.js → SFDWMTKC.js} +1 -1
- package/dist/cdn/{UHF5WWSO.js → SMMAGIIC.js} +1 -1
- package/dist/cdn/{Y2IQY2EY.js → SPL63LN5.js} +1 -1
- package/dist/cdn/{PX6D64G5.js → SPQ334F6.js} +1 -1
- package/dist/cdn/{3PS6ZCOJ.js → SV2D6WTU.js} +1 -1
- package/dist/cdn/{AA3DXSPP.js → U4DMH6YM.js} +1 -1
- package/dist/cdn/{QBBSIVGA.js → U75BL3NA.js} +1 -1
- package/dist/cdn/{KGUBLLAN.js → UA2MCESW.js} +1 -1
- package/dist/cdn/{XLHOSPQ5.js → UHRY64O3.js} +1 -1
- package/dist/cdn/{F5W7XT2Q.js → UNIPTT3B.js} +1 -1
- package/dist/cdn/UTQQM2LE.js +2 -0
- package/dist/cdn/UZCIMYHE.js +2 -0
- package/dist/cdn/{VXTK2DRE.js → VCI4KAKP.js} +1 -1
- package/dist/cdn/{M2RE5X5G.js → VQQFVMF2.js} +1 -1
- package/dist/cdn/{5KNJIBXU.js → W6SF2A6M.js} +1 -1
- package/dist/cdn/{N6H5WSS3.js → WCMZB7U6.js} +1 -1
- package/dist/cdn/{BI6N6OLG.js → WMP2DMFI.js} +1 -1
- package/dist/cdn/{OE3CTVMS.js → WP5WOQU7.js} +1 -1
- package/dist/cdn/{47OK73UM.js → WQZYQVVZ.js} +1 -1
- package/dist/cdn/{TCCEP2M6.js → X2CB6Q6Y.js} +1 -1
- package/dist/cdn/{EQ5QN55S.js → X5X3IQSE.js} +1 -1
- package/dist/cdn/{JM5ZQSHH.js → XGYIUMH7.js} +1 -1
- package/dist/cdn/{62BPSIAC.js → XVDGWRYO.js} +1 -1
- package/dist/cdn/{7TFAWSUU.js → Y745AXFT.js} +1 -1
- package/dist/cdn/{4DGEDSH7.js → YAELQLY3.js} +1 -1
- package/dist/cdn/{5CS4ZHWG.js → YIJUVWIX.js} +1 -1
- package/dist/cdn/{WSPCGNXA.js → YLSQ25XM.js} +1 -1
- package/dist/cdn/YSRNKW53.js +2 -0
- package/dist/cdn/{F6NYDGX3.js → YUM22OLS.js} +1 -1
- package/dist/cdn/{7OS36S45.js → ZJH2BJA2.js} +1 -1
- package/dist/cdn/assets/icon/layerStreamSetting16.json +1 -0
- package/dist/cdn/assets/icon/layerStreamSetting24.json +1 -0
- package/dist/cdn/assets/icon/layerStreamSetting32.json +1 -0
- package/dist/cdn/assets/icon/velocityServer16.json +1 -0
- package/dist/cdn/assets/icon/velocityServer24.json +1 -0
- package/dist/cdn/assets/icon/velocityServer32.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/form.js +0 -1
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/useForm.js +98 -25
- package/dist/components/calcite-input-date-picker/customElement.d.ts +1 -1
- package/dist/components/calcite-input-date-picker/customElement.js +30 -14
- package/dist/components/calcite-input-number/customElement.d.ts +1 -1
- package/dist/components/calcite-input-number/customElement.js +11 -24
- package/dist/components/calcite-input-time-picker/customElement.d.ts +1 -1
- package/dist/components/calcite-input-time-picker/customElement.js +10 -9
- package/dist/components/calcite-rating/customElement.d.ts +1 -1
- package/dist/components/calcite-rating/customElement.js +11 -4
- package/dist/components/calcite-segmented-control/customElement.js +7 -5
- package/dist/components/calcite-select/customElement.js +2 -2
- package/dist/components/calcite-slider/customElement.d.ts +1 -1
- package/dist/components/calcite-slider/customElement.js +8 -5
- package/dist/components/calcite-switch/customElement.js +8 -7
- package/dist/components/calcite-tooltip/customElement.d.ts +14 -1
- package/dist/components/calcite-tooltip/customElement.js +14 -7
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +8 -8
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/package.json +3 -3
- package/dist/cdn/25QNIXKR.js +0 -2
- package/dist/cdn/5IQZAMQB.js +0 -2
- package/dist/cdn/5MAX4LZ7.js +0 -2
- package/dist/cdn/7S2GCYMV.js +0 -2
- package/dist/cdn/7UOYXJ3K.js +0 -2
- package/dist/cdn/BHL2FDAW.js +0 -2
- package/dist/cdn/DID6SDT2.js +0 -2
- package/dist/cdn/EYYSCPVS.js +0 -2
- package/dist/cdn/JUOU7S4Z.js +0 -2
- package/dist/cdn/LGJMKX4S.js +0 -2
- package/dist/cdn/NGCSOSFT.js +0 -2
- package/dist/cdn/OPS2PPMB.js +0 -2
- package/dist/cdn/Q3YSVBG2.js +0 -2
- package/dist/cdn/W6BPLQNJ.js +0 -2
- package/dist/cdn/XCK6T2FY.js +0 -2
- package/dist/cdn/XP2AJQ56.js +0 -2
- package/dist/chunks/input.js +0 -40
package/dist/chunks/useForm.js
CHANGED
|
@@ -1,8 +1,89 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { makeGenericController } from "@arcgis/lumina/controllers";
|
|
3
3
|
import { uncapitalize, kebabToPascal } from "@arcgis/toolkit/string";
|
|
4
|
-
import { s as syncInputDelegate, i as isSupportedType } from "./input.js";
|
|
5
4
|
import { r as isCalciteFocusable } from "./dom.js";
|
|
5
|
+
import "lit";
|
|
6
|
+
const minMaxStepTypes = ["date", "datetime-local", "month", "number", "range", "time", "week"];
|
|
7
|
+
const patternTypes = ["email", "password", "search", "tel", "text", "url"];
|
|
8
|
+
const minMaxLengthTypes = ["email", "password", "search", "tel", "text", "textarea", "url"];
|
|
9
|
+
function updateConstraintValidation(inputComponent, input, propName, matchesType) {
|
|
10
|
+
const attributeName = propName.toLowerCase();
|
|
11
|
+
const value = inputComponent[propName];
|
|
12
|
+
if (matchesType && value != null) {
|
|
13
|
+
input.setAttribute(attributeName, `${value}`);
|
|
14
|
+
} else {
|
|
15
|
+
input.removeAttribute(attributeName);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function syncInputDelegate(type, inputComponent, input) {
|
|
19
|
+
input.type = type;
|
|
20
|
+
const isMinMaxStepType = minMaxStepTypes.includes(type);
|
|
21
|
+
const numericInputComponent = inputComponent;
|
|
22
|
+
updateConstraintValidation(numericInputComponent, input, "min", isMinMaxStepType);
|
|
23
|
+
updateConstraintValidation(numericInputComponent, input, "max", isMinMaxStepType);
|
|
24
|
+
updateConstraintValidation(numericInputComponent, input, "step", isMinMaxStepType);
|
|
25
|
+
const isMinMaxLengthType = minMaxLengthTypes.includes(type);
|
|
26
|
+
const textualInputComponent = inputComponent;
|
|
27
|
+
updateConstraintValidation(textualInputComponent, input, "minLength", isMinMaxLengthType);
|
|
28
|
+
updateConstraintValidation(textualInputComponent, input, "maxLength", isMinMaxLengthType);
|
|
29
|
+
const isPatternType = patternTypes.includes(type);
|
|
30
|
+
updateConstraintValidation(textualInputComponent, input, "pattern", isPatternType);
|
|
31
|
+
}
|
|
32
|
+
function isSupportedType(type) {
|
|
33
|
+
const effectiveType = type === "textarea" ? "text" : type;
|
|
34
|
+
return minMaxStepTypes.includes(effectiveType) || patternTypes.includes(effectiveType) || minMaxLengthTypes.includes(effectiveType);
|
|
35
|
+
}
|
|
36
|
+
const joinableValueTypes = ["text", "email", "search", "hidden", "tel", "url"];
|
|
37
|
+
const allValid = Object.freeze({ validity: {}, validationMessage: "" });
|
|
38
|
+
function validate(input, value) {
|
|
39
|
+
if (!Array.isArray(value)) {
|
|
40
|
+
if (validateValue(input, value)) {
|
|
41
|
+
return allValid;
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
validity: getValidityFlags(input.validity),
|
|
45
|
+
validationMessage: input.validationMessage
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (joinableValueTypes.includes(input.type)) {
|
|
49
|
+
if (validateValue(input, value.join(","))) {
|
|
50
|
+
return allValid;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
validity: getValidityFlags(input.validity),
|
|
54
|
+
validationMessage: input.validationMessage
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const mergedValidity = {};
|
|
58
|
+
const validationMessages = [];
|
|
59
|
+
for (const item of value) {
|
|
60
|
+
if (validateValue(input, item)) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
Object.assign(mergedValidity, getValidityFlags(input.validity));
|
|
64
|
+
if (input.validationMessage) {
|
|
65
|
+
validationMessages.push(input.validationMessage);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
validity: mergedValidity,
|
|
70
|
+
validationMessage: validationMessages.join("; ")
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function validateValue(inputDelegate, valueToValidate) {
|
|
74
|
+
inputDelegate.value = // file will throw if non-empty string is provided
|
|
75
|
+
inputDelegate.type === "file" || valueToValidate == null ? "" : String(valueToValidate);
|
|
76
|
+
return inputDelegate.validity.valid;
|
|
77
|
+
}
|
|
78
|
+
function getValidityFlags(validityState) {
|
|
79
|
+
const validityFlags = {};
|
|
80
|
+
for (const key in validityState) {
|
|
81
|
+
if (key !== "valid" && validityState[key]) {
|
|
82
|
+
validityFlags[key] = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return validityFlags;
|
|
86
|
+
}
|
|
6
87
|
const componentsWithInputEvent = [
|
|
7
88
|
"calcite-input",
|
|
8
89
|
"calcite-input-number",
|
|
@@ -57,9 +138,6 @@ function focusFirstInvalidFormElement(form) {
|
|
|
57
138
|
}
|
|
58
139
|
});
|
|
59
140
|
}
|
|
60
|
-
function overrideDefaultValue(component, value) {
|
|
61
|
-
component.defaultValue = value;
|
|
62
|
-
}
|
|
63
141
|
const useForm = (options) => {
|
|
64
142
|
return makeGenericController((component, controller) => {
|
|
65
143
|
let customValidityMessage = "";
|
|
@@ -144,7 +222,7 @@ const useForm = (options) => {
|
|
|
144
222
|
component.defaultChecked = component.checked;
|
|
145
223
|
}
|
|
146
224
|
}
|
|
147
|
-
if (changes.has("value") || isCheckable(component) && changes.has("checked")) {
|
|
225
|
+
if (changes.has("name") || changes.has("value") || isCheckable(component) && changes.has("checked")) {
|
|
148
226
|
component.elementInternals.setFormValue(getFormValue());
|
|
149
227
|
}
|
|
150
228
|
updateValidity();
|
|
@@ -155,22 +233,8 @@ const useForm = (options) => {
|
|
|
155
233
|
let validationMessage = "";
|
|
156
234
|
if (inputDelegate) {
|
|
157
235
|
inputDelegate.type = effectiveInputType;
|
|
158
|
-
const { value } = component;
|
|
159
|
-
const normalizedValue = value == null || /* type=file only accepts empty string as a value */
|
|
160
|
-
inputDelegate.type === "file" ? `` : Array.isArray(value) ? value.join(",") : `${value}`;
|
|
161
|
-
inputDelegate.value = normalizedValue;
|
|
162
236
|
syncInternalInput(component, inputDelegate);
|
|
163
|
-
|
|
164
|
-
for (const key in inputDelegate.validity) {
|
|
165
|
-
if (
|
|
166
|
-
// see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/setValidity#flags
|
|
167
|
-
key !== "valid"
|
|
168
|
-
) {
|
|
169
|
-
validity[key] = inputDelegate.validity[key];
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
validationMessage = inputDelegate.validationMessage;
|
|
173
|
-
}
|
|
237
|
+
({ validity, validationMessage } = validate(inputDelegate, getComponentValue()));
|
|
174
238
|
}
|
|
175
239
|
if (customValidityMessage) {
|
|
176
240
|
validity = { ...validity, customError: true };
|
|
@@ -181,24 +245,34 @@ const useForm = (options) => {
|
|
|
181
245
|
component.validity = elementInternals.validity;
|
|
182
246
|
}
|
|
183
247
|
}
|
|
248
|
+
function getComponentValue() {
|
|
249
|
+
if (options.getValue) {
|
|
250
|
+
return options.getValue();
|
|
251
|
+
}
|
|
252
|
+
return component.value;
|
|
253
|
+
}
|
|
184
254
|
function getFormValue() {
|
|
185
|
-
|
|
255
|
+
const value = getComponentValue();
|
|
256
|
+
if (Array.isArray(value)) {
|
|
186
257
|
const formData = new FormData();
|
|
187
|
-
|
|
258
|
+
value.forEach((value2) => formData.append(component.name, value2));
|
|
188
259
|
return formData;
|
|
189
260
|
}
|
|
190
261
|
if (isCheckable(component)) {
|
|
191
262
|
if (component.checked) {
|
|
192
|
-
return
|
|
263
|
+
return value || "on";
|
|
193
264
|
}
|
|
194
265
|
return null;
|
|
195
266
|
}
|
|
196
|
-
return
|
|
267
|
+
return value;
|
|
197
268
|
}
|
|
198
269
|
return {
|
|
199
270
|
get active() {
|
|
200
271
|
return !!component.elementInternals.form;
|
|
201
272
|
},
|
|
273
|
+
overrideDefaultValue: (value) => {
|
|
274
|
+
component.defaultValue = value;
|
|
275
|
+
},
|
|
202
276
|
overrideInputType: (type) => {
|
|
203
277
|
effectiveInputType = type;
|
|
204
278
|
updateValidity();
|
|
@@ -214,6 +288,5 @@ const useForm = (options) => {
|
|
|
214
288
|
});
|
|
215
289
|
};
|
|
216
290
|
export {
|
|
217
|
-
overrideDefaultValue as o,
|
|
218
291
|
useForm as u
|
|
219
292
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
3
|
import type { FlipPlacement, MenuPlacement, OverlayPositioning } from "../../utils/floating-ui.js";
|
|
4
|
-
import type { MutableValidityState } from "../../utils/form.js";
|
|
5
4
|
import type { NumberingSystem } from "../../utils/locale.js";
|
|
6
5
|
import type { HeadingLevel } from "../functional/Heading.js";
|
|
7
6
|
import type { Status } from "../interfaces.js";
|
|
8
7
|
import type { IconName } from "../calcite-icon/interfaces.js";
|
|
9
8
|
import type { DatePicker } from "../calcite-date-picker/customElement.js";
|
|
9
|
+
import type { MutableValidityState } from "../../controllers/useForm.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @cssproperty [--calcite-input-date-picker-actions-icon-color] - Specifies the component's actions icon color.
|
|
@@ -7,7 +7,6 @@ import { useDirection } from "@arcgis/lumina/controllers";
|
|
|
7
7
|
import { u as useFocusTrap } from "../../chunks/useFocusTrap.js";
|
|
8
8
|
import { l as datePartsFromISO, d as dateFromISO, b as dateFromRange, a as dateToISO, m as datePartsFromLocalizedString, o as dateFromLocalizedString, i as inRange } from "../../chunks/date.js";
|
|
9
9
|
import { d as defaultMenuPlacement, r as reposition, c as connectFloatingUI, a as disconnectFloatingUI, f as filterValidFlipPlacements, h as hideFloatingUI, F as FloatingCSS } from "../../chunks/floating-ui.js";
|
|
10
|
-
import { c as connectForm, d as disconnectForm, s as submitForm, H as HiddenFormInputSlot } from "../../chunks/form.js";
|
|
11
10
|
import { n as numberKeys } from "../../chunks/key.js";
|
|
12
11
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
13
12
|
import { g as getIconScale } from "../../chunks/component.js";
|
|
@@ -17,11 +16,11 @@ import { g as getValueAsDateRange, a as applyLocaleOverride, b as getLocaleData
|
|
|
17
16
|
import { g as guid } from "../../chunks/guid.js";
|
|
18
17
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
19
18
|
import { V as Validation } from "../../chunks/Validation.js";
|
|
20
|
-
import { a as syncHiddenFormInput } from "../../chunks/input.js";
|
|
21
19
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
22
20
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
23
21
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
24
22
|
import { u as useTopLayer } from "../../chunks/useTopLayer.js";
|
|
23
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
25
24
|
const styles = css`:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host .menu-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}:host .menu-container:popover-open{display:block}:host .menu-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}:host .menu-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}:host .menu-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}:host .menu-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}:host .menu-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}:host .menu-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{:host .menu-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}:host{position:relative;display:inline-block;width:100%;overflow:visible;vertical-align:top;box-shadow:var(--calcite-input-date-picker-shadow, var(--calcite-shadow-none))}:host .menu-container .calcite-floating-ui-anim{box-shadow:var(--calcite-input-date-picker-calendar-shadow, var(--calcite-shadow-sm))}:host([scale=s]){--calcite-internal-date-picker-toggle-spacing: var(--calcite-spacing-sm);--calcite-internal-input-text-input-padding-inline-end: calc(var(--calcite-internal-date-picker-toggle-spacing) + var(--calcite-spacing-lg))}:host([scale=m]){--calcite-internal-date-picker-toggle-spacing: var(--calcite-spacing-md);--calcite-internal-input-text-input-padding-inline-end: calc(var(--calcite-internal-date-picker-toggle-spacing) + var(--calcite-spacing-xxl))}:host([scale=l]){--calcite-internal-date-picker-toggle-spacing: var(--calcite-spacing-lg);--calcite-internal-input-text-input-padding-inline-end: calc(var(--calcite-internal-date-picker-toggle-spacing) + var(--calcite-spacing-xxxl))}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.calendar-wrapper{box-shadow:var(--calcite-input-date-picker-calendar-shadow, var(--calcite-shadow-none));transform:translateZ(0)}.input-wrapper{position:relative}.input-wrapper .chevron-icon{color:var(--calcite-input-date-picker-actions-icon-color, var(--calcite-color-text-3))}.input-wrapper:focus-within .chevron-icon,.input-wrapper:active .chevron-icon,.input-wrapper:hover .chevron-icon{color:var(--calcite-input-date-picker-actions-icon-color-hover, var(--calcite-color-text-1))}.input-wrapper:focus-within~.input-wrapper .chevron-icon,.input-wrapper:active~.input-wrapper .chevron-icon,.input-wrapper:hover~.input-wrapper .chevron-icon{color:var(--calcite-input-date-picker-actions-icon-color-hover, var(--calcite-color-text-1))}.toggle-icon{position:absolute;display:flex;cursor:pointer;align-items:center;inset-inline-end:0;inset-block:0;padding-inline:var(--calcite-internal-date-picker-toggle-spacing)}:host([range]) .container{display:flex}:host([range]) .input-container{display:flex;flex:1 1 auto}:host([range]) .input-wrapper{flex:1 1 auto}.divider-container{display:flex;align-items:stretch;border-width:1px;border-left-width:0px;border-right-width:0px;border-style:solid;background-color:var(--calcite-input-date-picker-background-color, var(--calcite-color-foreground-1));border-color:var(--calcite-input-date-picker-border-color, var(--calcite-color-border-input))}:host([layout=horizontal]) .divider-container{inline-size:var(--calcite-spacing-px)}.divider{display:inline-block;margin-block:var(--calcite-spacing-xxs);background-color:var(--calcite-input-date-picker-divider-color, var(--calcite-color-border-2));inline-size:var(--calcite-spacing-px)}:host([layout=vertical]) .divider-container{height:1px;width:100%;border-top-width:0px;border-bottom-width:0px;border-inline-start-width:var(--calcite-border-width-sm);border-inline-end-width:var(--calcite-border-width-none);padding-inline:var(--calcite-spacing-md)}:host([layout=vertical]) .divider-container .divider{margin-top:0;margin-bottom:0;height:1px;width:100%}:host([range][layout=vertical]) .input-wrapper{width:100%}:host([range][layout=vertical]) .input-container{flex-direction:column;align-items:flex-start}.menu-container{--calcite-floating-ui-z-index: var(--calcite-z-index-dropdown);inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.menu-container{opacity:0;inset-block-start:0;left:0}}.menu-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.menu-container:popover-open{display:block}.menu-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}.menu-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.menu-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.menu-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}.menu-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.menu-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.menu-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.input .calcite-input__wrapper{margin-top:0}.vertical-chevron-container{display:flex;align-items:center;border-width:1px;border-style:solid;padding-inline:var(--calcite-spacing-md);background-color:var(--calcite-input-date-picker-background-color, var(--calcite-color-foreground-1));border-color:var(--calcite-input-date-picker-border-color, var(--calcite-color-border-input));border-inline-start-width:0}.vertical-chevron-container calcite-icon{color:var(--calcite-input-date-picker-actions-icon-color, var(--calcite-color-text-3))}.vertical-chevron-container calcite-icon:hover{color:var(--calcite-input-date-picker-actions-icon-color-hover, var(--calcite-color-text-1))}:host([range][layout=vertical][scale=s]) .vertical-chevron-container,:host([range][layout=vertical][scale=s]) .divider-container{padding-inline:var(--calcite-spacing-sm)}:host([range][layout=vertical][scale=l]) .vertical-chevron-container,:host([range][layout=vertical][scale=l]) .divider-container{padding-inline:var(--calcite-spacing-lg)}.container:focus-within .vertical-chevron-container calcite-icon,.container:active .vertical-chevron-container calcite-icon,.container:hover .vertical-chevron-container calcite-icon{color:var(--calcite-input-date-picker-actions-icon-color-hover, var(--calcite-color-text-1))}.input{--calcite-input-text-background-color: var(--calcite-input-date-picker-background-color);--calcite-input-text-border-color: var(--calcite-input-date-picker-border-color);--calcite-input-text-corner-radius: var(--calcite-input-date-picker-corner-radius);--calcite-input-text-shadow: var(--calcite-input-date-picker-shadow);--calcite-input-text-icon-color: var(--calcite-input-date-picker-icon-color);--calcite-input-text-text-color: var(--calcite-input-date-picker-text-color);--calcite-input-text-placeholder-text-color: var(--calcite-input-date-picker-placeholder-text-color)}calcite-date-picker{--calcite-date-picker-border-color: var(--calcite-input-date-picker-calendar-border-color);--calcite-date-picker-corner-radius: var(--calcite-input-date-picker-calendar-corner-radius);--calcite-date-picker-range-calendar-divider-color: var(--calcite-input-date-picker-calendar-range-divider-color);--calcite-date-picker-week-header-text-color: var(--calcite-input-date-picker-calendar-text-color);--calcite-date-picker-header-action-background-color: var( --calcite-input-date-picker-calendar-actions-background-color );--calcite-date-picker-header-action-background-color-hover: var( --calcite-input-date-picker-calendar-actions-background-color-hover );--calcite-date-picker-header-action-background-color-press: var( --calcite-input-date-picker-calendar-actions-background-color-press );--calcite-date-picker-header-action-text-color: var(--calcite-input-date-picker-calendar-actions-text-color);--calcite-date-picker-header-action-text-color-press: var( --calcite-input-date-picker-calendar-actions-text-color-press );--calcite-date-picker-year-text-color: var(--calcite-input-date-picker-calendar-text-color);--calcite-date-picker-month-select-text-color: var(--calcite-input-date-picker-calendar-month-select-text-color);--calcite-date-picker-month-select-icon-color: var(--calcite-input-date-picker-calendar-icon-color);--calcite-date-picker-month-select-icon-color-hover: var(--calcite-input-date-picker-calendar-icon-color-hover);--calcite-date-picker-day-background-color: var(--calcite-input-date-picker-calendar-day-background-color);--calcite-date-picker-day-background-color-hover: var( --calcite-input-date-picker-calendar-day-background-color-hover );--calcite-date-picker-day-background-color-selected: var( --calcite-input-date-picker-calendar-selected-background-color );--calcite-date-picker-day-text-color: var(--calcite-input-date-picker-calendar-day-text-color);--calcite-date-picker-day-text-color-hover: var(--calcite-input-date-picker-calendar-day-text-color-hover);--calcite-date-picker-day-text-color-selected: var(--calcite-input-date-picker-calendar-day-text-color-selected);--calcite-date-picker-current-day-text-color: var( --calcite-input-date-picker-calendar-current-day-text-color, var(--calcite-input-date-picker-calendar-day-current-text-color) );--calcite-date-picker-day-range-text-color: var(--calcite-input-date-picker-calendar-day-range-text-color);--calcite-date-picker-day-range-background-color: var( --calcite-input-date-picker-calendar-day-range-background-color );--calcite-date-picker-day-outside-range-background-color-hover: var( --calcite-input-date-picker-calendar-day-outside-range-background-color-hover );--calcite-date-picker-day-outside-range-text-color-hover: var( --calcite-input-date-picker-calendar-day-outside-range-text-color-hover )}.assistive-text{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.validation-container{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}:host([scale=m]) .validation-container,:host([scale=l]) .validation-container{padding-block-start:.5rem}:host([scale=s]) .validation-container{padding-block-start:.25rem}::slotted(input[slot=hidden-form-input]){margin:0!important;opacity:0!important;outline:none!important;padding:0!important;position:absolute!important;inset:0!important;transform:none!important;-webkit-appearance:none!important;z-index:-1!important}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-spacing-base)}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-xxs)}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-md)}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-md)}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
26
25
|
const CSS = {
|
|
27
26
|
assistiveText: "assistive-text",
|
|
@@ -95,6 +94,9 @@ class InputDatePicker extends LitElement {
|
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
96
|
})(this);
|
|
97
|
+
this.formSupport = useForm({
|
|
98
|
+
inputType: "date"
|
|
99
|
+
})(this);
|
|
98
100
|
this.transitionProp = "opacity";
|
|
99
101
|
this.placeholderTextId = IDS.placeholder(guid());
|
|
100
102
|
this.rangeStartValueChangedByUser = false;
|
|
@@ -150,6 +152,9 @@ class InputDatePicker extends LitElement {
|
|
|
150
152
|
static {
|
|
151
153
|
this.properties = { datePickerActiveDate: [16, {}, { state: true }], focusedInput: [16, {}, { state: true }], localeData: [16, {}, { state: true }], calendars: [11, {}, { type: Number, reflect: true }], disabled: [7, {}, { reflect: true, type: Boolean }], flipPlacements: [0, {}, { attribute: false }], focusTrapDisabled: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], headingLevel: [11, {}, { type: Number, reflect: true }], label: 1, labelText: 1, layout: [3, {}, { reflect: true }], max: [3, {}, { reflect: true }], maxAsDate: [0, {}, { attribute: false }], messageOverrides: [0, {}, { attribute: false }], min: [3, {}, { reflect: true }], minAsDate: [0, {}, { attribute: false }], monthStyle: 1, name: [3, {}, { reflect: true }], numberingSystem: [3, {}, { reflect: true }], open: [7, {}, { reflect: true, type: Boolean }], overlayPositioning: [3, {}, { reflect: true }], placement: [3, {}, { reflect: true }], proximitySelectionDisabled: [5, {}, { type: Boolean }], range: [7, {}, { reflect: true, type: Boolean }], readOnly: [7, {}, { reflect: true, type: Boolean }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], status: [3, {}, { reflect: true }], topLayerDisabled: [7, {}, { reflect: true, type: Boolean }], validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1, validity: [0, {}, { attribute: false }], value: 1, valueAsDate: [0, {}, { attribute: false }] };
|
|
152
154
|
}
|
|
155
|
+
static {
|
|
156
|
+
this.formAssociated = true;
|
|
157
|
+
}
|
|
153
158
|
static {
|
|
154
159
|
this.shadowRootOptions = { mode: "open", delegatesFocus: true };
|
|
155
160
|
}
|
|
@@ -213,7 +218,6 @@ class InputDatePicker extends LitElement {
|
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
220
|
connectLabel(this);
|
|
216
|
-
connectForm(this);
|
|
217
221
|
this.setFilteredPlacements();
|
|
218
222
|
connectFloatingUI(this);
|
|
219
223
|
}
|
|
@@ -265,7 +269,6 @@ class InputDatePicker extends LitElement {
|
|
|
265
269
|
disconnectedCallback() {
|
|
266
270
|
super.disconnectedCallback();
|
|
267
271
|
disconnectLabel(this);
|
|
268
|
-
disconnectForm(this);
|
|
269
272
|
disconnectFloatingUI(this);
|
|
270
273
|
}
|
|
271
274
|
handleDisabledAndReadOnlyChange(value) {
|
|
@@ -390,9 +393,6 @@ class InputDatePicker extends LitElement {
|
|
|
390
393
|
this.datePickerEl?.reset();
|
|
391
394
|
this.topLayer.hide();
|
|
392
395
|
}
|
|
393
|
-
syncHiddenFormInput(input) {
|
|
394
|
-
syncHiddenFormInput("date", this, input);
|
|
395
|
-
}
|
|
396
396
|
blurHandler() {
|
|
397
397
|
this.open = false;
|
|
398
398
|
}
|
|
@@ -444,15 +444,31 @@ class InputDatePicker extends LitElement {
|
|
|
444
444
|
}
|
|
445
445
|
const targetHasSelect = event.composedPath().some((el) => el.tagName === "CALCITE-SELECT");
|
|
446
446
|
if (key === "Enter") {
|
|
447
|
-
|
|
447
|
+
const preCommitValue = this.value;
|
|
448
448
|
this.commitValue();
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
449
|
+
const focusRangeEnd = this.shouldFocusRangeEnd();
|
|
450
|
+
const focusRangeStart = !focusRangeEnd && this.shouldFocusRangeStart();
|
|
451
|
+
if (focusRangeEnd || focusRangeStart) {
|
|
452
|
+
event.preventDefault();
|
|
453
|
+
if (focusRangeEnd) {
|
|
454
|
+
this.endInputRef.value?.setFocus();
|
|
455
|
+
} else if (focusRangeStart) {
|
|
456
|
+
this.startInputRef.value?.setFocus();
|
|
457
|
+
}
|
|
458
|
+
return;
|
|
453
459
|
}
|
|
454
|
-
if (
|
|
460
|
+
if (this.open) {
|
|
455
461
|
this.restoreInputFocus(true);
|
|
462
|
+
event.preventDefault();
|
|
463
|
+
} else {
|
|
464
|
+
const formActive = this.formSupport.active;
|
|
465
|
+
const handledKey = preCommitValue !== this.value || formActive;
|
|
466
|
+
if (handledKey) {
|
|
467
|
+
event.preventDefault();
|
|
468
|
+
}
|
|
469
|
+
if (formActive) {
|
|
470
|
+
this.formSupport.requestSubmit();
|
|
471
|
+
}
|
|
456
472
|
}
|
|
457
473
|
} else if ((key === "ArrowDown" || key === "ArrowUp") && !targetHasSelect) {
|
|
458
474
|
this.open = true;
|
|
@@ -666,7 +682,7 @@ class InputDatePicker extends LitElement {
|
|
|
666
682
|
[CSS.inputNoTopBorder]: this.layout === "vertical" && this.range,
|
|
667
683
|
[CSS.inputNoLeftBorder]: this.layout === "horizontal" && this.range,
|
|
668
684
|
[CSS.inputNoRightBorder]: this.layout === "vertical" && this.range
|
|
669
|
-
})} .disabled=${disabled} .icon=${ICONS.calendar} .label=${this.messages.endDate} @calciteInputTextInput=${this.calciteInternalInputInputHandler} @calciteInternalInputTextBlur=${this.calciteInternalInputBlurHandler} @calciteInternalInputTextFocus=${this.endInputFocus} .placeholder=${this.localeData?.placeholder} .readOnly=${readOnly} role=combobox .scale=${this.scale} .status=${this.status} ${ref(this.endInputRef)}></calcite-input-text>${!this.readOnly && this.layout === "horizontal" && this.renderToggleIcon(this.open) || ""}</div>` || ""}</div>${this.range && this.layout === "vertical" && html`<div class=${safeClassMap(CSS.verticalChevronContainer)}><calcite-icon .icon=${this.open ? ICONS.chevronUp : ICONS.chevronDown} .scale=${getIconScale(this.scale)}></calcite-icon></div>` || ""}</div>${
|
|
685
|
+
})} .disabled=${disabled} .icon=${ICONS.calendar} .label=${this.messages.endDate} @calciteInputTextInput=${this.calciteInternalInputInputHandler} @calciteInternalInputTextBlur=${this.calciteInternalInputBlurHandler} @calciteInternalInputTextFocus=${this.endInputFocus} .placeholder=${this.localeData?.placeholder} .readOnly=${readOnly} role=combobox .scale=${this.scale} .status=${this.status} ${ref(this.endInputRef)}></calcite-input-text>${!this.readOnly && this.layout === "horizontal" && this.renderToggleIcon(this.open) || ""}</div>` || ""}</div>${this.range && this.layout === "vertical" && html`<div class=${safeClassMap(CSS.verticalChevronContainer)}><calcite-icon .icon=${this.open ? ICONS.chevronUp : ICONS.chevronDown} .scale=${getIconScale(this.scale)}></calcite-icon></div>` || ""}</div>${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}` });
|
|
670
686
|
}
|
|
671
687
|
renderToggleIcon(open) {
|
|
672
688
|
return html`<span class=${safeClassMap(CSS.toggleIcon)} tabindex=-1><calcite-icon class=${safeClassMap(CSS.chevronIcon)} .icon=${open ? ICONS.chevronUp : ICONS.chevronDown} .scale=${getIconScale(this.scale)}></calcite-icon></span>`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
3
|
import type { Alignment, Scale, Status } from "../interfaces.js";
|
|
4
|
-
import type { MutableValidityState } from "../../utils/form.js";
|
|
5
4
|
import type { NumberingSystem } from "../../utils/locale.js";
|
|
6
5
|
import type { InputPlacement } from "../calcite-input/interfaces.js";
|
|
7
6
|
import type { IconName } from "../calcite-icon/interfaces.js";
|
|
7
|
+
import type { MutableValidityState } from "../../controllers/useForm.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @cssproperty [--calcite-input-actions-background-color] - Specifies the background color of the component's `clearable` and `number-button-type` elements.
|
|
@@ -7,17 +7,16 @@ import { createRef, ref } from "lit/directives/ref.js";
|
|
|
7
7
|
import { LitElement, createEvent, stringOrBoolean, safeClassMap } from "@arcgis/lumina";
|
|
8
8
|
import { useWatchAttributes, useDirection } from "@arcgis/lumina/controllers";
|
|
9
9
|
import { b as setRequestedIcon, j as isPrimaryPointerButton } from "../../chunks/dom.js";
|
|
10
|
-
import { c as connectForm, i as internalHiddenInputInputEvent, d as disconnectForm, s as submitForm, H as HiddenFormInputSlot } from "../../chunks/form.js";
|
|
11
10
|
import { n as numberKeys } from "../../chunks/key.js";
|
|
12
11
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
13
12
|
import { i as isValidNumber, n as numberStringFormatter, B as BigDecimal, p as parseNumberString, s as sanitizeNumberString, a as addLocalizedTrailingDecimalZeros } from "../../chunks/locale.js";
|
|
14
13
|
import { g as getIconScale } from "../../chunks/component.js";
|
|
15
14
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
16
15
|
import { V as Validation } from "../../chunks/Validation.js";
|
|
17
|
-
import { a as syncHiddenFormInput } from "../../chunks/input.js";
|
|
18
16
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
19
17
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
20
18
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
19
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
21
20
|
const CSS = {
|
|
22
21
|
loader: "loader",
|
|
23
22
|
clearButton: "clear-button",
|
|
@@ -58,17 +57,10 @@ class InputNumber extends LitElement {
|
|
|
58
57
|
this.attributeWatch = useWatchAttributes(["autofocus", "enterkeyhint", "inputmode"], this.handleGlobalAttributesChanged);
|
|
59
58
|
this.childNumberRef = createRef();
|
|
60
59
|
this.direction = useDirection();
|
|
60
|
+
this.formSupport = useForm({
|
|
61
|
+
inputType: "number"
|
|
62
|
+
})(this);
|
|
61
63
|
this.inputWrapperRef = createRef();
|
|
62
|
-
this.onHiddenFormInputInput = (event) => {
|
|
63
|
-
if (event.target.name === this.name) {
|
|
64
|
-
this.setNumberValue({
|
|
65
|
-
value: event.target.value,
|
|
66
|
-
origin: "direct"
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
this.setFocus();
|
|
70
|
-
event.stopPropagation();
|
|
71
|
-
};
|
|
72
64
|
this.previousValueOrigin = "initial";
|
|
73
65
|
this.userChangedValue = false;
|
|
74
66
|
this._value = "";
|
|
@@ -113,6 +105,9 @@ class InputNumber extends LitElement {
|
|
|
113
105
|
static {
|
|
114
106
|
this.properties = { displayedValue: [16, {}, { state: true }], slottedActionElDisabledInternally: [16, {}, { state: true }], alignment: [3, {}, { reflect: true }], autocomplete: 1, clearable: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], editingEnabled: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], groupSeparator: [7, {}, { reflect: true, type: Boolean }], icon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], iconFlipRtl: [7, {}, { reflect: true, type: Boolean }], integer: [5, {}, { type: Boolean }], label: 1, labelText: 1, loading: [7, {}, { reflect: true, type: Boolean }], localeFormat: [5, {}, { type: Boolean }], max: [11, {}, { reflect: true, type: Number }], maxLength: [11, {}, { reflect: true, type: Number }], messageOverrides: [0, {}, { attribute: false }], min: [11, {}, { reflect: true, type: Number }], minLength: [11, {}, { reflect: true, type: Number }], name: [3, {}, { reflect: true }], numberButtonType: [3, {}, { reflect: true }], numberingSystem: [3, {}, { reflect: true }], placeholder: 1, prefixText: 1, readOnly: [7, {}, { reflect: true, type: Boolean }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], status: [3, {}, { reflect: true }], step: [3, {}, { reflect: true }], suffixText: 1, validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1, validity: [0, {}, { attribute: false }], value: 1 };
|
|
115
107
|
}
|
|
108
|
+
static {
|
|
109
|
+
this.formAssociated = true;
|
|
110
|
+
}
|
|
116
111
|
static {
|
|
117
112
|
this.styles = styles;
|
|
118
113
|
}
|
|
@@ -148,8 +143,6 @@ class InputNumber extends LitElement {
|
|
|
148
143
|
this.editingEnabled = this.inlineEditableEl.editingEnabled || false;
|
|
149
144
|
}
|
|
150
145
|
connectLabel(this);
|
|
151
|
-
connectForm(this);
|
|
152
|
-
this.el.addEventListener(internalHiddenInputInputEvent, this.onHiddenFormInputInput);
|
|
153
146
|
}
|
|
154
147
|
async load() {
|
|
155
148
|
this.maxString = this.max?.toString();
|
|
@@ -192,9 +185,7 @@ class InputNumber extends LitElement {
|
|
|
192
185
|
disconnectedCallback() {
|
|
193
186
|
super.disconnectedCallback();
|
|
194
187
|
disconnectLabel(this);
|
|
195
|
-
disconnectForm(this);
|
|
196
188
|
this.stopNudging();
|
|
197
|
-
this.el.removeEventListener(internalHiddenInputInputEvent, this.onHiddenFormInputInput);
|
|
198
189
|
}
|
|
199
190
|
stopNudging() {
|
|
200
191
|
window.clearInterval(this.nudgeNumberValueIntervalId);
|
|
@@ -226,10 +217,9 @@ class InputNumber extends LitElement {
|
|
|
226
217
|
this.clearInputValue(event);
|
|
227
218
|
event.preventDefault();
|
|
228
219
|
}
|
|
229
|
-
if (event.key === "Enter") {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
}
|
|
220
|
+
if (event.key === "Enter" && this.formSupport.active) {
|
|
221
|
+
this.formSupport.requestSubmit();
|
|
222
|
+
event.preventDefault();
|
|
233
223
|
}
|
|
234
224
|
}
|
|
235
225
|
onLabelClick() {
|
|
@@ -429,9 +419,6 @@ class InputNumber extends LitElement {
|
|
|
429
419
|
this.nudgeNumberValue(direction, event);
|
|
430
420
|
}
|
|
431
421
|
}
|
|
432
|
-
syncHiddenFormInput(input) {
|
|
433
|
-
syncHiddenFormInput("number", this, input);
|
|
434
|
-
}
|
|
435
422
|
setInputNumberValue(newInputValue) {
|
|
436
423
|
if (!this.childNumberRef.value) {
|
|
437
424
|
return;
|
|
@@ -537,7 +524,7 @@ class InputNumber extends LitElement {
|
|
|
537
524
|
[CSS.hasSuffix]: this.suffixText,
|
|
538
525
|
[CSS.hasPrefix]: this.prefixText,
|
|
539
526
|
[CSS.clearable]: this.isClearable
|
|
540
|
-
})} ${ref(this.inputWrapperRef)}>${this.numberButtonType === "horizontal" && !this.readOnly ? numberButtonsHorizontalDown : null}${this.prefixText ? prefixText : null}<div class=${safeClassMap(CSS.wrapper)}>${childEl}${this.isClearable ? inputClearButton : null}${this.requestedIcon ? iconEl : null}${this.loading ? loader : null}</div><div class=${safeClassMap(CSS.actionWrapper)} ${ref(this.actionWrapperRef)}><slot name=${SLOTS.action}></slot></div>${this.numberButtonType === "vertical" && !this.readOnly ? numberButtonsVertical : null}${this.suffixText ? suffixText : null}${this.numberButtonType === "horizontal" && !this.readOnly ? numberButtonsHorizontalUp : null}
|
|
527
|
+
})} ${ref(this.inputWrapperRef)}>${this.numberButtonType === "horizontal" && !this.readOnly ? numberButtonsHorizontalDown : null}${this.prefixText ? prefixText : null}<div class=${safeClassMap(CSS.wrapper)}>${childEl}${this.isClearable ? inputClearButton : null}${this.requestedIcon ? iconEl : null}${this.loading ? loader : null}</div><div class=${safeClassMap(CSS.actionWrapper)} ${ref(this.actionWrapperRef)}><slot name=${SLOTS.action}></slot></div>${this.numberButtonType === "vertical" && !this.readOnly ? numberButtonsVertical : null}${this.suffixText ? suffixText : null}${this.numberButtonType === "horizontal" && !this.readOnly ? numberButtonsHorizontalUp : null}</div>${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}` });
|
|
541
528
|
}
|
|
542
529
|
}
|
|
543
530
|
customElement("calcite-input-number", InputNumber);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
3
|
import type { LogicalPlacement, OverlayPositioning } from "../../utils/floating-ui.js";
|
|
4
|
-
import type { MutableValidityState } from "../../utils/form.js";
|
|
5
4
|
import type { NumberingSystem } from "../../utils/locale.js";
|
|
6
5
|
import type { HourFormat } from "../../utils/time.js";
|
|
7
6
|
import type { Scale, Status } from "../interfaces.js";
|
|
8
7
|
import type { IconName } from "../calcite-icon/interfaces.js";
|
|
9
8
|
import type { TimePicker } from "../calcite-time-picker/customElement.js";
|
|
9
|
+
import type { MutableValidityState } from "../../controllers/useForm.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @cssproperty [--calcite-input-time-picker-background-color] - Specifies the component's background color.
|
|
@@ -4,18 +4,17 @@ import { css, nothing, html } from "lit";
|
|
|
4
4
|
import { LitElement, createEvent, stringOrBoolean, safeClassMap } from "@arcgis/lumina";
|
|
5
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
6
|
import { useDirection } from "@arcgis/lumina/controllers";
|
|
7
|
-
import { c as connectForm, d as disconnectForm, s as submitForm, H as HiddenFormInputSlot } from "../../chunks/form.js";
|
|
8
7
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
9
8
|
import { d as decimalPlaces } from "../../chunks/math.js";
|
|
10
9
|
import { g as getIconScale } from "../../chunks/component.js";
|
|
11
10
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
12
11
|
import { V as Validation } from "../../chunks/Validation.js";
|
|
13
|
-
import { a as syncHiddenFormInput } from "../../chunks/input.js";
|
|
14
12
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
15
13
|
import { i as isValidNumber } from "../../chunks/locale.js";
|
|
16
14
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
17
15
|
import { u as useTime } from "../../chunks/useTime.js";
|
|
18
16
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
17
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
19
18
|
const styles = css`:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}::slotted(input[slot=hidden-form-input]){margin:0!important;opacity:0!important;outline:none!important;padding:0!important;position:absolute!important;inset:0!important;transform:none!important;-webkit-appearance:none!important;z-index:-1!important}calcite-time-picker{--calcite-time-picker-color: var(--calcite-input-time-picker-digit-text-color);--calcite-time-picker-icon-color: var(--calcite-input-time-picker-digit-icon-color);--calcite-time-picker-border-color: var(--calcite-input-time-picker-border-color);--calcite-time-picker-button-background-color-hover: var(--calcite-input-time-picker-action-background-color-hover);--calcite-time-picker-button-background-color-press: var(--calcite-input-time-picker-action-background-color-press);--calcite-time-picker-input-border-color-hover: var(--calcite-input-time-picker-digit-border-color-hover);--calcite-time-picker-input-border-color-press: var(--calcite-input-time-picker-digit-border-color-press)}.container{--calcite-icon-color: var( --calcite-input-time-picker-icon-color, var(--calcite-ui-icon-color, var(--calcite-color-text-3)) );align-items:center;background-color:var(--calcite-input-time-picker-input-background-color, var(--calcite-color-foreground-1));border:1px solid var(--calcite-input-time-picker-input-border-color, var(--calcite-color-border-input));border-radius:var(--calcite-input-time-picker-input-corner-radius, var(--calcite-corner-radius-none));box-shadow:var(--calcite-input-time-picker-input-shadow, var(--calcite-shadow-none));box-sizing:border-box;display:flex;color:var(--calcite-input-time-picker-input-text-color, var(--calcite-color-text-1));flex-wrap:nowrap;font-weight:var(--calcite-font-weight-normal);inline-size:100%;padding-block:var(--calcite-spacing-base);-webkit-user-select:none;user-select:none}.container:focus-within{border-color:var(--calcite-color-brand);outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.container.read-only{background-color:var(--calcite-color-background);font-weight:var(--calcite-font-weight-medium)}.clock-icon{--calcite-icon-color: var( --calcite-input-time-picker-icon-color, var(--calcite-ui-icon-color, var(--calcite-color-text-3)) )}.hour-suffix,.minute-suffix,.second-suffix{white-space:pre}.input-container{display:flex;flex-grow:1}.input{align-items:center;display:flex;block-size:100%;justify-content:center;min-inline-size:max-content}.input.empty{inline-size:var(--calcite-spacing-xl)}.input:focus,.input:hover:focus{background-color:Highlight;color:HighlightText;outline:2px solid transparent;outline-offset:2px}.toggle-icon{--calcite-icon-color: var(--calcite-input-time-picker-icon-color, var(--calcite-color-text-3));align-items:center;block-size:24px;cursor:pointer;display:flex;inline-size:24px;justify-content:center}.toggle-icon:hover{--calcite-icon-color: var(--calcite-input-time-picker-icon-color-hover, var(--calcite-color-text-1))}:host([scale=s]) .container{block-size:1.5rem;font-size:var(--calcite-font-size-sm);gap:var(--calcite-spacing-sm);padding-inline-start:var(--calcite-spacing-sm);padding-inline-end:var(--calcite-spacing-xxs)}:host([scale=s]) .input-container{line-height:1rem}:host([scale=m]) .container{block-size:2rem;font-size:var(--calcite-font-size);gap:var(--calcite-spacing-md);padding-inline-start:var(--calcite-spacing-md);padding-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .input-container{line-height:1.5rem}:host([scale=l]) .container{block-size:2.75rem;font-size:var(--calcite-font-size-md);gap:var(--calcite-spacing-lg);padding-inline:var(--calcite-spacing-lg)}:host([scale=l]) .input-container{line-height:2.25rem}:host([status=invalid]) .container{border-color:var(--calcite-color-status-danger)}:host([status=invalid]) .container:focus-within{outline:var(--calcite-border-width-md) solid var(--calcite-color-status-danger);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}calcite-time-picker{--calcite-time-picker-background-color: var(--calcite-input-time-picker-background-color);--calcite-time-picker-border-color: var(--calcite-input-time-picker-border-color, transparent);--calcite-time-picker-corner-radius: var( --calcite-input-time-picker-corner-radius, var(--calcite-corner-radius-round) )}calcite-popover{--calcite-popover-corner-radius: var(--calcite-input-time-picker-corner-radius, var(--calcite-corner-radius-round))}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-spacing-base)}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-xxs)}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-md)}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-md)}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}.validation-container{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}:host([scale=m]) .validation-container,:host([scale=l]) .validation-container{padding-block-start:.5rem}:host([scale=s]) .validation-container{padding-block-start:.25rem}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
20
19
|
const CSS = {
|
|
21
20
|
clockIcon: "clock-icon",
|
|
@@ -51,6 +50,9 @@ class InputTimePicker extends LitElement {
|
|
|
51
50
|
this.containerRef = createRef();
|
|
52
51
|
this.direction = useDirection();
|
|
53
52
|
this.focusSetter = useSetFocus()(this);
|
|
53
|
+
this.formSupport = useForm({
|
|
54
|
+
inputType: "time"
|
|
55
|
+
})(this);
|
|
54
56
|
this.fractionalSecondRef = createRef();
|
|
55
57
|
this.hourRef = createRef();
|
|
56
58
|
this.meridiemRef = createRef();
|
|
@@ -95,6 +97,9 @@ class InputTimePicker extends LitElement {
|
|
|
95
97
|
static {
|
|
96
98
|
this.properties = { disabled: [7, {}, { reflect: true, type: Boolean }], focusTrapDisabled: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], hourFormat: [3, {}, { reflect: true }], label: 1, labelText: 1, max: [3, {}, { reflect: true }], messageOverrides: [0, {}, { attribute: false }], min: [3, {}, { reflect: true }], name: 1, numberingSystem: [3, {}, { reflect: true }], open: [7, {}, { reflect: true, type: Boolean }], overlayPositioning: 1, placement: [3, {}, { reflect: true }], readOnly: [7, {}, { reflect: true, type: Boolean }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], status: [3, {}, { reflect: true }], step: [11, {}, { reflect: true, type: Number }], validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1, validity: [0, {}, { attribute: false }], value: 1 };
|
|
97
99
|
}
|
|
100
|
+
static {
|
|
101
|
+
this.formAssociated = true;
|
|
102
|
+
}
|
|
98
103
|
static {
|
|
99
104
|
this.shadowRootOptions = { mode: "open", delegatesFocus: true };
|
|
100
105
|
}
|
|
@@ -110,7 +115,6 @@ class InputTimePicker extends LitElement {
|
|
|
110
115
|
connectedCallback() {
|
|
111
116
|
super.connectedCallback();
|
|
112
117
|
connectLabel(this);
|
|
113
|
-
connectForm(this);
|
|
114
118
|
}
|
|
115
119
|
willUpdate(changes) {
|
|
116
120
|
if (changes.has("open") && (this.hasUpdated || this.open !== false)) {
|
|
@@ -141,7 +145,6 @@ class InputTimePicker extends LitElement {
|
|
|
141
145
|
disconnectedCallback() {
|
|
142
146
|
super.disconnectedCallback();
|
|
143
147
|
disconnectLabel(this);
|
|
144
|
-
disconnectForm(this);
|
|
145
148
|
}
|
|
146
149
|
blurHandler() {
|
|
147
150
|
this.changeEventHandler();
|
|
@@ -164,7 +167,8 @@ class InputTimePicker extends LitElement {
|
|
|
164
167
|
return;
|
|
165
168
|
}
|
|
166
169
|
if (key === "Enter") {
|
|
167
|
-
if (
|
|
170
|
+
if (this.formSupport.active) {
|
|
171
|
+
this.formSupport.requestSubmit();
|
|
168
172
|
event.preventDefault();
|
|
169
173
|
}
|
|
170
174
|
this.changeEventHandler();
|
|
@@ -277,9 +281,6 @@ class InputTimePicker extends LitElement {
|
|
|
277
281
|
const ref2 = target === "hour" ? this.hourRef : target === "minute" ? this.minuteRef : target === "second" ? this.secondRef : target === "fractionalSecond" ? this.fractionalSecondRef : this.meridiemRef;
|
|
278
282
|
ref2.value?.focus();
|
|
279
283
|
}
|
|
280
|
-
syncHiddenFormInput(input) {
|
|
281
|
-
syncHiddenFormInput("time", this, input);
|
|
282
|
-
}
|
|
283
284
|
timeChangeHandler(event) {
|
|
284
285
|
event.stopPropagation();
|
|
285
286
|
if (this.disabled) {
|
|
@@ -333,7 +334,7 @@ class InputTimePicker extends LitElement {
|
|
|
333
334
|
[CSS.empty]: !localizedFractionalSecond,
|
|
334
335
|
[CSS.fractionalSecond]: true,
|
|
335
336
|
[CSS.input]: true
|
|
336
|
-
})} @focus=${this.timePartFocusHandler} @keydown=${isInteractive ? handleFractionalSecondKeyDownEvent : void 0} role=spinbutton tabindex=0 ${ref(this.fractionalSecondRef)}>${localizedFractionalSecond || "".padStart(decimalPlaces(this.step), "-")}</span>` || ""}${localizedSecondSuffix && html`<span class=${safeClassMap(CSS.secondSuffix)}>${localizedSecondSuffix}</span>` || ""}${showMeridiem && !meridiemStart && this.renderMeridiem() || ""}</div>${!this.readOnly && this.renderToggleIcon(this.open) || ""}</div><calcite-popover auto-close .focusTrapDisabled=${this.focusTrapDisabled} .focusTrapOptions=${{ initialFocus: false }} .label=${messages.chooseTime} lang=${this.messages._lang ?? nothing} offset-distance=0 @calcitePopoverBeforeClose=${this.popoverBeforeCloseHandler} @calcitePopoverBeforeOpen=${this.popoverBeforeOpenHandler} @calcitePopoverClose=${this.popoverCloseHandler} @calcitePopoverOpen=${this.popoverOpenHandler} .overlayPositioning=${this.overlayPositioning} .placement=${this.placement} pointer-disabled .referenceElement=${this.containerRef.value} trigger-disabled ${ref(this.setCalcitePopoverEl)}><calcite-time-picker .hourFormat=${this.time.hourFormat} lang=${this.messages._lang ?? nothing} .messageOverrides=${this.messageOverrides} .numberingSystem=${this.numberingSystem} @calciteTimePickerChange=${this.timePickerChangeHandler} .scale=${this.scale} .step=${this.step} tabindex=${(this.open ? void 0 : -1) ?? nothing} .time=${this.time} .value=${this.value} ${ref(this.timePickerRef)}></calcite-time-picker></calcite-popover>${
|
|
337
|
+
})} @focus=${this.timePartFocusHandler} @keydown=${isInteractive ? handleFractionalSecondKeyDownEvent : void 0} role=spinbutton tabindex=0 ${ref(this.fractionalSecondRef)}>${localizedFractionalSecond || "".padStart(decimalPlaces(this.step), "-")}</span>` || ""}${localizedSecondSuffix && html`<span class=${safeClassMap(CSS.secondSuffix)}>${localizedSecondSuffix}</span>` || ""}${showMeridiem && !meridiemStart && this.renderMeridiem() || ""}</div>${!this.readOnly && this.renderToggleIcon(this.open) || ""}</div><calcite-popover auto-close .focusTrapDisabled=${this.focusTrapDisabled} .focusTrapOptions=${{ initialFocus: false }} .label=${messages.chooseTime} lang=${this.messages._lang ?? nothing} offset-distance=0 @calcitePopoverBeforeClose=${this.popoverBeforeCloseHandler} @calcitePopoverBeforeOpen=${this.popoverBeforeOpenHandler} @calcitePopoverClose=${this.popoverCloseHandler} @calcitePopoverOpen=${this.popoverOpenHandler} .overlayPositioning=${this.overlayPositioning} .placement=${this.placement} pointer-disabled .referenceElement=${this.containerRef.value} trigger-disabled ${ref(this.setCalcitePopoverEl)}><calcite-time-picker .hourFormat=${this.time.hourFormat} lang=${this.messages._lang ?? nothing} .messageOverrides=${this.messageOverrides} .numberingSystem=${this.numberingSystem} @calciteTimePickerChange=${this.timePickerChangeHandler} .scale=${this.scale} .step=${this.step} tabindex=${(this.open ? void 0 : -1) ?? nothing} .time=${this.time} .value=${this.value} ${ref(this.timePickerRef)}></calcite-time-picker></calcite-popover>${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}` });
|
|
337
338
|
}
|
|
338
339
|
renderMeridiem() {
|
|
339
340
|
const { handleMeridiemKeyDownEvent, localizedMeridiem, meridiem } = this.time;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
-
import type { MutableValidityState } from "../../utils/form.js";
|
|
4
3
|
import type { Scale, Status } from "../interfaces.js";
|
|
5
4
|
import type { IconName } from "../calcite-icon/interfaces.js";
|
|
5
|
+
import type { MutableValidityState } from "../../controllers/useForm.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @cssproperty [--calcite-rating-spacing] - Specifies the amount of left and right margin spacing between each item.
|