@bgottsch/d-naive 1.8.9

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/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # d-naive
2
+
3
+ ## Overview
4
+
5
+ `d-naive` is a Vue library designed to enhance Naive UI components with additional functionalities for complex data handling and user input management. It includes a robust `DDataTable` component and a versatile `DInput` component, making it suitable for a wide range of applications.
6
+
7
+ ## Installation
8
+
9
+ Install `d-naive` with npm:
10
+
11
+ ```bash
12
+ npm install d-naive
13
+ ```
14
+ ## Components
15
+
16
+ ### DataTable
17
+
18
+ The `DataTable` component provides advanced features such as sorting, pagination, filtering, and cell editing.
19
+
20
+ #### Props
21
+
22
+ - **data**: Array of data objects.
23
+ - **columns**: Definitions of the table columns.
24
+ - **pagination**: Configuration options for pagination.
25
+ - **editable**: Boolean to enable editing directly in the table.
26
+ - **scrollX**: Horizontal scrolling setting.
27
+
28
+ #### Events
29
+
30
+ - **update:expanded**: Emitted when the expanded rows are updated.
31
+ - **put**: Emitted after confirming data modifications.
32
+ - **delete**: Emitted when an item is deleted.
33
+
34
+ #### Methods
35
+
36
+ - **resetFilters()**: Clears all applied filters.
37
+ - **scrollTo(value)**: Scrolls to the specified row.
38
+ - **getData()**: Returns the current data displayed in the table.
39
+
40
+ ### DInput
41
+
42
+ The `DInput` component manages various types of inputs including text, select, number, date, and checkbox, with options for validation and custom formatting.
43
+
44
+ #### Props
45
+
46
+ - **modelValue**: The input's bound value.
47
+ - **type**: The type of input (e.g., text, select, date).
48
+ - **options**: Options for select inputs, if applicable.
49
+
50
+ #### Events
51
+
52
+ - **update:modelValue**: Emitted when the input value changes.
53
+
54
+ ## Helper Functions
55
+
56
+ ### `formatValue(row, field)`
57
+
58
+ Formats a value based on the specified field's type.
59
+
60
+ ### `getValue(row, field)`
61
+
62
+ Retrieves a value from an object based on a dot-notated key string.
63
+
64
+ ## Usage Example
65
+
66
+ Here is an example of using the `DDataTable` component in a Vue application:
67
+
68
+ ```vue
69
+ <template>
70
+ <d-data-table :data="users" :columns="columns" />
71
+ </template>
72
+
73
+ <script>
74
+
75
+ export default {
76
+
77
+ data() {
78
+ return {
79
+ users: [{ id: 1, name: 'John Doe', age: 30 }],
80
+ columns: [
81
+ { title: 'ID', key: 'id' },
82
+ { title: 'Name', key: 'name' },
83
+ { title: 'Age', key: 'age', sortable: true }
84
+ ]
85
+ };
86
+ }
87
+ }
88
+ </script>
@@ -0,0 +1,6 @@
1
+ interface ModuleOptions {
2
+ }
3
+ declare const _default: any;
4
+
5
+ export { _default as default };
6
+ export type { ModuleOptions };
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "d-naive",
3
+ "configKey": "d-naive",
4
+ "version": "1.8.9",
5
+ "builder": {
6
+ "@nuxt/module-builder": "1.0.2",
7
+ "unbuild": "3.6.1"
8
+ }
9
+ }
@@ -0,0 +1,33 @@
1
+ import { defineNuxtModule, createResolver, addComponentsDir, addImports, addPluginTemplate } from '@nuxt/kit';
2
+
3
+ const module$1 = defineNuxtModule({
4
+ meta: {
5
+ name: "d-naive",
6
+ configKey: "d-naive"
7
+ },
8
+ // Default configuration options of the Nuxt module
9
+ defaults: {},
10
+ setup(options) {
11
+ const { resolve } = createResolver(import.meta.url);
12
+ const plugin = `import { defineNuxtPlugin } from '#imports';
13
+ export default defineNuxtPlugin((nuxtApp) => {
14
+ nuxtApp.provide('dNaive', ${JSON.stringify(options)})
15
+ })`;
16
+ addComponentsDir({
17
+ path: resolve("./runtime/components"),
18
+ pathPrefix: false,
19
+ prefix: "d",
20
+ global: true
21
+ });
22
+ addImports([
23
+ ...[
24
+ "formatValue",
25
+ "getValue",
26
+ "toDate"
27
+ ].map((n) => ({ name: n, from: resolve("runtime/utils") }))
28
+ ]);
29
+ addPluginTemplate({ getContents: () => plugin, filename: "plugin.mjs" });
30
+ }
31
+ });
32
+
33
+ export { module$1 as default };
@@ -0,0 +1,45 @@
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: import("vue").DefineComponent<{}, {
4
+ sorterList: import("vue").Ref<never[], never[]>;
5
+ resetFilters: typeof resetFilters;
6
+ scrollTo: typeof scrollTo;
7
+ getData: typeof getData;
8
+ cols: import("vue").Ref<never[], never[]>;
9
+ $emit: typeof emit;
10
+ $props: Partial<typeof props>;
11
+ data: unknown[];
12
+ modelValue: string | number | Record<string, any>;
13
+ columns: unknown[];
14
+ selectable: boolean;
15
+ editable: boolean;
16
+ scrollX: string | number | boolean;
17
+ height: string | number;
18
+ returnObject: boolean;
19
+ selectedClass: string;
20
+ sortable: boolean;
21
+ draggable: boolean;
22
+ resizable: boolean;
23
+ filterable: boolean;
24
+ pagination?: boolean | Record<string, any> | undefined;
25
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
26
+ declare function resetFilters(): void;
27
+ declare function scrollTo(value: any): void;
28
+ declare function getData(): any;
29
+ declare const emit: (event: "update:modelValue" | "update:expanded" | "put" | "delete" | "dragColumn", ...args: any[]) => void;
30
+ declare const props: {
31
+ readonly data: unknown[];
32
+ readonly modelValue: string | number | Record<string, any>;
33
+ readonly columns: unknown[];
34
+ readonly selectable: boolean;
35
+ readonly editable: boolean;
36
+ readonly scrollX: string | number | boolean;
37
+ readonly height: string | number;
38
+ readonly returnObject: boolean;
39
+ readonly selectedClass: string;
40
+ readonly sortable: boolean;
41
+ readonly draggable: boolean;
42
+ readonly resizable: boolean;
43
+ readonly filterable: boolean;
44
+ readonly pagination?: boolean | Record<string, any> | undefined;
45
+ };