@wssto2/vue-core 0.16.0 → 0.18.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/CHANGELOG.md +32 -0
- package/README.md +5 -3
- package/bin/architecture/engine.mjs +3 -0
- package/bin/architecture/permissions.mjs +56 -0
- package/bin/architecture/rules.mjs +17 -0
- package/bin/commands/check-architecture.mjs +19 -0
- package/bin/config.mjs +2 -0
- package/dist/{AccessGate.vue_vue_type_script_setup_true_lang-BH3f0hda.js → AccessGate.vue_vue_type_script_setup_true_lang-Bg8JFAOT.js} +1 -1
- package/dist/{ActionRow.vue_vue_type_script_setup_true_lang-DybAIOHS.js → ActionRow.vue_vue_type_script_setup_true_lang-B5IMNnTf.js} +4 -4
- package/dist/{Activity-DOUuIkZR.js → Activity-CiYn5E6A.js} +7 -7
- package/dist/{AdaptivePageShell.vue_vue_type_script_setup_true_lang-d_dPurWG.js → AdaptivePageShell.vue_vue_type_script_setup_true_lang-oXWQTfBs.js} +1 -1
- package/dist/{Changes-BfcbVgmu.js → Changes-Cy8STpLX.js} +3 -3
- package/dist/{CollectionPage.vue_vue_type_script_setup_true_lang-B5hSkJ2N.js → CollectionPage.vue_vue_type_script_setup_true_lang-Dr6nFNBB.js} +6 -6
- package/dist/{DataTable.vue_vue_type_script_setup_true_lang-DbRS37n3.js → DataTable.vue_vue_type_script_setup_true_lang-D372wlxR.js} +1 -1
- package/dist/{DateField.vue_vue_type_script_setup_true_lang-DzCvYHAf.js → DateField.vue_vue_type_script_setup_true_lang-D0KcfW8R.js} +17 -16
- package/dist/{DeadLetters-CuMvfXH8.js → DeadLetters-DhJkMpd_.js} +4 -4
- package/dist/{FormGroup.vue_vue_type_script_setup_true_lang-dsO1m9Mm.js → FormGroup.vue_vue_type_script_setup_true_lang-lvAuBG-0.js} +2 -2
- package/dist/FormRow.vue_vue_type_script_setup_true_lang-CpgNVQF4.js +160 -0
- package/dist/{FormView.vue_vue_type_script_setup_true_lang-Bq_Qa4py.js → FormView.vue_vue_type_script_setup_true_lang-D01Jr4UU.js} +5 -5
- package/dist/{General-B5vcSEhP.js → General-CwTPC5UP.js} +10 -10
- package/dist/{IncidentRecord-wmStcEag.js → IncidentRecord-hXEGuLGg.js} +13 -13
- package/dist/{IncidentsList-CFx5tsxP.js → IncidentsList-C41VyDwK.js} +6 -6
- package/dist/{NewRolePage-CZxAp7LR.js → NewRolePage-BYYZJkK7.js} +3 -3
- package/dist/{NumberField.vue_vue_type_script_setup_true_lang-U-_kcnGr.js → NumberField.vue_vue_type_script_setup_true_lang-BhNZgEW6.js} +7 -6
- package/dist/{PersonAccess.vue_vue_type_script_setup_true_lang-BPDh9s2m.js → PersonAccess.vue_vue_type_script_setup_true_lang-mYFuG-Y3.js} +56 -56
- package/dist/{ProfilePage-B-T8kBcc.js → ProfilePage-DGEsIycR.js} +13 -13
- package/dist/{RecordHeader.vue_vue_type_script_setup_true_lang-Bt5mT19g.js → RecordHeader.vue_vue_type_script_setup_true_lang-B3BnYg1x.js} +1 -1
- package/dist/{ResourcePage.vue_vue_type_script_setup_true_lang-DOiFuJnH.js → ResourcePage.vue_vue_type_script_setup_true_lang-1iZtj3rh.js} +1 -1
- package/dist/{RoleEditor.vue_vue_type_script_setup_true_lang-CqSsNPCw.js → RoleEditor.vue_vue_type_script_setup_true_lang-BslSDDiM.js} +9 -9
- package/dist/{RolePage-zcUWpuDE.js → RolePage-C08ZUqw1.js} +9 -9
- package/dist/{RolesPage-C7_zWw-c.js → RolesPage-FOuY1VKg.js} +10 -10
- package/dist/{SectionNavigator.vue_vue_type_script_setup_true_lang-BlCx9dVL.js → SectionNavigator.vue_vue_type_script_setup_true_lang-DCTFxfPB.js} +2 -2
- package/dist/{SegmentedField.vue_vue_type_script_setup_true_lang-zv_AxpBn.js → SegmentedField.vue_vue_type_script_setup_true_lang-CLR6EvzO.js} +13 -12
- package/dist/{SelectField.vue_vue_type_script_setup_true_lang-CLkoPbGm.js → SelectField.vue_vue_type_script_setup_true_lang-D5xYofdb.js} +10 -9
- package/dist/{ServiceAccountDialog.vue_vue_type_script_setup_true_lang-C2D_D5Hi.js → ServiceAccountDialog.vue_vue_type_script_setup_true_lang-CDr4WNIb.js} +9 -9
- package/dist/{ServiceAccountRecord-BYxpHzTR.js → ServiceAccountRecord-kWwIQGZb.js} +12 -12
- package/dist/{ServiceAccountsList-BUuK-RUj.js → ServiceAccountsList-CKy9_YHP.js} +8 -8
- package/dist/{Sessions-Cm-Kilwl.js → Sessions-BDc8gdYH.js} +4 -4
- package/dist/{SettingsPage-Bavl0K-F.js → SettingsPage-t-8kmFVT.js} +13 -13
- package/dist/{SignIn-SfEhFiyM.js → SignIn-CqtkvtCZ.js} +7 -7
- package/dist/{SignInPage-BU0n2ehq.js → SignInPage-DcdNKZIb.js} +4 -4
- package/dist/{SignIns-Ahbn5cO6.js → SignIns-D4-nGu0B.js} +3 -3
- package/dist/{SwitchField.vue_vue_type_script_setup_true_lang-Ds4q0bbl.js → SwitchField.vue_vue_type_script_setup_true_lang-CLtcuofe.js} +15 -14
- package/dist/{TextField.vue_vue_type_script_setup_true_lang-CWIeeZRE.js → TextField.vue_vue_type_script_setup_true_lang-CVGh-p3J.js} +7 -6
- package/dist/{TextareaField.vue_vue_type_script_setup_true_lang-D2j4s96s.js → TextareaField.vue_vue_type_script_setup_true_lang-YxUlNHSk.js} +6 -5
- package/dist/{TimeField.vue_vue_type_script_setup_true_lang-C1mLvOkc.js → TimeField.vue_vue_type_script_setup_true_lang-DHNC_MLt.js} +30 -29
- package/dist/{Timestamp.vue_vue_type_script_setup_true_lang-jCXYFLtq.js → Timestamp.vue_vue_type_script_setup_true_lang-d_KuxWjH.js} +1 -1
- package/dist/{UserRecord-3pCKMHkq.js → UserRecord-CwZCr9Im.js} +10 -10
- package/dist/{UsersList-vw3aDpvo.js → UsersList-Cn19sFgv.js} +4 -4
- package/dist/access/index.js +4 -4
- package/dist/app/application.d.ts +2 -0
- package/dist/app/index.js +2 -2
- package/dist/app/validate.d.ts +3 -1
- package/dist/{application-CHPpOssP.js → application-CDSweJb9.js} +144 -142
- package/dist/collection/DynamicCollection.vue.d.ts +69 -0
- package/dist/collection/authors.d.ts +27 -0
- package/dist/collection/definition.d.ts +4 -4
- package/dist/collection/dynamicColumns.d.ts +13 -0
- package/dist/collection/index.d.ts +3 -0
- package/dist/collection/index.js +196 -142
- package/dist/config/index.d.ts +42 -0
- package/dist/config/index.js +12 -3
- package/dist/content/Panel.vue.d.ts +1 -1
- package/dist/content/index.js +2 -2
- package/dist/{contributions-9CPT-Z5v.js → contributions-B0x5x5xD.js} +1 -1
- package/dist/form/CommandDialog.vue.d.ts +1 -1
- package/dist/form/DateField.vue.d.ts +1 -1
- package/dist/form/DateTimeField.vue.d.ts +1 -1
- package/dist/form/FileField.vue.d.ts +1 -1
- package/dist/form/FormRow.vue.d.ts +2 -2
- package/dist/form/I18nField.vue.d.ts +2 -2
- package/dist/form/TextField.vue.d.ts +1 -1
- package/dist/form/TextareaField.vue.d.ts +2 -2
- package/dist/form/date/value.d.ts +21 -0
- package/dist/form/dynamic/DynamicForm.vue.d.ts +46 -0
- package/dist/form/dynamic/RepeatField.vue.d.ts +47 -0
- package/dist/form/dynamic/ResourceField.vue.d.ts +38 -0
- package/dist/form/dynamic/ResourcePickerList.vue.d.ts +12 -0
- package/dist/form/dynamic/RichTextField.vue.d.ts +40 -0
- package/dist/form/dynamic/localeMode.d.ts +5 -0
- package/dist/form/dynamic/resources.d.ts +34 -0
- package/dist/form/dynamic/schema.d.ts +73 -0
- package/dist/form/dynamic/validator.d.ts +30 -0
- package/dist/form/dynamic/visibility.d.ts +12 -0
- package/dist/form/index.d.ts +12 -0
- package/dist/form/index.js +2100 -1260
- package/dist/format/format.d.ts +8 -2
- package/dist/format/index.js +1 -1
- package/dist/format-C_HXlOYQ.js +136 -0
- package/dist/{guards-6fJxfUtk.js → guards-CNJ0ATVC.js} +1 -1
- package/dist/i18n/index.d.ts +14 -2
- package/dist/i18n/index.js +86 -75
- package/dist/i18n/messages.d.ts +10 -1
- package/dist/i18n/runtime.d.ts +3 -1
- package/dist/identity/index.js +3 -3
- package/dist/identity/profile/EmailChangeDialog.vue.d.ts +2 -2
- package/dist/identity/users/list.d.ts +1 -1
- package/dist/incidents/index.js +1 -1
- package/dist/{index-D9_xqF5g.js → index-1HS7O2-e.js} +9 -9
- package/dist/{index-nByFc1eL.js → index-BA2w8uwD.js} +86 -86
- package/dist/{index-Ct7W_gYE.js → index-SLJWm40T.js} +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/modal/DiscardChangesModal.vue.d.ts +2 -2
- package/dist/modal/Modal.vue.d.ts +2 -2
- package/dist/modal/Sheet.vue.d.ts +2 -2
- package/dist/modules/identity/routes.d.ts +1 -1
- package/dist/modules/identity/schemas.d.ts +2 -2
- package/dist/{navigation-DMJ6akat.js → navigation-d-JAPBGA.js} +1 -1
- package/dist/{neighbors-BpypL3Wb.js → neighbors-Dg_LU9ry.js} +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/onboarding/index.js +1 -1
- package/dist/options-mOOX6JSS.js +214 -0
- package/dist/overlay/AlertDialog.vue.d.ts +3 -3
- package/dist/overlay/Menu.vue.d.ts +2 -2
- package/dist/overlay/PhotoViewer.vue.d.ts +2 -2
- package/dist/overlay/Popover.vue.d.ts +2 -2
- package/dist/page/SectionNavigator.vue.d.ts +1 -1
- package/dist/page/SectionPanel.vue.d.ts +1 -1
- package/dist/page/index.js +3 -3
- package/dist/phone/index.js +57 -56
- package/dist/platform/index.d.ts +10 -1
- package/dist/platform/index.js +16 -15
- package/dist/platform/platform.d.ts +4 -2
- package/dist/{platform-ORzRR3Tw.js → platform-DU9QFts8.js} +7 -6
- package/dist/playwright/config.d.ts +33 -0
- package/dist/playwright/index.d.ts +2 -0
- package/dist/playwright/index.js +192 -171
- package/dist/resource/index.js +1 -1
- package/dist/resources-BZLlAtoS.js +62 -0
- package/dist/router/index.js +3 -3
- package/dist/{rowLayout-QKfNHsML.js → rowLayout-PIuD7MGo.js} +2 -2
- package/dist/{sections-CSpJN0Z7.js → sections-BpiRLntE.js} +1 -1
- package/dist/{serverMessages-Ce8-MK4e.js → serverMessages-C_KkDvpT.js} +1 -1
- package/dist/shell/index.js +4 -4
- package/dist/state/NextStepPanel.vue.d.ts +63 -0
- package/dist/state/PhaseTiles.vue.d.ts +20 -0
- package/dist/state/PhaseTrack.vue.d.ts +48 -0
- package/dist/state/RequirementList.vue.d.ts +10 -0
- package/dist/state/TodoRow.vue.d.ts +52 -0
- package/dist/state/index.d.ts +9 -0
- package/dist/state/index.js +731 -126
- package/dist/state/phaseStep.d.ts +7 -0
- package/dist/state/phaseTile.d.ts +10 -0
- package/dist/state/requirementItem.d.ts +16 -0
- package/dist/state/todoRow.d.ts +8 -0
- package/dist/{state-QDaxntgR.js → state-z1iPF1DT.js} +1 -1
- package/dist/styles.css +1 -1
- package/dist/{suggestions-q_v3M7G6.js → suggestions-DeMgs_ki.js} +1 -1
- package/dist/testing/format.d.ts +1 -1
- package/dist/testing/index.js +31 -31
- package/dist/{useCommand-DAMgQ5NE.js → useCommand-DQKvro1n.js} +2 -2
- package/dist/{useGroupSheet-B-Hs4gNO.js → useGroupSheet-CRw3MUmX.js} +3 -3
- package/dist/{usePreferences-BfMXVbSO.js → usePreferences-DB29UTFD.js} +1 -1
- package/dist/{useRecordDialog-QPKFH1Ww.js → useRecordDialog-0azHxxvm.js} +1 -1
- package/dist/{useResourceForm-Oa6bk3NI.js → useResourceForm-zVuWerSn.js} +1 -1
- package/dist/{useTypedEntry-CITij2C_.js → useTypedEntry-BsMV66Yc.js} +46 -45
- package/package.json +6 -1
- package/dist/format-Cp1h0vsC.js +0 -125
- package/dist/options-B48UiYsG.js +0 -368
|
@@ -36,13 +36,13 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
|
|
|
36
36
|
error: string;
|
|
37
37
|
required: boolean;
|
|
38
38
|
presentation: "control" | "value";
|
|
39
|
-
|
|
39
|
+
maxLength: number;
|
|
40
40
|
stacked: boolean;
|
|
41
41
|
labelHidden: boolean;
|
|
42
|
+
rows: number;
|
|
42
43
|
hint: string;
|
|
43
44
|
editable: boolean;
|
|
44
45
|
lockedReason: string;
|
|
45
|
-
maxLength: number;
|
|
46
46
|
autocomplete: string;
|
|
47
47
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
48
48
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { today } from "./days";
|
|
2
|
+
/**
|
|
3
|
+
* An API date or timestamp as the `YYYY-MM-DD` a `DateField` binds, or null (empty, the Go zero date, not a date). A string is sliced as
|
|
4
|
+
* written, never read through `new Date()`, which would move the day across midnight in a zone away from UTC; a `Date` is read on the
|
|
5
|
+
* user's clock.
|
|
6
|
+
*/
|
|
7
|
+
export declare function dateValue(value: string | Date | null | undefined): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* An API timestamp as the `YYYY-MM-DDTHH:mm` a `DateTimeField` binds (the user's clock, minutes), or null. An instant with an offset
|
|
10
|
+
* (`...Z`, `+01:00`) is converted; a value without one (`2026-09-30 14:35`) is already local.
|
|
11
|
+
*/
|
|
12
|
+
export declare function dateTimeValue(value: string | Date | null | undefined): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* A date model or API value as a `Date`. `YYYY-MM-DDTHH:mm` and the older `YYYY-MM-DD HH:mm` are both read as local time (Safari rejects
|
|
15
|
+
* the space), and a bare `YYYY-MM-DD` is local midnight, not UTC. Anything else goes to `new Date`. An unreadable value is an invalid
|
|
16
|
+
* `Date` (`getTime()` is NaN).
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseDateValue(value: string): Date;
|
|
19
|
+
/** The current minute on the user's clock, as a `DateTimeField` value. */
|
|
20
|
+
export declare function now(clock?: Date): string;
|
|
21
|
+
export { today };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ErrorBag } from "../errors";
|
|
2
|
+
import type { FieldMessages } from "../validation";
|
|
3
|
+
import { type LocaleMode } from "./localeMode";
|
|
4
|
+
import type { ResourceSource } from "./resources";
|
|
5
|
+
import type { FormSchema } from "./schema";
|
|
6
|
+
/**
|
|
7
|
+
* A form generated from a typed schema (a content type's fields): each field's `kind` picks the control. It generates a form,
|
|
8
|
+
* nothing more: no page, no save; put it in an `EditorPage` and save the value yourself.
|
|
9
|
+
*
|
|
10
|
+
* <DynamicForm v-model="values" :schema="schema" :locales="['hr', 'en']" :errors="form.errors.all()" :resources="media" />
|
|
11
|
+
*
|
|
12
|
+
* - **Value:** `Record<field key, value>`. A translatable text is `Record<locale, string>`; an image / document is a resource id,
|
|
13
|
+
* a gallery a list of ids; a collection a list of row values.
|
|
14
|
+
* - **`visible_when`:** a field whose rule does not hold is not shown. It keeps its value, and an error under its key is not shown.
|
|
15
|
+
* - **`errors`:** go-core's field messages (`form.errors.all()`, or the `ErrorBag`), by field key; `images.0.title` reaches a row.
|
|
16
|
+
* - **`localeMode`:** `"perField"` (default) shows a language strip on each translatable field; `"form"` shows one switcher for
|
|
17
|
+
* the whole form, which switches every translatable field at once.
|
|
18
|
+
*/
|
|
19
|
+
type __VLS_Props = {
|
|
20
|
+
schema: FormSchema;
|
|
21
|
+
modelValue?: Record<string, unknown>;
|
|
22
|
+
/** The languages of translatable fields. Default: the application's. */
|
|
23
|
+
locales?: readonly string[];
|
|
24
|
+
/** The language shown first, and the one a required translatable field needs. Default: the first. */
|
|
25
|
+
defaultLocale?: string;
|
|
26
|
+
errors?: FieldMessages | ErrorBag;
|
|
27
|
+
/** Reads the values instead of editing them. */
|
|
28
|
+
readonly?: boolean;
|
|
29
|
+
localeMode?: LocaleMode;
|
|
30
|
+
/** The media library of image, document and gallery fields, and of the picture button of rich text. */
|
|
31
|
+
resources?: ResourceSource;
|
|
32
|
+
};
|
|
33
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
34
|
+
"update:modelValue": (values: Record<string, unknown>) => any;
|
|
35
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
36
|
+
"onUpdate:modelValue"?: ((values: Record<string, unknown>) => any) | undefined;
|
|
37
|
+
}>, {
|
|
38
|
+
errors: FieldMessages | ErrorBag;
|
|
39
|
+
modelValue: Record<string, unknown>;
|
|
40
|
+
readonly: boolean;
|
|
41
|
+
locales: readonly string[];
|
|
42
|
+
defaultLocale: string;
|
|
43
|
+
resources: ResourceSource;
|
|
44
|
+
localeMode: LocaleMode;
|
|
45
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type FieldProps } from "../field";
|
|
2
|
+
import type { FieldMessages } from "../validation";
|
|
3
|
+
import type { LocaleMode } from "./localeMode";
|
|
4
|
+
import type { ResourceSource } from "./resources";
|
|
5
|
+
import type { SchemaField } from "./schema";
|
|
6
|
+
/**
|
|
7
|
+
* A repeatable group: rows the user adds, removes and moves, each a `DynamicForm` over `fields`. The value is the list of the
|
|
8
|
+
* rows' values. Errors of the rows arrive in the form's paths relative to this field (`0.title` is the first row's title).
|
|
9
|
+
*
|
|
10
|
+
* <RepeatField v-model="form.slides" :fields="slideFields" label="Slides" />
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = FieldProps & {
|
|
13
|
+
/** The fields of each row. */
|
|
14
|
+
fields: readonly SchemaField[];
|
|
15
|
+
modelValue?: readonly Record<string, unknown>[];
|
|
16
|
+
locales?: readonly string[];
|
|
17
|
+
defaultLocale?: string;
|
|
18
|
+
/** Messages by path inside this field: `"0.title"`. */
|
|
19
|
+
errors?: FieldMessages;
|
|
20
|
+
resources?: ResourceSource;
|
|
21
|
+
addLabel?: string;
|
|
22
|
+
localeMode?: LocaleMode;
|
|
23
|
+
};
|
|
24
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
25
|
+
"update:modelValue": (rows: Record<string, unknown>[]) => any;
|
|
26
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
27
|
+
"onUpdate:modelValue"?: ((rows: Record<string, unknown>[]) => any) | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
disabled: boolean;
|
|
30
|
+
name: string;
|
|
31
|
+
label: string;
|
|
32
|
+
error: string;
|
|
33
|
+
required: boolean;
|
|
34
|
+
presentation: "control" | "value";
|
|
35
|
+
errors: FieldMessages;
|
|
36
|
+
modelValue: readonly Record<string, unknown>[];
|
|
37
|
+
labelHidden: boolean;
|
|
38
|
+
hint: string;
|
|
39
|
+
editable: boolean;
|
|
40
|
+
lockedReason: string;
|
|
41
|
+
locales: readonly string[];
|
|
42
|
+
defaultLocale: string;
|
|
43
|
+
resources: ResourceSource;
|
|
44
|
+
addLabel: string;
|
|
45
|
+
localeMode: LocaleMode;
|
|
46
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
47
|
+
export default _default;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type FieldProps } from "../field";
|
|
2
|
+
import { type ResourceId, type ResourceSource } from "./resources";
|
|
3
|
+
/**
|
|
4
|
+
* One resource, or several, chosen from the app's media library: the value is an id (`multiple`: a list of ids). It shows each
|
|
5
|
+
* as a picture from `source.thumbnail` and opens a `PickerModal` over `source.list(query)` to choose. The app owns the library;
|
|
6
|
+
* uploads are its too.
|
|
7
|
+
*
|
|
8
|
+
* <ResourceField v-model="form.image" :source="media" label="Image" accept="image/*" />
|
|
9
|
+
* <ResourceField v-model="form.gallery" :source="media" multiple label="Gallery" />
|
|
10
|
+
*/
|
|
11
|
+
type __VLS_Props = FieldProps & {
|
|
12
|
+
source: ResourceSource;
|
|
13
|
+
/** Several ids, kept in the order chosen. */
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
/** Passed to `source.list` as `query.accept`. */
|
|
16
|
+
accept?: string;
|
|
17
|
+
modelValue?: ResourceId | readonly ResourceId[] | null;
|
|
18
|
+
};
|
|
19
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
20
|
+
"update:modelValue": (value: ResourceId | ResourceId[] | null) => any;
|
|
21
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
22
|
+
"onUpdate:modelValue"?: ((value: ResourceId | ResourceId[] | null) => any) | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
name: string;
|
|
26
|
+
label: string;
|
|
27
|
+
error: string;
|
|
28
|
+
required: boolean;
|
|
29
|
+
presentation: "control" | "value";
|
|
30
|
+
accept: string;
|
|
31
|
+
modelValue: ResourceId | readonly ResourceId[] | null;
|
|
32
|
+
labelHidden: boolean;
|
|
33
|
+
hint: string;
|
|
34
|
+
editable: boolean;
|
|
35
|
+
lockedReason: string;
|
|
36
|
+
multiple: boolean;
|
|
37
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ResourceItem, type ResourceSource } from "./resources";
|
|
2
|
+
/** The body of the resource picker: a search box, the app's rows as pictures, previous / next. Mounted afresh each time the dialog opens. */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
source: ResourceSource;
|
|
5
|
+
accept?: string;
|
|
6
|
+
};
|
|
7
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
8
|
+
select: (item: ResourceItem) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
|
+
onSelect?: ((item: ResourceItem) => any) | undefined;
|
|
11
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type FieldProps } from "../field";
|
|
2
|
+
import { type ResourceSource } from "./resources";
|
|
3
|
+
/**
|
|
4
|
+
* Formatted text: headings, bold, italic, lists, links, a picture from the media library, optionally a video. The value is an
|
|
5
|
+
* HTML string ("" when empty). The editor is Quill 2, an optional peer dependency loaded when the field first shows
|
|
6
|
+
* (`npm i quill`); an application that never shows this field never loads it.
|
|
7
|
+
*
|
|
8
|
+
* The browser does not sanitise: the HTML is what the editor produced, and the server is the one that cleans it before storing.
|
|
9
|
+
*
|
|
10
|
+
* <RichTextField v-model="form.body" :images="media" video label="Text" />
|
|
11
|
+
*/
|
|
12
|
+
type __VLS_Props = FieldProps & {
|
|
13
|
+
modelValue?: string;
|
|
14
|
+
/** The media library for the image button; without it there is no image button. Its `image` URL (else `thumbnail`) is the picture's `src`. */
|
|
15
|
+
images?: ResourceSource;
|
|
16
|
+
/** Shows the video embed button. */
|
|
17
|
+
video?: boolean;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
};
|
|
20
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
21
|
+
"update:modelValue": (html: string) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
23
|
+
"onUpdate:modelValue"?: ((html: string) => any) | undefined;
|
|
24
|
+
}>, {
|
|
25
|
+
disabled: boolean;
|
|
26
|
+
placeholder: string;
|
|
27
|
+
name: string;
|
|
28
|
+
label: string;
|
|
29
|
+
video: boolean;
|
|
30
|
+
error: string;
|
|
31
|
+
required: boolean;
|
|
32
|
+
presentation: "control" | "value";
|
|
33
|
+
modelValue: string;
|
|
34
|
+
labelHidden: boolean;
|
|
35
|
+
hint: string;
|
|
36
|
+
editable: boolean;
|
|
37
|
+
lockedReason: string;
|
|
38
|
+
images: ResourceSource;
|
|
39
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { InjectionKey, Ref } from "vue";
|
|
2
|
+
/** The language a form in `localeMode: "form"` is showing; its rows (`RepeatField`) follow it instead of showing a switcher of their own. */
|
|
3
|
+
export declare const activeLocaleKey: InjectionKey<Readonly<Ref<string>>>;
|
|
4
|
+
/** How translatable fields show their languages: a segment strip per field (`I18nField`), or one switcher for the whole form. */
|
|
5
|
+
export type LocaleMode = "perField" | "form";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** An id the app's media library gives a resource (a picture, a document). */
|
|
2
|
+
export type ResourceId = number | string;
|
|
3
|
+
/** A row of the app's resource list; the picker needs nothing more. */
|
|
4
|
+
export interface ResourceItem {
|
|
5
|
+
readonly id: ResourceId;
|
|
6
|
+
readonly name?: string;
|
|
7
|
+
}
|
|
8
|
+
/** What the picker asks the app's list for. `accept` is the field's `props.accept` (`"image/*"`). */
|
|
9
|
+
export interface ResourceQuery {
|
|
10
|
+
readonly search: string;
|
|
11
|
+
/** From 1. */
|
|
12
|
+
readonly page: number;
|
|
13
|
+
readonly pageSize: number;
|
|
14
|
+
readonly accept?: string;
|
|
15
|
+
}
|
|
16
|
+
/** The part of a list page the picker reads; a `ListPage<ResourceItem>` fits. */
|
|
17
|
+
export interface ResourcePage {
|
|
18
|
+
readonly rows: readonly ResourceItem[];
|
|
19
|
+
readonly lastPage: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Where resources come from: the app's, since only it knows its media library (folders, search, type filter go into
|
|
23
|
+
* `list`). A field holds ids; `thumbnail` turns one into a picture.
|
|
24
|
+
*/
|
|
25
|
+
export interface ResourceSource {
|
|
26
|
+
list(query: ResourceQuery, context: {
|
|
27
|
+
signal: AbortSignal;
|
|
28
|
+
}): Promise<ResourcePage>;
|
|
29
|
+
/** A URL with `{id}` in it: `"/media/{id}/thumb"`. */
|
|
30
|
+
thumbnail: string;
|
|
31
|
+
/** The URL of the full picture, for an image placed in rich text. Default: `thumbnail`. */
|
|
32
|
+
image?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare const thumbnailUrl: (source: Pick<ResourceSource, "thumbnail">, id: ResourceId) => string;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The typed schema `DynamicForm`, `DynamicCollection` and `buildValidator` are generated from: the shape a content
|
|
3
|
+
* type's definition has in the API (snake_case keys, as the server sends them). It is data, not a page description:
|
|
4
|
+
* a list of fields with a kind, nothing about layout.
|
|
5
|
+
*/
|
|
6
|
+
/** The kinds a field can have. `image`, `document` and `gallery` hold ids of resources (one, one, several). */
|
|
7
|
+
export type FieldKind = "text" | "textarea" | "rich_text" | "number" | "boolean" | "select" | "multi_select" | "date" | "datetime" | "image" | "document" | "gallery" | "collection";
|
|
8
|
+
/** One test of a `visible_when` rule: the field named, compared with one operator. */
|
|
9
|
+
export type VisibilityCondition = {
|
|
10
|
+
readonly field: string;
|
|
11
|
+
readonly eq: unknown;
|
|
12
|
+
} | {
|
|
13
|
+
readonly field: string;
|
|
14
|
+
readonly ne: unknown;
|
|
15
|
+
} | {
|
|
16
|
+
readonly field: string;
|
|
17
|
+
readonly in: readonly unknown[];
|
|
18
|
+
} | {
|
|
19
|
+
readonly field: string;
|
|
20
|
+
readonly empty: true;
|
|
21
|
+
} | {
|
|
22
|
+
readonly field: string;
|
|
23
|
+
readonly not_empty: true;
|
|
24
|
+
};
|
|
25
|
+
/** When a field shows: every condition of `all` holds, or at least one of `any`. See `evaluateVisibility`. */
|
|
26
|
+
export type VisibilityRule = {
|
|
27
|
+
readonly all: readonly VisibilityCondition[];
|
|
28
|
+
readonly any?: undefined;
|
|
29
|
+
} | {
|
|
30
|
+
readonly any: readonly VisibilityCondition[];
|
|
31
|
+
readonly all?: undefined;
|
|
32
|
+
};
|
|
33
|
+
export interface SelectChoice {
|
|
34
|
+
readonly value: string | number;
|
|
35
|
+
readonly label: string;
|
|
36
|
+
}
|
|
37
|
+
/** A rule of the whitelist a field may carry (the server's list, mirrored); `args` is the rule's parameters (`max`: `[150]`). */
|
|
38
|
+
export interface FieldRule {
|
|
39
|
+
readonly rule: "required" | "min" | "max" | "email" | "url" | "regex";
|
|
40
|
+
readonly args?: readonly unknown[];
|
|
41
|
+
}
|
|
42
|
+
/** What a control shows, never what is valid (that is `validation`). */
|
|
43
|
+
export interface SchemaFieldProps {
|
|
44
|
+
readonly placeholder?: string;
|
|
45
|
+
readonly hint?: string;
|
|
46
|
+
/** A resource field: the kinds the picker lists (`"image/*"`), passed to the app's `list(query)`. */
|
|
47
|
+
readonly accept?: string;
|
|
48
|
+
/** A `textarea`'s rows. */
|
|
49
|
+
readonly rows?: number;
|
|
50
|
+
/** A `rich_text` field: show the video embed button. */
|
|
51
|
+
readonly video?: boolean;
|
|
52
|
+
/** A `collection` field: the label of its add button. */
|
|
53
|
+
readonly addLabel?: string;
|
|
54
|
+
}
|
|
55
|
+
export interface SchemaField {
|
|
56
|
+
readonly key: string;
|
|
57
|
+
readonly kind: FieldKind;
|
|
58
|
+
readonly label: string;
|
|
59
|
+
readonly required?: boolean;
|
|
60
|
+
/** Text kinds only: the value is `Record<locale, string>`. */
|
|
61
|
+
readonly translatable?: boolean;
|
|
62
|
+
readonly props?: SchemaFieldProps;
|
|
63
|
+
/** `select` and `multi_select`. */
|
|
64
|
+
readonly options?: readonly SelectChoice[];
|
|
65
|
+
/** Whitelisted rules besides `required`: `min`/`max` (a text's length, a number's value, a list's size), `email`, `url`, `regex`. */
|
|
66
|
+
readonly validation?: readonly FieldRule[];
|
|
67
|
+
readonly visible_when?: VisibilityRule;
|
|
68
|
+
/** `collection` only: the fields of each row. */
|
|
69
|
+
readonly children?: readonly SchemaField[];
|
|
70
|
+
}
|
|
71
|
+
export interface FormSchema {
|
|
72
|
+
readonly fields: readonly SchemaField[];
|
|
73
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type * as Zod from "zod";
|
|
2
|
+
import type { FormValidator } from "../validation";
|
|
3
|
+
import type { FormSchema } from "./schema";
|
|
4
|
+
export interface SchemaValidatorOptions {
|
|
5
|
+
/**
|
|
6
|
+
* The `zod` module (`import * as zod from "zod"`). Passed in, not imported here, so an application that never validates a
|
|
7
|
+
* schema does not need Zod installed: it is an optional peer, and an import in this file would load it with `@wssto2/vue-core/form`.
|
|
8
|
+
*/
|
|
9
|
+
zod: typeof Zod;
|
|
10
|
+
/**
|
|
11
|
+
* Texts that replace Zod's. Without them the issues carry Zod's own messages, which `zodErrorMap(application)` words in the
|
|
12
|
+
* application's language (a missing value reads as `validation_errors.required`).
|
|
13
|
+
*/
|
|
14
|
+
messages?: Partial<Record<"required" | "email" | "url" | "regex" | "type", string>>;
|
|
15
|
+
/** The language a required translatable text needs. Default: any language written. */
|
|
16
|
+
defaultLocale?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A validator for a schema, with the shape `useForm` takes (`safeParse`), built on Zod 4. It checks what the server will: `required`,
|
|
20
|
+
* the type of each kind, `min` / `max` (a text's length, a number's value, the size of a list or collection), `email`, `url`,
|
|
21
|
+
* `regex`, and the rows of a collection. A field whose `visible_when` does not hold is skipped, and left out of the output, as is a
|
|
22
|
+
* key the schema does not list. The server is authoritative; this only saves the round trip.
|
|
23
|
+
*
|
|
24
|
+
* const validator = buildValidator(schema, { zod });
|
|
25
|
+
* const form = useForm({ defaults, validator });
|
|
26
|
+
*
|
|
27
|
+
* A `regex` argument must be valid for both JavaScript and Go's RE2 (no look-around, no back-references). A rule the schema
|
|
28
|
+
* words wrongly (`max` without a number) throws when the validator is built, not on the user's first keystroke.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildValidator(schema: FormSchema, options: SchemaValidatorOptions): FormValidator<Record<string, unknown>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { VisibilityRule } from "./schema";
|
|
2
|
+
/** Empty means not entered: null, undefined, "", an empty list, and an object (a translated text) with no non-blank entry. `false` and `0` are values. */
|
|
3
|
+
export declare function isEmptyValue(value: unknown): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Whether a field with this `visible_when` rule shows, given the form's values. A pure function; the server evaluates the same
|
|
6
|
+
* rule (a hidden field is neither required nor validated) and both run `test-data/content/visibility.json`.
|
|
7
|
+
*
|
|
8
|
+
* - no rule, or a rule with no conditions: visible;
|
|
9
|
+
* - `all`: every condition holds; `any`: at least one does;
|
|
10
|
+
* - a malformed condition (unknown operator, `in` without a list) is skipped, and a rule left with none is visible: a broken rule never hides a field for good.
|
|
11
|
+
*/
|
|
12
|
+
export declare function evaluateVisibility(rule: VisibilityRule | null | undefined, values: Readonly<Record<string, unknown>>): boolean;
|
package/dist/form/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { default as ChoiceChips } from "./ChoiceChips.vue";
|
|
|
17
17
|
export { default as ComboField } from "./ComboField.vue";
|
|
18
18
|
export { default as Calendar } from "./date/Calendar.vue";
|
|
19
19
|
export type { DisabledDates } from "./date/days";
|
|
20
|
+
export { dateTimeValue, dateValue, now, parseDateValue, today } from "./date/value";
|
|
20
21
|
export type { QuickPick, QuickTime } from "./date/quickPicks";
|
|
21
22
|
export { default as DateField } from "./DateField.vue";
|
|
22
23
|
export { default as DateTimeField } from "./DateTimeField.vue";
|
|
@@ -80,3 +81,14 @@ export type { StepDefinition, StepDialogBinding, StepDraftOptions, StepFlow, Ste
|
|
|
80
81
|
export { default as StepForm } from "./StepForm.vue";
|
|
81
82
|
export { default as StepNavigation } from "./StepNavigation.vue";
|
|
82
83
|
export { default as StepProgress } from "./StepProgress.vue";
|
|
84
|
+
export { default as DynamicForm } from "./dynamic/DynamicForm.vue";
|
|
85
|
+
export { default as RepeatField } from "./dynamic/RepeatField.vue";
|
|
86
|
+
export { default as ResourceField } from "./dynamic/ResourceField.vue";
|
|
87
|
+
export { default as RichTextField } from "./dynamic/RichTextField.vue";
|
|
88
|
+
export { evaluateVisibility, isEmptyValue } from "./dynamic/visibility";
|
|
89
|
+
export { buildValidator } from "./dynamic/validator";
|
|
90
|
+
export type { SchemaValidatorOptions } from "./dynamic/validator";
|
|
91
|
+
export type { LocaleMode } from "./dynamic/localeMode";
|
|
92
|
+
export { thumbnailUrl } from "./dynamic/resources";
|
|
93
|
+
export type { ResourceId, ResourceItem, ResourcePage, ResourceQuery, ResourceSource } from "./dynamic/resources";
|
|
94
|
+
export type { FieldKind, FieldRule, FormSchema, SchemaField, SelectChoice, VisibilityCondition, VisibilityRule } from "./dynamic/schema";
|