@salesql/sql_components_vue3 3.13.0 → 3.15.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.
@@ -0,0 +1,36 @@
1
+ import { CREATE_OPTION, DELETE, EDIT, FORM_CLOSE, UPDATE_OPTION } from '../constants/events';
2
+ import { type DsPickerOption, type DsPickerRowActionsMode } from '../constants/pickers';
3
+ import type { DsOrganizerFormSubmitPayload } from '../ui/DsOrganizerForm';
4
+ type PickerOrganizerEvent = typeof EDIT | typeof DELETE | typeof CREATE_OPTION | typeof UPDATE_OPTION | typeof FORM_CLOSE;
5
+ export interface PickerOrganizerOptions {
6
+ colors: () => readonly string[];
7
+ rowActions: () => DsPickerRowActionsMode;
8
+ formError: () => string;
9
+ emit: (event: PickerOrganizerEvent, payload?: unknown) => void;
10
+ focusSearch: () => void;
11
+ }
12
+ export declare function usePickerOrganizer(options: PickerOrganizerOptions): {
13
+ view: import("vue").Ref<"form" | "list", "form" | "list">;
14
+ mode: import("vue").Ref<"edit" | "create", "edit" | "create">;
15
+ editing: import("vue").Ref<{
16
+ id: string | number;
17
+ name: string;
18
+ color?: string | undefined;
19
+ } | null, DsPickerOption | {
20
+ id: string | number;
21
+ name: string;
22
+ color?: string | undefined;
23
+ } | null>;
24
+ formName: import("vue").Ref<string, string>;
25
+ formColor: import("vue").Ref<string, string>;
26
+ isForm: import("vue").ComputedRef<boolean>;
27
+ shownFormError: import("vue").ComputedRef<string>;
28
+ editingColor: import("vue").ComputedRef<string>;
29
+ resetForm: () => void;
30
+ openCreateForm: (name?: string) => void;
31
+ onEdit: (option: DsPickerOption) => void;
32
+ onDelete: (option: DsPickerOption) => void;
33
+ onSubmit: ({ name, color }: DsOrganizerFormSubmitPayload) => void;
34
+ closeForm: () => void;
35
+ };
36
+ export {};
@@ -68,3 +68,5 @@ export declare const UPDATE_NAME: "update:name";
68
68
  export type UpdateNameEventName = typeof UPDATE_NAME;
69
69
  export declare const UPDATE_COLOR: "update:color";
70
70
  export type UpdateColorEventName = typeof UPDATE_COLOR;
71
+ export declare const FORM_CLOSE: "form-close";
72
+ export type FormCloseEventName = typeof FORM_CLOSE;
@@ -19,6 +19,40 @@ export declare const DS_PICKER_ALIGNS: {
19
19
  export type DsPickerAlign = (typeof DS_PICKER_ALIGNS)[keyof typeof DS_PICKER_ALIGNS];
20
20
  /** Widest a tag / folder panel grows to keep its footer on one line (the viewport still caps it). */
21
21
  export declare const DS_PICKER_PANEL_MAX_WIDTH = "360px";
22
+ /**
23
+ * What the create affordance does: nothing, emit `create` for the app's own flow, or open the
24
+ * in-panel form (needs `colors`).
25
+ */
26
+ export declare const DS_PICKER_CREATE_MODES: {
27
+ readonly NONE: "none";
28
+ readonly EVENT: "event";
29
+ readonly FORM: "form";
30
+ };
31
+ export type DsPickerCreateMode = (typeof DS_PICKER_CREATE_MODES)[keyof typeof DS_PICKER_CREATE_MODES];
32
+ /** What the row ⋮ menu does: absent, emit `edit` / `delete` only, or also open the form on Edit. */
33
+ export declare const DS_PICKER_ROW_ACTIONS: {
34
+ readonly NONE: "none";
35
+ readonly EVENT: "event";
36
+ readonly FORM: "form";
37
+ };
38
+ export type DsPickerRowActionsMode = (typeof DS_PICKER_ROW_ACTIONS)[keyof typeof DS_PICKER_ROW_ACTIONS];
39
+ /** The strings the in-panel form and the row ⋮ menu share between the pickers. */
40
+ export interface DsPickerOrganizerCopy {
41
+ /** Accessible name of each row's ⋮ button. */
42
+ actions: string;
43
+ edit: string;
44
+ delete: string;
45
+ createFormTitle: string;
46
+ editFormTitle: string;
47
+ createSubmit: string;
48
+ editSubmit: string;
49
+ namePlaceholder: string;
50
+ setColor: string;
51
+ back: string;
52
+ /** Unset = DsOrganizerForm's own fallback. */
53
+ errorMissingName?: string;
54
+ errorTooLongName?: string;
55
+ }
22
56
  /** The "send to" choice of Add to sequence — the contract's email kinds that can be mailed. */
23
57
  export declare const DS_SEQUENCE_CHANNELS: {
24
58
  readonly WORK: "work";
@@ -36,3 +70,33 @@ export declare function filterOptions<T extends {
36
70
  }>(options: readonly T[], query: string): T[];
37
71
  /** The panel opens below the trigger, aligned to the edge the consumer asked for. */
38
72
  export declare function pickerPlacement(align: DsPickerAlign): DsPopoverPlacement;
73
+ /** Defaults under partials; a key a partial leaves `undefined` does not override. */
74
+ export declare function mergeCopy<T extends object>(defaults: T, ...partials: ReadonlyArray<Partial<T> | undefined>): T;
75
+ type ModeValidatorProps = Readonly<Record<string, unknown>>;
76
+ /** Two-argument Vue prop validator (dev only): `'form'` needs a palette to render. */
77
+ export declare function isValidCreateMode(value: unknown, props: ModeValidatorProps): boolean;
78
+ /** Same rule for `rowActions`, which still takes the boolean of the deprecated alias. */
79
+ export declare function isValidRowActionsMode(value: unknown, props: ModeValidatorProps): boolean;
80
+ export interface LegacyPickerPropsInput {
81
+ create?: DsPickerCreateMode;
82
+ rowActions?: DsPickerRowActionsMode | boolean;
83
+ colors: readonly string[];
84
+ /** The consumer passed a `#footer` slot. */
85
+ hasFooterSlot?: boolean;
86
+ /** The deprecated per-string props as the consumer passed them, by their old prop name. */
87
+ aliases: Readonly<Record<string, unknown>>;
88
+ /** Old prop name → the `copy` key(s) it feeds. */
89
+ copyMap: Readonly<Record<string, string | readonly string[]>>;
90
+ }
91
+ export interface ResolvedLegacyPickerProps {
92
+ create: DsPickerCreateMode;
93
+ rowActions: DsPickerRowActionsMode;
94
+ copy: Record<string, string>;
95
+ }
96
+ /**
97
+ * The ONLY place the deprecated picker props are interpreted: the pre-modes `colors` /
98
+ * `createLabel` / boolean `rowActions` gating and the loose copy props. An explicit new prop
99
+ * always wins over its alias. Delete with the aliases.
100
+ */
101
+ export declare function resolveLegacyPickerProps(input: LegacyPickerPropsInput): ResolvedLegacyPickerProps;
102
+ export {};