@naptics/vue-collection 0.2.11 → 0.2.13
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.
|
@@ -95,6 +95,7 @@ export declare const nCrudModalProps: {
|
|
|
95
95
|
readonly onOk: PropType<() => void>;
|
|
96
96
|
readonly onCancel: PropType<() => void>;
|
|
97
97
|
readonly modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
98
|
+
readonly content: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
98
99
|
readonly header: PropType<() => JSX.Element>;
|
|
99
100
|
readonly footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
100
101
|
readonly value: PropType<boolean>;
|
|
@@ -200,6 +201,7 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
200
201
|
readonly onOk: PropType<() => void>;
|
|
201
202
|
readonly onCancel: PropType<() => void>;
|
|
202
203
|
readonly modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
204
|
+
readonly content: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
203
205
|
readonly header: PropType<() => JSX.Element>;
|
|
204
206
|
readonly footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
205
207
|
readonly value: PropType<boolean>;
|
|
@@ -299,6 +301,7 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
299
301
|
readonly onOk: PropType<() => void>;
|
|
300
302
|
readonly onCancel: PropType<() => void>;
|
|
301
303
|
readonly modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
304
|
+
readonly content: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
302
305
|
readonly header: PropType<() => JSX.Element>;
|
|
303
306
|
readonly footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
304
307
|
readonly value: PropType<boolean>;
|
|
@@ -52,6 +52,7 @@ export declare const nFormModalProps: {
|
|
|
52
52
|
readonly onOk: PropType<() => void>;
|
|
53
53
|
readonly onCancel: PropType<() => void>;
|
|
54
54
|
readonly modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
55
|
+
readonly content: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
55
56
|
readonly header: PropType<() => JSX.Element>;
|
|
56
57
|
readonly footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
57
58
|
readonly value: PropType<boolean>;
|
|
@@ -113,6 +114,7 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
113
114
|
readonly onOk: PropType<() => void>;
|
|
114
115
|
readonly onCancel: PropType<() => void>;
|
|
115
116
|
readonly modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
117
|
+
readonly content: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
116
118
|
readonly header: PropType<() => JSX.Element>;
|
|
117
119
|
readonly footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
118
120
|
readonly value: PropType<boolean>;
|
|
@@ -168,6 +170,7 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
168
170
|
readonly onOk: PropType<() => void>;
|
|
169
171
|
readonly onCancel: PropType<() => void>;
|
|
170
172
|
readonly modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
173
|
+
readonly content: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
171
174
|
readonly header: PropType<() => JSX.Element>;
|
|
172
175
|
readonly footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
173
176
|
readonly value: PropType<boolean>;
|
package/components/NModal.d.ts
CHANGED
|
@@ -92,6 +92,10 @@ export declare const nModalProps: {
|
|
|
92
92
|
* A slot to replace the whole modal content including all buttons, header and footer.
|
|
93
93
|
*/
|
|
94
94
|
readonly modal: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
95
|
+
/**
|
|
96
|
+
* A slot to replace the whole content section, i.e. everything between the header and the footer.
|
|
97
|
+
*/
|
|
98
|
+
readonly content: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
95
99
|
/**
|
|
96
100
|
* A slot to replace the whole header section (excluding the x).
|
|
97
101
|
*/
|
|
@@ -203,6 +207,10 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
203
207
|
* A slot to replace the whole modal content including all buttons, header and footer.
|
|
204
208
|
*/
|
|
205
209
|
readonly modal: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
210
|
+
/**
|
|
211
|
+
* A slot to replace the whole content section, i.e. everything between the header and the footer.
|
|
212
|
+
*/
|
|
213
|
+
readonly content: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
206
214
|
/**
|
|
207
215
|
* A slot to replace the whole header section (excluding the x).
|
|
208
216
|
*/
|
|
@@ -305,6 +313,10 @@ declare const Component: import("vue").DefineComponent<{
|
|
|
305
313
|
* A slot to replace the whole modal content including all buttons, header and footer.
|
|
306
314
|
*/
|
|
307
315
|
readonly modal: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
316
|
+
/**
|
|
317
|
+
* A slot to replace the whole content section, i.e. everything between the header and the footer.
|
|
318
|
+
*/
|
|
319
|
+
readonly content: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
308
320
|
/**
|
|
309
321
|
* A slot to replace the whole header section (excluding the x).
|
|
310
322
|
*/
|
package/components/NModal.js
CHANGED
|
@@ -99,6 +99,10 @@ export const nModalProps = {
|
|
|
99
99
|
* A slot to replace the whole modal content including all buttons, header and footer.
|
|
100
100
|
*/
|
|
101
101
|
modal: Function,
|
|
102
|
+
/**
|
|
103
|
+
* A slot to replace the whole content section, i.e. everything between the header and the footer.
|
|
104
|
+
*/
|
|
105
|
+
content: Function,
|
|
102
106
|
/**
|
|
103
107
|
* A slot to replace the whole header section (excluding the x).
|
|
104
108
|
*/
|
|
@@ -183,7 +187,10 @@ const Component = createComponentWithSlots('NModal', nModalProps, ['modal', 'hea
|
|
|
183
187
|
"class": "text-lg font-semibold"
|
|
184
188
|
}, {
|
|
185
189
|
default: () => [props.title]
|
|
186
|
-
})]),
|
|
190
|
+
})]), props.content?.({
|
|
191
|
+
ok,
|
|
192
|
+
cancel
|
|
193
|
+
}) || _createVNode("div", {
|
|
187
194
|
"class": "px-4 sm:px-6 py-4 rounded-lg"
|
|
188
195
|
}, [slots.default?.()]), !props.hideFooter && _createVNode("div", {
|
|
189
196
|
"class": "px-4 sm:px-6 pb-4 pt-2 bg-default-50 rounded-b-lg"
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@naptics/vue-collection",
|
|
3
3
|
"author": "Timo Siegenthaler",
|
|
4
4
|
"description": "Vue Collection is a collection of styled and fully functional Vue components which can easily be integrated into our projects.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.13",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
package/utils/identifiable.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type Nullish } from './utils';
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
id: IdType;
|
|
2
|
+
export type Identifiable<Id = string> = Readonly<{
|
|
3
|
+
id: Id;
|
|
5
4
|
}>;
|
|
6
|
-
export type MaybeIdentifiable = Readonly<{
|
|
7
|
-
id?: Nullish<
|
|
5
|
+
export type MaybeIdentifiable<Id = string> = Readonly<{
|
|
6
|
+
id?: Nullish<Id>;
|
|
8
7
|
}>;
|
|
9
8
|
/**
|
|
10
9
|
* Looks for the `id` in the given array of `Identifiables`.
|
|
@@ -12,14 +11,14 @@ export type MaybeIdentifiable = Readonly<{
|
|
|
12
11
|
* @param id The `id` of the desired item.
|
|
13
12
|
* @returns The first item with the specified `id` or `undefined` if none exists.
|
|
14
13
|
*/
|
|
15
|
-
declare function find<
|
|
14
|
+
declare function find<Id, Item extends Identifiable<Id>>(array: Nullish<Item[]>, id: Id): Item | undefined;
|
|
16
15
|
/**
|
|
17
16
|
* Checks if the given array contains an item with the `id`.
|
|
18
17
|
* @param array The array to search the item in.
|
|
19
18
|
* @param id The `id` to check the array for.
|
|
20
19
|
* @returns `true` if there is at least one item in the array with the given `id`.
|
|
21
20
|
*/
|
|
22
|
-
declare function contains<
|
|
21
|
+
declare function contains<Id, Item extends Identifiable<Id>>(array: Item[], id: Id): boolean;
|
|
23
22
|
/**
|
|
24
23
|
* Inserts the items into the given array, replacing items with the same `id`.
|
|
25
24
|
* If no item with the same `id` exists, the item is appended to the array.
|
|
@@ -28,14 +27,14 @@ declare function contains<T extends Identifiable>(array: T[], id: IdType): boole
|
|
|
28
27
|
* @param insertItems The items to insert into the array.
|
|
29
28
|
* @returns The reference to the same array, which was passed.
|
|
30
29
|
*/
|
|
31
|
-
declare function insert<
|
|
30
|
+
declare function insert<Id, Item extends Identifiable<Id>>(array: Item[], ...insertItems: Item[]): Item[];
|
|
32
31
|
/**
|
|
33
32
|
* Removes all items with the specified `ids` from the given array.
|
|
34
33
|
* @param array The array to remove the items from.
|
|
35
34
|
* @param ids The `ids` of the items which should be removed.
|
|
36
35
|
* @returns The reference to the same array, which was passed.
|
|
37
36
|
*/
|
|
38
|
-
declare function remove<
|
|
37
|
+
declare function remove<Id, Item extends Identifiable>(array: Item[], ...ids: Id[]): Item[];
|
|
39
38
|
/**
|
|
40
39
|
* Compares the two arrays and checks if they both have
|
|
41
40
|
* items with the same `ids` in the same order.
|
|
@@ -43,7 +42,7 @@ declare function remove<T extends Identifiable>(array: T[], ...ids: IdType[]): T
|
|
|
43
42
|
* @param second The second array to compare.
|
|
44
43
|
* @returns `true` if the arrays contain item with the same `ids` in the same order.
|
|
45
44
|
*/
|
|
46
|
-
declare function areSameArrays(first: Identifiable[], second: Identifiable[]): boolean;
|
|
45
|
+
declare function areSameArrays<Id>(first: Identifiable<Id>[], second: Identifiable<Id>[]): boolean;
|
|
47
46
|
/**
|
|
48
47
|
* This object contains utility functions to deal with {@link Identifiable} objects.
|
|
49
48
|
*/
|