@chelone/vue 0.2.0 → 0.4.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.
Files changed (142) hide show
  1. package/dist/array/use-array-input.d.ts +4 -3
  2. package/dist/choices/use-choices.d.ts +19 -12
  3. package/dist/choices/use-choices.js +8 -11
  4. package/dist/components/admin/auth/auth-error.vue.d.ts +1 -1
  5. package/dist/components/admin/buttons/dual-approval-button.vue.d.ts +19 -15
  6. package/dist/components/admin/buttons/dual-approval-button.vue.js +3 -1
  7. package/dist/components/admin/buttons/save-button.vue.d.ts +1 -1
  8. package/dist/components/admin/buttons/sort-button.vue.d.ts +2 -1
  9. package/dist/components/admin/buttons/status-transition-button.vue.d.ts +19 -14
  10. package/dist/components/admin/buttons/status-transition-button.vue.js +3 -1
  11. package/dist/components/admin/buttons/update-button.vue.d.ts +3 -3
  12. package/dist/components/admin/feedback/linear-progress.vue.d.ts +1 -1
  13. package/dist/components/admin/fields/api-key-field.vue.d.ts +27 -9
  14. package/dist/components/admin/fields/api-key-field.vue.js +3 -1
  15. package/dist/components/admin/fields/array-field.vue.d.ts +2 -2
  16. package/dist/components/admin/fields/badge-field.vue.d.ts +2 -2
  17. package/dist/components/admin/fields/boolean-field.vue.d.ts +2 -2
  18. package/dist/components/admin/fields/chip-field.vue.d.ts +2 -2
  19. package/dist/components/admin/fields/color-field.vue.d.ts +2 -2
  20. package/dist/components/admin/fields/cron-field.vue.d.ts +2 -2
  21. package/dist/components/admin/fields/currency-field.vue.d.ts +2 -2
  22. package/dist/components/admin/fields/date-field.vue.d.ts +2 -2
  23. package/dist/components/admin/fields/duration-field.vue.d.ts +2 -2
  24. package/dist/components/admin/fields/email-field.vue.d.ts +2 -2
  25. package/dist/components/admin/fields/file-field.vue.d.ts +2 -2
  26. package/dist/components/admin/fields/file-field.vue.js +3 -3
  27. package/dist/components/admin/fields/function-field.vue.d.ts +3 -3
  28. package/dist/components/admin/fields/image-field.vue.d.ts +2 -2
  29. package/dist/components/admin/fields/image-field.vue.js +3 -3
  30. package/dist/components/admin/fields/json-field.vue.d.ts +2 -2
  31. package/dist/components/admin/fields/number-field.vue.d.ts +2 -2
  32. package/dist/components/admin/fields/phone-field.vue.d.ts +2 -2
  33. package/dist/components/admin/fields/rating-field.vue.d.ts +22 -7
  34. package/dist/components/admin/fields/rating-field.vue.js +3 -1
  35. package/dist/components/admin/fields/record-field.vue.d.ts +3 -3
  36. package/dist/components/admin/fields/reference-array-field.vue.d.ts +2 -2
  37. package/dist/components/admin/fields/reference-field.vue.d.ts +2 -1
  38. package/dist/components/admin/fields/reference-many-count.vue.d.ts +2 -2
  39. package/dist/components/admin/fields/reference-many-field.vue.d.ts +2 -2
  40. package/dist/components/admin/fields/reference-one-field.vue.d.ts +2 -2
  41. package/dist/components/admin/fields/select-field.vue.d.ts +2 -2
  42. package/dist/components/admin/fields/select-field.vue.js +1 -1
  43. package/dist/components/admin/fields/subscription-plan-field.vue.d.ts +2 -2
  44. package/dist/components/admin/fields/text-array-field.vue.d.ts +2 -2
  45. package/dist/components/admin/fields/text-field.vue.d.ts +2 -8
  46. package/dist/components/admin/fields/url-field.vue.d.ts +2 -2
  47. package/dist/components/admin/fields/usage-meter-field.vue.d.ts +22 -7
  48. package/dist/components/admin/fields/usage-meter-field.vue.js +3 -1
  49. package/dist/components/admin/fields/webhook-endpoint-field.vue.d.ts +2 -2
  50. package/dist/components/admin/fields/wrapper-field.vue.d.ts +3 -3
  51. package/dist/components/admin/fields/wrapper-field.vue.js +6 -0
  52. package/dist/components/admin/inputs/api-key-input.vue.d.ts +2 -2
  53. package/dist/components/admin/inputs/array-input.vue.d.ts +2 -2
  54. package/dist/components/admin/inputs/autocomplete-array-input.vue.d.ts +14 -6
  55. package/dist/components/admin/inputs/autocomplete-array-input.vue.js +2 -3
  56. package/dist/components/admin/inputs/autocomplete-input.vue.d.ts +14 -6
  57. package/dist/components/admin/inputs/autocomplete-input.vue.js +2 -3
  58. package/dist/components/admin/inputs/boolean-input.vue.d.ts +2 -2
  59. package/dist/components/admin/inputs/checkbox-group-input.vue.d.ts +1 -1
  60. package/dist/components/admin/inputs/choice-input-props.d.ts +7 -7
  61. package/dist/components/admin/inputs/color-input.vue.d.ts +2 -2
  62. package/dist/components/admin/inputs/cron-input.vue.d.ts +2 -2
  63. package/dist/components/admin/inputs/currency-input.vue.d.ts +2 -2
  64. package/dist/components/admin/inputs/date-input.vue.d.ts +2 -2
  65. package/dist/components/admin/inputs/date-time-input.vue.d.ts +2 -2
  66. package/dist/components/admin/inputs/duration-input.vue.d.ts +2 -2
  67. package/dist/components/admin/inputs/file-input.vue.d.ts +2 -2
  68. package/dist/components/admin/inputs/nullable-boolean-input.vue.d.ts +2 -2
  69. package/dist/components/admin/inputs/number-input.vue.d.ts +2 -2
  70. package/dist/components/admin/inputs/password-input.vue.d.ts +2 -2
  71. package/dist/components/admin/inputs/phone-input.vue.d.ts +2 -2
  72. package/dist/components/admin/inputs/radio-button-group-input.vue.d.ts +1 -1
  73. package/dist/components/admin/inputs/rating-input.vue.d.ts +2 -2
  74. package/dist/components/admin/inputs/reference-array-input.vue.d.ts +2 -2
  75. package/dist/components/admin/inputs/reference-input.vue.d.ts +2 -2
  76. package/dist/components/admin/inputs/resettable-text-input.vue.d.ts +2 -1
  77. package/dist/components/admin/inputs/search-input.vue.d.ts +3 -3
  78. package/dist/components/admin/inputs/select-array-input.vue.d.ts +14 -5
  79. package/dist/components/admin/inputs/select-array-input.vue.js +1 -1
  80. package/dist/components/admin/inputs/select-input.vue.d.ts +14 -7
  81. package/dist/components/admin/inputs/select-input.vue.js +1 -1
  82. package/dist/components/admin/inputs/subscription-plan-picker.vue.d.ts +2 -2
  83. package/dist/components/admin/inputs/text-array-input.vue.d.ts +2 -2
  84. package/dist/components/admin/inputs/text-input.vue.d.ts +2 -1
  85. package/dist/components/admin/inputs/time-input.vue.d.ts +2 -1
  86. package/dist/components/admin/inputs/use-choice-input.d.ts +13 -19
  87. package/dist/components/admin/inputs/use-choice-input.js +4 -1
  88. package/dist/components/admin/inputs/webhook-endpoint-input.vue.d.ts +2 -2
  89. package/dist/components/admin/list/calendar-list.vue.d.ts +8 -8
  90. package/dist/components/admin/list/data-table-col.vue.d.ts +2 -2
  91. package/dist/components/admin/list/data-table-number-col.vue.d.ts +2 -1
  92. package/dist/components/admin/list/filter-form.vue.js +2 -10
  93. package/dist/components/admin/list/filter-live-search.vue.d.ts +1 -1
  94. package/dist/components/admin/list/kanban-board.vue.d.ts +41 -0
  95. package/dist/components/admin/list/kanban-board.vue.js +275 -0
  96. package/dist/components/admin/list/kanban-board2.vue.js +4 -0
  97. package/dist/components/admin/list/list-icons.d.ts +2 -0
  98. package/dist/components/admin/list/list-icons.js +7 -0
  99. package/dist/components/admin/list/tree-list.vue.d.ts +7 -6
  100. package/dist/components/admin/list/tree-list.vue.js +3 -9
  101. package/dist/components/admin/view/labeled.vue.d.ts +6 -5
  102. package/dist/components/admin/view/labeled.vue.js +4 -1
  103. package/dist/components/admin/view/tabbed-show-layout-tab.vue.d.ts +2 -2
  104. package/dist/components/index.d.ts +2 -0
  105. package/dist/components/maps/geo-json-field.vue.d.ts +2 -1
  106. package/dist/components/maps/lat-lng-field.vue.d.ts +3 -3
  107. package/dist/components/maps/lat-lng-input.vue.d.ts +4 -4
  108. package/dist/components/maps-draw/shape-input.vue.d.ts +4 -4
  109. package/dist/components/maps-draw/simplify-input.vue.d.ts +2 -2
  110. package/dist/components/maps-osm/geocoding-input.vue.d.ts +6 -6
  111. package/dist/components/maps-osm/map-with-search.vue.d.ts +4 -4
  112. package/dist/components/maps-osm/osm-feature-operator.vue.d.ts +3 -3
  113. package/dist/components/maps-osm/reverse-geocode-field.vue.d.ts +3 -3
  114. package/dist/components/mdx-editor/mdx-field.vue.d.ts +2 -2
  115. package/dist/components/mdx-editor/mdx-input.vue.d.ts +2 -2
  116. package/dist/components/monaco/monaco-json-field.vue.d.ts +2 -2
  117. package/dist/components/monaco/monaco-json-input.vue.d.ts +2 -2
  118. package/dist/components/ui/alert.d.ts +1 -1
  119. package/dist/components/ui/badge.d.ts +1 -1
  120. package/dist/components/ui/button.vue.d.ts +1 -1
  121. package/dist/components/ui/command/command-dialog.vue.d.ts +1 -1
  122. package/dist/components/ui/dropdown-menu/dropdown-menu-item.vue.js +9 -3
  123. package/dist/components/ui/input.vue.d.ts +2 -2
  124. package/dist/components/ui/sidebar/sidebar-menu-button.vue.d.ts +1 -1
  125. package/dist/components/ui/textarea.vue.d.ts +2 -2
  126. package/dist/controllers/use-controller-for-id.d.ts +6 -2
  127. package/dist/controllers/use-controller-for-id.js +2 -1
  128. package/dist/create-resource-components.d.ts +743 -0
  129. package/dist/create-resource-components.js +171 -0
  130. package/dist/data/create-chelone-hooks.d.ts +28 -8
  131. package/dist/data/mutations.d.ts +28 -8
  132. package/dist/form/use-input.d.ts +9 -6
  133. package/dist/form/use-input.js +2 -1
  134. package/dist/index.d.ts +2 -0
  135. package/dist/index.js +248 -243
  136. package/dist/label/use-get-record-representation.d.ts +2 -1
  137. package/dist/label/use-get-record-representation.js +1 -13
  138. package/dist/record/use-field-value.d.ts +22 -11
  139. package/dist/record/use-field-value.js +3 -20
  140. package/package.json +4 -4
  141. package/dist/components/admin/fields/get-path.d.ts +0 -7
  142. package/dist/components/admin/fields/get-path.js +0 -14
@@ -4,10 +4,10 @@
4
4
  * incomplete number (`-`, `0.`) before it is parsed, and writes `null` (not `0`)
5
5
  * on empty so required validation still triggers. Binds through `useInput`.
6
6
  */
7
- import type { Validator } from "@chelone/core";
7
+ import type { SourceProp, Validator } from "@chelone/core";
8
8
  /** Props for {@link NumberInput}. */
9
9
  export interface NumberInputProps {
10
- source: string;
10
+ source: SourceProp;
11
11
  label?: string | false;
12
12
  defaultValue?: unknown;
13
13
  validate?: Validator | readonly Validator[];
@@ -7,10 +7,10 @@
7
7
  * Icon note: the Vue slice is dependency-free (no `lucide-vue-next`), so the
8
8
  * eye / eye-off glyphs are inlined SVGs mirroring lucide's paths.
9
9
  */
10
- import type { Validator } from "@chelone/core";
10
+ import type { SourceProp, Validator } from "@chelone/core";
11
11
  /** Props for {@link PasswordInput}. */
12
12
  export interface PasswordInputProps {
13
- source: string;
13
+ source: SourceProp;
14
14
  label?: string | false;
15
15
  initiallyVisible?: boolean;
16
16
  defaultValue?: unknown;
@@ -5,11 +5,11 @@
5
5
  * `libphonenumber-js` (the same dep the twin uses); `AsYouType` formats while
6
6
  * typing and `parsePhoneNumber(...).number` normalizes on write-back.
7
7
  */
8
- import type { Validator } from "@chelone/core";
8
+ import type { SourceProp, Validator } from "@chelone/core";
9
9
  import { type CountryCode } from "libphonenumber-js";
10
10
  /** Props for {@link PhoneInput}. */
11
11
  export interface PhoneInputProps {
12
- source: string;
12
+ source: SourceProp;
13
13
  label?: string | false;
14
14
  defaultValue?: unknown;
15
15
  validate?: Validator | readonly Validator[];
@@ -6,8 +6,8 @@ export interface RadioButtonGroupInputProps extends ChoiceInputBaseProps {
6
6
  }
7
7
  declare const _default: import("vue").DefineComponent<RadioButtonGroupInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<RadioButtonGroupInputProps> & Readonly<{}>, {
8
8
  label: string | false;
9
- row: boolean;
10
9
  optionValue: string;
10
+ row: boolean;
11
11
  disableValue: string;
12
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
13
  export default _default;
@@ -1,7 +1,7 @@
1
- import type { Validator } from "@chelone/core";
1
+ import type { SourceProp, Validator } from "@chelone/core";
2
2
  /** Props for {@link RatingInput}. */
3
3
  export interface RatingInputProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  label?: string | false;
6
6
  defaultValue?: unknown;
7
7
  validate?: Validator | readonly Validator[];
@@ -1,8 +1,8 @@
1
- import type { FilterPayload, SortPayload } from "@chelone/core";
1
+ import type { FilterPayload, SortPayload, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link ReferenceArrayInput}. */
3
3
  export interface ReferenceArrayInputProps {
4
4
  /** The FK-array field on the current record (e.g. `"tag_ids"`). */
5
- source: string;
5
+ source: SourceProp;
6
6
  /** The referenced resource choices are fetched from (e.g. `"tags"`). */
7
7
  reference: string;
8
8
  /**
@@ -7,10 +7,10 @@
7
7
  * native `<select>` (the reka-ui combobox autocomplete is a later wave — spec
8
8
  * Risk 1). Choice labels use the reference's record representation.
9
9
  */
10
- import type { Validator } from "@chelone/core";
10
+ import type { SourceProp, Validator } from "@chelone/core";
11
11
  /** Props for {@link ReferenceInput}. */
12
12
  export interface ReferenceInputProps {
13
- source: string;
13
+ source: SourceProp;
14
14
  reference: string;
15
15
  label?: string | false;
16
16
  perPage?: number;
@@ -12,9 +12,10 @@
12
12
  * registration) and clear via the same `form.setFieldValue(wrappedSource, "")`.
13
13
  */
14
14
  import type { Validator } from "@chelone/core";
15
+ import type { SourceProp } from "@chelone/core";
15
16
  /** Props for {@link ResettableTextInput}. */
16
17
  export interface ResettableTextInputProps {
17
- source: string;
18
+ source: SourceProp;
18
19
  label?: string | false;
19
20
  resettable?: boolean;
20
21
  clearAlwaysVisible?: boolean;
@@ -5,10 +5,10 @@
5
5
  * form store and clears via `form.setFieldValue`. It throws if given a `label`
6
6
  * (use `<TextInput>` when a label is needed) — mirroring the React twin.
7
7
  */
8
- import type { Validator } from "@chelone/core";
8
+ import type { SourceProp, Validator } from "@chelone/core";
9
9
  /** Props for {@link SearchInput}. */
10
10
  export interface SearchInputProps {
11
- source?: string;
11
+ source?: SourceProp;
12
12
  label?: string | false;
13
13
  disableClearable?: boolean;
14
14
  defaultValue?: unknown;
@@ -18,7 +18,7 @@ export interface SearchInputProps {
18
18
  class?: string;
19
19
  }
20
20
  declare const _default: import("vue").DefineComponent<SearchInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SearchInputProps> & Readonly<{}>, {
21
- source: string;
21
+ source: SourceProp;
22
22
  disableClearable: boolean;
23
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
24
  export default _default;
@@ -1,11 +1,20 @@
1
+ import type { ChoiceRecord } from "../../../choices/use-choices.js";
1
2
  import type { ChoiceInputBaseProps } from "./choice-input-props.js";
2
3
  /** Props for {@link SelectArrayInput}. */
3
- export interface SelectArrayInputProps extends ChoiceInputBaseProps {
4
+ export interface SelectArrayInputProps<TChoice extends ChoiceRecord = ChoiceRecord> extends ChoiceInputBaseProps<TChoice> {
4
5
  /** Placeholder shown in the trigger when nothing is selected. */
5
6
  placeholder?: string;
6
7
  }
7
- declare const _default: import("vue").DefineComponent<SelectArrayInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SelectArrayInputProps> & Readonly<{}>, {
8
- label: string | false;
9
- disableValue: string;
10
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
+ 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<{
9
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & SelectArrayInputProps<TChoice> & Partial<{}>> & import("vue").PublicProps;
10
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
11
+ attrs: any;
12
+ slots: {};
13
+ emit: {};
14
+ }>) => import("vue").VNode & {
15
+ __ctx?: Awaited<typeof __VLS_setup>;
16
+ };
11
17
  export default _default;
18
+ type __VLS_PrettifyLocal<T> = {
19
+ [K in keyof T]: T[K];
20
+ } & {};
@@ -36,7 +36,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  choices: {},
37
37
  optionText: {},
38
38
  optionValue: {},
39
- disableValue: { default: "disabled" },
39
+ disableValue: {},
40
40
  translateChoice: { type: Boolean },
41
41
  label: { type: [String, Boolean], default: void 0 },
42
42
  helperText: {},
@@ -1,15 +1,22 @@
1
+ import type { ChoiceRecord } from "../../../choices/use-choices.js";
1
2
  import type { ChoiceInputBaseProps } from "./choice-input-props.js";
2
3
  /** Props for {@link SelectInput}. */
3
- export interface SelectInputProps extends ChoiceInputBaseProps {
4
+ export interface SelectInputProps<TChoice extends ChoiceRecord = ChoiceRecord> extends ChoiceInputBaseProps<TChoice> {
4
5
  /** Label of the empty option prepended to the list. Default `""` (a blank line). */
5
6
  emptyText?: string;
6
7
  /** Underlying value submitted when the empty option is chosen. Default `""`. */
7
8
  emptyValue?: string | number | boolean | null;
8
9
  }
9
- declare const _default: import("vue").DefineComponent<SelectInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SelectInputProps> & Readonly<{}>, {
10
- label: string | false;
11
- emptyText: string;
12
- disableValue: string;
13
- emptyValue: string | number | boolean | null;
14
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
10
+ 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<{
11
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & SelectInputProps<TChoice> & Partial<{}>> & import("vue").PublicProps;
12
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
13
+ attrs: any;
14
+ slots: {};
15
+ emit: {};
16
+ }>) => import("vue").VNode & {
17
+ __ctx?: Awaited<typeof __VLS_setup>;
18
+ };
15
19
  export default _default;
20
+ type __VLS_PrettifyLocal<T> = {
21
+ [K in keyof T]: T[K];
22
+ } & {};
@@ -18,7 +18,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
18
18
  choices: {},
19
19
  optionText: {},
20
20
  optionValue: {},
21
- disableValue: { default: "disabled" },
21
+ disableValue: {},
22
22
  translateChoice: { type: Boolean },
23
23
  label: { type: [String, Boolean], default: void 0 },
24
24
  helperText: {},
@@ -1,4 +1,4 @@
1
- import type { Validator } from "@chelone/core";
1
+ import type { SourceProp, Validator } from "@chelone/core";
2
2
  /** A subscription plan a {@link SubscriptionPlanPicker} renders as one card. */
3
3
  export interface SubscriptionPlan {
4
4
  id: string;
@@ -11,7 +11,7 @@ export interface SubscriptionPlan {
11
11
  /** Props for {@link SubscriptionPlanPicker}. */
12
12
  export interface SubscriptionPlanPickerProps {
13
13
  /** The FK/field path holding the selected plan id. */
14
- source: string;
14
+ source: SourceProp;
15
15
  /** The plans rendered as cards. */
16
16
  plans: readonly SubscriptionPlan[];
17
17
  /** Highlights one plan as recommended. */
@@ -1,7 +1,7 @@
1
- import type { Validator } from "@chelone/core";
1
+ import type { SourceProp, Validator } from "@chelone/core";
2
2
  /** Props for {@link TextArrayInput}. */
3
3
  export interface TextArrayInputProps {
4
- source: string;
4
+ source: SourceProp;
5
5
  label?: string | false;
6
6
  defaultValue?: unknown;
7
7
  validate?: Validator | readonly Validator[];
@@ -6,9 +6,10 @@
6
6
  * `<ValidationError>`), never an RHF `error.root.message`.
7
7
  */
8
8
  import type { Validator } from "@chelone/core";
9
+ import type { SourceProp } from "@chelone/core";
9
10
  /** Props for {@link TextInput}. */
10
11
  export interface TextInputProps {
11
- source: string;
12
+ source: SourceProp;
12
13
  label?: string | false;
13
14
  type?: string;
14
15
  defaultValue?: unknown;
@@ -7,9 +7,10 @@
7
7
  * pattern as `<DateInput>`.
8
8
  */
9
9
  import type { Validator } from "@chelone/core";
10
+ import type { SourceProp } from "@chelone/core";
10
11
  /** Props for {@link TimeInput}. */
11
12
  export interface TimeInputProps {
12
- source: string;
13
+ source: SourceProp;
13
14
  label?: string | false;
14
15
  defaultValue?: unknown;
15
16
  validate?: Validator | readonly Validator[];
@@ -21,34 +21,28 @@
21
21
  * / `resource` / `isFromReference` are stable per context, so they are read once
22
22
  * (parity with the twin's `useState` capture of the reference options).
23
23
  */
24
+ import type { SourcePath, SourceProp } from "@chelone/core";
24
25
  import { type ComputedRef } from "vue";
25
26
  import { type ChoiceRecord, type OptionText } from "../../../choices/use-choices.js";
26
27
  /** Options for {@link useChoiceInput}. */
27
- export interface UseChoiceInputOptions {
28
+ export interface UseChoiceInputOptions<TChoice extends ChoiceRecord = ChoiceRecord> {
28
29
  /** Component name used in the "must provide the source prop" error. */
29
30
  componentName: string;
30
31
  /** Inline choices — synthesized into a static context, ignoring any ambient one. */
31
- choices?: readonly (string | ChoiceRecord)[];
32
+ choices?: readonly (string | TChoice)[];
32
33
  /** The FK/field path (falls back to the ambient reference context's source). */
33
- source?: string;
34
+ source?: SourceProp | undefined;
34
35
  /** The display path or a formatter. */
35
- optionText?: OptionText;
36
+ optionText?: OptionText<TChoice>;
36
37
  /** The value path. Default `id` (via `useChoices`). */
37
- optionValue?: string;
38
+ optionValue?: SourcePath<TChoice>;
38
39
  /** The disabled-flag path. Default `disabled`. */
39
- disableValue?: string;
40
+ disableValue?: SourcePath<TChoice>;
40
41
  /** Translate a string-path label. Default `!isFromReference`. */
41
42
  translateChoice?: boolean;
42
- /**
43
- * The `optionText` fallback for a NON-reference context when `optionText` is
44
- * omitted (a reference context always falls back to the record
45
- * representation). `undefined` lets `useChoices` apply its own `name` default;
46
- * the autocomplete twins pass `"name"` explicitly.
47
- */
48
- defaultOptionText?: OptionText;
49
43
  }
50
44
  /** The resolved choice-input surface — accessors + reactive context fields. */
51
- export interface UseChoiceInputResult {
45
+ export interface UseChoiceInputResult<TChoice extends ChoiceRecord = ChoiceRecord> {
52
46
  /** The resolved `source` (guaranteed defined — the composable throws otherwise). */
53
47
  source: string;
54
48
  /** `true` for a reference context, `false` for inline choices. */
@@ -56,18 +50,18 @@ export interface UseChoiceInputResult {
56
50
  /** The referenced resource name (inline: `undefined`). */
57
51
  resource: string | undefined;
58
52
  /** The full choice list (reactive). */
59
- allChoices: ComputedRef<ChoiceRecord[]>;
53
+ allChoices: ComputedRef<TChoice[]>;
60
54
  /** Whether the reference list is still loading (inline: `false`). */
61
55
  isPending: ComputedRef<boolean>;
62
56
  /** The reference fetch error (inline: `null`). */
63
57
  fetchError: ComputedRef<unknown>;
64
58
  /** The display text for a choice. */
65
- getChoiceText(choice: ChoiceRecord): string;
59
+ getChoiceText(choice: TChoice): string;
66
60
  /** The value for a choice (`optionValue` path or `id`). */
67
- getChoiceValue(choice: ChoiceRecord): unknown;
61
+ getChoiceValue(choice: TChoice): unknown;
68
62
  /** The disabled flag for a choice. */
69
- getDisableValue(choice: ChoiceRecord): unknown;
63
+ getDisableValue(choice: TChoice): unknown;
70
64
  /** Push a filter onto a reference context (inert for inline choices). */
71
65
  setFilters(filter: Record<string, unknown>, debounce?: boolean): void;
72
66
  }
73
- export declare function useChoiceInput(options: UseChoiceInputOptions): UseChoiceInputResult;
67
+ export declare function useChoiceInput<TChoice extends ChoiceRecord = ChoiceRecord>(options: UseChoiceInputOptions<TChoice>): UseChoiceInputResult<TChoice>;
@@ -17,7 +17,7 @@ function useChoiceInput(options) {
17
17
  const resource = ctx.resource;
18
18
  const getRecordRepresentation = useGetRecordRepresentation(resource);
19
19
  const { getChoiceText, getChoiceValue, getDisableValue } = useChoices({
20
- optionText: options.optionText ?? (isFromReference ? getRecordRepresentation : options.defaultOptionText),
20
+ optionText: options.optionText ?? (isFromReference ? getRecordRepresentation : void 0),
21
21
  optionValue: options.optionValue,
22
22
  disableValue: options.disableValue,
23
23
  translateChoice: options.translateChoice ?? !isFromReference
@@ -28,6 +28,9 @@ function useChoiceInput(options) {
28
28
  resource,
29
29
  // Computeds re-read the reference context's getters inside a tracking scope
30
30
  // so the list stays live; for an inline context they read static fields.
31
+ // The cast: the context list is erased. Inline `choices` are `TChoice`
32
+ // records, and under a reference the choices come from context, where
33
+ // `TChoice` stays the default.
31
34
  allChoices: computed(() => ctx.allChoices ?? []),
32
35
  isPending: computed(() => ctx.isPending),
33
36
  fetchError: computed(() => ctx.error),
@@ -1,4 +1,4 @@
1
- import type { Validator } from "@chelone/core";
1
+ import type { SourceProp, Validator } from "@chelone/core";
2
2
  /**
3
3
  * Storage shape a `<WebhookEndpointInput>` edits. Mirrors the React twin's
4
4
  * inlined type (the shadmin source imported it from a sibling field not yet
@@ -15,7 +15,7 @@ export interface WebhookEndpoint {
15
15
  }
16
16
  /** Props for {@link WebhookEndpointInput}. */
17
17
  export interface WebhookEndpointInputProps {
18
- source: string;
18
+ source: SourceProp;
19
19
  label?: string | false;
20
20
  /** Available event-type strings to surface as checkboxes. */
21
21
  eventTypes: readonly string[];
@@ -21,18 +21,18 @@
21
21
  */
22
22
  import { type LooseRecord } from "@chelone/core";
23
23
  import { type CalendarEventSlotProps, type CalendarDrop, type CalendarSlot } from "./calendar-month-view.vue.js";
24
- import type { CalendarRange, CalendarView, CalendarWeekStart } from "@chelone/core";
24
+ import type { CalendarRange, CalendarView, CalendarWeekStart, SourceProp } from "@chelone/core";
25
25
  import type { CalendarNavigateDirection } from "./calendar-header.vue.js";
26
26
  /** Props for {@link CalendarList}. */
27
27
  export interface CalendarListProps {
28
28
  /** The field holding the start of an event; a dotted path reads a nested value. */
29
- startSource: string;
29
+ startSource: SourceProp;
30
30
  /** The field holding the end. An event with none, or one before its start, covers its start day only. */
31
- endSource?: string;
31
+ endSource?: SourceProp;
32
32
  /** The string field shown as the event title; the record representation otherwise. */
33
- titleSource?: string;
33
+ titleSource?: SourceProp;
34
34
  /** The field whose value picks a color from `colorMap`. */
35
- colorSource?: string;
35
+ colorSource?: SourceProp;
36
36
  colorMap?: Record<string, string>;
37
37
  /** The view shown first. Default `month`. */
38
38
  defaultView?: CalendarView;
@@ -83,9 +83,9 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<CalendarLi
83
83
  perPage: number;
84
84
  linkType: "edit" | "show" | false;
85
85
  views: CalendarView[];
86
- endSource: string;
87
- titleSource: string;
88
- colorSource: string;
86
+ endSource: SourceProp;
87
+ titleSource: SourceProp;
88
+ colorSource: SourceProp;
89
89
  colorMap: Record<string, string>;
90
90
  defaultView: CalendarView;
91
91
  weekStartsOn: CalendarWeekStart;
@@ -1,7 +1,7 @@
1
- import type { LooseRecord } from "@chelone/core";
1
+ import type { LooseRecord, SourceProp } from "@chelone/core";
2
2
  /** Props for {@link DataTableCol}. */
3
3
  export interface DataTableColProps {
4
- source?: string;
4
+ source?: SourceProp;
5
5
  label?: string;
6
6
  /** Applied to both the header and the body cells. */
7
7
  class?: string;
@@ -1,7 +1,8 @@
1
+ import type { SourceProp } from "@chelone/core";
1
2
  import type { DataTableColProps } from "./data-table-col.vue.js";
2
3
  /** Props for {@link DataTableNumberCol}. */
3
4
  export interface DataTableNumberColProps extends Omit<DataTableColProps, "source"> {
4
- source: string;
5
+ source: SourceProp;
5
6
  /** BCP 47 locale(s) for `Intl.NumberFormat`. */
6
7
  locales?: string | string[];
7
8
  /** `Intl.NumberFormatOptions` (currency, percent, fraction digits…). */
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, watch, openBlock, createElementBlock, withModifiers, Fragment, renderList, createBlock, resolveDynamicComponent, mergeProps, unref, createVNode, createCommentVNode, renderSlot } from "vue";
2
- import { mergeFilterValues, getFilterFormValues, filterFormReflectShape } from "@chelone/core";
2
+ import { mergeFilterValues, getFilterFormValues, filterFormReflectShape, getAtPath } from "@chelone/core";
3
3
  import { useTranslate } from "../../../i18n/use-translate.js";
4
4
  import { useForm } from "../../../form/use-form.js";
5
5
  import { useListContext } from "../../../list/list-context.js";
@@ -36,16 +36,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
36
  }
37
37
  return false;
38
38
  }
39
- function valueAt(record, source) {
40
- let current = record;
41
- for (const key of source.split(".")) {
42
- if (current == null || typeof current !== "object") return void 0;
43
- current = current[key];
44
- }
45
- return current;
46
- }
47
39
  function isShown(entry) {
48
- return !!entry.alwaysOn || !!list.displayedFilters?.[entry.source] || !isEmptyValue(valueAt(list.filter, entry.source));
40
+ return !!entry.alwaysOn || !!list.displayedFilters?.[entry.source] || !isEmptyValue(getAtPath(list.filter, entry.source));
49
41
  }
50
42
  const { form, values, reset } = useForm({
51
43
  resource,
@@ -2,7 +2,7 @@ import type { SearchInputProps } from "../inputs/search-input.vue.js";
2
2
  /** Props for {@link FilterLiveSearch}: those of `<SearchInput>`. */
3
3
  export type FilterLiveSearchProps = SearchInputProps;
4
4
  declare const _default: import("vue").DefineComponent<SearchInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SearchInputProps> & Readonly<{}>, {
5
- source: string;
5
+ source: import("@chelone/core").SourceProp;
6
6
  placeholder: string;
7
7
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
8
8
  export default _default;
@@ -0,0 +1,41 @@
1
+ import type { KanbanColumnDef, LooseRecord, SourceKey, SourceProp } from "@chelone/core";
2
+ /** Props for {@link KanbanBoard}. */
3
+ export interface KanbanBoardProps<TRecord extends LooseRecord = LooseRecord> {
4
+ /**
5
+ * The top-level field whose value names a column; a drop writes the target
6
+ * column's `id` to it.
7
+ */
8
+ groupSource: SourceKey<TRecord>;
9
+ /** The columns, in order. A record whose group value names none is not shown. */
10
+ columns: readonly KanbanColumnDef[];
11
+ /** The field shown as the card title; the record representation when it is null or undefined. */
12
+ titleSource?: SourceProp<TRecord>;
13
+ /** The field shown as a second line when its value is not empty. */
14
+ descriptionSource?: SourceProp<TRecord>;
15
+ /**
16
+ * Where a card goes when nothing listens to `select-card`. `edit` by default,
17
+ * `show` when the resource has no edit view. `false` leaves cards inert.
18
+ */
19
+ linkType?: "edit" | "show" | false;
20
+ class?: string;
21
+ }
22
+ declare const _default: <TRecord 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<{
24
+ readonly "onSelect-card"?: ((record: TRecord) => any) | undefined;
25
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onSelect-card"> & KanbanBoardProps<TRecord> & Partial<{}>> & import("vue").PublicProps;
26
+ expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
27
+ attrs: any;
28
+ slots: {
29
+ /** Replaces the title and description inside a card. */
30
+ card?(props: {
31
+ record: TRecord;
32
+ }): unknown;
33
+ };
34
+ emit: (evt: "select-card", record: TRecord) => void;
35
+ }>) => import("vue").VNode & {
36
+ __ctx?: Awaited<typeof __VLS_setup>;
37
+ };
38
+ export default _default;
39
+ type __VLS_PrettifyLocal<T> = {
40
+ [K in keyof T]: T[K];
41
+ } & {};