sit-onyx 1.0.0-beta.60 → 1.0.0-beta.62
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/components/OnyxCheckboxGroup/types.d.ts +2 -1
- package/dist/components/OnyxDataGrid/OnyxDataGrid.vue.d.ts +16 -0
- package/dist/components/OnyxDataGrid/OnyxDataGridRenderer/types.d.ts +1 -1
- package/dist/components/OnyxDataGrid/features/HeaderCell.vue.d.ts +28 -0
- package/dist/components/OnyxDataGrid/features/index.d.ts +97 -0
- package/dist/components/OnyxDataGrid/features/sorting/SortAction.vue.d.ts +21 -0
- package/dist/components/OnyxDataGrid/features/sorting/sorting.d.ts +6 -0
- package/dist/components/OnyxDataGrid/types.d.ts +13 -0
- package/dist/components/OnyxInput/types.d.ts +1 -1
- package/dist/components/OnyxRadioGroup/types.d.ts +2 -1
- package/dist/components/OnyxStepper/OnyxStepper.vue.d.ts +10 -5
- package/dist/components/OnyxStepper/types.d.ts +17 -4
- package/dist/composables/useCustomValidity.d.ts +1 -1
- package/dist/composables/useSkeletonState.d.ts +6 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +1430 -1382
- package/dist/utils/numbers.d.ts +26 -0
- package/package.json +1 -1
- package/src/i18n/locales/en-US.json +9 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DensityProp } from "../../composables/density";
|
|
2
2
|
import type { RequiredMarkerProp } from "../../composables/required";
|
|
3
3
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
4
|
+
import type { SkeletonInjected } from "../../composables/useSkeletonState";
|
|
4
5
|
import type { AutofocusProp, BaseSelectOption, Direction, SelectOptionValue } from "../../types";
|
|
5
6
|
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
6
7
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
@@ -35,6 +36,6 @@ export type OnyxCheckboxGroupProps<TValue extends SelectOptionValue = SelectOpti
|
|
|
35
36
|
/**
|
|
36
37
|
* If set, the specified number of skeleton radio buttons will be shown.
|
|
37
38
|
*/
|
|
38
|
-
skeleton?:
|
|
39
|
+
skeleton?: SkeletonInjected;
|
|
39
40
|
};
|
|
40
41
|
export type CheckboxGroupOption<TValue extends SelectOptionValue = SelectOptionValue> = BaseSelectOption<TValue> & RequiredMarkerProp & CustomValidityProp & AutofocusProp;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type DataGridEntry, type OnyxDataGridProps } from "../..";
|
|
2
|
+
declare const _default: <TEntry extends DataGridEntry>(__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<{
|
|
3
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & OnyxDataGridProps<TEntry>> & import("vue").PublicProps;
|
|
4
|
+
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
5
|
+
attrs: any;
|
|
6
|
+
slots: {};
|
|
7
|
+
emit: {};
|
|
8
|
+
}>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}> & {
|
|
11
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_PrettifyLocal<T> = {
|
|
15
|
+
[K in keyof T]: T[K];
|
|
16
|
+
} & {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
declare function __VLS_template(): {
|
|
2
|
+
slots: Readonly<{
|
|
3
|
+
actions?(): unknown;
|
|
4
|
+
}> & {
|
|
5
|
+
actions?(): unknown;
|
|
6
|
+
};
|
|
7
|
+
refs: {};
|
|
8
|
+
attrs: Partial<{}>;
|
|
9
|
+
};
|
|
10
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
11
|
+
declare const __VLS_component: import("vue").DefineComponent<{
|
|
12
|
+
/**
|
|
13
|
+
* label of the column
|
|
14
|
+
*/
|
|
15
|
+
label: string;
|
|
16
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
17
|
+
/**
|
|
18
|
+
* label of the column
|
|
19
|
+
*/
|
|
20
|
+
label: string;
|
|
21
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
23
|
+
export default _default;
|
|
24
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
25
|
+
new (): {
|
|
26
|
+
$slots: S;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { type Component, type WatchSource } from "vue";
|
|
2
|
+
import type { DataGridRendererColumn, DataGridRendererRow } from "../../..";
|
|
3
|
+
import type { DataGridEntry, DataGridMetadata } from "../types";
|
|
4
|
+
export type DataGridFeature<TEntry extends DataGridEntry, TFeatureName extends symbol> = {
|
|
5
|
+
/**
|
|
6
|
+
* Unique name and identifier of the datagrid feature
|
|
7
|
+
*/
|
|
8
|
+
name: TFeatureName;
|
|
9
|
+
/**
|
|
10
|
+
* An array of reactive states that should trigger a datagrid re-generation
|
|
11
|
+
*/
|
|
12
|
+
watch: WatchSource[];
|
|
13
|
+
/**
|
|
14
|
+
* Allows modifying the datagrid state as a whole.
|
|
15
|
+
*/
|
|
16
|
+
mutation?: {
|
|
17
|
+
func: (state: Readonly<TEntry>[]) => void;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Allows the modification of the headers.
|
|
21
|
+
*/
|
|
22
|
+
header?: {
|
|
23
|
+
/**
|
|
24
|
+
* Adds header icon button(s).
|
|
25
|
+
* `iconComponent` of an action is shown after the header label.
|
|
26
|
+
* The components must be ARIA-conform buttons.
|
|
27
|
+
*/
|
|
28
|
+
actions?: (column: keyof TEntry) => {
|
|
29
|
+
iconComponent: Component;
|
|
30
|
+
listComponent?: never;
|
|
31
|
+
}[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Helper function that infers the generics of the DataGridFeature type.
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
*
|
|
39
|
+
* const MY_FEATURE = Symbol("TABLE_HEADER_BUTTON");
|
|
40
|
+
* export const useDataGridHeaderButton = createFeature(<TEntry extends DataGridEntry>() => {
|
|
41
|
+
* return {
|
|
42
|
+
* name: MY_FEATURE,
|
|
43
|
+
* header: {
|
|
44
|
+
* actions: (column) => [
|
|
45
|
+
* {
|
|
46
|
+
* iconComponent: h('button', { onClick: (column) => console.log(`Clicked on ${column}`) },),
|
|
47
|
+
* },
|
|
48
|
+
* ],
|
|
49
|
+
* },
|
|
50
|
+
* };
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare const createFeature: <TFeatureName extends symbol, TArgs extends unknown[]>(featureDefinition: <TEntry extends DataGridEntry>(...args: TArgs) => DataGridFeature<TEntry, TFeatureName>) => <TEntry extends DataGridEntry>(...args: TArgs) => DataGridFeature<TEntry, TFeatureName>;
|
|
55
|
+
type ExtractTEntry<T> = T extends DataGridFeature<infer I, symbol>[] ? I : never;
|
|
56
|
+
/**
|
|
57
|
+
* Uses the defined datagrid features to provide factory functions.
|
|
58
|
+
* These factories are to be used to map data and configuration to `OnyxDataGridRenderer` properties.
|
|
59
|
+
* The properties are then used to render the data grid.
|
|
60
|
+
*
|
|
61
|
+
* Make use of the `watchSources` to trigger re-rendering when state changes occur.
|
|
62
|
+
* @example
|
|
63
|
+
* ```vue
|
|
64
|
+
* <script setup lang="ts">
|
|
65
|
+
* // ...
|
|
66
|
+
* // imports, props, emits, etc.
|
|
67
|
+
* const withHeaderButton = useDataGridHeaderButton<TEntry>();
|
|
68
|
+
*
|
|
69
|
+
* const { watchSources, createRendererRows, createRendererColumns } = useDataGridFeatures([withHeaderButton]);
|
|
70
|
+
*
|
|
71
|
+
* const renderCols: Ref<DataGridRendererColumn<TEntry, object>[]> = ref([]);
|
|
72
|
+
* const renderRows: Ref<DataGridRendererRow<TEntry, DataGridMetadata>[]> = ref([]);
|
|
73
|
+
*
|
|
74
|
+
* const { columns, data } = toRefs(props);
|
|
75
|
+
*
|
|
76
|
+
* watch(
|
|
77
|
+
* [columns, data, ...watchSources],
|
|
78
|
+
* ([newColumns, newData]) => {
|
|
79
|
+
* renderCols.value = createRendererColumns(newColumns);
|
|
80
|
+
* renderRows.value = createRendererRows(newData, newColumns);
|
|
81
|
+
* },
|
|
82
|
+
* { immediate: true },
|
|
83
|
+
* );
|
|
84
|
+
* </script>
|
|
85
|
+
* <template>
|
|
86
|
+
* <OnyxDataGridRenderer :columns="renderCols" :rows="renderRows" />
|
|
87
|
+
* </template>
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
export declare const useDataGridFeatures: <T extends DataGridFeature<TEntry, symbol>[] | [], TEntry extends DataGridEntry = ExtractTEntry<T>>(features: T) => {
|
|
91
|
+
/** Takes the column definition and maps all, calls mutation func and maps at the end to RendererCell */
|
|
92
|
+
createRendererRows: (entries: TEntry[], columns: (keyof TEntry)[]) => DataGridRendererRow<TEntry, DataGridMetadata>[];
|
|
93
|
+
/** Takes the column definition and creates a RenderHeader for each, adds actions from features */
|
|
94
|
+
createRendererColumns: (columns: (keyof TEntry)[]) => DataGridRendererColumn<TEntry, object>[];
|
|
95
|
+
watchSources: WatchSource[];
|
|
96
|
+
};
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SortDirection } from "./sorting";
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{
|
|
3
|
+
/**
|
|
4
|
+
* Label of this Column.
|
|
5
|
+
*/
|
|
6
|
+
columnLabel: string;
|
|
7
|
+
/**
|
|
8
|
+
* The current sorting direction, that should be indicated.
|
|
9
|
+
*/
|
|
10
|
+
sortDirection?: SortDirection;
|
|
11
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
12
|
+
/**
|
|
13
|
+
* Label of this Column.
|
|
14
|
+
*/
|
|
15
|
+
columnLabel: string;
|
|
16
|
+
/**
|
|
17
|
+
* The current sorting direction, that should be indicated.
|
|
18
|
+
*/
|
|
19
|
+
sortDirection?: SortDirection;
|
|
20
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DataGridEntry } from "../../types";
|
|
2
|
+
export type SortDirection = "asc" | "desc" | "none";
|
|
3
|
+
export declare const nextSortDirection: (current?: SortDirection) => SortDirection;
|
|
4
|
+
declare const SORTING_FEATURE: unique symbol;
|
|
5
|
+
export declare const useDataGridSorting: <TEntry extends DataGridEntry>() => import("..").DataGridFeature<TEntry, typeof SORTING_FEATURE>;
|
|
6
|
+
export {};
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
export type DataGridMetadata = Record<string, unknown>;
|
|
2
|
+
/**
|
|
3
|
+
* @experimental The DataGrid is still working in progress and the props will change in the future.
|
|
4
|
+
*/
|
|
5
|
+
export type OnyxDataGridProps<TEntry extends DataGridEntry> = {
|
|
6
|
+
/**
|
|
7
|
+
* The order of and which columns should be rendered.
|
|
8
|
+
*/
|
|
9
|
+
columns: (keyof TEntry)[];
|
|
10
|
+
/**
|
|
11
|
+
* The data that should be used to fill the datagrid.
|
|
12
|
+
*/
|
|
13
|
+
data: TEntry[];
|
|
14
|
+
};
|
|
2
15
|
/**
|
|
3
16
|
* "Raw" user data for a data grid entry/row, e.g. fetched from a backend service.
|
|
4
17
|
*/
|
|
@@ -54,7 +54,7 @@ export type OnyxInputProps = FormInjectedProps & DensityProp & RequiredMarkerPro
|
|
|
54
54
|
loading?: boolean;
|
|
55
55
|
/**
|
|
56
56
|
* Minimum number of characters that have to to be entered.
|
|
57
|
-
* Warning: when the value is (pre)set
|
|
57
|
+
* Warning: when the value is (pre)set programmatically,
|
|
58
58
|
* the input invalidity will not be detected by the browser, it will only turn invalid
|
|
59
59
|
* as soon as a user interacts with the input (types something).
|
|
60
60
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DensityProp } from "../../composables/density";
|
|
2
2
|
import type { RequiredMarkerProp } from "../../composables/required";
|
|
3
3
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
4
|
+
import type { SkeletonInjected } from "../../composables/useSkeletonState";
|
|
4
5
|
import type { AutofocusProp, BaseSelectOption, Direction, SelectOptionValue } from "../../types";
|
|
5
6
|
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
6
7
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
@@ -30,6 +31,6 @@ export type OnyxRadioGroupProps<TValue extends SelectOptionValue = SelectOptionV
|
|
|
30
31
|
/**
|
|
31
32
|
* If set, the specified number of skeleton radio buttons will be shown.
|
|
32
33
|
*/
|
|
33
|
-
skeleton?:
|
|
34
|
+
skeleton?: SkeletonInjected;
|
|
34
35
|
};
|
|
35
36
|
export type RadioButtonOption<TValue extends SelectOptionValue = SelectOptionValue> = Omit<BaseSelectOption<TValue>, "hideLabel"> & AutofocusProp;
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { OnyxStepperProps } from "./types";
|
|
2
|
-
declare
|
|
2
|
+
declare let __VLS_typeProps: OnyxStepperProps;
|
|
3
|
+
type __VLS_PublicProps = {
|
|
4
|
+
modelValue?: number;
|
|
5
|
+
} & typeof __VLS_typeProps;
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
7
|
validityChange: (validity: ValidityState) => any;
|
|
4
|
-
"update:modelValue": (
|
|
5
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
8
|
+
"update:modelValue": (modelValue: number) => any;
|
|
9
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
6
10
|
onValidityChange?: ((validity: ValidityState) => any) | undefined;
|
|
7
|
-
"onUpdate:modelValue"?: ((
|
|
11
|
+
"onUpdate:modelValue"?: ((modelValue: number) => any) | undefined;
|
|
8
12
|
}>, {
|
|
9
13
|
skeleton: import("../../composables/useSkeletonState").SkeletonInjected;
|
|
10
14
|
disabled: boolean | symbol;
|
|
11
15
|
showError: boolean | symbol | "touched";
|
|
12
16
|
loading: boolean;
|
|
13
|
-
step: number;
|
|
14
17
|
readonly: boolean;
|
|
18
|
+
precision: number;
|
|
19
|
+
stripStep: boolean;
|
|
15
20
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
16
21
|
export default _default;
|
|
@@ -6,10 +6,6 @@ import type { FormInjectedProps } from "../OnyxForm/OnyxForm.core";
|
|
|
6
6
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
7
7
|
import type { Autocomplete } from "../OnyxInput/types";
|
|
8
8
|
export type OnyxStepperProps = FormInjectedProps & DensityProp & CustomValidityProp & Omit<OnyxFormElementProps, "modelValue" | "errorMessages" | "withCounter" | "maxlength"> & AutofocusProp & {
|
|
9
|
-
/**
|
|
10
|
-
* Current value of the input.
|
|
11
|
-
*/
|
|
12
|
-
modelValue?: number;
|
|
13
9
|
/**
|
|
14
10
|
* Same as the native `name` attribute of `<input>`.
|
|
15
11
|
* Used to reference the input in JavaScript or in submitted form data.
|
|
@@ -30,7 +26,24 @@ export type OnyxStepperProps = FormInjectedProps & DensityProp & CustomValidityP
|
|
|
30
26
|
/**
|
|
31
27
|
* Incremental step.
|
|
32
28
|
*/
|
|
29
|
+
/**
|
|
30
|
+
* Incremental step.
|
|
31
|
+
* @deprecated
|
|
32
|
+
*/
|
|
33
33
|
step?: number;
|
|
34
|
+
/**
|
|
35
|
+
* The smallest allowed value and rounded precision
|
|
36
|
+
*/
|
|
37
|
+
precision?: number;
|
|
38
|
+
/**
|
|
39
|
+
* The increment number
|
|
40
|
+
* @default precision is the default stepSize
|
|
41
|
+
*/
|
|
42
|
+
stepSize?: number;
|
|
43
|
+
/**
|
|
44
|
+
* Ensure no wrong number can be inputed
|
|
45
|
+
*/
|
|
46
|
+
stripStep?: boolean;
|
|
34
47
|
/**
|
|
35
48
|
* Specify how to provide automated assistance in filling out the input.
|
|
36
49
|
* Some autocomplete values might required specific browser permissions to be allowed by the user.
|
|
@@ -19,7 +19,7 @@ export type UseCustomValidityOptions = {
|
|
|
19
19
|
minlength?: number;
|
|
20
20
|
min?: number;
|
|
21
21
|
max?: number;
|
|
22
|
-
|
|
22
|
+
precision?: number;
|
|
23
23
|
} & Pick<BaseSelectOption, "hideLabel" | "label">;
|
|
24
24
|
/**
|
|
25
25
|
* Component emit as defined with `const emit = defineEmits()`
|
|
@@ -10,7 +10,7 @@ export type SkeletonProvidedProp = {
|
|
|
10
10
|
* Prop that may be used by the child components.
|
|
11
11
|
*/
|
|
12
12
|
type LocalProps = {
|
|
13
|
-
skeleton: symbol | boolean;
|
|
13
|
+
skeleton: symbol | boolean | number;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
16
|
* Symbol for the skeleton injected property.
|
|
@@ -22,6 +22,9 @@ export type SKELETON_INJECTED = symbol;
|
|
|
22
22
|
* The prop **MUST** use `SKELETON_INJECTED_SYMBOL` as default value.
|
|
23
23
|
* `useSkeletonContext` is used to access the injected parent property.
|
|
24
24
|
*
|
|
25
|
+
* NOTE: The number type is used only for OnyxRadioGroup and OnyxCheckboxGroup components.
|
|
26
|
+
* NOTE: The number type is not intended to be used by other properties with boolean skeleton prop.
|
|
27
|
+
*
|
|
25
28
|
* @example
|
|
26
29
|
* ```ts
|
|
27
30
|
* const props = withDefaults(defineProps<OnyxComponentProps>(), {
|
|
@@ -31,7 +34,7 @@ export type SKELETON_INJECTED = symbol;
|
|
|
31
34
|
* const skeleton = useSkeletonContext(props);
|
|
32
35
|
* ```
|
|
33
36
|
*/
|
|
34
|
-
export type SkeletonInjected = symbol | boolean;
|
|
37
|
+
export type SkeletonInjected = symbol | boolean | number;
|
|
35
38
|
export declare const provideSkeletonContext: (parentElementProps: Reactive<SkeletonProvidedProp> | undefined) => void;
|
|
36
39
|
/**
|
|
37
40
|
* Provides the injected parent property (if available).
|
|
@@ -50,5 +53,5 @@ export declare const provideSkeletonContext: (parentElementProps: Reactive<Skele
|
|
|
50
53
|
* const skeleton = useSkeletonContext(props);
|
|
51
54
|
* ```
|
|
52
55
|
*/
|
|
53
|
-
export declare const useSkeletonContext: (props: Reactive<LocalProps>) => ComputedRef<boolean>;
|
|
56
|
+
export declare const useSkeletonContext: (props: Reactive<LocalProps>) => ComputedRef<number | boolean>;
|
|
54
57
|
export {};
|