@chelone/vue 0.3.0 → 0.5.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/choices/use-choices.d.ts +11 -10
- package/dist/choices/use-choices.js +5 -4
- package/dist/components/admin/auth/auth-error.vue.d.ts +1 -1
- package/dist/components/admin/buttons/save-button.vue.d.ts +1 -1
- package/dist/components/admin/buttons/update-button.vue.d.ts +3 -3
- package/dist/components/admin/feedback/linear-progress.vue.d.ts +1 -1
- package/dist/components/admin/fields/api-key-field.vue.d.ts +27 -9
- package/dist/components/admin/fields/api-key-field.vue.js +3 -1
- package/dist/components/admin/fields/array-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/badge-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/boolean-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/chip-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/color-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/cron-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/currency-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/date-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/duration-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/email-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/file-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/function-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/image-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/json-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/number-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/phone-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/rating-field.vue.d.ts +22 -7
- package/dist/components/admin/fields/rating-field.vue.js +3 -1
- package/dist/components/admin/fields/record-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/reference-array-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/reference-field.vue.d.ts +2 -1
- package/dist/components/admin/fields/reference-many-count.vue.d.ts +2 -2
- package/dist/components/admin/fields/reference-many-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/reference-one-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/select-field.vue.d.ts +18 -7
- package/dist/components/admin/fields/select-field.vue.js +1 -1
- package/dist/components/admin/fields/subscription-plan-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/text-array-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/text-field.vue.d.ts +2 -8
- package/dist/components/admin/fields/url-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/usage-meter-field.vue.d.ts +22 -7
- package/dist/components/admin/fields/usage-meter-field.vue.js +3 -1
- package/dist/components/admin/fields/webhook-endpoint-field.vue.d.ts +2 -2
- package/dist/components/admin/fields/wrapper-field.vue.d.ts +3 -3
- package/dist/components/admin/fields/wrapper-field.vue.js +6 -0
- package/dist/components/admin/inputs/api-key-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/array-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/autocomplete-array-input.vue.d.ts +14 -6
- package/dist/components/admin/inputs/autocomplete-array-input.vue.js +2 -3
- package/dist/components/admin/inputs/autocomplete-input.vue.d.ts +14 -6
- package/dist/components/admin/inputs/autocomplete-input.vue.js +2 -3
- package/dist/components/admin/inputs/boolean-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/checkbox-group-input.vue.d.ts +14 -7
- package/dist/components/admin/inputs/checkbox-group-input.vue.js +2 -2
- package/dist/components/admin/inputs/choice-input-props.d.ts +6 -6
- package/dist/components/admin/inputs/color-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/cron-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/currency-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/datagrid-input.vue.d.ts +20 -5
- package/dist/components/admin/inputs/datagrid-input.vue.js +7 -3
- package/dist/components/admin/inputs/date-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/date-time-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/duration-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/file-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/nullable-boolean-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/number-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/password-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/phone-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/radio-button-group-input.vue.d.ts +14 -7
- package/dist/components/admin/inputs/radio-button-group-input.vue.js +2 -2
- package/dist/components/admin/inputs/rating-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/reference-array-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/reference-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/resettable-text-input.vue.d.ts +2 -1
- package/dist/components/admin/inputs/search-input.vue.d.ts +3 -3
- package/dist/components/admin/inputs/select-array-input.vue.d.ts +14 -5
- package/dist/components/admin/inputs/select-array-input.vue.js +1 -1
- package/dist/components/admin/inputs/select-input.vue.d.ts +14 -7
- package/dist/components/admin/inputs/select-input.vue.js +1 -1
- package/dist/components/admin/inputs/subscription-plan-picker.vue.d.ts +2 -2
- package/dist/components/admin/inputs/text-array-input.vue.d.ts +2 -2
- package/dist/components/admin/inputs/text-input.vue.d.ts +2 -1
- package/dist/components/admin/inputs/time-input.vue.d.ts +2 -1
- package/dist/components/admin/inputs/use-choice-input.d.ts +12 -19
- package/dist/components/admin/inputs/use-choice-input.js +4 -1
- package/dist/components/admin/inputs/webhook-endpoint-input.vue.d.ts +2 -2
- package/dist/components/admin/list/calendar-list.vue.d.ts +8 -8
- package/dist/components/admin/list/filter-live-search.vue.d.ts +1 -1
- package/dist/components/admin/list/kanban-board.vue.d.ts +41 -0
- package/dist/components/admin/list/kanban-board.vue.js +275 -0
- package/dist/components/admin/list/kanban-board2.vue.js +4 -0
- package/dist/components/admin/list/list-icons.d.ts +2 -0
- package/dist/components/admin/list/list-icons.js +7 -0
- package/dist/components/admin/list/tree-list.vue.d.ts +6 -5
- package/dist/components/admin/view/labeled.vue.d.ts +6 -5
- package/dist/components/admin/view/labeled.vue.js +4 -1
- package/dist/components/admin/view/tabbed-show-layout-tab.vue.d.ts +2 -2
- package/dist/components/index.d.ts +2 -0
- package/dist/components/maps/geo-json-field.vue.d.ts +2 -1
- package/dist/components/maps/lat-lng-field.vue.d.ts +3 -3
- package/dist/components/maps/lat-lng-input.vue.d.ts +4 -4
- package/dist/components/maps-draw/shape-input.vue.d.ts +4 -4
- package/dist/components/maps-draw/simplify-input.vue.d.ts +2 -2
- package/dist/components/maps-osm/geocoding-input.vue.d.ts +6 -6
- package/dist/components/maps-osm/map-with-search.vue.d.ts +4 -4
- package/dist/components/maps-osm/osm-feature-operator.vue.d.ts +3 -3
- package/dist/components/maps-osm/reverse-geocode-field.vue.d.ts +3 -3
- package/dist/components/mdx-editor/mdx-field.vue.d.ts +2 -2
- package/dist/components/mdx-editor/mdx-input.vue.d.ts +2 -2
- package/dist/components/monaco/monaco-json-field.vue.d.ts +2 -2
- package/dist/components/monaco/monaco-json-input.vue.d.ts +2 -2
- package/dist/components/ui/alert.d.ts +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/button.vue.d.ts +1 -1
- package/dist/components/ui/command/command-dialog.vue.d.ts +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.vue.js +9 -3
- package/dist/components/ui/input.vue.d.ts +2 -2
- package/dist/components/ui/sidebar/sidebar-menu-button.vue.d.ts +1 -1
- package/dist/components/ui/textarea.vue.d.ts +2 -2
- package/dist/create-resource-components.d.ts +867 -0
- package/dist/create-resource-components.js +171 -0
- package/dist/data/create-chelone-hooks.d.ts +8 -8
- package/dist/data/mutations.d.ts +8 -8
- package/dist/form/use-input.d.ts +9 -7
- package/dist/form/use-input.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +248 -243
- package/dist/record/use-field-value.d.ts +16 -6
- package/package.json +4 -4
|
@@ -13,28 +13,29 @@
|
|
|
13
13
|
* comes from the ambient i18n via {@link useTranslate}, so `useChoices` must be
|
|
14
14
|
* called in `setup`.
|
|
15
15
|
*/
|
|
16
|
+
import { type SourcePath } from "@chelone/core";
|
|
16
17
|
/** An erased choice record — choices carry arbitrary shapes (`{id, name, ...}`). */
|
|
17
18
|
export type ChoiceRecord = Record<string, unknown>;
|
|
18
19
|
/** The display path (dot or bracket) or a formatter over the whole choice. */
|
|
19
|
-
export type OptionText =
|
|
20
|
-
export interface UseChoicesOptions {
|
|
20
|
+
export type OptionText<TChoice extends ChoiceRecord = ChoiceRecord> = SourcePath<TChoice> | ((choice: TChoice) => string);
|
|
21
|
+
export interface UseChoicesOptions<TChoice extends ChoiceRecord = ChoiceRecord> {
|
|
21
22
|
/** The display path or a formatter. Default `'name'`. */
|
|
22
|
-
optionText?: OptionText
|
|
23
|
+
optionText?: OptionText<TChoice>;
|
|
23
24
|
/** The value path. Default `'id'`. */
|
|
24
|
-
optionValue?:
|
|
25
|
+
optionValue?: SourcePath<TChoice>;
|
|
25
26
|
/** The disabled-flag path. Default `'disabled'`. */
|
|
26
|
-
disableValue?:
|
|
27
|
+
disableValue?: SourcePath<TChoice>;
|
|
27
28
|
/** Translate a string-path text through the catalog (default `true`). */
|
|
28
29
|
translateChoice?: boolean;
|
|
29
30
|
}
|
|
30
31
|
/** The choice accessors a choice input needs. */
|
|
31
|
-
export interface UseChoicesResult {
|
|
32
|
+
export interface UseChoicesResult<TChoice extends ChoiceRecord = ChoiceRecord> {
|
|
32
33
|
/** The display text: string path (optionally translated) or the formatter's output. */
|
|
33
|
-
getChoiceText(choice:
|
|
34
|
+
getChoiceText(choice: TChoice): string;
|
|
34
35
|
/** The value: `get(choice, optionValue)`, falling back to `choice.id`. */
|
|
35
|
-
getChoiceValue(choice:
|
|
36
|
+
getChoiceValue(choice: TChoice): unknown;
|
|
36
37
|
/** The disabled flag: `get(choice, disableValue)`. */
|
|
37
|
-
getDisableValue(choice:
|
|
38
|
+
getDisableValue(choice: TChoice): unknown;
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* Read a choice path off a record with core's one path grammar
|
|
@@ -50,4 +51,4 @@ export declare function getChoicePath(record: ChoiceRecord, path: string): unkno
|
|
|
50
51
|
* value (`optionValue` path or `id`), and disabled flag. Defaults are read live
|
|
51
52
|
* off `options`, so a reactive props object stays live between reads.
|
|
52
53
|
*/
|
|
53
|
-
export declare function useChoices(options?: UseChoicesOptions): UseChoicesResult
|
|
54
|
+
export declare function useChoices<TChoice extends ChoiceRecord = ChoiceRecord>(options?: UseChoicesOptions<TChoice>): UseChoicesResult<TChoice>;
|
|
@@ -6,22 +6,23 @@ function getChoicePath(record, path) {
|
|
|
6
6
|
}
|
|
7
7
|
function useChoices(options = {}) {
|
|
8
8
|
const translate = useTranslate();
|
|
9
|
+
const loose = () => options;
|
|
9
10
|
return {
|
|
10
11
|
getChoiceText(choice) {
|
|
11
|
-
const optionText =
|
|
12
|
+
const optionText = loose().optionText ?? "name";
|
|
12
13
|
if (typeof optionText === "function") return optionText(choice);
|
|
13
14
|
const raw = getChoicePath(choice, optionText);
|
|
14
15
|
const text = raw == null ? "" : String(raw);
|
|
15
|
-
if (
|
|
16
|
+
if (loose().translateChoice === false) return text;
|
|
16
17
|
const translated = translate(text, { _: text });
|
|
17
18
|
return translated === text ? text : translated;
|
|
18
19
|
},
|
|
19
20
|
getChoiceValue(choice) {
|
|
20
|
-
const value = getChoicePath(choice,
|
|
21
|
+
const value = getChoicePath(choice, loose().optionValue ?? "id");
|
|
21
22
|
return value !== void 0 ? value : choice.id;
|
|
22
23
|
},
|
|
23
24
|
getDisableValue(choice) {
|
|
24
|
-
return getChoicePath(choice,
|
|
25
|
+
return getChoicePath(choice, loose().disableValue ?? "disabled");
|
|
25
26
|
}
|
|
26
27
|
};
|
|
27
28
|
}
|
|
@@ -7,7 +7,7 @@ export interface AuthErrorProps {
|
|
|
7
7
|
class?: string;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: import("vue").DefineComponent<AuthErrorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<AuthErrorProps> & Readonly<{}>, {
|
|
10
|
-
message: string;
|
|
11
10
|
title: string;
|
|
11
|
+
message: string;
|
|
12
12
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
13
|
export default _default;
|
|
@@ -7,8 +7,8 @@ export interface SaveButtonProps {
|
|
|
7
7
|
class?: string;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: import("vue").DefineComponent<SaveButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SaveButtonProps> & Readonly<{}>, {
|
|
10
|
-
label: string;
|
|
11
10
|
variant: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
11
|
+
label: string;
|
|
12
12
|
alwaysEnable: boolean;
|
|
13
13
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
export default _default;
|
|
@@ -29,16 +29,16 @@ export interface UpdateButtonProps {
|
|
|
29
29
|
}
|
|
30
30
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<UpdateButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
31
31
|
click: (e?: MouseEvent | undefined) => any;
|
|
32
|
-
error: (error: unknown) => any;
|
|
33
32
|
success: (data: LooseRecord) => any;
|
|
33
|
+
error: (error: unknown) => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<UpdateButtonProps> & Readonly<{
|
|
35
35
|
onClick?: ((e?: MouseEvent | undefined) => any) | undefined;
|
|
36
|
-
onError?: ((error: unknown) => any) | undefined;
|
|
37
36
|
onSuccess?: ((data: LooseRecord) => any) | undefined;
|
|
37
|
+
onError?: ((error: unknown) => any) | undefined;
|
|
38
38
|
}>, {
|
|
39
39
|
variant: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link";
|
|
40
|
-
confirmColor: "primary" | "warning";
|
|
41
40
|
mutationMode: MutationMode;
|
|
41
|
+
confirmColor: "primary" | "warning";
|
|
42
42
|
confirmTitle: string;
|
|
43
43
|
confirmContent: string;
|
|
44
44
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
@@ -10,7 +10,7 @@ export interface LinearProgressProps {
|
|
|
10
10
|
class?: string;
|
|
11
11
|
}
|
|
12
12
|
declare const _default: import("vue").DefineComponent<LinearProgressProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<LinearProgressProps> & Readonly<{}>, {
|
|
13
|
-
timeout: number;
|
|
14
13
|
max: number;
|
|
14
|
+
timeout: number;
|
|
15
15
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
16
|
export default _default;
|
|
@@ -1,16 +1,34 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceKey, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ApiKeyField}. */
|
|
3
|
-
export interface ApiKeyFieldProps {
|
|
4
|
-
source:
|
|
5
|
-
record
|
|
3
|
+
export interface ApiKeyFieldProps<RecordType extends LooseRecord = LooseRecord> {
|
|
4
|
+
source: SourceProp;
|
|
5
|
+
/** The record to render. Defaults to the ambient `RecordContext` value. */
|
|
6
|
+
record?: RecordType;
|
|
6
7
|
defaultValue?: unknown;
|
|
7
|
-
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Sibling record field with scope strings; renders chips when set. A
|
|
10
|
+
* top-level key, not a path: the read is `record[scopesSource]`.
|
|
11
|
+
*/
|
|
12
|
+
scopesSource?: SourceKey<RecordType>;
|
|
13
|
+
/**
|
|
14
|
+
* Sibling record field with an ISO last-used timestamp. A top-level key, not
|
|
15
|
+
* a path: the read is `record[lastUsedSource]`.
|
|
16
|
+
*/
|
|
17
|
+
lastUsedSource?: SourceKey<RecordType>;
|
|
11
18
|
/** 'last4' shows the trailing 4 chars; 'full' masks everything. */
|
|
12
19
|
maskedFormat?: "last4" | "full";
|
|
13
20
|
class?: string;
|
|
14
21
|
}
|
|
15
|
-
declare const _default:
|
|
22
|
+
declare const _default: <RecordType extends LooseRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
23
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & ApiKeyFieldProps<RecordType> & Partial<{}>> & import("vue").PublicProps;
|
|
24
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
25
|
+
attrs: any;
|
|
26
|
+
slots: {};
|
|
27
|
+
emit: {};
|
|
28
|
+
}>) => import("vue").VNode & {
|
|
29
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
30
|
+
};
|
|
16
31
|
export default _default;
|
|
32
|
+
type __VLS_PrettifyLocal<T> = {
|
|
33
|
+
[K in keyof T]: T[K];
|
|
34
|
+
} & {};
|
|
@@ -61,7 +61,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
61
61
|
defaultValue: props.defaultValue
|
|
62
62
|
});
|
|
63
63
|
const injectedRecord = inject(RecordContextKey, null);
|
|
64
|
-
const ctxRecord = computed(
|
|
64
|
+
const ctxRecord = computed(
|
|
65
|
+
() => props.record ?? injectedRecord?.value
|
|
66
|
+
);
|
|
65
67
|
const revealed = ref(false);
|
|
66
68
|
const copied = ref(false);
|
|
67
69
|
const key = computed(() => value.value == null ? null : String(value.value));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { FilterPayload, LooseRecord, SortPayload } from "@chelone/core";
|
|
1
|
+
import type { FilterPayload, LooseRecord, SortPayload, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ArrayField}. */
|
|
3
3
|
export interface ArrayFieldProps {
|
|
4
4
|
/** The field path to the array on the current record. */
|
|
5
|
-
source:
|
|
5
|
+
source: SourceProp;
|
|
6
6
|
/** The record to read. Defaults to the ambient `RecordContext` value. */
|
|
7
7
|
record?: LooseRecord;
|
|
8
8
|
/** Returned when the resolved value is `undefined`. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
import type { BadgeVariant } from "../../ui/badge.js";
|
|
3
3
|
/** Props for {@link BadgeField}. */
|
|
4
4
|
export interface BadgeFieldProps {
|
|
5
|
-
source:
|
|
5
|
+
source: SourceProp;
|
|
6
6
|
record?: LooseRecord;
|
|
7
7
|
defaultValue?: unknown;
|
|
8
8
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link BooleanField}. */
|
|
3
3
|
export interface BooleanFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
/** Label shown (as a native `title` tooltip) when the value is truthy. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
import type { BadgeVariant } from "../../ui/badge.js";
|
|
3
3
|
/** Props for {@link ChipField}. */
|
|
4
4
|
export interface ChipFieldProps {
|
|
5
|
-
source:
|
|
5
|
+
source: SourceProp;
|
|
6
6
|
record?: LooseRecord;
|
|
7
7
|
defaultValue?: unknown;
|
|
8
8
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ColorField}. */
|
|
3
3
|
export interface ColorFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link CronField}. */
|
|
3
3
|
export interface CronFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link CurrencyField}. */
|
|
3
3
|
export interface CurrencyFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link DateField}. */
|
|
3
3
|
export interface DateFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link DurationField}. */
|
|
3
3
|
export interface DurationFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link EmailField}. */
|
|
3
3
|
export interface EmailFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link FileField}. */
|
|
3
3
|
export interface FileFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link FunctionField}. */
|
|
3
|
-
export interface FunctionFieldProps<RecordType = LooseRecord> {
|
|
3
|
+
export interface FunctionFieldProps<RecordType extends LooseRecord = LooseRecord> {
|
|
4
4
|
record?: RecordType;
|
|
5
5
|
/** Optional source, forwarded to the default slot for convenience. */
|
|
6
|
-
source?:
|
|
6
|
+
source?: SourceProp<RecordType>;
|
|
7
7
|
class?: string;
|
|
8
8
|
}
|
|
9
9
|
declare const _default: <RecordType extends LooseRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ImageField}. */
|
|
3
3
|
export interface ImageFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link JsonField}. */
|
|
3
3
|
export interface JsonFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link NumberField}. */
|
|
3
3
|
export interface NumberFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link PhoneField}. */
|
|
3
3
|
export interface PhoneFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|
|
@@ -1,17 +1,32 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceKey, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link RatingField}. */
|
|
3
|
-
export interface RatingFieldProps {
|
|
4
|
-
source:
|
|
5
|
-
record
|
|
3
|
+
export interface RatingFieldProps<RecordType extends LooseRecord = LooseRecord> {
|
|
4
|
+
source: SourceProp;
|
|
5
|
+
/** The record to render. Defaults to the ambient `RecordContext` value. */
|
|
6
|
+
record?: RecordType;
|
|
6
7
|
defaultValue?: unknown;
|
|
7
8
|
empty?: string;
|
|
8
9
|
/** Total stars rendered (filled + outlined). Default 5. */
|
|
9
10
|
max?: number;
|
|
10
11
|
/** Allow half-star granularity when the value falls between integers. */
|
|
11
12
|
allowHalf?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Sibling record field rendered in parentheses (e.g. a review count). A
|
|
15
|
+
* top-level key, not a path: the read is `record[countSource]`.
|
|
16
|
+
*/
|
|
17
|
+
countSource?: SourceKey<RecordType>;
|
|
14
18
|
class?: string;
|
|
15
19
|
}
|
|
16
|
-
declare const _default:
|
|
20
|
+
declare const _default: <RecordType extends LooseRecord = LooseRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
21
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & RatingFieldProps<RecordType> & Partial<{}>> & import("vue").PublicProps;
|
|
22
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
23
|
+
attrs: any;
|
|
24
|
+
slots: {};
|
|
25
|
+
emit: {};
|
|
26
|
+
}>) => import("vue").VNode & {
|
|
27
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
28
|
+
};
|
|
17
29
|
export default _default;
|
|
30
|
+
type __VLS_PrettifyLocal<T> = {
|
|
31
|
+
[K in keyof T]: T[K];
|
|
32
|
+
} & {};
|
|
@@ -30,7 +30,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
30
30
|
defaultValue: props.defaultValue
|
|
31
31
|
});
|
|
32
32
|
const injectedRecord = inject(RecordContextKey, null);
|
|
33
|
-
const ctxRecord = computed(
|
|
33
|
+
const ctxRecord = computed(
|
|
34
|
+
() => props.record ?? injectedRecord?.value
|
|
35
|
+
);
|
|
34
36
|
const translate = useTranslate();
|
|
35
37
|
const count = computed(() => {
|
|
36
38
|
const rec = ctxRecord.value;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { Component } from "vue";
|
|
2
|
-
import type { LooseRecord } from "@chelone/core";
|
|
2
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
3
3
|
/** Props for {@link RecordField}. */
|
|
4
|
-
export interface RecordFieldProps<RecordType = LooseRecord> {
|
|
5
|
-
source?:
|
|
4
|
+
export interface RecordFieldProps<RecordType extends LooseRecord = LooseRecord> {
|
|
5
|
+
source?: SourceProp<RecordType>;
|
|
6
6
|
/** Explicit label, or `false`/`""` to hide it. Absent → humanized `source`. */
|
|
7
7
|
label?: string | false;
|
|
8
8
|
/** Override the ambient resource (reserved for label i18n; inert in V1). */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { FilterPayload, LooseRecord, SortPayload } from "@chelone/core";
|
|
1
|
+
import type { FilterPayload, LooseRecord, SortPayload, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ReferenceArrayField}. */
|
|
3
3
|
export interface ReferenceArrayFieldProps {
|
|
4
4
|
/** The FK-array field on the current record (e.g. `"tag_ids"`). */
|
|
5
|
-
source:
|
|
5
|
+
source: SourceProp;
|
|
6
6
|
/** The referenced resource the ids point at (e.g. `"tags"`). */
|
|
7
7
|
reference: string;
|
|
8
8
|
/** The record to read the FK array off. Defaults to the ambient record. */
|
|
@@ -19,10 +19,11 @@
|
|
|
19
19
|
* `<DataTable>` row click does not also fire.
|
|
20
20
|
*/
|
|
21
21
|
import type { LooseRecord } from "@chelone/core";
|
|
22
|
+
import type { SourceProp } from "@chelone/core";
|
|
22
23
|
import type { LinkToType } from "../../../router/index.js";
|
|
23
24
|
/** Props for {@link ReferenceField}. */
|
|
24
25
|
export interface ReferenceFieldProps {
|
|
25
|
-
source:
|
|
26
|
+
source: SourceProp;
|
|
26
27
|
reference: string;
|
|
27
28
|
record?: LooseRecord;
|
|
28
29
|
empty?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FilterPayload, LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { FilterPayload, LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ReferenceManyCount}. */
|
|
3
3
|
export interface ReferenceManyCountProps {
|
|
4
4
|
/** The referenced resource holding the reverse FK (e.g. `"books"`). */
|
|
@@ -6,7 +6,7 @@ export interface ReferenceManyCountProps {
|
|
|
6
6
|
/** The FK field on the reference pointing back at this record (e.g. `"author_id"`). */
|
|
7
7
|
target: string;
|
|
8
8
|
/** The field on the current record the `target` matches. Default `"id"`. */
|
|
9
|
-
source?:
|
|
9
|
+
source?: SourceProp;
|
|
10
10
|
/** The record whose id is matched. Defaults to the ambient record. */
|
|
11
11
|
record?: LooseRecord;
|
|
12
12
|
/** Permanent filter merged into the lookup, so only matching rows are counted. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FilterPayload, LooseRecord, SortPayload } from "@chelone/core";
|
|
1
|
+
import type { FilterPayload, LooseRecord, SortPayload, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ReferenceManyField}. */
|
|
3
3
|
export interface ReferenceManyFieldProps {
|
|
4
4
|
/** The referenced resource holding the reverse FK (e.g. `"books"`). */
|
|
@@ -6,7 +6,7 @@ export interface ReferenceManyFieldProps {
|
|
|
6
6
|
/** The FK field on the reference pointing back at this record (e.g. `"author_id"`). */
|
|
7
7
|
target: string;
|
|
8
8
|
/** The field on the current record the `target` matches. Default `"id"`. */
|
|
9
|
-
source?:
|
|
9
|
+
source?: SourceProp;
|
|
10
10
|
/** The record whose id is matched. Defaults to the ambient record. */
|
|
11
11
|
record?: LooseRecord;
|
|
12
12
|
/** Initial sort of the related list. Default id ascending. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FilterPayload, LooseRecord, SortPayload } from "@chelone/core";
|
|
1
|
+
import type { FilterPayload, LooseRecord, SortPayload, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link ReferenceOneField}. */
|
|
3
3
|
export interface ReferenceOneFieldProps {
|
|
4
4
|
/** The referenced resource holding the one-to-one record (e.g. `"bios"`). */
|
|
@@ -6,7 +6,7 @@ export interface ReferenceOneFieldProps {
|
|
|
6
6
|
/** The FK field on the reference pointing back at this record (e.g. `"author_id"`). */
|
|
7
7
|
target: string;
|
|
8
8
|
/** The field on the current record the `target` matches. Default `"id"`. */
|
|
9
|
-
source?:
|
|
9
|
+
source?: SourceProp;
|
|
10
10
|
/** The record whose id is matched. Defaults to the ambient record. */
|
|
11
11
|
record?: LooseRecord;
|
|
12
12
|
/** Sort applied to the reference lookup (the first match is used). Read when the record id changes; remount with a `key` to change it otherwise. */
|
|
@@ -1,20 +1,31 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourcePath, SourceProp } from "@chelone/core";
|
|
2
2
|
import type { ChoiceRecord, OptionText } from "../../../choices/use-choices.js";
|
|
3
3
|
/** Props for {@link SelectField}. */
|
|
4
|
-
export interface SelectFieldProps {
|
|
5
|
-
source:
|
|
4
|
+
export interface SelectFieldProps<TChoice extends ChoiceRecord = ChoiceRecord> {
|
|
5
|
+
source: SourceProp;
|
|
6
6
|
record?: LooseRecord;
|
|
7
7
|
defaultValue?: unknown;
|
|
8
8
|
empty?: string;
|
|
9
9
|
/** The list of choices to map the value against. */
|
|
10
|
-
choices?: readonly
|
|
10
|
+
choices?: readonly TChoice[];
|
|
11
11
|
/** The value path on a choice. Default `'id'`. */
|
|
12
|
-
optionValue?:
|
|
12
|
+
optionValue?: SourcePath<TChoice>;
|
|
13
13
|
/** The display path or a formatter. Default `'name'`. */
|
|
14
|
-
optionText?: OptionText
|
|
14
|
+
optionText?: OptionText<TChoice>;
|
|
15
15
|
/** Translate a string-path text through the catalog. Default `true`. */
|
|
16
16
|
translateChoice?: boolean;
|
|
17
17
|
class?: string;
|
|
18
18
|
}
|
|
19
|
-
declare const _default:
|
|
19
|
+
declare const _default: <TChoice extends ChoiceRecord = ChoiceRecord>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
20
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & SelectFieldProps<TChoice> & Partial<{}>> & import("vue").PublicProps;
|
|
21
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
22
|
+
attrs: any;
|
|
23
|
+
slots: {};
|
|
24
|
+
emit: {};
|
|
25
|
+
}>) => import("vue").VNode & {
|
|
26
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
27
|
+
};
|
|
20
28
|
export default _default;
|
|
29
|
+
type __VLS_PrettifyLocal<T> = {
|
|
30
|
+
[K in keyof T]: T[K];
|
|
31
|
+
} & {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
import type { SubscriptionPlan } from "../inputs/subscription-plan-picker.vue.js";
|
|
3
3
|
export type { SubscriptionPlan };
|
|
4
4
|
/** Props for {@link SubscriptionPlanField}. */
|
|
5
5
|
export interface SubscriptionPlanFieldProps {
|
|
6
|
-
source:
|
|
6
|
+
source: SourceProp;
|
|
7
7
|
record?: LooseRecord;
|
|
8
8
|
defaultValue?: unknown;
|
|
9
9
|
empty?: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
import type { BadgeVariant } from "../../ui/badge.js";
|
|
3
3
|
/** Props for {@link TextArrayField}. */
|
|
4
4
|
export interface TextArrayFieldProps {
|
|
5
|
-
source:
|
|
5
|
+
source: SourceProp;
|
|
6
6
|
record?: LooseRecord;
|
|
7
7
|
defaultValue?: unknown;
|
|
8
8
|
empty?: string;
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
* `<TextField>` — displays a text value from a record field, the Vue analog of
|
|
3
|
-
* `@chelone/react`'s `fields/text-field.tsx`. Reads the value at `source` off
|
|
4
|
-
* the ambient (or overridden) record via `useFieldValue` and renders it in a
|
|
5
|
-
* `<span>`. A nullish value renders the `empty` fallback (or nothing).
|
|
6
|
-
*/
|
|
7
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
8
2
|
/** Props for {@link TextField}. */
|
|
9
3
|
export interface TextFieldProps {
|
|
10
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
11
5
|
record?: LooseRecord;
|
|
12
6
|
defaultValue?: unknown;
|
|
13
7
|
empty?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LooseRecord } from "@chelone/core";
|
|
1
|
+
import type { LooseRecord, SourceProp } from "@chelone/core";
|
|
2
2
|
/** Props for {@link UrlField}. */
|
|
3
3
|
export interface UrlFieldProps {
|
|
4
|
-
source:
|
|
4
|
+
source: SourceProp;
|
|
5
5
|
record?: LooseRecord;
|
|
6
6
|
defaultValue?: unknown;
|
|
7
7
|
empty?: string;
|