@uibit/form 0.1.0
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/LICENSE +21 -0
- package/README.md +26 -0
- package/custom-elements.json +407 -0
- package/dist/form.d.ts +55 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.js +449 -0
- package/dist/form.js.map +1 -0
- package/dist/frameworks/angular/index.ts +45 -0
- package/dist/frameworks/astro/index.d.ts +10 -0
- package/dist/frameworks/nuxt/index.ts +7 -0
- package/dist/frameworks/preact/index.d.ts +17 -0
- package/dist/frameworks/qwik/index.tsx +10 -0
- package/dist/frameworks/react/index.d.ts +21 -0
- package/dist/frameworks/solid/index.d.ts +18 -0
- package/dist/frameworks/stencil/index.d.ts +16 -0
- package/dist/frameworks/svelte/index.svelte +63 -0
- package/dist/frameworks/vue/index.ts +26 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +131 -0
- package/dist/styles.js.map +1 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +91 -0
package/dist/form.js
ADDED
|
@@ -0,0 +1,449 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing } from 'lit';
|
|
8
|
+
import { customElement, msg, UIBitElement } from '@uibit/core';
|
|
9
|
+
import { property, state } from 'lit/decorators.js';
|
|
10
|
+
import { styles } from './styles';
|
|
11
|
+
/**
|
|
12
|
+
* A declarative form wrapper that wraps a native `<form>` and adds wizards,
|
|
13
|
+
* submit lifecycle states, and dirty checking.
|
|
14
|
+
*
|
|
15
|
+
* @slot - Default slot where the native `<form>` element is placed.
|
|
16
|
+
* @slot success - Custom success template displayed upon successful submission.
|
|
17
|
+
* @slot error - Custom error template displayed upon failed submission.
|
|
18
|
+
*/
|
|
19
|
+
let Form = class Form extends UIBitElement {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments);
|
|
22
|
+
/** Opt-in warning prompt if the user tries to leave the page with unsaved changes. */
|
|
23
|
+
this.warnUnsaved = false;
|
|
24
|
+
/** Active wizard step (1-indexed). Only active if multiple fieldsets exist. */
|
|
25
|
+
this.step = 1;
|
|
26
|
+
/** The total number of steps/fieldsets detected in the form. */
|
|
27
|
+
this.stepsCount = 0;
|
|
28
|
+
this._stepTitles = [];
|
|
29
|
+
this._maxVisitedStep = 1;
|
|
30
|
+
/** Tracks whether the form has unsaved changes. */
|
|
31
|
+
this.dirty = false;
|
|
32
|
+
/** Submission state: 'idle', 'pending', 'success', or 'error'. */
|
|
33
|
+
this.status = 'idle';
|
|
34
|
+
this._slottedFormEl = null;
|
|
35
|
+
this._initialValues = new Map();
|
|
36
|
+
this._formListenersCleanups = [];
|
|
37
|
+
// ── Form Actions ───────────────────────────────────────────────
|
|
38
|
+
this._isResetting = false;
|
|
39
|
+
}
|
|
40
|
+
static { this.styles = styles; }
|
|
41
|
+
connectedCallback() {
|
|
42
|
+
super.connectedCallback();
|
|
43
|
+
this.listen(window, 'beforeunload', this._onBeforeUnload.bind(this));
|
|
44
|
+
this.listen(this, 'input', this._onFormInput.bind(this));
|
|
45
|
+
this.listen(this, 'change', this._onFormInput.bind(this));
|
|
46
|
+
this.listen(this, 'click', this._onFormClick.bind(this));
|
|
47
|
+
this._observer = new MutationObserver(() => {
|
|
48
|
+
this._initializeForm();
|
|
49
|
+
this.requestUpdate();
|
|
50
|
+
});
|
|
51
|
+
this._observer.observe(this, { childList: true, subtree: true });
|
|
52
|
+
}
|
|
53
|
+
disconnectedCallback() {
|
|
54
|
+
super.disconnectedCallback();
|
|
55
|
+
if (this._observer) {
|
|
56
|
+
this._observer.disconnect();
|
|
57
|
+
}
|
|
58
|
+
this._cleanupFormListeners();
|
|
59
|
+
}
|
|
60
|
+
firstUpdated(changedProperties) {
|
|
61
|
+
super.firstUpdated(changedProperties);
|
|
62
|
+
this._initializeForm();
|
|
63
|
+
}
|
|
64
|
+
_cleanupFormListeners() {
|
|
65
|
+
for (const cleanup of this._formListenersCleanups) {
|
|
66
|
+
cleanup();
|
|
67
|
+
}
|
|
68
|
+
this._formListenersCleanups = [];
|
|
69
|
+
}
|
|
70
|
+
_initializeForm() {
|
|
71
|
+
this._detectSlottedForm();
|
|
72
|
+
this._detectSteps();
|
|
73
|
+
this._captureInitialValues();
|
|
74
|
+
}
|
|
75
|
+
_detectSlottedForm() {
|
|
76
|
+
const form = this.querySelector('form');
|
|
77
|
+
if (form !== this._slottedFormEl) {
|
|
78
|
+
this._cleanupFormListeners();
|
|
79
|
+
this._slottedFormEl = form;
|
|
80
|
+
if (this._slottedFormEl) {
|
|
81
|
+
// Intercept submit and reset on the slotted form element
|
|
82
|
+
const submitCleanup = this.listen(this._slottedFormEl, 'submit', this._onSubmit.bind(this));
|
|
83
|
+
const resetCleanup = this.listen(this._slottedFormEl, 'reset', this.reset.bind(this));
|
|
84
|
+
this._formListenersCleanups.push(submitCleanup, resetCleanup);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
_detectSteps() {
|
|
89
|
+
if (!this._slottedFormEl) {
|
|
90
|
+
this.stepsCount = 0;
|
|
91
|
+
this._stepTitles = [];
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const fieldsets = this._slottedFormEl.querySelectorAll('fieldset');
|
|
95
|
+
this.stepsCount = fieldsets.length;
|
|
96
|
+
this._stepTitles = Array.from(fieldsets).map((fieldset, idx) => {
|
|
97
|
+
const legend = fieldset.querySelector('legend');
|
|
98
|
+
let title = fieldset.getAttribute('data-step-title') || '';
|
|
99
|
+
if (!title && legend) {
|
|
100
|
+
title = legend.textContent?.trim() || '';
|
|
101
|
+
title = title.replace(/^step\s+\d+:\s*/i, '');
|
|
102
|
+
}
|
|
103
|
+
return title || `Step ${idx + 1}`;
|
|
104
|
+
});
|
|
105
|
+
this._updateStepVisibility();
|
|
106
|
+
}
|
|
107
|
+
_updateStepVisibility() {
|
|
108
|
+
if (this.stepsCount <= 1 || !this._slottedFormEl)
|
|
109
|
+
return;
|
|
110
|
+
const fieldsets = this._slottedFormEl.querySelectorAll('fieldset');
|
|
111
|
+
fieldsets.forEach((fieldset, idx) => {
|
|
112
|
+
if (idx + 1 === this.step) {
|
|
113
|
+
fieldset.style.display = '';
|
|
114
|
+
fieldset.removeAttribute('disabled');
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
fieldset.style.display = 'none';
|
|
118
|
+
fieldset.setAttribute('disabled', 'true');
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
_getFormElements() {
|
|
123
|
+
if (!this._slottedFormEl)
|
|
124
|
+
return [];
|
|
125
|
+
return Array.from(this._slottedFormEl.querySelectorAll('input, select, textarea'));
|
|
126
|
+
}
|
|
127
|
+
_captureInitialValues() {
|
|
128
|
+
const elements = this._getFormElements();
|
|
129
|
+
for (const key of this._initialValues.keys()) {
|
|
130
|
+
if (!elements.includes(key)) {
|
|
131
|
+
this._initialValues.delete(key);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
for (const el of elements) {
|
|
135
|
+
if (!this._initialValues.has(el)) {
|
|
136
|
+
this._initialValues.set(el, this._getElementValue(el));
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
_getElementValue(el) {
|
|
141
|
+
if (el instanceof HTMLInputElement) {
|
|
142
|
+
if (el.type === 'checkbox') {
|
|
143
|
+
return el.checked;
|
|
144
|
+
}
|
|
145
|
+
if (el.type === 'radio') {
|
|
146
|
+
return el.checked ? el.value : null;
|
|
147
|
+
}
|
|
148
|
+
return el.value;
|
|
149
|
+
}
|
|
150
|
+
if (el instanceof HTMLSelectElement) {
|
|
151
|
+
if (el.multiple) {
|
|
152
|
+
return Array.from(el.selectedOptions).map(opt => opt.value);
|
|
153
|
+
}
|
|
154
|
+
return el.value;
|
|
155
|
+
}
|
|
156
|
+
return el.value;
|
|
157
|
+
}
|
|
158
|
+
_onFormInput() {
|
|
159
|
+
this._checkDirty();
|
|
160
|
+
}
|
|
161
|
+
_checkDirty() {
|
|
162
|
+
const elements = this._getFormElements();
|
|
163
|
+
let isDirty = false;
|
|
164
|
+
for (const el of elements) {
|
|
165
|
+
const initial = this._initialValues.get(el);
|
|
166
|
+
const current = this._getElementValue(el);
|
|
167
|
+
if (Array.isArray(initial) && Array.isArray(current)) {
|
|
168
|
+
if (initial.length !== current.length ||
|
|
169
|
+
!initial.every((val, idx) => current[idx] === val)) {
|
|
170
|
+
isDirty = true;
|
|
171
|
+
break;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
else if (el.type === 'radio') {
|
|
175
|
+
if (initial !== current) {
|
|
176
|
+
isDirty = true;
|
|
177
|
+
break;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
else if (initial !== current) {
|
|
181
|
+
isDirty = true;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
this.dirty = isDirty;
|
|
186
|
+
}
|
|
187
|
+
_onBeforeUnload(e) {
|
|
188
|
+
if (this.warnUnsaved && this.dirty) {
|
|
189
|
+
e.preventDefault();
|
|
190
|
+
e.returnValue = msg('You have unsaved changes. Are you sure you want to leave?');
|
|
191
|
+
return e.returnValue;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
_onSlotChange() {
|
|
195
|
+
this._initializeForm();
|
|
196
|
+
this.requestUpdate();
|
|
197
|
+
}
|
|
198
|
+
// ── Step Navigation ────────────────────────────────────────────
|
|
199
|
+
nextStep() {
|
|
200
|
+
if (this.step < this.stepsCount && this._slottedFormEl) {
|
|
201
|
+
const currentFieldset = this._slottedFormEl.querySelectorAll('fieldset')[this.step - 1];
|
|
202
|
+
if (currentFieldset) {
|
|
203
|
+
const inputs = currentFieldset.querySelectorAll('input, select, textarea');
|
|
204
|
+
let allValid = true;
|
|
205
|
+
for (const input of Array.from(inputs)) {
|
|
206
|
+
if (!input.checkValidity()) {
|
|
207
|
+
input.reportValidity();
|
|
208
|
+
allValid = false;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
if (!allValid)
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
this.step++;
|
|
216
|
+
if (this.step > this._maxVisitedStep) {
|
|
217
|
+
this._maxVisitedStep = this.step;
|
|
218
|
+
}
|
|
219
|
+
this._updateStepVisibility();
|
|
220
|
+
this.dispatchCustomEvent('uibit-step-change', { step: this.step });
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
prevStep() {
|
|
224
|
+
if (this.step > 1) {
|
|
225
|
+
this.step--;
|
|
226
|
+
this._updateStepVisibility();
|
|
227
|
+
this.dispatchCustomEvent('uibit-step-change', { step: this.step });
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
goToStep(stepNum) {
|
|
231
|
+
if (stepNum >= 1 && stepNum <= this.stepsCount && stepNum <= this._maxVisitedStep) {
|
|
232
|
+
// Validate current step if trying to skip forward
|
|
233
|
+
if (stepNum > this.step && this._slottedFormEl) {
|
|
234
|
+
for (let i = this.step; i < stepNum; i++) {
|
|
235
|
+
const fieldset = this._slottedFormEl.querySelectorAll('fieldset')[i - 1];
|
|
236
|
+
if (fieldset) {
|
|
237
|
+
const inputs = fieldset.querySelectorAll('input, select, textarea');
|
|
238
|
+
let allValid = true;
|
|
239
|
+
for (const input of Array.from(inputs)) {
|
|
240
|
+
if (!input.checkValidity()) {
|
|
241
|
+
input.reportValidity();
|
|
242
|
+
allValid = false;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (!allValid)
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
this.step = stepNum;
|
|
252
|
+
if (this.step > this._maxVisitedStep) {
|
|
253
|
+
this._maxVisitedStep = this.step;
|
|
254
|
+
}
|
|
255
|
+
this._updateStepVisibility();
|
|
256
|
+
this.dispatchCustomEvent('uibit-step-change', { step: this.step });
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
reset() {
|
|
260
|
+
if (this._isResetting)
|
|
261
|
+
return;
|
|
262
|
+
this._isResetting = true;
|
|
263
|
+
try {
|
|
264
|
+
if (this._slottedFormEl) {
|
|
265
|
+
this._slottedFormEl.reset();
|
|
266
|
+
}
|
|
267
|
+
const elements = this._getFormElements();
|
|
268
|
+
for (const el of elements) {
|
|
269
|
+
const initial = this._initialValues.get(el);
|
|
270
|
+
if (initial !== undefined) {
|
|
271
|
+
if (el instanceof HTMLInputElement && el.type === 'checkbox') {
|
|
272
|
+
el.checked = !!initial;
|
|
273
|
+
}
|
|
274
|
+
else if (el instanceof HTMLInputElement && el.type === 'radio') {
|
|
275
|
+
el.checked = el.value === initial;
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
el.value = initial;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
this.dirty = false;
|
|
283
|
+
this.status = 'idle';
|
|
284
|
+
this.step = 1;
|
|
285
|
+
this._maxVisitedStep = 1;
|
|
286
|
+
this._updateStepVisibility();
|
|
287
|
+
this.dispatchCustomEvent('uibit-reset');
|
|
288
|
+
}
|
|
289
|
+
finally {
|
|
290
|
+
this._isResetting = false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
async submit() {
|
|
294
|
+
if (!this._slottedFormEl)
|
|
295
|
+
return;
|
|
296
|
+
if (!this._slottedFormEl.checkValidity()) {
|
|
297
|
+
this._slottedFormEl.reportValidity();
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const action = this._slottedFormEl.getAttribute('action');
|
|
301
|
+
const method = this._slottedFormEl.getAttribute('method') || 'POST';
|
|
302
|
+
if (action) {
|
|
303
|
+
this.status = 'pending';
|
|
304
|
+
const formData = new FormData(this._slottedFormEl);
|
|
305
|
+
try {
|
|
306
|
+
const response = await fetch(action, {
|
|
307
|
+
method: method,
|
|
308
|
+
body: method.toUpperCase() === 'GET' ? undefined : formData,
|
|
309
|
+
});
|
|
310
|
+
if (!response.ok) {
|
|
311
|
+
throw new Error(`HTTP error! status: ${response.status}`);
|
|
312
|
+
}
|
|
313
|
+
this.status = 'success';
|
|
314
|
+
this.dirty = false;
|
|
315
|
+
this._initialValues.clear();
|
|
316
|
+
this._captureInitialValues();
|
|
317
|
+
this.dispatchCustomEvent('uibit-submit-success', { response });
|
|
318
|
+
}
|
|
319
|
+
catch (error) {
|
|
320
|
+
this.status = 'error';
|
|
321
|
+
this.dispatchCustomEvent('uibit-submit-error', { error });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
this._slottedFormEl.submit();
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
_onSubmit(e) {
|
|
329
|
+
e.preventDefault();
|
|
330
|
+
if (this.stepsCount > 1 && this.step < this.stepsCount) {
|
|
331
|
+
this.nextStep();
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
this.submit();
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
_onFormClick(e) {
|
|
338
|
+
const path = e.composedPath();
|
|
339
|
+
const nextBtn = path.find((el) => el instanceof HTMLElement && el.hasAttribute('data-uibit-form-next'));
|
|
340
|
+
if (nextBtn) {
|
|
341
|
+
e.preventDefault();
|
|
342
|
+
this.nextStep();
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
const prevBtn = path.find((el) => el instanceof HTMLElement && el.hasAttribute('data-uibit-form-prev'));
|
|
346
|
+
if (prevBtn) {
|
|
347
|
+
e.preventDefault();
|
|
348
|
+
this.prevStep();
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
willUpdate(changedProperties) {
|
|
353
|
+
if (changedProperties.has('step')) {
|
|
354
|
+
this._updateStepVisibility();
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
render() {
|
|
358
|
+
return html `
|
|
359
|
+
${this.stepsCount > 1
|
|
360
|
+
? html `
|
|
361
|
+
<div class="wizard-header" part="wizard-header">
|
|
362
|
+
<div class="wizard-meta" part="wizard-meta">
|
|
363
|
+
<slot name="wizard-info">
|
|
364
|
+
<span class="wizard-step-info" part="wizard-step-info">
|
|
365
|
+
<span class="wizard-step-num" part="wizard-step-num">${this.step}</span>
|
|
366
|
+
<span class="wizard-step-sep" part="wizard-step-sep">/</span>
|
|
367
|
+
<span class="wizard-step-total" part="wizard-step-total">${this.stepsCount}</span>
|
|
368
|
+
</span>
|
|
369
|
+
</slot>
|
|
370
|
+
<slot name="step-title-${this.step}">
|
|
371
|
+
<span class="wizard-step-title" part="wizard-step-title">
|
|
372
|
+
${this._stepTitles[this.step - 1] || ''}
|
|
373
|
+
</span>
|
|
374
|
+
</slot>
|
|
375
|
+
</div>
|
|
376
|
+
<slot name="wizard-controls">
|
|
377
|
+
<div class="wizard-controls" part="wizard-controls">
|
|
378
|
+
<button
|
|
379
|
+
type="button"
|
|
380
|
+
class="wizard-back-btn ${this.step === 1 ? 'disabled-control' : ''}"
|
|
381
|
+
part="wizard-back-btn"
|
|
382
|
+
?disabled="${this.step === 1}"
|
|
383
|
+
@click="${this.prevStep}"
|
|
384
|
+
aria-label="Go to previous step"
|
|
385
|
+
>
|
|
386
|
+
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>
|
|
387
|
+
</button>
|
|
388
|
+
<button
|
|
389
|
+
type="button"
|
|
390
|
+
class="wizard-next-btn ${this.step === this.stepsCount ? 'disabled-control' : ''}"
|
|
391
|
+
part="wizard-next-btn"
|
|
392
|
+
?disabled="${this.step === this.stepsCount}"
|
|
393
|
+
@click="${this.nextStep}"
|
|
394
|
+
aria-label="Go to next step"
|
|
395
|
+
>
|
|
396
|
+
<svg viewBox="0 0 24 24" width="14" height="14" stroke="currentColor" stroke-width="2.5" fill="none" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg>
|
|
397
|
+
</button>
|
|
398
|
+
</div>
|
|
399
|
+
</slot>
|
|
400
|
+
</div>
|
|
401
|
+
`
|
|
402
|
+
: nothing}
|
|
403
|
+
|
|
404
|
+
<div class="state-content" data-state="pending">
|
|
405
|
+
<slot name="loading"></slot>
|
|
406
|
+
</div>
|
|
407
|
+
|
|
408
|
+
<div class="state-content" data-state="success">
|
|
409
|
+
<slot name="success"></slot>
|
|
410
|
+
</div>
|
|
411
|
+
|
|
412
|
+
${this.status === 'error'
|
|
413
|
+
? html `
|
|
414
|
+
<div class="error-banner" role="alert">
|
|
415
|
+
<slot name="error"></slot>
|
|
416
|
+
</div>
|
|
417
|
+
`
|
|
418
|
+
: nothing}
|
|
419
|
+
|
|
420
|
+
<slot @slotchange="${this._onSlotChange}"></slot>
|
|
421
|
+
`;
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
__decorate([
|
|
425
|
+
property({ type: Boolean, attribute: 'warn-unsaved' })
|
|
426
|
+
], Form.prototype, "warnUnsaved", void 0);
|
|
427
|
+
__decorate([
|
|
428
|
+
property({ type: Number, reflect: true })
|
|
429
|
+
], Form.prototype, "step", void 0);
|
|
430
|
+
__decorate([
|
|
431
|
+
property({ type: Number, reflect: true, attribute: 'steps-count' })
|
|
432
|
+
], Form.prototype, "stepsCount", void 0);
|
|
433
|
+
__decorate([
|
|
434
|
+
state()
|
|
435
|
+
], Form.prototype, "_stepTitles", void 0);
|
|
436
|
+
__decorate([
|
|
437
|
+
state()
|
|
438
|
+
], Form.prototype, "_maxVisitedStep", void 0);
|
|
439
|
+
__decorate([
|
|
440
|
+
property({ type: Boolean, reflect: true })
|
|
441
|
+
], Form.prototype, "dirty", void 0);
|
|
442
|
+
__decorate([
|
|
443
|
+
property({ type: String, reflect: true })
|
|
444
|
+
], Form.prototype, "status", void 0);
|
|
445
|
+
Form = __decorate([
|
|
446
|
+
customElement('uibit-form')
|
|
447
|
+
], Form);
|
|
448
|
+
export { Form };
|
|
449
|
+
//# sourceMappingURL=form.js.map
|
package/dist/form.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.js","sourceRoot":"","sources":["../src/form.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC;;;;;;;GAOG;AAEI,IAAM,IAAI,GAAV,MAAM,IAAK,SAAQ,YAAY;IAA/B;;QAIL,sFAAsF;QAC9B,gBAAW,GAAG,KAAK,CAAC;QAE5E,+EAA+E;QACpC,SAAI,GAAG,CAAC,CAAC;QAEpD,gEAAgE;QACK,eAAU,GAAG,CAAC,CAAC;QAEnE,gBAAW,GAAa,EAAE,CAAC;QAC3B,oBAAe,GAAG,CAAC,CAAC;QAErC,mDAAmD;QACP,U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B,CAAC,CAAC,CAAC,EAAE;;iCAEnE,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,UAAU;8BAChC,IAAI,CAAC,QAAQ;;;;;;;;WAQhC;YACH,CAAC,CAAC,OAAO;;;;;;;;;;QAUT,IAAI,CAAC,MAAM,KAAK,OAAO;YACvB,CAAC,CAAC,IAAI,CAAA;;;;WAIH;YACH,CAAC,CAAC,OAAO;;2BAEU,IAAI,CAAC,aAAa;KACxC,CAAC;IACJ,CAAC;CACF,CAAA;AA1byD;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;yCAAqB;AAGjC;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;kCAAU;AAGiB;IAApE,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;wCAAgB;AAEnE;IAAhB,KAAK,EAAE;yCAAoC;AAC3B;IAAhB,KAAK,EAAE;6CAA6B;AAGO;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mCAAe;AAGf;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oCAA2D;AApB1F,IAAI;IADhB,aAAa,CAAC,YAAY,CAAC;GACf,IAAI,CA+bhB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy, ElementRef, input, effect, booleanAttribute, numberAttribute } from '@angular/core';
|
|
2
|
+
import '@uibit/form';
|
|
3
|
+
import type { Form as HTMLElementClass } from '@uibit/form';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'uibit-form',
|
|
7
|
+
template: '<ng-content></ng-content>',
|
|
8
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
9
|
+
standalone: true
|
|
10
|
+
})
|
|
11
|
+
export class NgxForm {
|
|
12
|
+
constructor(private el: ElementRef<HTMLElementClass>) {
|
|
13
|
+
effect(() => {
|
|
14
|
+
if (this.el.nativeElement) {
|
|
15
|
+
this.el.nativeElement.warnUnsaved = this.warnUnsaved();
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
effect(() => {
|
|
19
|
+
if (this.el.nativeElement) {
|
|
20
|
+
this.el.nativeElement.step = this.step();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
effect(() => {
|
|
24
|
+
if (this.el.nativeElement) {
|
|
25
|
+
this.el.nativeElement.stepsCount = this.stepsCount();
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
effect(() => {
|
|
29
|
+
if (this.el.nativeElement) {
|
|
30
|
+
this.el.nativeElement.dirty = this.dirty();
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
effect(() => {
|
|
34
|
+
if (this.el.nativeElement) {
|
|
35
|
+
this.el.nativeElement.status = this.status();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
readonly warnUnsaved = input<boolean, any>(false, { transform: booleanAttribute });
|
|
41
|
+
readonly step = input<number, any>(1, { transform: numberAttribute });
|
|
42
|
+
readonly stepsCount = input<number, any>(0, { transform: numberAttribute });
|
|
43
|
+
readonly dirty = input<boolean, any>(false, { transform: booleanAttribute });
|
|
44
|
+
readonly status = input<'idle' | 'pending' | 'success' | 'error', any>('idle');
|
|
45
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { Form as HTMLElementClass } from '@uibit/form';
|
|
3
|
+
import '@uibit/form';
|
|
4
|
+
|
|
5
|
+
declare module 'preact' {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'uibit-form': JSX.HTMLAttributes<HTMLElementClass> & {
|
|
9
|
+
warnUnsaved?: boolean;
|
|
10
|
+
step?: number;
|
|
11
|
+
stepsCount?: number;
|
|
12
|
+
dirty?: boolean;
|
|
13
|
+
status?: 'idle' | 'pending' | 'success' | 'error';
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { HTMLAttributes, ClassAttributes } from 'react';
|
|
2
|
+
import type { Form as HTMLElementClass } from '@uibit/form';
|
|
3
|
+
import '@uibit/form';
|
|
4
|
+
|
|
5
|
+
declare global {
|
|
6
|
+
namespace React {
|
|
7
|
+
namespace JSX {
|
|
8
|
+
interface IntrinsicElements {
|
|
9
|
+
'uibit-form': ClassAttributes<HTMLElementClass> & HTMLAttributes<HTMLElementClass> & {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
class?: string;
|
|
12
|
+
warnUnsaved?: boolean;
|
|
13
|
+
step?: number;
|
|
14
|
+
stepsCount?: number;
|
|
15
|
+
dirty?: boolean;
|
|
16
|
+
status?: 'idle' | 'pending' | 'success' | 'error';
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { JSX } from 'solid-js';
|
|
2
|
+
import type { Form as HTMLElementClass } from '@uibit/form';
|
|
3
|
+
import '@uibit/form';
|
|
4
|
+
|
|
5
|
+
declare module 'solid-js' {
|
|
6
|
+
namespace JSX {
|
|
7
|
+
interface IntrinsicElements {
|
|
8
|
+
'uibit-form': Partial<HTMLElementClass> & JSX.HTMLAttributes<HTMLElementClass> & {
|
|
9
|
+
warnUnsaved?: boolean;
|
|
10
|
+
step?: number;
|
|
11
|
+
stepsCount?: number;
|
|
12
|
+
dirty?: boolean;
|
|
13
|
+
status?: 'idle' | 'pending' | 'success' | 'error';
|
|
14
|
+
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Form as HTMLElementClass } from '@uibit/form';
|
|
2
|
+
import '@uibit/form';
|
|
3
|
+
|
|
4
|
+
declare module '@stencil/core' {
|
|
5
|
+
export namespace JSX {
|
|
6
|
+
interface IntrinsicElements {
|
|
7
|
+
'uibit-form': HTMLElementClass & {
|
|
8
|
+
warnUnsaved?: boolean;
|
|
9
|
+
step?: number;
|
|
10
|
+
stepsCount?: number;
|
|
11
|
+
dirty?: boolean;
|
|
12
|
+
status?: 'idle' | 'pending' | 'success' | 'error';
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|