@prolibu-suite/cobalt-form 0.2.2 → 2.0.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/dist/cjs/co-form-wizard.cjs.entry.js +40 -11
- package/dist/cjs/co-form.cjs.entry.js +1 -1
- package/dist/cjs/cobalt-form.cjs.js +1 -1
- package/dist/cjs/{index-CLL7Ervz.js → index-Brpri7nS.js} +120 -19
- package/dist/cjs/index.cjs.js +146 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cobalt-form/cobalt-form.esm.js +1 -1
- package/dist/cobalt-form/index.esm.js +1 -1
- package/dist/cobalt-form/p-296094ec.entry.js +1 -0
- package/dist/cobalt-form/{p-2168be6b.entry.js → p-95e1cedb.entry.js} +1 -1
- package/dist/cobalt-form/{p-CPE0t-C2.js → p-CzvtCEKX.js} +3 -3
- package/dist/collection/components/co-form/co-form.css +326 -4
- package/dist/collection/components/co-form/co-form.js +167 -4
- package/dist/collection/components/co-form-wizard/co-form-wizard.css +5 -0
- package/dist/collection/components/co-form-wizard/co-form-wizard.js +92 -10
- package/dist/components/co-form-wizard.js +1 -1
- package/dist/components/index.js +7 -7
- package/dist/esm/co-form-wizard.entry.js +40 -11
- package/dist/esm/co-form.entry.js +1 -1
- package/dist/esm/cobalt-form.js +1 -1
- package/dist/esm/{index-CPE0t-C2.js → index-CzvtCEKX.js} +120 -19
- package/dist/esm/index.js +146 -5
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/co-form/co-form.d.ts +7 -0
- package/dist/types/components/co-form-wizard/co-form-wizard.d.ts +15 -1
- package/dist/types/components.d.ts +33 -0
- package/dist/types/jsx-cobalt.d.ts +3 -0
- package/package.json +3 -3
- package/dist/cobalt-form/p-0a2a284f.entry.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-Mpsm3UE7.js');
|
|
4
|
-
var index$1 = require('./index-
|
|
4
|
+
var index$1 = require('./index-Brpri7nS.js');
|
|
5
5
|
|
|
6
|
-
const coFormWizardCss = () => `:host{display:block;font-family:var(--co-font-family-primary, sans-serif)}.co-form-wizard{max-width:720px;margin:0 auto;padding:var(--co-spacing-2xl, 24px);display:flex;flex-direction:column;gap:var(--co-spacing-lg, 16px)}.co-form-wizard[data-has-bg]{padding:var(--co-spacing-3xl, 32px) var(--co-spacing-2xl, 24px);background-repeat:no-repeat}.co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page, #fff));border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);padding:var(--co-spacing-2xl, 24px) var(--co-spacing-3xl, 28px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);min-height:var(--co-form-header-height, auto)}.co-form-wizard[data-hide-header] .co-form-wizard__title-block{display:none}.co-form-wizard[data-density="compact"] .co-form-wizard{gap:var(--co-spacing-sm, 8px)}.co-form-wizard[data-density="compact"] .co-form-wizard__title-block{padding:var(--co-spacing-lg, 16px) var(--co-spacing-xl, 20px)}.co-form-wizard[data-density="compact"] .co-form-wizard__page-head,.co-form-wizard[data-density="compact"] .co-form-wizard__nav{padding-top:var(--co-spacing-sm, 8px);padding-bottom:var(--co-spacing-sm, 8px)}.co-form-wizard__title{margin:0;font-size:24px;font-weight:700;letter-spacing:-0.02em;line-height:1.2;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__title-desc{margin:6px 0 0;font-size:var(--co-font-size-14, 14px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__stepper{display:flex;align-items:center;gap:var(--co-spacing-sm, 8px);list-style:none;padding:0;margin:0;flex-wrap:wrap}.co-form-wizard__step{display:flex;align-items:center;color:var(--co-semantic-text-secondary, #6b7280);font-size:var(--co-font-size-12, 12px)}.co-form-wizard__step-btn{display:inline-flex;align-items:center;gap:var(--co-spacing-xs, 4px);padding:4px 6px;border:0;background:transparent;border-radius:var(--co-border-radius-xxs, 4px);font:inherit;color:inherit;cursor:pointer}.co-form-wizard__step-btn:hover{background:var(--co-semantic-surface-hover, #f3f4f6);color:var(--co-semantic-text-default, #111827)}.co-form-wizard__step-num{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:var(--co-border-radius-full, 9999px);background:var(--co-semantic-surface-hover, #f3f4f6);font-weight:600}.co-form-wizard__step.is-active .co-form-wizard__step-num{background:var(--co-color-primary-azul, #2563eb);color:white}.co-form-wizard__step.is-done .co-form-wizard__step-num{background:var(--co-color-primary-verde, #02a270);color:white}.co-form-wizard__step.is-active{color:var(--co-semantic-text-default, #111827);font-weight:600}.co-form-wizard__page-card{background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);overflow:hidden;display:flex;flex-direction:column}.co-form-wizard__page-head{padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px);border-bottom:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__page-pill{display:inline-flex;font-size:10px;font-weight:700;letter-spacing:0.08em;color:var(--co-color-primary-azul, #2563eb);background:color-mix(in srgb, var(--co-color-primary-azul) 10%, transparent);padding:3px 8px;border-radius:var(--co-border-radius-full, 9999px);margin-bottom:6px}.co-form-wizard__page-title{margin:0;font-size:var(--co-font-size-18, 18px);font-weight:600;line-height:1.3;letter-spacing:-0.01em;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__page-desc{margin:4px 0 0;font-size:var(--co-font-size-13, 13px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__page-card>co-form{display:block;padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px)}.co-form-wizard__nav{display:flex;justify-content:space-between;gap:var(--co-spacing-sm, 8px);padding:var(--co-spacing-md, 12px) var(--co-spacing-2xl, 24px);border-top:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__empty{padding:var(--co-spacing-lg, 16px);text-align:center;color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__score{text-align:center;padding:var(--co-spacing-2xl, 24px);background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04)}.co-form-wizard__score-title{margin:0;font-size:var(--co-font-size-18, 18px)}.co-form-wizard__score-num{font-size:48px;font-weight:600;color:var(--co-color-primary-azul, #2563eb);margin:var(--co-spacing-md, 12px) 0}.co-form-wizard__score-pct{font-size:var(--co-font-size-16, 16px);color:var(--co-semantic-text-secondary, #6b7280);margin-left:var(--co-spacing-sm, 8px)}.co-form-wizard__score-pass{display:inline-block;padding:var(--co-spacing-xs, 4px) var(--co-spacing-md, 12px);border-radius:var(--co-border-radius-full, 9999px);font-weight:600;margin-bottom:var(--co-spacing-md, 12px)}.co-form-wizard__score-pass.is-pass{background:var(--co-color-status-success, #0a7724);color:white}.co-form-wizard__score-pass.is-fail{background:var(--co-color-status-error, #aa2e1b);color:white}.co-form-wizard__score-feedback{text-align:left;list-style:disc;padding-left:var(--co-spacing-2xl, 24px);color:var(--co-semantic-text-default, #111827)}.co-form-wizard[data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-has-bg] .co-form-wizard__score{border:0;box-shadow:0 4px 24px rgba(0, 0, 0, 0.08)}.co-form-wizard[data-theme="dark"]{--co-semantic-surface-page:#1a1f2b;--co-semantic-surface-secondary:#1a1f2b;--co-semantic-surface-primary:#ffffff;--co-semantic-surface-muted:#2a3142;--co-semantic-surface-hover:rgba(255, 255, 255, 0.06);--co-semantic-surface-disabled:rgba(255, 255, 255, 0.04);--co-semantic-on-primary:#1a1f2b;--co-semantic-on-secondary:#f9fafb;--co-semantic-text-default:#f9fafb;--co-semantic-text-secondary:#9ca3af;--co-semantic-text-muted:#6b7280;--co-semantic-text-disabled:#4b5563;--co-semantic-border-default:rgba(255, 255, 255, 0.12);--co-semantic-border-subtle:rgba(255, 255, 255, 0.14);--co-semantic-border-strong:rgba(255, 255, 255, 0.25);--co-semantic-border-focus:rgba(255, 255, 255, 0.25);--co-semantic-border-focus-ring:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"] .co-form-wizard__score{background:var(--co-semantic-surface-page);border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page));border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-title{color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-desc,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-desc{color:#9ca3af}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-head,.co-form-wizard[data-theme="dark"] .co-form-wizard__nav{background:rgba(255, 255, 255, 0.03);border-color:var(--co-semantic-border-default)}.co-form-wizard[data-theme="dark"] .co-form-wizard__step-num{background:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__score{box-shadow:0 4px 24px rgba(0, 0, 0, 0.4)}.co-form-wizard[data-appearance="flat"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card{background:transparent !important;border:0 !important;box-shadow:none !important;padding:0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-head{background:transparent !important;border-bottom:0 !important;padding:0 0 var(--co-spacing-md, 12px) 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__nav{background:transparent !important;border-top:0 !important;padding:var(--co-spacing-md, 12px) 0 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card>co-form{padding:0 !important}.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__page-card{color:#f9fafb}`;
|
|
6
|
+
const coFormWizardCss = () => `:host{display:block;font-family:var(--co-font-family-primary, sans-serif)}.co-form-wizard{max-width:720px;margin:0 auto;padding:var(--co-spacing-2xl, 24px);display:flex;flex-direction:column;gap:var(--co-spacing-lg, 16px)}.co-form-wizard[data-has-bg]{padding:var(--co-spacing-3xl, 32px) var(--co-spacing-2xl, 24px);background-repeat:no-repeat}.co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page, #fff));border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);padding:var(--co-spacing-2xl, 24px) var(--co-spacing-3xl, 28px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);min-height:var(--co-form-header-height, auto)}.co-form-wizard[data-hide-header] .co-form-wizard__title-block{display:none}.co-form-wizard[data-density="compact"] .co-form-wizard{gap:var(--co-spacing-sm, 8px)}.co-form-wizard[data-density="compact"] .co-form-wizard__title-block{padding:var(--co-spacing-lg, 16px) var(--co-spacing-xl, 20px)}.co-form-wizard[data-density="compact"] .co-form-wizard__page-head,.co-form-wizard[data-density="compact"] .co-form-wizard__nav{padding-top:var(--co-spacing-sm, 8px);padding-bottom:var(--co-spacing-sm, 8px)}.co-form-wizard__title{margin:0;font-size:24px;font-weight:700;letter-spacing:-0.02em;line-height:1.2;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__title-desc{margin:6px 0 0;font-size:var(--co-font-size-14, 14px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__stepper{display:flex;align-items:center;gap:var(--co-spacing-sm, 8px);list-style:none;padding:0;margin:0;flex-wrap:wrap}.co-form-wizard__step{display:flex;align-items:center;color:var(--co-semantic-text-secondary, #6b7280);font-size:var(--co-font-size-12, 12px)}.co-form-wizard__step-btn{display:inline-flex;align-items:center;gap:var(--co-spacing-xs, 4px);padding:4px 6px;border:0;background:transparent;border-radius:var(--co-border-radius-xxs, 4px);font:inherit;color:inherit;cursor:pointer}.co-form-wizard__step-btn:hover{background:var(--co-semantic-surface-hover, #f3f4f6);color:var(--co-semantic-text-default, #111827)}.co-form-wizard__step-num{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:var(--co-border-radius-full, 9999px);background:var(--co-semantic-surface-hover, #f3f4f6);font-weight:600}.co-form-wizard__step.is-active .co-form-wizard__step-num{background:var(--co-color-primary-azul, #2563eb);color:white}.co-form-wizard__step.is-done .co-form-wizard__step-num{background:var(--co-color-primary-verde, #02a270);color:white}.co-form-wizard__step.is-active{color:var(--co-semantic-text-default, #111827);font-weight:600}.co-form-wizard__page-card{background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04);overflow:hidden;display:flex;flex-direction:column}.co-form-wizard__page-head{padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px);border-bottom:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__page-pill{display:inline-flex;font-size:10px;font-weight:700;letter-spacing:0.08em;color:var(--co-color-primary-azul, #2563eb);background:color-mix(in srgb, var(--co-color-primary-azul) 10%, transparent);padding:3px 8px;border-radius:var(--co-border-radius-full, 9999px);margin-bottom:6px}.co-form-wizard__page-title{margin:0;font-size:var(--co-font-size-18, 18px);font-weight:600;line-height:1.3;letter-spacing:-0.01em;color:var(--co-semantic-text-default, #111827)}.co-form-wizard__page-desc{margin:4px 0 0;font-size:var(--co-font-size-13, 13px);color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__page-card>co-form{display:block;padding:var(--co-spacing-xl, 20px) var(--co-spacing-2xl, 24px)}.co-form-wizard__nav{display:flex;justify-content:space-between;gap:var(--co-spacing-sm, 8px);padding:var(--co-spacing-md, 12px) var(--co-spacing-2xl, 24px);border-top:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));background:var(--co-semantic-surface-hover, #f9fafb)}.co-form-wizard__nav co-button:only-child{margin-left:auto}.co-form-wizard__empty{padding:var(--co-spacing-lg, 16px);text-align:center;color:var(--co-semantic-text-secondary, #6b7280)}.co-form-wizard__score{text-align:center;padding:var(--co-spacing-2xl, 24px);background:var(--co-semantic-surface-page, #fff);border:1px solid var(--co-semantic-border-default, rgba(17, 24, 39, 0.08));border-radius:var(--co-border-radius-lg, 16px);box-shadow:0 1px 2px rgba(0, 0, 0, 0.04)}.co-form-wizard__score-title{margin:0;font-size:var(--co-font-size-18, 18px)}.co-form-wizard__score-num{font-size:48px;font-weight:600;color:var(--co-color-primary-azul, #2563eb);margin:var(--co-spacing-md, 12px) 0}.co-form-wizard__score-pct{font-size:var(--co-font-size-16, 16px);color:var(--co-semantic-text-secondary, #6b7280);margin-left:var(--co-spacing-sm, 8px)}.co-form-wizard__score-pass{display:inline-block;padding:var(--co-spacing-xs, 4px) var(--co-spacing-md, 12px);border-radius:var(--co-border-radius-full, 9999px);font-weight:600;margin-bottom:var(--co-spacing-md, 12px)}.co-form-wizard__score-pass.is-pass{background:var(--co-color-status-success, #0a7724);color:white}.co-form-wizard__score-pass.is-fail{background:var(--co-color-status-error, #aa2e1b);color:white}.co-form-wizard__score-feedback{text-align:left;list-style:disc;padding-left:var(--co-spacing-2xl, 24px);color:var(--co-semantic-text-default, #111827)}.co-form-wizard[data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-has-bg] .co-form-wizard__score{border:0;box-shadow:0 4px 24px rgba(0, 0, 0, 0.08)}.co-form-wizard[data-theme="dark"]{--co-semantic-surface-page:#1a1f2b;--co-semantic-surface-secondary:#1a1f2b;--co-semantic-surface-primary:#ffffff;--co-semantic-surface-muted:#2a3142;--co-semantic-surface-hover:rgba(255, 255, 255, 0.06);--co-semantic-surface-disabled:rgba(255, 255, 255, 0.04);--co-semantic-on-primary:#1a1f2b;--co-semantic-on-secondary:#f9fafb;--co-semantic-text-default:#f9fafb;--co-semantic-text-secondary:#9ca3af;--co-semantic-text-muted:#6b7280;--co-semantic-text-disabled:#4b5563;--co-semantic-border-default:rgba(255, 255, 255, 0.12);--co-semantic-border-subtle:rgba(255, 255, 255, 0.14);--co-semantic-border-strong:rgba(255, 255, 255, 0.25);--co-semantic-border-focus:rgba(255, 255, 255, 0.25);--co-semantic-border-focus-ring:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"] .co-form-wizard__score{background:var(--co-semantic-surface-page);border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-block{background:var(--co-form-header-bg, var(--co-semantic-surface-page));border-color:var(--co-semantic-border-default);color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-title{color:#f9fafb}.co-form-wizard[data-theme="dark"] .co-form-wizard__title-desc,.co-form-wizard[data-theme="dark"] .co-form-wizard__page-desc{color:#9ca3af}.co-form-wizard[data-theme="dark"] .co-form-wizard__page-head,.co-form-wizard[data-theme="dark"] .co-form-wizard__nav{background:rgba(255, 255, 255, 0.03);border-color:var(--co-semantic-border-default)}.co-form-wizard[data-theme="dark"] .co-form-wizard__step-num{background:rgba(255, 255, 255, 0.1);color:#f9fafb}.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__title-block,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__page-card,.co-form-wizard[data-theme="dark"][data-has-bg] .co-form-wizard__score{box-shadow:0 4px 24px rgba(0, 0, 0, 0.4)}.co-form-wizard[data-appearance="flat"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card{background:transparent !important;border:0 !important;box-shadow:none !important;padding:0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-head{background:transparent !important;border-bottom:0 !important;padding:0 0 var(--co-spacing-md, 12px) 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__nav{background:transparent !important;border-top:0 !important;padding:var(--co-spacing-md, 12px) 0 0 !important}.co-form-wizard[data-appearance="flat"] .co-form-wizard__page-card>co-form{padding:0 !important}.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__title-block,.co-form-wizard[data-appearance="flat"][data-theme="dark"] .co-form-wizard__page-card{color:#f9fafb}`;
|
|
7
7
|
|
|
8
8
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
9
9
|
var t = {};
|
|
@@ -25,17 +25,30 @@ function safeJsonParse(s) {
|
|
|
25
25
|
return null;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
const DEFAULT_LABELS = {
|
|
29
|
+
result: 'Result',
|
|
30
|
+
passed: 'Passed',
|
|
31
|
+
failed: 'Failed',
|
|
32
|
+
prev: 'Previous',
|
|
33
|
+
next: 'Next',
|
|
34
|
+
submit: 'Submit',
|
|
35
|
+
empty: 'No pages to display.',
|
|
36
|
+
pagePrefix: 'PAGE',
|
|
37
|
+
};
|
|
28
38
|
const CoFormWizard = class {
|
|
29
39
|
constructor(hostRef) {
|
|
30
40
|
index.registerInstance(this, hostRef);
|
|
31
41
|
this.coSubmit = index.createEvent(this, "coSubmit");
|
|
32
42
|
this.coPageChange = index.createEvent(this, "coPageChange");
|
|
43
|
+
this.coChange = index.createEvent(this, "coChange");
|
|
33
44
|
/** Locale for AJV error messages. */
|
|
34
45
|
this.locale = 'es';
|
|
35
46
|
/** Layout passed to each page's <co-form>. */
|
|
36
47
|
this.layout = 'grid';
|
|
37
48
|
/** Number of columns per page. */
|
|
38
49
|
this.columns = 1;
|
|
50
|
+
/** When to run validation. Forwarded to each page's `<co-form>`. */
|
|
51
|
+
this.validateOn = 'change';
|
|
39
52
|
this.currentIndex = 0;
|
|
40
53
|
this.values = {};
|
|
41
54
|
this.finalScore = null;
|
|
@@ -57,13 +70,13 @@ const CoFormWizard = class {
|
|
|
57
70
|
return;
|
|
58
71
|
if (this.currentIndex < this.activePages.length - 1) {
|
|
59
72
|
this.currentIndex += 1;
|
|
60
|
-
this.
|
|
73
|
+
this.emitPageChange();
|
|
61
74
|
}
|
|
62
75
|
};
|
|
63
76
|
this.handlePrev = () => {
|
|
64
77
|
if (this.currentIndex > 0) {
|
|
65
78
|
this.currentIndex -= 1;
|
|
66
|
-
this.
|
|
79
|
+
this.emitPageChange();
|
|
67
80
|
}
|
|
68
81
|
};
|
|
69
82
|
/**
|
|
@@ -77,7 +90,7 @@ const CoFormWizard = class {
|
|
|
77
90
|
return;
|
|
78
91
|
if (targetIndex < this.currentIndex) {
|
|
79
92
|
this.currentIndex = targetIndex;
|
|
80
|
-
this.
|
|
93
|
+
this.emitPageChange();
|
|
81
94
|
return;
|
|
82
95
|
}
|
|
83
96
|
// Forward jump — validate-and-advance one step at a time.
|
|
@@ -87,7 +100,7 @@ const CoFormWizard = class {
|
|
|
87
100
|
return;
|
|
88
101
|
this.currentIndex += 1;
|
|
89
102
|
}
|
|
90
|
-
this.
|
|
103
|
+
this.emitPageChange();
|
|
91
104
|
};
|
|
92
105
|
this.handleSubmit = async () => {
|
|
93
106
|
const ok = await this.commitCurrentPage();
|
|
@@ -103,8 +116,17 @@ const CoFormWizard = class {
|
|
|
103
116
|
};
|
|
104
117
|
this.handlePageChange = (ev) => {
|
|
105
118
|
this.values = Object.assign(Object.assign({}, this.values), { [ev.detail.name]: ev.detail.value });
|
|
119
|
+
this.coChange.emit(ev.detail);
|
|
106
120
|
};
|
|
107
121
|
}
|
|
122
|
+
get mergedLabels() {
|
|
123
|
+
if (!this.labels)
|
|
124
|
+
return DEFAULT_LABELS;
|
|
125
|
+
const parsed = safeJsonParse(this.labels);
|
|
126
|
+
if (!parsed || typeof parsed !== 'object')
|
|
127
|
+
return DEFAULT_LABELS;
|
|
128
|
+
return Object.assign(Object.assign({}, DEFAULT_LABELS), parsed);
|
|
129
|
+
}
|
|
108
130
|
componentWillLoad() {
|
|
109
131
|
this.parseSchema();
|
|
110
132
|
this.values = this.parseInitialValues();
|
|
@@ -198,6 +220,12 @@ const CoFormWizard = class {
|
|
|
198
220
|
var _a;
|
|
199
221
|
return (_a = this.activePages[this.currentIndex]) !== null && _a !== void 0 ? _a : null;
|
|
200
222
|
}
|
|
223
|
+
emitPageChange() {
|
|
224
|
+
const page = this.currentPage;
|
|
225
|
+
if (page) {
|
|
226
|
+
this.coPageChange.emit({ index: this.currentIndex, page });
|
|
227
|
+
}
|
|
228
|
+
}
|
|
201
229
|
async commitCurrentPage() {
|
|
202
230
|
var _a, _b;
|
|
203
231
|
if (!this.currentFormEl)
|
|
@@ -233,7 +261,7 @@ const CoFormWizard = class {
|
|
|
233
261
|
var _a;
|
|
234
262
|
const pages = this.activePages;
|
|
235
263
|
if (pages.length === 0) {
|
|
236
|
-
return (index.h(index.Host, Object.assign({}, this.hostProps()), index.h("div", { class: "co-form-wizard__empty" },
|
|
264
|
+
return (index.h(index.Host, Object.assign({}, this.hostProps()), index.h("div", { class: "co-form-wizard__empty" }, this.mergedLabels.empty)));
|
|
237
265
|
}
|
|
238
266
|
// Quiz finished — show the score panel.
|
|
239
267
|
if (this.finalScore && ((_a = this.paged.scoring) === null || _a === void 0 ? void 0 : _a.showScore)) {
|
|
@@ -260,7 +288,7 @@ const CoFormWizard = class {
|
|
|
260
288
|
'co-form-wizard__step': true,
|
|
261
289
|
'is-active': i === this.currentIndex,
|
|
262
290
|
'is-done': i < this.currentIndex,
|
|
263
|
-
}, key: p.name }, index.h("button", { type: "button", class: "co-form-wizard__step-btn", onClick: () => this.handleStepClick(i) }, index.h("span", { class: "co-form-wizard__step-num" }, i + 1), index.h("span", { class: "co-form-wizard__step-label" }, p.title || p.name))))))), index.h("section", { class: "co-form-wizard__page-card" }, this.renderPageHead(current, pages.length > 1), index.h("co-form", { ref: (el) => (this.currentFormEl = el), schema: JSON.stringify(current.fields), "initial-values": JSON.stringify(pageInitial), locale: this.locale, layout: this.layout, columns: this.columns, theme: this.themeForChildren, "hide-footer": true, onCoChange: this.handlePageChange }), index.h("div", { class: "co-form-wizard__nav" }, index.h("co-button", { label:
|
|
291
|
+
}, key: p.name }, index.h("button", { type: "button", class: "co-form-wizard__step-btn", onClick: () => this.handleStepClick(i) }, index.h("span", { class: "co-form-wizard__step-num" }, i + 1), index.h("span", { class: "co-form-wizard__step-label" }, p.title || p.name))))))), index.h("section", { class: "co-form-wizard__page-card" }, this.renderPageHead(current, pages.length > 1), index.h("co-form", { ref: (el) => (this.currentFormEl = el), schema: JSON.stringify(current.fields), "initial-values": JSON.stringify(pageInitial), locale: this.locale, layout: this.layout, columns: this.columns, theme: this.themeForChildren, "validate-on": this.validateOn, "hide-footer": true, onCoChange: this.handlePageChange }), index.h("div", { class: "co-form-wizard__nav" }, pages.length > 1 && (index.h("co-button", { label: this.mergedLabels.prev, variant: "stroke", disabled: isFirst, onClick: this.handlePrev })), isLast ? (index.h("co-button", { label: this.mergedLabels.submit, variant: "primary", onClick: this.handleSubmit })) : (index.h("co-button", { label: this.mergedLabels.next, variant: "primary", onClick: this.handleNext })))), index.h("slot", { name: "footer" })));
|
|
264
292
|
}
|
|
265
293
|
/**
|
|
266
294
|
* Smart page-head visibility:
|
|
@@ -282,11 +310,12 @@ const CoFormWizard = class {
|
|
|
282
310
|
const wantsPill = isMulti && !current.hideTitle;
|
|
283
311
|
if (!wantsPill && !wantsTitle && !wantsDesc)
|
|
284
312
|
return null;
|
|
285
|
-
return (index.h("header", { class: "co-form-wizard__page-head" }, wantsPill && (index.h("span", { class: "co-form-wizard__page-pill" }, "
|
|
313
|
+
return (index.h("header", { class: "co-form-wizard__page-head" }, wantsPill && (index.h("span", { class: "co-form-wizard__page-pill" }, this.mergedLabels.pagePrefix, " ", this.currentIndex + 1)), wantsTitle && (index.h("h2", { class: "co-form-wizard__page-title" }, current.title)), wantsDesc && (index.h("p", { class: "co-form-wizard__page-desc" }, current.description))));
|
|
286
314
|
}
|
|
287
315
|
renderScorePanel(score) {
|
|
288
|
-
const
|
|
289
|
-
|
|
316
|
+
const labels = this.mergedLabels;
|
|
317
|
+
const passText = score.passed === true ? labels.passed : score.passed === false ? labels.failed : null;
|
|
318
|
+
return (index.h("div", { class: "co-form-wizard co-form-wizard__score" }, index.h("h2", { class: "co-form-wizard__score-title" }, labels.result), index.h("div", { class: "co-form-wizard__score-num" }, score.total, " / ", score.max, index.h("span", { class: "co-form-wizard__score-pct" }, "(", score.percent, "%)")), passText && (index.h("div", { class: {
|
|
290
319
|
'co-form-wizard__score-pass': true,
|
|
291
320
|
'is-pass': score.passed === true,
|
|
292
321
|
'is-fail': score.passed === false,
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["co-form.cjs",[[260,"co-form",{"schema":[1],"initialValues":[1,"initial-values"],"schemaInstance":[16],"refResolver":[16],"locale":[1],"layout":[1],"excludeFields":[1,"exclude-fields"],"disabled":[4],"readOnly":[4,"read-only"],"columns":[2],"gap":[1],"footerAlign":[1,"footer-align"],"hideFooter":[4,"hide-footer"],"theme":[1],"snapshot":[32],"refStates":[32],"themeStyles":[32],"hasBg":[32],"setValue":[64],"getValue":[64],"touch":[64],"validateAndCollect":[64]},null,{"schema":[{"onSchemaChange":0}],"schemaInstance":[{"onSchemaChange":0}],"locale":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]],["co-form-wizard.cjs",[[260,"co-form-wizard",{"schema":[1],"initialValues":[1,"initial-values"],"locale":[1],"layout":[1],"columns":[2],"theme":[1],"currentIndex":[32],"values":[32],"finalScore":[32],"themeStyles":[32],"hasBg":[32]},null,{"schema":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["co-form.cjs",[[260,"co-form",{"schema":[1],"initialValues":[1,"initial-values"],"schemaInstance":[16],"refResolver":[16],"locale":[1],"layout":[1],"excludeFields":[1,"exclude-fields"],"disabled":[4],"readOnly":[4,"read-only"],"columns":[2],"gap":[1],"footerAlign":[1,"footer-align"],"hideFooter":[4,"hide-footer"],"validateOn":[1,"validate-on"],"theme":[1],"snapshot":[32],"refStates":[32],"themeStyles":[32],"hasBg":[32],"orderingDragIdx":[32],"orderingDropIdx":[32],"setValue":[64],"getValue":[64],"touch":[64],"validateAndCollect":[64]},null,{"schema":[{"onSchemaChange":0}],"schemaInstance":[{"onSchemaChange":0}],"locale":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]],["co-form-wizard.cjs",[[260,"co-form-wizard",{"schema":[1],"initialValues":[1,"initial-values"],"locale":[1],"layout":[1],"columns":[2],"theme":[1],"validateOn":[1,"validate-on"],"labels":[1],"currentIndex":[32],"values":[32],"finalScore":[32],"themeStyles":[32],"hasBg":[32]},null,{"schema":[{"onSchemaChange":0}],"theme":[{"onThemeChange":0}]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
|
@@ -7390,7 +7390,31 @@ var RESOLVERS = [
|
|
|
7390
7390
|
(orig) => orig.uiCom === "ColorPicker" ? "color" : void 0,
|
|
7391
7391
|
(orig) => orig.uiCom === "Section" ? "section" : void 0,
|
|
7392
7392
|
(orig) => orig.uiCom === "File" || orig.uiCom === "FileUpload" ? "file" : void 0,
|
|
7393
|
+
// FillBlank deprecated — resolve to 'text' for backward compatibility.
|
|
7394
|
+
(orig) => orig.uiCom === "FillBlank" ? "text" : void 0,
|
|
7395
|
+
(orig) => orig.uiCom === "Ordering" ? "ordering" : void 0,
|
|
7396
|
+
(orig) => orig.uiCom === "Matching" ? "matching" : void 0,
|
|
7397
|
+
(orig) => orig.uiCom === "ImageRadioGroup" ? "image-choice" : void 0,
|
|
7393
7398
|
(orig) => orig.uiCom === "Repeater" || orig.uiCom === "objectEditor" ? "array" : void 0,
|
|
7399
|
+
// Phone with country code indicator.
|
|
7400
|
+
(orig) => orig.uiCom === "PhoneWithIndicative" ? "phone" : void 0,
|
|
7401
|
+
// Explicit date picker (renderer override, not a domain type). The
|
|
7402
|
+
// underlying value stays a date-only string.
|
|
7403
|
+
(orig) => orig.uiCom === "DatePicker" ? "date" : void 0,
|
|
7404
|
+
// Radio / Checkbox group — explicit uiCom before the generic enum→select.
|
|
7405
|
+
(orig) => orig.uiCom === "RadioGroup" ? "radio" : void 0,
|
|
7406
|
+
(orig) => orig.uiCom === "CheckboxGroup" ? "checkbox" : void 0,
|
|
7407
|
+
// Masked is a renderer behavior (not a domain type). Keep it after explicit
|
|
7408
|
+
// uiCom mappings, but before ref/enum/type fallbacks.
|
|
7409
|
+
(orig) => {
|
|
7410
|
+
const mask = orig.mask;
|
|
7411
|
+
if (typeof mask === "string") return mask.trim() ? "masked" : void 0;
|
|
7412
|
+
if (mask && typeof mask === "object") return "masked";
|
|
7413
|
+
return void 0;
|
|
7414
|
+
},
|
|
7415
|
+
// A `File` ref is an upload field, not a model picker — route it before the
|
|
7416
|
+
// generic ref rule.
|
|
7417
|
+
(orig) => orig.ref === "File" ? "file" : void 0,
|
|
7394
7418
|
// Ref binds to a backend model.
|
|
7395
7419
|
(orig) => orig.ref ? "ref" : void 0,
|
|
7396
7420
|
// Enum → select.
|
|
@@ -7398,12 +7422,17 @@ var RESOLVERS = [
|
|
|
7398
7422
|
// Array of objects → repeater (when no other uiCom matches).
|
|
7399
7423
|
(orig) => Array.isArray(orig.type) && orig.type[0] && typeof orig.type[0] === "object" ? "array" : void 0,
|
|
7400
7424
|
(orig) => orig.type === "array" && orig.itemSchema ? "array" : void 0,
|
|
7425
|
+
// Array of primitives (e.g. Mongoose `type: [String]`) → free-text tags.
|
|
7426
|
+
// Placed after the array-of-objects (repeater) rule so only primitive arrays
|
|
7427
|
+
// reach it, and after `ref` so arrays of object-id refs stay multi-ref.
|
|
7428
|
+
(orig) => Array.isArray(orig.type) && orig.type[0] && typeof orig.type[0] !== "object" ? "tags" : void 0,
|
|
7401
7429
|
// File ref / file format.
|
|
7402
7430
|
(orig) => orig.format === "file" || orig.type === "File" ? "file" : void 0,
|
|
7403
7431
|
// Primitive types.
|
|
7404
7432
|
(orig) => orig.type === "boolean" ? "boolean" : void 0,
|
|
7405
7433
|
(orig) => orig.type === "number" || orig.type === "integer" ? "number" : void 0,
|
|
7406
7434
|
(orig) => orig.type === "date" ? "date" : void 0,
|
|
7435
|
+
(orig) => orig.type === "mixed" ? "mixed" : void 0,
|
|
7407
7436
|
(orig) => orig.type === "string" ? "text" : void 0
|
|
7408
7437
|
];
|
|
7409
7438
|
function resolveFieldKind(ajvProperty) {
|
|
@@ -7421,8 +7450,46 @@ function resolveFieldKind(ajvProperty) {
|
|
|
7421
7450
|
function labelFromName(name) {
|
|
7422
7451
|
return String(name).replace(/([a-z])([A-Z])/g, "$1 $2").replace(/_/g, " ").toLowerCase().replace(/^./, (c) => c.toUpperCase());
|
|
7423
7452
|
}
|
|
7424
|
-
function
|
|
7453
|
+
function readColSpan(orig) {
|
|
7454
|
+
const raw = orig.colSpan ?? orig.cols;
|
|
7455
|
+
const n = Number(raw);
|
|
7456
|
+
return Number.isFinite(n) && n >= 1 ? Math.floor(n) : void 0;
|
|
7457
|
+
}
|
|
7458
|
+
function resolveNestedSchema(ajvProperty, resolveRef) {
|
|
7459
|
+
if (!ajvProperty || typeof ajvProperty !== "object") return null;
|
|
7460
|
+
if (typeof ajvProperty.$ref === "string" && typeof resolveRef === "function") {
|
|
7461
|
+
const sub = resolveRef(ajvProperty.$ref);
|
|
7462
|
+
if (sub && sub.properties && typeof sub.properties === "object") return sub;
|
|
7463
|
+
}
|
|
7464
|
+
if (ajvProperty.properties && typeof ajvProperty.properties === "object") {
|
|
7465
|
+
return ajvProperty;
|
|
7466
|
+
}
|
|
7467
|
+
return null;
|
|
7468
|
+
}
|
|
7469
|
+
function describeField(name, ajvProperty, resolveRef, path = name, requiredFromParent = false) {
|
|
7425
7470
|
const orig = ajvProperty?.originalAttrs || {};
|
|
7471
|
+
const required = !!orig.required || requiredFromParent;
|
|
7472
|
+
if (!orig.hidden) {
|
|
7473
|
+
const sub = resolveNestedSchema(ajvProperty, resolveRef);
|
|
7474
|
+
if (sub) {
|
|
7475
|
+
return {
|
|
7476
|
+
name,
|
|
7477
|
+
kind: "object",
|
|
7478
|
+
label: orig.label || labelFromName(name),
|
|
7479
|
+
placeholder: orig.placeholder || orig.eg || "",
|
|
7480
|
+
required,
|
|
7481
|
+
disabled: !!(orig.readOnly || orig.disabled),
|
|
7482
|
+
hidden: false,
|
|
7483
|
+
fullWidth: true,
|
|
7484
|
+
// fieldsets span the full grid width
|
|
7485
|
+
helperText: orig.helperText || orig.description || "",
|
|
7486
|
+
originalAttrs: orig,
|
|
7487
|
+
ajvProperty,
|
|
7488
|
+
path,
|
|
7489
|
+
children: describeFields(sub.properties, resolveRef, path, sub.required)
|
|
7490
|
+
};
|
|
7491
|
+
}
|
|
7492
|
+
}
|
|
7426
7493
|
const kind = resolveFieldKind(ajvProperty);
|
|
7427
7494
|
if (kind === null) return null;
|
|
7428
7495
|
return {
|
|
@@ -7430,19 +7497,23 @@ function describeField(name, ajvProperty) {
|
|
|
7430
7497
|
kind,
|
|
7431
7498
|
label: orig.label || labelFromName(name),
|
|
7432
7499
|
placeholder: orig.placeholder || orig.eg || "",
|
|
7433
|
-
required
|
|
7500
|
+
required,
|
|
7434
7501
|
disabled: !!(orig.readOnly || orig.disabled),
|
|
7435
7502
|
hidden: !!orig.hidden,
|
|
7436
7503
|
fullWidth: !!orig.full,
|
|
7504
|
+
colSpan: readColSpan(orig),
|
|
7437
7505
|
helperText: orig.helperText || orig.description || "",
|
|
7438
7506
|
originalAttrs: orig,
|
|
7439
|
-
ajvProperty
|
|
7507
|
+
ajvProperty,
|
|
7508
|
+
path
|
|
7440
7509
|
};
|
|
7441
7510
|
}
|
|
7442
|
-
function describeFields(properties) {
|
|
7511
|
+
function describeFields(properties, resolveRef, parentPath = "", requiredKeys) {
|
|
7512
|
+
const requiredSet = new Set(Array.isArray(requiredKeys) ? requiredKeys : []);
|
|
7443
7513
|
const out = [];
|
|
7444
7514
|
for (const [name, property] of Object.entries(properties)) {
|
|
7445
|
-
const
|
|
7515
|
+
const path = parentPath ? `${parentPath}.${name}` : name;
|
|
7516
|
+
const desc = describeField(name, property, resolveRef, path, requiredSet.has(name));
|
|
7446
7517
|
if (desc) out.push(desc);
|
|
7447
7518
|
}
|
|
7448
7519
|
return out;
|
|
@@ -7612,15 +7683,16 @@ function normalizeForValidation(data, properties) {
|
|
|
7612
7683
|
}
|
|
7613
7684
|
return out;
|
|
7614
7685
|
}
|
|
7686
|
+
function instancePathToDot(instancePath) {
|
|
7687
|
+
if (typeof instancePath !== "string" || instancePath.length === 0) return "";
|
|
7688
|
+
return instancePath.split("/").filter((s) => s.length > 0 && !/^\d+$/.test(s)).join(".");
|
|
7689
|
+
}
|
|
7615
7690
|
function extractFieldName(err) {
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
if (typeof err.instancePath === "string" && err.instancePath.length > 0) {
|
|
7620
|
-
const segments = err.instancePath.split("/").filter(Boolean);
|
|
7621
|
-
return segments[0] || null;
|
|
7691
|
+
const base = instancePathToDot(err.instancePath);
|
|
7692
|
+
if ((err.keyword === "required" || err.keyword === "requiredNotNull") && err.params?.missingProperty) {
|
|
7693
|
+
return base ? `${base}.${err.params.missingProperty}` : err.params.missingProperty;
|
|
7622
7694
|
}
|
|
7623
|
-
return null;
|
|
7695
|
+
return base || null;
|
|
7624
7696
|
}
|
|
7625
7697
|
function groupErrorsByField(errors) {
|
|
7626
7698
|
const out = {};
|
|
@@ -7661,10 +7733,16 @@ function fieldToJsonSchema(def) {
|
|
|
7661
7733
|
break;
|
|
7662
7734
|
case "date":
|
|
7663
7735
|
out.type = "string";
|
|
7664
|
-
out.format = "date
|
|
7736
|
+
out.format = "date";
|
|
7665
7737
|
break;
|
|
7666
7738
|
case "mixed":
|
|
7667
7739
|
break;
|
|
7740
|
+
case "array":
|
|
7741
|
+
out.type = "array";
|
|
7742
|
+
if (Array.isArray(def.enum) && def.enum.length > 0) {
|
|
7743
|
+
out.items = { type: "string", enum: def.enum };
|
|
7744
|
+
}
|
|
7745
|
+
break;
|
|
7668
7746
|
default:
|
|
7669
7747
|
if (Array.isArray(def.type)) {
|
|
7670
7748
|
const inner = typeof def.type[0] === "string" ? def.type[0].toLowerCase() : "string";
|
|
@@ -7672,7 +7750,7 @@ function fieldToJsonSchema(def) {
|
|
|
7672
7750
|
out.items = { type: inner === "number" ? "number" : "string" };
|
|
7673
7751
|
}
|
|
7674
7752
|
}
|
|
7675
|
-
if (Array.isArray(def.enum) && def.enum.length > 0) out.enum = def.enum;
|
|
7753
|
+
if (Array.isArray(def.enum) && def.enum.length > 0 && out.type !== "array") out.enum = def.enum;
|
|
7676
7754
|
if (typeof def.min === "number") out.minimum = def.min;
|
|
7677
7755
|
if (typeof def.max === "number") out.maximum = def.max;
|
|
7678
7756
|
if (typeof def.minLength === "number") out.minLength = def.minLength;
|
|
@@ -7771,7 +7849,7 @@ var FormController = class {
|
|
|
7771
7849
|
__publicField(this, "listeners", /* @__PURE__ */ new Set());
|
|
7772
7850
|
__publicField(this, "notifyScheduled", false);
|
|
7773
7851
|
this.schemaInstance = resolveSchema(options.schema);
|
|
7774
|
-
this.fields =
|
|
7852
|
+
this.fields = this.describe();
|
|
7775
7853
|
this.validateOn = options.validateOn ?? "change";
|
|
7776
7854
|
const defaults = this.collectDefaults();
|
|
7777
7855
|
const userInitial = options.initialValues ?? {};
|
|
@@ -7837,10 +7915,17 @@ var FormController = class {
|
|
|
7837
7915
|
if (this.state.touched[name]) return;
|
|
7838
7916
|
this.commit({ touched: { ...this.state.touched, [name]: true } });
|
|
7839
7917
|
}
|
|
7840
|
-
/** Mark every field as touched
|
|
7918
|
+
/** Mark every field as touched (recursing into nested object children by
|
|
7919
|
+
* their dot-`path`), so a submit reveals nested-field errors too. */
|
|
7841
7920
|
touchAll() {
|
|
7842
7921
|
const touched = { ...this.state.touched };
|
|
7843
|
-
|
|
7922
|
+
const walk = (fields) => {
|
|
7923
|
+
for (const f of fields) {
|
|
7924
|
+
touched[f.path ?? f.name] = true;
|
|
7925
|
+
if (f.children?.length) walk(f.children);
|
|
7926
|
+
}
|
|
7927
|
+
};
|
|
7928
|
+
walk(this.fields);
|
|
7844
7929
|
this.commit({ touched });
|
|
7845
7930
|
}
|
|
7846
7931
|
/**
|
|
@@ -7850,10 +7935,21 @@ var FormController = class {
|
|
|
7850
7935
|
*/
|
|
7851
7936
|
setSchema(instance) {
|
|
7852
7937
|
this.schemaInstance = instance;
|
|
7853
|
-
this.fields =
|
|
7938
|
+
this.fields = this.describe();
|
|
7854
7939
|
this.runValidation();
|
|
7855
7940
|
this.scheduleNotify();
|
|
7856
7941
|
}
|
|
7942
|
+
/** Build field descriptors, threading `$ref` resolution for nested objects. */
|
|
7943
|
+
describe() {
|
|
7944
|
+
const getSchema = this.schemaInstance.getSchema;
|
|
7945
|
+
const resolveRef = typeof getSchema === "function" ? (ref) => getSchema.call(this.schemaInstance, ref) : void 0;
|
|
7946
|
+
return describeFields(
|
|
7947
|
+
this.schemaInstance.formSchema.properties,
|
|
7948
|
+
resolveRef,
|
|
7949
|
+
"",
|
|
7950
|
+
this.schemaInstance.formSchema.required
|
|
7951
|
+
);
|
|
7952
|
+
}
|
|
7857
7953
|
async submit() {
|
|
7858
7954
|
this.commit({ isSubmitting: true });
|
|
7859
7955
|
try {
|
|
@@ -7904,7 +8000,12 @@ var FormController = class {
|
|
|
7904
8000
|
for (const f of this.fields) {
|
|
7905
8001
|
const runtime = this.getFieldStateNoSnapshot(f, this.state.values);
|
|
7906
8002
|
if (!runtime.visible) {
|
|
7907
|
-
|
|
8003
|
+
const key = f.path ?? f.name;
|
|
8004
|
+
delete errors[key];
|
|
8005
|
+
const prefix = `${key}.`;
|
|
8006
|
+
for (const k of Object.keys(errors)) {
|
|
8007
|
+
if (k.startsWith(prefix)) delete errors[k];
|
|
8008
|
+
}
|
|
7908
8009
|
continue;
|
|
7909
8010
|
}
|
|
7910
8011
|
if (runtime.required) {
|