@nysds/nys-fileinput 1.10.1 → 1.11.1
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/nys-fileinput.d.ts +1 -1
- package/dist/nys-fileinput.js +197 -229
- package/dist/nys-fileinput.js.map +1 -1
- package/package.json +6 -9
package/dist/nys-fileinput.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as se, LitElement as re, html as y } from "lit";
|
|
2
2
|
/*!
|
|
3
3
|
* ▒█▄░▒█ ▒█░░▒█ ▒█▀▀▀█ ▒█▀▀▄ ▒█▀▀▀█
|
|
4
4
|
* ▒█▒█▒█ ▒█▄▄▄█ ░▀▀▀▄▄ ▒█░▒█ ░▀▀▀▄▄
|
|
@@ -14,18 +14,18 @@ import { css as oe, LitElement as ne, html as y } from "lit";
|
|
|
14
14
|
* Copyright 2019 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
16
|
*/
|
|
17
|
-
const
|
|
18
|
-
let
|
|
17
|
+
const D = globalThis, L = D.ShadowRoot && (D.ShadyCSS === void 0 || D.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, oe = Symbol(), Y = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
let de = class {
|
|
19
19
|
constructor(e, t, i) {
|
|
20
|
-
if (this._$cssResult$ = !0, i !==
|
|
20
|
+
if (this._$cssResult$ = !0, i !== oe) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
|
21
21
|
this.cssText = e, this.t = t;
|
|
22
22
|
}
|
|
23
23
|
get styleSheet() {
|
|
24
24
|
let e = this.o;
|
|
25
25
|
const t = this.t;
|
|
26
|
-
if (
|
|
26
|
+
if (L && e === void 0) {
|
|
27
27
|
const i = t !== void 0 && t.length === 1;
|
|
28
|
-
i && (e =
|
|
28
|
+
i && (e = Y.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && Y.set(t, e));
|
|
29
29
|
}
|
|
30
30
|
return e;
|
|
31
31
|
}
|
|
@@ -33,26 +33,26 @@ let pe = class {
|
|
|
33
33
|
return this.cssText;
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
const
|
|
37
|
-
if (
|
|
36
|
+
const ce = (o) => new de(typeof o == "string" ? o : o + "", void 0, oe), pe = (o, e) => {
|
|
37
|
+
if (L) o.adoptedStyleSheets = e.map(((t) => t instanceof CSSStyleSheet ? t : t.styleSheet));
|
|
38
38
|
else for (const t of e) {
|
|
39
|
-
const i = document.createElement("style"), s =
|
|
39
|
+
const i = document.createElement("style"), s = D.litNonce;
|
|
40
40
|
s !== void 0 && i.setAttribute("nonce", s), i.textContent = t.cssText, o.appendChild(i);
|
|
41
41
|
}
|
|
42
|
-
},
|
|
42
|
+
}, G = L ? (o) => o : (o) => o instanceof CSSStyleSheet ? ((e) => {
|
|
43
43
|
let t = "";
|
|
44
44
|
for (const i of e.cssRules) t += i.cssText;
|
|
45
|
-
return
|
|
45
|
+
return ce(t);
|
|
46
46
|
})(o) : o;
|
|
47
47
|
/**
|
|
48
48
|
* @license
|
|
49
49
|
* Copyright 2017 Google LLC
|
|
50
50
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
51
51
|
*/
|
|
52
|
-
const { is:
|
|
52
|
+
const { is: ue, defineProperty: fe, getOwnPropertyDescriptor: _e, getOwnPropertyNames: ye, getOwnPropertySymbols: ge, getPrototypeOf: me } = Object, q = globalThis, J = q.trustedTypes, ve = J ? J.emptyScript : "", $e = q.reactiveElementPolyfillSupport, C = (o, e) => o, U = { toAttribute(o, e) {
|
|
53
53
|
switch (e) {
|
|
54
54
|
case Boolean:
|
|
55
|
-
o = o ?
|
|
55
|
+
o = o ? ve : null;
|
|
56
56
|
break;
|
|
57
57
|
case Object:
|
|
58
58
|
case Array:
|
|
@@ -77,46 +77,44 @@ const { is: _e, defineProperty: ye, getOwnPropertyDescriptor: ge, getOwnProperty
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
return t;
|
|
80
|
-
} },
|
|
81
|
-
Symbol.metadata
|
|
82
|
-
class
|
|
80
|
+
} }, B = (o, e) => !ue(o, e), K = { attribute: !0, type: String, converter: U, reflect: !1, useDefault: !1, hasChanged: B };
|
|
81
|
+
Symbol.metadata ??= Symbol("metadata"), q.litPropertyMetadata ??= /* @__PURE__ */ new WeakMap();
|
|
82
|
+
class S extends HTMLElement {
|
|
83
83
|
static addInitializer(e) {
|
|
84
|
-
this._$Ei(), (this.l
|
|
84
|
+
this._$Ei(), (this.l ??= []).push(e);
|
|
85
85
|
}
|
|
86
86
|
static get observedAttributes() {
|
|
87
87
|
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
|
88
88
|
}
|
|
89
|
-
static createProperty(e, t =
|
|
90
|
-
if (t.state && (t.attribute = !1), this._$Ei(), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
89
|
+
static createProperty(e, t = K) {
|
|
90
|
+
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
|
91
91
|
const i = Symbol(), s = this.getPropertyDescriptor(e, i, t);
|
|
92
|
-
s !== void 0 &&
|
|
92
|
+
s !== void 0 && fe(this.prototype, e, s);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
static getPropertyDescriptor(e, t, i) {
|
|
96
|
-
const { get: s, set: r } =
|
|
96
|
+
const { get: s, set: r } = _e(this.prototype, e) ?? { get() {
|
|
97
97
|
return this[t];
|
|
98
98
|
}, set(n) {
|
|
99
99
|
this[t] = n;
|
|
100
100
|
} };
|
|
101
|
-
return { get() {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const a = s == null ? void 0 : s.call(this);
|
|
105
|
-
r.call(this, n), this.requestUpdate(e, a, i);
|
|
101
|
+
return { get: s, set(n) {
|
|
102
|
+
const a = s?.call(this);
|
|
103
|
+
r?.call(this, n), this.requestUpdate(e, a, i);
|
|
106
104
|
}, configurable: !0, enumerable: !0 };
|
|
107
105
|
}
|
|
108
106
|
static getPropertyOptions(e) {
|
|
109
|
-
return this.elementProperties.get(e) ??
|
|
107
|
+
return this.elementProperties.get(e) ?? K;
|
|
110
108
|
}
|
|
111
109
|
static _$Ei() {
|
|
112
|
-
if (this.hasOwnProperty(
|
|
113
|
-
const e =
|
|
110
|
+
if (this.hasOwnProperty(C("elementProperties"))) return;
|
|
111
|
+
const e = me(this);
|
|
114
112
|
e.finalize(), e.l !== void 0 && (this.l = [...e.l]), this.elementProperties = new Map(e.elementProperties);
|
|
115
113
|
}
|
|
116
114
|
static finalize() {
|
|
117
|
-
if (this.hasOwnProperty(
|
|
118
|
-
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(
|
|
119
|
-
const t = this.properties, i = [...
|
|
115
|
+
if (this.hasOwnProperty(C("finalized"))) return;
|
|
116
|
+
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(C("properties"))) {
|
|
117
|
+
const t = this.properties, i = [...ye(t), ...ge(t)];
|
|
120
118
|
for (const s of i) this.createProperty(s, t[s]);
|
|
121
119
|
}
|
|
122
120
|
const e = this[Symbol.metadata];
|
|
@@ -135,8 +133,8 @@ class x extends HTMLElement {
|
|
|
135
133
|
const t = [];
|
|
136
134
|
if (Array.isArray(e)) {
|
|
137
135
|
const i = new Set(e.flat(1 / 0).reverse());
|
|
138
|
-
for (const s of i) t.unshift(
|
|
139
|
-
} else e !== void 0 && t.push(
|
|
136
|
+
for (const s of i) t.unshift(G(s));
|
|
137
|
+
} else e !== void 0 && t.push(G(e));
|
|
140
138
|
return t;
|
|
141
139
|
}
|
|
142
140
|
static _$Eu(e, t) {
|
|
@@ -147,16 +145,13 @@ class x extends HTMLElement {
|
|
|
147
145
|
super(), this._$Ep = void 0, this.isUpdatePending = !1, this.hasUpdated = !1, this._$Em = null, this._$Ev();
|
|
148
146
|
}
|
|
149
147
|
_$Ev() {
|
|
150
|
-
|
|
151
|
-
this._$ES = new Promise((t) => this.enableUpdating = t), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), (e = this.constructor.l) == null || e.forEach((t) => t(this));
|
|
148
|
+
this._$ES = new Promise(((e) => this.enableUpdating = e)), this._$AL = /* @__PURE__ */ new Map(), this._$E_(), this.requestUpdate(), this.constructor.l?.forEach(((e) => e(this)));
|
|
152
149
|
}
|
|
153
150
|
addController(e) {
|
|
154
|
-
|
|
155
|
-
(this._$EO ?? (this._$EO = /* @__PURE__ */ new Set())).add(e), this.renderRoot !== void 0 && this.isConnected && ((t = e.hostConnected) == null || t.call(e));
|
|
151
|
+
(this._$EO ??= /* @__PURE__ */ new Set()).add(e), this.renderRoot !== void 0 && this.isConnected && e.hostConnected?.();
|
|
156
152
|
}
|
|
157
153
|
removeController(e) {
|
|
158
|
-
|
|
159
|
-
(t = this._$EO) == null || t.delete(e);
|
|
154
|
+
this._$EO?.delete(e);
|
|
160
155
|
}
|
|
161
156
|
_$E_() {
|
|
162
157
|
const e = /* @__PURE__ */ new Map(), t = this.constructor.elementProperties;
|
|
@@ -165,54 +160,47 @@ class x extends HTMLElement {
|
|
|
165
160
|
}
|
|
166
161
|
createRenderRoot() {
|
|
167
162
|
const e = this.shadowRoot ?? this.attachShadow(this.constructor.shadowRootOptions);
|
|
168
|
-
return
|
|
163
|
+
return pe(e, this.constructor.elementStyles), e;
|
|
169
164
|
}
|
|
170
165
|
connectedCallback() {
|
|
171
|
-
|
|
172
|
-
this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this.enableUpdating(!0), (e = this._$EO) == null || e.forEach((t) => {
|
|
173
|
-
var i;
|
|
174
|
-
return (i = t.hostConnected) == null ? void 0 : i.call(t);
|
|
175
|
-
});
|
|
166
|
+
this.renderRoot ??= this.createRenderRoot(), this.enableUpdating(!0), this._$EO?.forEach(((e) => e.hostConnected?.()));
|
|
176
167
|
}
|
|
177
168
|
enableUpdating(e) {
|
|
178
169
|
}
|
|
179
170
|
disconnectedCallback() {
|
|
180
|
-
|
|
181
|
-
(e = this._$EO) == null || e.forEach((t) => {
|
|
182
|
-
var i;
|
|
183
|
-
return (i = t.hostDisconnected) == null ? void 0 : i.call(t);
|
|
184
|
-
});
|
|
171
|
+
this._$EO?.forEach(((e) => e.hostDisconnected?.()));
|
|
185
172
|
}
|
|
186
173
|
attributeChangedCallback(e, t, i) {
|
|
187
174
|
this._$AK(e, i);
|
|
188
175
|
}
|
|
189
|
-
_$
|
|
190
|
-
var r;
|
|
176
|
+
_$ET(e, t) {
|
|
191
177
|
const i = this.constructor.elementProperties.get(e), s = this.constructor._$Eu(e, i);
|
|
192
178
|
if (s !== void 0 && i.reflect === !0) {
|
|
193
|
-
const
|
|
194
|
-
this._$Em = e,
|
|
179
|
+
const r = (i.converter?.toAttribute !== void 0 ? i.converter : U).toAttribute(t, i.type);
|
|
180
|
+
this._$Em = e, r == null ? this.removeAttribute(s) : this.setAttribute(s, r), this._$Em = null;
|
|
195
181
|
}
|
|
196
182
|
}
|
|
197
183
|
_$AK(e, t) {
|
|
198
|
-
var r;
|
|
199
184
|
const i = this.constructor, s = i._$Eh.get(e);
|
|
200
185
|
if (s !== void 0 && this._$Em !== s) {
|
|
201
|
-
const
|
|
202
|
-
this._$Em = s
|
|
186
|
+
const r = i.getPropertyOptions(s), n = typeof r.converter == "function" ? { fromAttribute: r.converter } : r.converter?.fromAttribute !== void 0 ? r.converter : U;
|
|
187
|
+
this._$Em = s;
|
|
188
|
+
const a = n.fromAttribute(t, r.type);
|
|
189
|
+
this[s] = a ?? this._$Ej?.get(s) ?? a, this._$Em = null;
|
|
203
190
|
}
|
|
204
191
|
}
|
|
205
192
|
requestUpdate(e, t, i) {
|
|
206
193
|
if (e !== void 0) {
|
|
207
|
-
|
|
208
|
-
|
|
194
|
+
const s = this.constructor, r = this[e];
|
|
195
|
+
if (i ??= s.getPropertyOptions(e), !((i.hasChanged ?? B)(r, t) || i.useDefault && i.reflect && r === this._$Ej?.get(e) && !this.hasAttribute(s._$Eu(e, i)))) return;
|
|
196
|
+
this.C(e, t, i);
|
|
209
197
|
}
|
|
210
|
-
this.isUpdatePending === !1 && (this._$ES = this._$
|
|
198
|
+
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
|
211
199
|
}
|
|
212
|
-
|
|
213
|
-
this._$AL.has(e) || this._$AL.set(e, t),
|
|
200
|
+
C(e, t, { useDefault: i, reflect: s, wrapped: r }, n) {
|
|
201
|
+
i && !(this._$Ej ??= /* @__PURE__ */ new Map()).has(e) && (this._$Ej.set(e, n ?? t ?? this[e]), r !== !0 || n !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), s === !0 && this._$Em !== e && (this._$Eq ??= /* @__PURE__ */ new Set()).add(e));
|
|
214
202
|
}
|
|
215
|
-
async _$
|
|
203
|
+
async _$EP() {
|
|
216
204
|
this.isUpdatePending = !0;
|
|
217
205
|
try {
|
|
218
206
|
await this._$ES;
|
|
@@ -226,38 +214,33 @@ class x extends HTMLElement {
|
|
|
226
214
|
return this.performUpdate();
|
|
227
215
|
}
|
|
228
216
|
performUpdate() {
|
|
229
|
-
var i;
|
|
230
217
|
if (!this.isUpdatePending) return;
|
|
231
218
|
if (!this.hasUpdated) {
|
|
232
|
-
if (this.renderRoot
|
|
233
|
-
for (const [
|
|
219
|
+
if (this.renderRoot ??= this.createRenderRoot(), this._$Ep) {
|
|
220
|
+
for (const [s, r] of this._$Ep) this[s] = r;
|
|
234
221
|
this._$Ep = void 0;
|
|
235
222
|
}
|
|
236
|
-
const
|
|
237
|
-
if (
|
|
223
|
+
const i = this.constructor.elementProperties;
|
|
224
|
+
if (i.size > 0) for (const [s, r] of i) {
|
|
225
|
+
const { wrapped: n } = r, a = this[s];
|
|
226
|
+
n !== !0 || this._$AL.has(s) || a === void 0 || this.C(s, void 0, r, a);
|
|
227
|
+
}
|
|
238
228
|
}
|
|
239
229
|
let e = !1;
|
|
240
230
|
const t = this._$AL;
|
|
241
231
|
try {
|
|
242
|
-
e = this.shouldUpdate(t), e ? (this.willUpdate(t),
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}), this.update(t)) : this._$EU();
|
|
246
|
-
} catch (s) {
|
|
247
|
-
throw e = !1, this._$EU(), s;
|
|
232
|
+
e = this.shouldUpdate(t), e ? (this.willUpdate(t), this._$EO?.forEach(((i) => i.hostUpdate?.())), this.update(t)) : this._$EM();
|
|
233
|
+
} catch (i) {
|
|
234
|
+
throw e = !1, this._$EM(), i;
|
|
248
235
|
}
|
|
249
236
|
e && this._$AE(t);
|
|
250
237
|
}
|
|
251
238
|
willUpdate(e) {
|
|
252
239
|
}
|
|
253
240
|
_$AE(e) {
|
|
254
|
-
|
|
255
|
-
(t = this._$EO) == null || t.forEach((i) => {
|
|
256
|
-
var s;
|
|
257
|
-
return (s = i.hostUpdated) == null ? void 0 : s.call(i);
|
|
258
|
-
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
241
|
+
this._$EO?.forEach(((t) => t.hostUpdated?.())), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
|
259
242
|
}
|
|
260
|
-
_$
|
|
243
|
+
_$EM() {
|
|
261
244
|
this._$AL = /* @__PURE__ */ new Map(), this.isUpdatePending = !1;
|
|
262
245
|
}
|
|
263
246
|
get updateComplete() {
|
|
@@ -270,29 +253,29 @@ class x extends HTMLElement {
|
|
|
270
253
|
return !0;
|
|
271
254
|
}
|
|
272
255
|
update(e) {
|
|
273
|
-
this._$
|
|
256
|
+
this._$Eq &&= this._$Eq.forEach(((t) => this._$ET(t, this[t]))), this._$EM();
|
|
274
257
|
}
|
|
275
258
|
updated(e) {
|
|
276
259
|
}
|
|
277
260
|
firstUpdated(e) {
|
|
278
261
|
}
|
|
279
262
|
}
|
|
280
|
-
|
|
263
|
+
S.elementStyles = [], S.shadowRootOptions = { mode: "open" }, S[C("elementProperties")] = /* @__PURE__ */ new Map(), S[C("finalized")] = /* @__PURE__ */ new Map(), $e?.({ ReactiveElement: S }), (q.reactiveElementVersions ??= []).push("2.1.1");
|
|
281
264
|
/**
|
|
282
265
|
* @license
|
|
283
266
|
* Copyright 2017 Google LLC
|
|
284
267
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
285
268
|
*/
|
|
286
|
-
const
|
|
269
|
+
const be = { attribute: !0, type: String, converter: U, reflect: !1, hasChanged: B }, Ae = (o = be, e, t) => {
|
|
287
270
|
const { kind: i, metadata: s } = t;
|
|
288
271
|
let r = globalThis.litPropertyMetadata.get(s);
|
|
289
|
-
if (r === void 0 && globalThis.litPropertyMetadata.set(s, r = /* @__PURE__ */ new Map()), r.set(t.name, o), i === "accessor") {
|
|
272
|
+
if (r === void 0 && globalThis.litPropertyMetadata.set(s, r = /* @__PURE__ */ new Map()), i === "setter" && ((o = Object.create(o)).wrapped = !0), r.set(t.name, o), i === "accessor") {
|
|
290
273
|
const { name: n } = t;
|
|
291
274
|
return { set(a) {
|
|
292
275
|
const l = e.get.call(this);
|
|
293
276
|
e.set.call(this, a), this.requestUpdate(n, l, o);
|
|
294
277
|
}, init(a) {
|
|
295
|
-
return a !== void 0 && this.
|
|
278
|
+
return a !== void 0 && this.C(n, void 0, o, a), a;
|
|
296
279
|
} };
|
|
297
280
|
}
|
|
298
281
|
if (i === "setter") {
|
|
@@ -305,9 +288,9 @@ const Ae = { attribute: !0, type: String, converter: R, reflect: !1, hasChanged:
|
|
|
305
288
|
throw Error("Unsupported decorator location: " + i);
|
|
306
289
|
};
|
|
307
290
|
function d(o) {
|
|
308
|
-
return (e, t) => typeof t == "object" ?
|
|
291
|
+
return (e, t) => typeof t == "object" ? Ae(o, e, t) : ((i, s, r) => {
|
|
309
292
|
const n = s.hasOwnProperty(r);
|
|
310
|
-
return s.constructor.createProperty(r,
|
|
293
|
+
return s.constructor.createProperty(r, i), n ? Object.getOwnPropertyDescriptor(s, r) : void 0;
|
|
311
294
|
})(o, e, t);
|
|
312
295
|
}
|
|
313
296
|
/**
|
|
@@ -315,50 +298,50 @@ function d(o) {
|
|
|
315
298
|
* Copyright 2017 Google LLC
|
|
316
299
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
317
300
|
*/
|
|
318
|
-
const
|
|
319
|
-
\f\r]`,
|
|
320
|
-
\f\r"'\`<>=]|("|')|))|$)`, "g"),
|
|
321
|
-
function
|
|
322
|
-
if (!
|
|
323
|
-
return
|
|
301
|
+
const j = globalThis, z = j.trustedTypes, Z = z ? z.createPolicy("lit-html", { createHTML: (o) => o }) : void 0, ne = "$lit$", v = `lit$${Math.random().toFixed(9).slice(2)}$`, le = "?" + v, we = `<${le}>`, A = document, R = () => A.createComment(""), P = (o) => o === null || typeof o != "object" && typeof o != "function", V = Array.isArray, Ee = (o) => V(o) || typeof o?.[Symbol.iterator] == "function", I = `[
|
|
302
|
+
\f\r]`, x = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, Q = /-->/g, X = />/g, $ = RegExp(`>|${I}(?:([^\\s"'>=/]+)(${I}*=${I}*(?:[^
|
|
303
|
+
\f\r"'\`<>=]|("|')|))|$)`, "g"), ee = /'/g, te = /"/g, ae = /^(?:script|style|textarea|title)$/i, k = Symbol.for("lit-noChange"), c = Symbol.for("lit-nothing"), ie = /* @__PURE__ */ new WeakMap(), b = A.createTreeWalker(A, 129);
|
|
304
|
+
function he(o, e) {
|
|
305
|
+
if (!V(o) || !o.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
306
|
+
return Z !== void 0 ? Z.createHTML(e) : e;
|
|
324
307
|
}
|
|
325
|
-
const
|
|
308
|
+
const Se = (o, e) => {
|
|
326
309
|
const t = o.length - 1, i = [];
|
|
327
|
-
let s, r = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n =
|
|
310
|
+
let s, r = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", n = x;
|
|
328
311
|
for (let a = 0; a < t; a++) {
|
|
329
312
|
const l = o[a];
|
|
330
313
|
let u, f, h = -1, g = 0;
|
|
331
|
-
for (; g < l.length && (n.lastIndex = g, f = n.exec(l), f !== null); ) g = n.lastIndex, n ===
|
|
332
|
-
const m = n ===
|
|
333
|
-
r += n ===
|
|
314
|
+
for (; g < l.length && (n.lastIndex = g, f = n.exec(l), f !== null); ) g = n.lastIndex, n === x ? f[1] === "!--" ? n = Q : f[1] !== void 0 ? n = X : f[2] !== void 0 ? (ae.test(f[2]) && (s = RegExp("</" + f[2], "g")), n = $) : f[3] !== void 0 && (n = $) : n === $ ? f[0] === ">" ? (n = s ?? x, h = -1) : f[1] === void 0 ? h = -2 : (h = n.lastIndex - f[2].length, u = f[1], n = f[3] === void 0 ? $ : f[3] === '"' ? te : ee) : n === te || n === ee ? n = $ : n === Q || n === X ? n = x : (n = $, s = void 0);
|
|
315
|
+
const m = n === $ && o[a + 1].startsWith("/>") ? " " : "";
|
|
316
|
+
r += n === x ? l + we : h >= 0 ? (i.push(u), l.slice(0, h) + ne + l.slice(h) + v + m) : l + v + (h === -2 ? a : m);
|
|
334
317
|
}
|
|
335
|
-
return [
|
|
318
|
+
return [he(o, r + (o[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
|
336
319
|
};
|
|
337
|
-
class
|
|
320
|
+
class F {
|
|
338
321
|
constructor({ strings: e, _$litType$: t }, i) {
|
|
339
322
|
let s;
|
|
340
323
|
this.parts = [];
|
|
341
324
|
let r = 0, n = 0;
|
|
342
|
-
const a = e.length - 1, l = this.parts, [u, f] =
|
|
343
|
-
if (this.el =
|
|
325
|
+
const a = e.length - 1, l = this.parts, [u, f] = Se(e, t);
|
|
326
|
+
if (this.el = F.createElement(u, i), b.currentNode = this.el.content, t === 2 || t === 3) {
|
|
344
327
|
const h = this.el.content.firstChild;
|
|
345
328
|
h.replaceWith(...h.childNodes);
|
|
346
329
|
}
|
|
347
|
-
for (; (s =
|
|
330
|
+
for (; (s = b.nextNode()) !== null && l.length < a; ) {
|
|
348
331
|
if (s.nodeType === 1) {
|
|
349
|
-
if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(
|
|
350
|
-
const g = f[n++], m = s.getAttribute(h).split(v),
|
|
351
|
-
l.push({ type: 1, index: r, name:
|
|
332
|
+
if (s.hasAttributes()) for (const h of s.getAttributeNames()) if (h.endsWith(ne)) {
|
|
333
|
+
const g = f[n++], m = s.getAttribute(h).split(v), M = /([.?@])?(.*)/.exec(g);
|
|
334
|
+
l.push({ type: 1, index: r, name: M[2], strings: m, ctor: M[1] === "." ? Ce : M[1] === "?" ? Pe : M[1] === "@" ? ke : T }), s.removeAttribute(h);
|
|
352
335
|
} else h.startsWith(v) && (l.push({ type: 6, index: r }), s.removeAttribute(h));
|
|
353
|
-
if (
|
|
336
|
+
if (ae.test(s.tagName)) {
|
|
354
337
|
const h = s.textContent.split(v), g = h.length - 1;
|
|
355
338
|
if (g > 0) {
|
|
356
|
-
s.textContent =
|
|
357
|
-
for (let m = 0; m < g; m++) s.append(h[m],
|
|
358
|
-
s.append(h[g],
|
|
339
|
+
s.textContent = z ? z.emptyScript : "";
|
|
340
|
+
for (let m = 0; m < g; m++) s.append(h[m], R()), b.nextNode(), l.push({ type: 2, index: ++r });
|
|
341
|
+
s.append(h[g], R());
|
|
359
342
|
}
|
|
360
343
|
}
|
|
361
|
-
} else if (s.nodeType === 8) if (s.data ===
|
|
344
|
+
} else if (s.nodeType === 8) if (s.data === le) l.push({ type: 2, index: r });
|
|
362
345
|
else {
|
|
363
346
|
let h = -1;
|
|
364
347
|
for (; (h = s.data.indexOf(v, h + 1)) !== -1; ) l.push({ type: 7, index: r }), h += v.length - 1;
|
|
@@ -367,18 +350,17 @@ class U {
|
|
|
367
350
|
}
|
|
368
351
|
}
|
|
369
352
|
static createElement(e, t) {
|
|
370
|
-
const i =
|
|
353
|
+
const i = A.createElement("template");
|
|
371
354
|
return i.innerHTML = e, i;
|
|
372
355
|
}
|
|
373
356
|
}
|
|
374
|
-
function
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
return (s == null ? void 0 : s.constructor) !== r && ((a = s == null ? void 0 : s._$AO) == null || a.call(s, !1), r === void 0 ? s = void 0 : (s = new r(o), s._$AT(o, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = s : t._$Cl = s), s !== void 0 && (e = S(o, s._$AS(o, e.values), s, i)), e;
|
|
357
|
+
function E(o, e, t = o, i) {
|
|
358
|
+
if (e === k) return e;
|
|
359
|
+
let s = i !== void 0 ? t._$Co?.[i] : t._$Cl;
|
|
360
|
+
const r = P(e) ? void 0 : e._$litDirective$;
|
|
361
|
+
return s?.constructor !== r && (s?._$AO?.(!1), r === void 0 ? s = void 0 : (s = new r(o), s._$AT(o, t, i)), i !== void 0 ? (t._$Co ??= [])[i] = s : t._$Cl = s), s !== void 0 && (e = E(o, s._$AS(o, e.values), s, i)), e;
|
|
380
362
|
}
|
|
381
|
-
class
|
|
363
|
+
class xe {
|
|
382
364
|
constructor(e, t) {
|
|
383
365
|
this._$AV = [], this._$AN = void 0, this._$AD = e, this._$AM = t;
|
|
384
366
|
}
|
|
@@ -389,35 +371,34 @@ class Ce {
|
|
|
389
371
|
return this._$AM._$AU;
|
|
390
372
|
}
|
|
391
373
|
u(e) {
|
|
392
|
-
const { el: { content: t }, parts: i } = this._$AD, s = (
|
|
393
|
-
|
|
394
|
-
let r =
|
|
374
|
+
const { el: { content: t }, parts: i } = this._$AD, s = (e?.creationScope ?? A).importNode(t, !0);
|
|
375
|
+
b.currentNode = s;
|
|
376
|
+
let r = b.nextNode(), n = 0, a = 0, l = i[0];
|
|
395
377
|
for (; l !== void 0; ) {
|
|
396
378
|
if (n === l.index) {
|
|
397
379
|
let u;
|
|
398
|
-
l.type === 2 ? u = new
|
|
380
|
+
l.type === 2 ? u = new H(r, r.nextSibling, this, e) : l.type === 1 ? u = new l.ctor(r, l.name, l.strings, this, e) : l.type === 6 && (u = new Fe(r, this, e)), this._$AV.push(u), l = i[++a];
|
|
399
381
|
}
|
|
400
|
-
n !==
|
|
382
|
+
n !== l?.index && (r = b.nextNode(), n++);
|
|
401
383
|
}
|
|
402
|
-
return
|
|
384
|
+
return b.currentNode = A, s;
|
|
403
385
|
}
|
|
404
386
|
p(e) {
|
|
405
387
|
let t = 0;
|
|
406
388
|
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, t), t += i.strings.length - 2) : i._$AI(e[t])), t++;
|
|
407
389
|
}
|
|
408
390
|
}
|
|
409
|
-
class
|
|
391
|
+
class H {
|
|
410
392
|
get _$AU() {
|
|
411
|
-
|
|
412
|
-
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
|
393
|
+
return this._$AM?._$AU ?? this._$Cv;
|
|
413
394
|
}
|
|
414
395
|
constructor(e, t, i, s) {
|
|
415
|
-
this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = s, this._$Cv =
|
|
396
|
+
this.type = 2, this._$AH = c, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = s, this._$Cv = s?.isConnected ?? !0;
|
|
416
397
|
}
|
|
417
398
|
get parentNode() {
|
|
418
399
|
let e = this._$AA.parentNode;
|
|
419
400
|
const t = this._$AM;
|
|
420
|
-
return t !== void 0 &&
|
|
401
|
+
return t !== void 0 && e?.nodeType === 11 && (e = t.parentNode), e;
|
|
421
402
|
}
|
|
422
403
|
get startNode() {
|
|
423
404
|
return this._$AA;
|
|
@@ -426,7 +407,7 @@ class q {
|
|
|
426
407
|
return this._$AB;
|
|
427
408
|
}
|
|
428
409
|
_$AI(e, t = this) {
|
|
429
|
-
e =
|
|
410
|
+
e = E(this, e, t), P(e) ? e === c || e == null || e === "" ? (this._$AH !== c && this._$AR(), this._$AH = c) : e !== this._$AH && e !== k && this._(e) : e._$litType$ !== void 0 ? this.$(e) : e.nodeType !== void 0 ? this.T(e) : Ee(e) ? this.k(e) : this._(e);
|
|
430
411
|
}
|
|
431
412
|
O(e) {
|
|
432
413
|
return this._$AA.parentNode.insertBefore(e, this._$AB);
|
|
@@ -435,41 +416,38 @@ class q {
|
|
|
435
416
|
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
|
436
417
|
}
|
|
437
418
|
_(e) {
|
|
438
|
-
this._$AH !== c &&
|
|
419
|
+
this._$AH !== c && P(this._$AH) ? this._$AA.nextSibling.data = e : this.T(A.createTextNode(e)), this._$AH = e;
|
|
439
420
|
}
|
|
440
421
|
$(e) {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
if (((r = this._$AH) == null ? void 0 : r._$AD) === s) this._$AH.p(t);
|
|
422
|
+
const { values: t, _$litType$: i } = e, s = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = F.createElement(he(i.h, i.h[0]), this.options)), i);
|
|
423
|
+
if (this._$AH?._$AD === s) this._$AH.p(t);
|
|
444
424
|
else {
|
|
445
|
-
const
|
|
446
|
-
|
|
425
|
+
const r = new xe(s, this), n = r.u(this.options);
|
|
426
|
+
r.p(t), this.T(n), this._$AH = r;
|
|
447
427
|
}
|
|
448
428
|
}
|
|
449
429
|
_$AC(e) {
|
|
450
|
-
let t =
|
|
451
|
-
return t === void 0 &&
|
|
430
|
+
let t = ie.get(e.strings);
|
|
431
|
+
return t === void 0 && ie.set(e.strings, t = new F(e)), t;
|
|
452
432
|
}
|
|
453
433
|
k(e) {
|
|
454
|
-
|
|
434
|
+
V(this._$AH) || (this._$AH = [], this._$AR());
|
|
455
435
|
const t = this._$AH;
|
|
456
436
|
let i, s = 0;
|
|
457
|
-
for (const r of e) s === t.length ? t.push(i = new
|
|
437
|
+
for (const r of e) s === t.length ? t.push(i = new H(this.O(R()), this.O(R()), this, this.options)) : i = t[s], i._$AI(r), s++;
|
|
458
438
|
s < t.length && (this._$AR(i && i._$AB.nextSibling, s), t.length = s);
|
|
459
439
|
}
|
|
460
440
|
_$AR(e = this._$AA.nextSibling, t) {
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
e.remove(), e = s;
|
|
441
|
+
for (this._$AP?.(!1, !0, t); e !== this._$AB; ) {
|
|
442
|
+
const i = e.nextSibling;
|
|
443
|
+
e.remove(), e = i;
|
|
465
444
|
}
|
|
466
445
|
}
|
|
467
446
|
setConnected(e) {
|
|
468
|
-
|
|
469
|
-
this._$AM === void 0 && (this._$Cv = e, (t = this._$AP) == null || t.call(this, e));
|
|
447
|
+
this._$AM === void 0 && (this._$Cv = e, this._$AP?.(e));
|
|
470
448
|
}
|
|
471
449
|
}
|
|
472
|
-
class
|
|
450
|
+
class T {
|
|
473
451
|
get tagName() {
|
|
474
452
|
return this.element.tagName;
|
|
475
453
|
}
|
|
@@ -482,11 +460,11 @@ class N {
|
|
|
482
460
|
_$AI(e, t = this, i, s) {
|
|
483
461
|
const r = this.strings;
|
|
484
462
|
let n = !1;
|
|
485
|
-
if (r === void 0) e =
|
|
463
|
+
if (r === void 0) e = E(this, e, t, 0), n = !P(e) || e !== this._$AH && e !== k, n && (this._$AH = e);
|
|
486
464
|
else {
|
|
487
465
|
const a = e;
|
|
488
466
|
let l, u;
|
|
489
|
-
for (e = r[0], l = 0; l < r.length - 1; l++) u =
|
|
467
|
+
for (e = r[0], l = 0; l < r.length - 1; l++) u = E(this, a[i + l], t, l), u === k && (u = this._$AH[l]), n ||= !P(u) || u !== this._$AH[l], u === c ? e = c : e !== c && (e += (u ?? "") + r[l + 1]), this._$AH[l] = u;
|
|
490
468
|
}
|
|
491
469
|
n && !s && this.j(e);
|
|
492
470
|
}
|
|
@@ -494,7 +472,7 @@ class N {
|
|
|
494
472
|
e === c ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
|
495
473
|
}
|
|
496
474
|
}
|
|
497
|
-
class
|
|
475
|
+
class Ce extends T {
|
|
498
476
|
constructor() {
|
|
499
477
|
super(...arguments), this.type = 3;
|
|
500
478
|
}
|
|
@@ -502,7 +480,7 @@ class Pe extends N {
|
|
|
502
480
|
this.element[this.name] = e === c ? void 0 : e;
|
|
503
481
|
}
|
|
504
482
|
}
|
|
505
|
-
class
|
|
483
|
+
class Pe extends T {
|
|
506
484
|
constructor() {
|
|
507
485
|
super(...arguments), this.type = 4;
|
|
508
486
|
}
|
|
@@ -510,21 +488,20 @@ class ke extends N {
|
|
|
510
488
|
this.element.toggleAttribute(this.name, !!e && e !== c);
|
|
511
489
|
}
|
|
512
490
|
}
|
|
513
|
-
class
|
|
491
|
+
class ke extends T {
|
|
514
492
|
constructor(e, t, i, s, r) {
|
|
515
493
|
super(e, t, i, s, r), this.type = 5;
|
|
516
494
|
}
|
|
517
495
|
_$AI(e, t = this) {
|
|
518
|
-
if ((e =
|
|
496
|
+
if ((e = E(this, e, t, 0) ?? c) === k) return;
|
|
519
497
|
const i = this._$AH, s = e === c && i !== c || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, r = e !== c && (i === c || s);
|
|
520
498
|
s && this.element.removeEventListener(this.name, this, i), r && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
|
521
499
|
}
|
|
522
500
|
handleEvent(e) {
|
|
523
|
-
|
|
524
|
-
typeof this._$AH == "function" ? this._$AH.call(((t = this.options) == null ? void 0 : t.host) ?? this.element, e) : this._$AH.handleEvent(e);
|
|
501
|
+
typeof this._$AH == "function" ? this._$AH.call(this.options?.host ?? this.element, e) : this._$AH.handleEvent(e);
|
|
525
502
|
}
|
|
526
503
|
}
|
|
527
|
-
class
|
|
504
|
+
class Fe {
|
|
528
505
|
constructor(e, t, i) {
|
|
529
506
|
this.element = e, this.type = 6, this._$AN = void 0, this._$AM = t, this.options = i;
|
|
530
507
|
}
|
|
@@ -532,18 +509,18 @@ class Me {
|
|
|
532
509
|
return this._$AM._$AU;
|
|
533
510
|
}
|
|
534
511
|
_$AI(e) {
|
|
535
|
-
|
|
512
|
+
E(this, e);
|
|
536
513
|
}
|
|
537
514
|
}
|
|
538
|
-
const
|
|
539
|
-
|
|
515
|
+
const Me = j.litHtmlPolyfillSupport;
|
|
516
|
+
Me?.(F, H), (j.litHtmlVersions ??= []).push("3.3.1");
|
|
540
517
|
/**
|
|
541
518
|
* @license
|
|
542
519
|
* Copyright 2018 Google LLC
|
|
543
520
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
544
521
|
*/
|
|
545
|
-
const
|
|
546
|
-
async function
|
|
522
|
+
const De = (o) => o ?? c;
|
|
523
|
+
async function Ue(o, e) {
|
|
547
524
|
if (!e || e.trim() === "") return !0;
|
|
548
525
|
const t = e.toLowerCase().split(",").map((r) => r.trim()), i = o.name.toLowerCase(), s = i.includes(".") ? i.split(".").pop() : "";
|
|
549
526
|
for (const r of t)
|
|
@@ -551,7 +528,7 @@ async function De(o, e) {
|
|
|
551
528
|
return !0;
|
|
552
529
|
return !1;
|
|
553
530
|
}
|
|
554
|
-
const ze =
|
|
531
|
+
const ze = se`
|
|
555
532
|
:host {
|
|
556
533
|
/* Global Fileinput Styles */
|
|
557
534
|
--_nys-fileinput-gap: var(--nys-space-100, 8px);
|
|
@@ -684,7 +661,7 @@ const ze = oe`
|
|
|
684
661
|
progress::-webkit-progress-bar {
|
|
685
662
|
background-color: var(--_nys-fileinput-progress-background);
|
|
686
663
|
}
|
|
687
|
-
`, Re =
|
|
664
|
+
`, Re = se`
|
|
688
665
|
:host {
|
|
689
666
|
/* Global fileitem Styles */
|
|
690
667
|
--_nys-fileitem-border-radius: var(--nys-radius-md, 4px);
|
|
@@ -830,12 +807,12 @@ const ze = oe`
|
|
|
830
807
|
}
|
|
831
808
|
}
|
|
832
809
|
`;
|
|
833
|
-
var Oe = Object.defineProperty,
|
|
810
|
+
var Oe = Object.defineProperty, N = (o, e, t, i) => {
|
|
834
811
|
for (var s = void 0, r = o.length - 1, n; r >= 0; r--)
|
|
835
812
|
(n = o[r]) && (s = n(e, t, s) || s);
|
|
836
813
|
return s && Oe(e, t, s), s;
|
|
837
814
|
};
|
|
838
|
-
const
|
|
815
|
+
const W = class W extends re {
|
|
839
816
|
constructor() {
|
|
840
817
|
super(...arguments), this.filename = "", this.status = "pending", this.progress = 0, this.errorMessage = "";
|
|
841
818
|
}
|
|
@@ -890,7 +867,7 @@ const G = class G extends ne {
|
|
|
890
867
|
ariaLabel="close button"
|
|
891
868
|
size="sm"
|
|
892
869
|
variant="ghost"
|
|
893
|
-
|
|
870
|
+
@nys-click=${this._handleRemove}
|
|
894
871
|
ariaLabel="Remove file: ${this.filename}"
|
|
895
872
|
></nys-button>
|
|
896
873
|
</div>
|
|
@@ -908,31 +885,31 @@ const G = class G extends ne {
|
|
|
908
885
|
`;
|
|
909
886
|
}
|
|
910
887
|
};
|
|
911
|
-
|
|
912
|
-
let
|
|
913
|
-
|
|
888
|
+
W.styles = Re;
|
|
889
|
+
let w = W;
|
|
890
|
+
N([
|
|
914
891
|
d({ type: String })
|
|
915
|
-
],
|
|
916
|
-
|
|
892
|
+
], w.prototype, "filename");
|
|
893
|
+
N([
|
|
917
894
|
d({ type: String })
|
|
918
|
-
],
|
|
919
|
-
|
|
895
|
+
], w.prototype, "status");
|
|
896
|
+
N([
|
|
920
897
|
d({ type: Number })
|
|
921
|
-
],
|
|
922
|
-
|
|
898
|
+
], w.prototype, "progress");
|
|
899
|
+
N([
|
|
923
900
|
d({ type: String })
|
|
924
|
-
],
|
|
925
|
-
customElements.define("nys-fileitem",
|
|
926
|
-
var
|
|
901
|
+
], w.prototype, "errorMessage");
|
|
902
|
+
customElements.define("nys-fileitem", w);
|
|
903
|
+
var qe = Object.defineProperty, _ = (o, e, t, i) => {
|
|
927
904
|
for (var s = void 0, r = o.length - 1, n; r >= 0; r--)
|
|
928
905
|
(n = o[r]) && (s = n(e, t, s) || s);
|
|
929
|
-
return s &&
|
|
906
|
+
return s && qe(e, t, s), s;
|
|
930
907
|
};
|
|
931
|
-
let
|
|
932
|
-
const
|
|
908
|
+
let He = 0;
|
|
909
|
+
const O = class O extends re {
|
|
933
910
|
// allows use of elementInternals' API
|
|
934
911
|
constructor() {
|
|
935
|
-
super(), this.id = "", this.name = "", this.label = "", this.description = "", this.multiple = !1, this.form = null, this._tooltip = "", this.accept = "", this.disabled = !1, this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.dropzone = !1, this.width = "full", this.
|
|
912
|
+
super(), this.id = "", this.name = "", this.label = "", this.description = "", this.multiple = !1, this.form = null, this._tooltip = "", this.accept = "", this.disabled = !1, this.required = !1, this.optional = !1, this.showError = !1, this.errorMessage = "", this.dropzone = !1, this.width = "full", this.inverted = !1, this._selectedFiles = [], this._dragActive = !1, this._internals = this.attachInternals();
|
|
936
913
|
}
|
|
937
914
|
get _isDropDisabled() {
|
|
938
915
|
return this.disabled || !this.multiple && this._selectedFiles.length > 0;
|
|
@@ -956,17 +933,15 @@ const T = class T extends ne {
|
|
|
956
933
|
return `${t}${e ? " Error: One or more files are not valid file types." : ""}`;
|
|
957
934
|
}
|
|
958
935
|
get _innerNysButton() {
|
|
959
|
-
|
|
960
|
-
const e = this.renderRoot.querySelector(
|
|
936
|
+
return this.renderRoot.querySelector(
|
|
961
937
|
'[name="file-btn"]'
|
|
962
|
-
)
|
|
963
|
-
return (i = e == null ? void 0 : e.shadowRoot) == null ? void 0 : i.querySelector(
|
|
938
|
+
)?.shadowRoot?.querySelector(
|
|
964
939
|
"button"
|
|
965
940
|
);
|
|
966
941
|
}
|
|
967
942
|
// Generate a unique ID if one is not provided
|
|
968
943
|
connectedCallback() {
|
|
969
|
-
super.connectedCallback(), this.id || (this.id = `nys-fileinput-${Date.now()}-${
|
|
944
|
+
super.connectedCallback(), this.id || (this.id = `nys-fileinput-${Date.now()}-${He++}`), this.addEventListener("invalid", this._handleInvalid);
|
|
970
945
|
}
|
|
971
946
|
disconnectedCallback() {
|
|
972
947
|
super.disconnectedCallback(), this.removeEventListener("invalid", this._handleInvalid);
|
|
@@ -976,34 +951,31 @@ const T = class T extends ne {
|
|
|
976
951
|
}
|
|
977
952
|
/********************** Form Integration **********************/
|
|
978
953
|
_setValue() {
|
|
979
|
-
var e;
|
|
980
954
|
if (this.multiple) {
|
|
981
|
-
const
|
|
982
|
-
if (
|
|
983
|
-
const
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
}), this._internals.setFormValue(
|
|
955
|
+
const e = this._selectedFiles.map((t) => t.file);
|
|
956
|
+
if (e.length > 0) {
|
|
957
|
+
const t = new FormData();
|
|
958
|
+
e.forEach((i) => {
|
|
959
|
+
t.append(this.name, i);
|
|
960
|
+
}), this._internals.setFormValue(t);
|
|
987
961
|
} else
|
|
988
962
|
this._internals.setFormValue(null);
|
|
989
963
|
} else {
|
|
990
|
-
const
|
|
991
|
-
this._internals.setFormValue(
|
|
964
|
+
const e = this._selectedFiles[0]?.file || null;
|
|
965
|
+
this._internals.setFormValue(e);
|
|
992
966
|
}
|
|
993
967
|
this._manageRequire();
|
|
994
968
|
}
|
|
995
969
|
// Called to internally set the initial internalElement required flag.
|
|
996
970
|
_manageRequire() {
|
|
997
|
-
|
|
998
|
-
const e = (s = this.shadowRoot) == null ? void 0 : s.querySelector("input");
|
|
971
|
+
const e = this.shadowRoot?.querySelector("input");
|
|
999
972
|
if (!e) return;
|
|
1000
973
|
const t = this.errorMessage || "Please upload a file.";
|
|
1001
974
|
this.required && this._selectedFiles.length == 0 ? (this._internals.ariaRequired = "true", this._internals.setValidity({ valueMissing: !0 }, t, e)) : (this._internals.ariaRequired = "false", this._internals.setValidity({}, "", e));
|
|
1002
975
|
}
|
|
1003
976
|
_setValidityMessage(e = "") {
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
t && (this.showError = e === (this.errorMessage || "Please upload a file."), (s = this.errorMessage) != null && s.trim() && e !== "" && (e = this.errorMessage), this._internals.setValidity(
|
|
977
|
+
const t = this.shadowRoot?.querySelector("input");
|
|
978
|
+
t && (this.showError = e === (this.errorMessage || "Please upload a file."), this.errorMessage?.trim() && e !== "" && (e = this.errorMessage), this._internals.setValidity(
|
|
1007
979
|
e ? { customError: !0 } : {},
|
|
1008
980
|
e,
|
|
1009
981
|
t
|
|
@@ -1018,8 +990,7 @@ const T = class T extends ne {
|
|
|
1018
990
|
}
|
|
1019
991
|
// This helper function is called to perform the element's native validation.
|
|
1020
992
|
checkValidity() {
|
|
1021
|
-
|
|
1022
|
-
const e = (t = this.shadowRoot) == null ? void 0 : t.querySelector("input");
|
|
993
|
+
const e = this.shadowRoot?.querySelector("input");
|
|
1023
994
|
return e ? e.checkValidity() : !0;
|
|
1024
995
|
}
|
|
1025
996
|
_handleInvalid(e) {
|
|
@@ -1049,7 +1020,7 @@ const T = class T extends ne {
|
|
|
1049
1020
|
async _processFile(e) {
|
|
1050
1021
|
e.status = "processing";
|
|
1051
1022
|
try {
|
|
1052
|
-
if (!await
|
|
1023
|
+
if (!await Ue(e.file, this.accept)) {
|
|
1053
1024
|
e.status = "error", e.errorMsg = "File type is invalid.", this.requestUpdate();
|
|
1054
1025
|
return;
|
|
1055
1026
|
}
|
|
@@ -1078,10 +1049,9 @@ const T = class T extends ne {
|
|
|
1078
1049
|
);
|
|
1079
1050
|
}
|
|
1080
1051
|
_openFileDialog() {
|
|
1081
|
-
|
|
1052
|
+
this.renderRoot.querySelector(
|
|
1082
1053
|
".hidden-file-input"
|
|
1083
|
-
);
|
|
1084
|
-
e == null || e.click();
|
|
1054
|
+
)?.click();
|
|
1085
1055
|
}
|
|
1086
1056
|
_handlePostFileSelectionFocus() {
|
|
1087
1057
|
if (this.multiple) {
|
|
@@ -1091,15 +1061,14 @@ const T = class T extends ne {
|
|
|
1091
1061
|
this._focusFirstFileItemIfSingleMode();
|
|
1092
1062
|
}
|
|
1093
1063
|
async _focusFirstFileItemIfSingleMode() {
|
|
1094
|
-
var e;
|
|
1095
1064
|
if (!this.multiple) {
|
|
1096
1065
|
await this.updateComplete;
|
|
1097
1066
|
const t = this.renderRoot.querySelector(
|
|
1098
1067
|
"nys-fileitem"
|
|
1099
|
-
)
|
|
1068
|
+
)?.shadowRoot?.querySelector(
|
|
1100
1069
|
".file-item"
|
|
1101
1070
|
);
|
|
1102
|
-
|
|
1071
|
+
t && (t.setAttribute("tabindex", "-1"), t.focus());
|
|
1103
1072
|
}
|
|
1104
1073
|
}
|
|
1105
1074
|
/******************** Event Handlers ********************/
|
|
@@ -1111,15 +1080,14 @@ const T = class T extends ne {
|
|
|
1111
1080
|
}), this.requestUpdate(), this._dispatchChangeEvent(), this._handlePostFileSelectionFocus();
|
|
1112
1081
|
}
|
|
1113
1082
|
_handleFileRemove(e) {
|
|
1114
|
-
var i;
|
|
1115
1083
|
const t = e.detail.filename;
|
|
1116
1084
|
if (this._selectedFiles = this._selectedFiles.filter(
|
|
1117
|
-
(
|
|
1085
|
+
(i) => i.file.name !== t
|
|
1118
1086
|
), this._selectedFiles.length === 0) {
|
|
1119
|
-
const
|
|
1087
|
+
const i = this.shadowRoot?.querySelector(
|
|
1120
1088
|
"input"
|
|
1121
1089
|
);
|
|
1122
|
-
|
|
1090
|
+
i && (i.value = "");
|
|
1123
1091
|
}
|
|
1124
1092
|
this._setValue(), this._validate(), this.requestUpdate(), this._dispatchChangeEvent();
|
|
1125
1093
|
}
|
|
@@ -1131,14 +1099,13 @@ const T = class T extends ne {
|
|
|
1131
1099
|
this.disabled || (e.stopPropagation(), e.preventDefault(), e.currentTarget === e.target && (this._dragActive = !1, this.requestUpdate()));
|
|
1132
1100
|
}
|
|
1133
1101
|
_onDrop(e) {
|
|
1134
|
-
var s;
|
|
1135
1102
|
if (this.disabled) return;
|
|
1136
1103
|
e.preventDefault(), this._dragActive = !1, this.requestUpdate();
|
|
1137
|
-
const t =
|
|
1104
|
+
const t = e.dataTransfer?.files;
|
|
1138
1105
|
if (!t) return;
|
|
1139
1106
|
const i = Array.from(t);
|
|
1140
|
-
this.multiple ? i.forEach((
|
|
1141
|
-
this._saveSelectedFiles(
|
|
1107
|
+
this.multiple ? i.forEach((s) => {
|
|
1108
|
+
this._saveSelectedFiles(s);
|
|
1142
1109
|
}) : this._saveSelectedFiles(i[0]), this.requestUpdate(), this._dispatchChangeEvent();
|
|
1143
1110
|
}
|
|
1144
1111
|
render() {
|
|
@@ -1152,7 +1119,7 @@ const T = class T extends ne {
|
|
|
1152
1119
|
description=${this.description}
|
|
1153
1120
|
flag=${this.required ? "required" : this.optional ? "optional" : ""}
|
|
1154
1121
|
_tooltip=${this._tooltip}
|
|
1155
|
-
?
|
|
1122
|
+
?inverted=${this.inverted}
|
|
1156
1123
|
>
|
|
1157
1124
|
<slot name="description" slot="description">${this.description}</slot>
|
|
1158
1125
|
</nys-label>
|
|
@@ -1163,7 +1130,7 @@ const T = class T extends ne {
|
|
|
1163
1130
|
type="file"
|
|
1164
1131
|
name=${this.name}
|
|
1165
1132
|
accept=${this.accept}
|
|
1166
|
-
form=${
|
|
1133
|
+
form=${De(this.form || void 0)}
|
|
1167
1134
|
?multiple=${this.multiple}
|
|
1168
1135
|
?required=${this.required}
|
|
1169
1136
|
?disabled=${this.disabled || !this.multiple && this._selectedFiles.length > 0}
|
|
@@ -1186,27 +1153,28 @@ const T = class T extends ne {
|
|
|
1186
1153
|
aria-label="Drag files here or choose from folder"
|
|
1187
1154
|
>
|
|
1188
1155
|
${this._dragActive ? y`<p>Drop file to upload</p>` : y` <nys-button
|
|
1189
|
-
id
|
|
1156
|
+
id="choose-files-btn-drag"
|
|
1190
1157
|
name="file-btn"
|
|
1191
1158
|
label=${this.multiple ? "Choose files" : "Choose file"}
|
|
1192
1159
|
variant="outline"
|
|
1193
1160
|
ariaLabel=${this._buttonAriaLabel}
|
|
1194
1161
|
ariaDescription=${this._buttonAriaDescription}
|
|
1195
1162
|
?disabled=${this._isDropDisabled}
|
|
1196
|
-
|
|
1163
|
+
@nys-click=${(e) => {
|
|
1197
1164
|
e.stopPropagation(), this._openFileDialog();
|
|
1198
1165
|
}}
|
|
1166
|
+
@click=${(e) => e.stopPropagation()}
|
|
1199
1167
|
></nys-button>
|
|
1200
1168
|
<p>or drag here</p>`}
|
|
1201
1169
|
</div>` : y`<nys-button
|
|
1202
|
-
id
|
|
1170
|
+
id="choose-files-btn"
|
|
1203
1171
|
name="file-btn"
|
|
1204
1172
|
label=${this.multiple ? "Choose files" : "Choose file"}
|
|
1205
1173
|
variant="outline"
|
|
1206
1174
|
ariaLabel=${this._buttonAriaLabel}
|
|
1207
1175
|
ariaDescription=${this._buttonAriaDescription}
|
|
1208
1176
|
?disabled=${this.disabled || !this.multiple && this._selectedFiles.length > 0}
|
|
1209
|
-
|
|
1177
|
+
@nys-click=${this._openFileDialog}
|
|
1210
1178
|
></nys-button>`}
|
|
1211
1179
|
${this.showError ? y`
|
|
1212
1180
|
<nys-errormessage
|
|
@@ -1231,8 +1199,8 @@ const T = class T extends ne {
|
|
|
1231
1199
|
</div>`;
|
|
1232
1200
|
}
|
|
1233
1201
|
};
|
|
1234
|
-
|
|
1235
|
-
let p =
|
|
1202
|
+
O.styles = ze, O.formAssociated = !0;
|
|
1203
|
+
let p = O;
|
|
1236
1204
|
_([
|
|
1237
1205
|
d({ type: String })
|
|
1238
1206
|
], p.prototype, "id");
|
|
@@ -1280,7 +1248,7 @@ _([
|
|
|
1280
1248
|
], p.prototype, "width");
|
|
1281
1249
|
_([
|
|
1282
1250
|
d({ type: Boolean, reflect: !0 })
|
|
1283
|
-
], p.prototype, "
|
|
1251
|
+
], p.prototype, "inverted");
|
|
1284
1252
|
customElements.get("nys-fileinput") || customElements.define("nys-fileinput", p);
|
|
1285
1253
|
export {
|
|
1286
1254
|
p as NysFileinput
|