@naptics/vue-collection 0.3.1 → 1.0.0-beta.1
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/eslint.config.cjs +0 -2
- package/package.json +32 -31
- package/postcss.config.js +1 -4
- package/src/demo/App.css +47 -3
- package/src/demo/components/ComponentSection.tsx +1 -1
- package/src/demo/views/NavigationView.tsx +1 -1
- package/src/demo/views/presentation/TooltipView.tsx +8 -2
- package/src/lib/components/NAlert.tsx +3 -3
- package/src/lib/components/NBadge.tsx +1 -1
- package/src/lib/components/NButton.tsx +6 -4
- package/src/lib/components/NCheckbox.tsx +2 -2
- package/src/lib/components/NDialog.tsx +2 -2
- package/src/lib/components/NDropdown.tsx +11 -9
- package/src/lib/components/NDropzone.tsx +4 -4
- package/src/lib/components/NIconButton.tsx +2 -2
- package/src/lib/components/NInput.tsx +1 -1
- package/src/lib/components/NLink.tsx +1 -1
- package/src/lib/components/NModal.tsx +4 -4
- package/src/lib/components/NPagination.css +4 -2
- package/src/lib/components/NPagination.tsx +1 -1
- package/src/lib/components/NSearchbar.tsx +1 -1
- package/src/lib/components/NSelect.tsx +1 -1
- package/src/lib/components/NSuggestionList.tsx +1 -1
- package/src/lib/components/NTable.css +2 -0
- package/src/lib/components/NTableAction.tsx +1 -1
- package/src/lib/components/NTextArea.tsx +1 -1
- package/src/lib/components/NTooltip.css +2 -0
- package/src/lib/components/NTooltip.tsx +42 -3
- package/src/lib/utils/component.tsx +1 -1
- package/tsconfig.lib.json +1 -0
- package/vite.config.ts +2 -0
- package/components/NAlert.d.ts +0 -29
- package/components/NAlert.js +0 -84
- package/components/NBadge.d.ts +0 -69
- package/components/NBadge.js +0 -64
- package/components/NBreadcrub.d.ts +0 -69
- package/components/NBreadcrub.js +0 -71
- package/components/NButton.d.ts +0 -60
- package/components/NButton.js +0 -72
- package/components/NCheckbox.d.ts +0 -20
- package/components/NCheckbox.js +0 -43
- package/components/NCheckboxLabel.d.ts +0 -26
- package/components/NCheckboxLabel.js +0 -42
- package/components/NCrudModal.d.ts +0 -118
- package/components/NCrudModal.js +0 -120
- package/components/NDialog.d.ts +0 -81
- package/components/NDialog.js +0 -161
- package/components/NDropdown.d.ts +0 -67
- package/components/NDropdown.js +0 -115
- package/components/NDropzone.d.ts +0 -61
- package/components/NDropzone.js +0 -218
- package/components/NForm.d.ts +0 -21
- package/components/NForm.js +0 -29
- package/components/NFormModal.d.ts +0 -75
- package/components/NFormModal.js +0 -59
- package/components/NIconButton.d.ts +0 -79
- package/components/NIconButton.js +0 -88
- package/components/NIconCircle.d.ts +0 -49
- package/components/NIconCircle.js +0 -67
- package/components/NInput.css +0 -11
- package/components/NInput.d.ts +0 -90
- package/components/NInput.js +0 -110
- package/components/NInputPhone.d.ts +0 -54
- package/components/NInputPhone.js +0 -47
- package/components/NInputSelect.d.ts +0 -99
- package/components/NInputSelect.js +0 -115
- package/components/NInputSuggestion.d.ts +0 -75
- package/components/NInputSuggestion.js +0 -64
- package/components/NLink.d.ts +0 -47
- package/components/NLink.js +0 -67
- package/components/NList.d.ts +0 -37
- package/components/NList.js +0 -40
- package/components/NLoadingIndicator.css +0 -46
- package/components/NLoadingIndicator.d.ts +0 -29
- package/components/NLoadingIndicator.js +0 -54
- package/components/NModal.d.ts +0 -133
- package/components/NModal.js +0 -232
- package/components/NPagination.css +0 -15
- package/components/NPagination.d.ts +0 -37
- package/components/NPagination.js +0 -105
- package/components/NSearchbar.d.ts +0 -39
- package/components/NSearchbar.js +0 -64
- package/components/NSearchbarList.d.ts +0 -33
- package/components/NSearchbarList.js +0 -41
- package/components/NSelect.d.ts +0 -78
- package/components/NSelect.js +0 -101
- package/components/NSuggestionList.d.ts +0 -153
- package/components/NSuggestionList.js +0 -160
- package/components/NTable.css +0 -3
- package/components/NTable.d.ts +0 -97
- package/components/NTable.js +0 -128
- package/components/NTableAction.d.ts +0 -30
- package/components/NTableAction.js +0 -50
- package/components/NTextArea.d.ts +0 -92
- package/components/NTextArea.js +0 -133
- package/components/NTooltip.css +0 -37
- package/components/NTooltip.d.ts +0 -136
- package/components/NTooltip.js +0 -207
- package/components/NValInput.d.ts +0 -155
- package/components/NValInput.js +0 -113
- package/components/ValidatedForm.d.ts +0 -39
- package/components/ValidatedForm.js +0 -35
- package/i18n/de/vue-collection.json +0 -58
- package/i18n/en/vue-collection.json +0 -58
- package/i18n/index.d.ts +0 -40
- package/i18n/index.js +0 -31
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/tailwind.config.js +0 -38
- package/utils/breakpoints.d.ts +0 -18
- package/utils/breakpoints.js +0 -40
- package/utils/component.d.ts +0 -57
- package/utils/component.js +0 -79
- package/utils/deferred.d.ts +0 -13
- package/utils/deferred.js +0 -17
- package/utils/identifiable.d.ts +0 -56
- package/utils/identifiable.js +0 -81
- package/utils/stringMaxLength.d.ts +0 -14
- package/utils/stringMaxLength.js +0 -23
- package/utils/tailwind.d.ts +0 -4
- package/utils/tailwind.js +0 -1
- package/utils/utils.d.ts +0 -47
- package/utils/utils.js +0 -56
- package/utils/vModel.d.ts +0 -182
- package/utils/vModel.js +0 -224
- package/utils/validation.d.ts +0 -90
- package/utils/validation.js +0 -147
- package/utils/vue.d.ts +0 -13
- package/utils/vue.js +0 -21
package/components/NModal.d.ts
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import type { PropType } from 'vue';
|
|
2
|
-
import type { TWMaxWidth } from '../utils/tailwind';
|
|
3
|
-
export declare const nModalProps: {
|
|
4
|
-
/**
|
|
5
|
-
* If set to `true` the header of the modal is hidden.
|
|
6
|
-
*/
|
|
7
|
-
readonly hideHeader: BooleanConstructor;
|
|
8
|
-
/**
|
|
9
|
-
* If set to `true` the footer of the modal is hidden.
|
|
10
|
-
*/
|
|
11
|
-
readonly hideFooter: BooleanConstructor;
|
|
12
|
-
/**
|
|
13
|
-
* If set to `true` the X-button in the top right is hidden.
|
|
14
|
-
*/
|
|
15
|
-
readonly hideX: BooleanConstructor;
|
|
16
|
-
/**
|
|
17
|
-
* The maximum width of the modal. A regular tailwind class.
|
|
18
|
-
*/
|
|
19
|
-
readonly maxWidth: {
|
|
20
|
-
readonly type: PropType<TWMaxWidth>;
|
|
21
|
-
readonly default: "max-w-md";
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* The vertical position of the modal. Default is `center`.
|
|
25
|
-
*/
|
|
26
|
-
readonly verticalPosition: {
|
|
27
|
-
readonly type: PropType<"start" | "center" | "end">;
|
|
28
|
-
readonly default: "center";
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* The horizontal position of the modal. Default is `center`.
|
|
32
|
-
*/
|
|
33
|
-
readonly horizontalPosition: {
|
|
34
|
-
readonly type: PropType<"start" | "center" | "end">;
|
|
35
|
-
readonly default: "center";
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* The title of the modal which is displayed in the header.
|
|
39
|
-
*/
|
|
40
|
-
readonly title: StringConstructor;
|
|
41
|
-
/**
|
|
42
|
-
* The text of the ok-button.
|
|
43
|
-
*/
|
|
44
|
-
readonly okText: {
|
|
45
|
-
readonly type: StringConstructor;
|
|
46
|
-
readonly default: string;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* The color of the ok-button.
|
|
50
|
-
*/
|
|
51
|
-
readonly okColor: {
|
|
52
|
-
readonly type: StringConstructor;
|
|
53
|
-
readonly default: "primary";
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* If set to `true` the modal is closed when `onOk` is called.
|
|
57
|
-
*/
|
|
58
|
-
readonly closeOnOk: {
|
|
59
|
-
readonly type: BooleanConstructor;
|
|
60
|
-
readonly default: true;
|
|
61
|
-
};
|
|
62
|
-
/**
|
|
63
|
-
* If set to `true` the ok-button is hidden.
|
|
64
|
-
*/
|
|
65
|
-
readonly hideOk: BooleanConstructor;
|
|
66
|
-
/**
|
|
67
|
-
* If set to `true` the ok-button is disabled.
|
|
68
|
-
*/
|
|
69
|
-
readonly okDisabled: BooleanConstructor;
|
|
70
|
-
/**
|
|
71
|
-
* The text of the cancel-button.
|
|
72
|
-
*/
|
|
73
|
-
readonly cancelText: {
|
|
74
|
-
readonly type: StringConstructor;
|
|
75
|
-
readonly default: string;
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* The color of the cancel-button.
|
|
79
|
-
*/
|
|
80
|
-
readonly cancelColor: {
|
|
81
|
-
readonly type: StringConstructor;
|
|
82
|
-
readonly default: "default";
|
|
83
|
-
};
|
|
84
|
-
/**
|
|
85
|
-
* If set to `true`, the modal is closed when clicking on the background.
|
|
86
|
-
* This will call `onCancel`. Default is `true`.
|
|
87
|
-
*/
|
|
88
|
-
readonly closeOnBackground: {
|
|
89
|
-
readonly type: BooleanConstructor;
|
|
90
|
-
readonly default: true;
|
|
91
|
-
};
|
|
92
|
-
/**
|
|
93
|
-
* If set to `true` the cancel-button is hidden.
|
|
94
|
-
*/
|
|
95
|
-
readonly hideCancel: BooleanConstructor;
|
|
96
|
-
/**
|
|
97
|
-
* This is called when the ok-button was clicked.
|
|
98
|
-
*/
|
|
99
|
-
readonly onOk: PropType<() => void>;
|
|
100
|
-
/**
|
|
101
|
-
* This is called when the cancel-button or X-button was clicked or
|
|
102
|
-
* if the modal was closed by clicking on the background.
|
|
103
|
-
*/
|
|
104
|
-
readonly onCancel: PropType<() => void>;
|
|
105
|
-
/**
|
|
106
|
-
* A slot to replace the whole modal content including all buttons, header and footer.
|
|
107
|
-
*/
|
|
108
|
-
readonly modal: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
109
|
-
/**
|
|
110
|
-
* A slot to replace the whole content section, i.e. everything between the header and the footer.
|
|
111
|
-
*/
|
|
112
|
-
readonly content: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
113
|
-
/**
|
|
114
|
-
* A slot to replace the whole header section (excluding the x).
|
|
115
|
-
*/
|
|
116
|
-
readonly header: PropType<() => JSX.Element>;
|
|
117
|
-
/**
|
|
118
|
-
* A slot to replace the whole footer section.
|
|
119
|
-
*/
|
|
120
|
-
readonly footer: PropType<(props: ModalSlotProps) => JSX.Element>;
|
|
121
|
-
readonly value: PropType<boolean>;
|
|
122
|
-
readonly onUpdateValue: PropType<(newValue: boolean) => void>;
|
|
123
|
-
};
|
|
124
|
-
export type ModalSlotProps = {
|
|
125
|
-
ok: () => void;
|
|
126
|
-
cancel: () => void;
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* The `NModal` is the base component for all modals and dialogs.
|
|
130
|
-
* It provides the core mechanics to display a window in front of everything else.
|
|
131
|
-
*/
|
|
132
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
133
|
-
export { Component as NModal, Component as default };
|
package/components/NModal.js
DELETED
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
|
|
2
|
-
import { createComponentWithSlots } from '../utils/component';
|
|
3
|
-
import { Dialog, DialogOverlay, DialogTitle, TransitionRoot, TransitionChild } from '@headlessui/vue';
|
|
4
|
-
import NButton from './NButton';
|
|
5
|
-
import NIconButton from './NIconButton';
|
|
6
|
-
import { XMarkIcon } from '@heroicons/vue/24/solid';
|
|
7
|
-
import { trsl } from '../i18n';
|
|
8
|
-
import { vModelProps } from '../utils/vModel';
|
|
9
|
-
export const nModalProps = {
|
|
10
|
-
...vModelProps(Boolean),
|
|
11
|
-
/**
|
|
12
|
-
* If set to `true` the header of the modal is hidden.
|
|
13
|
-
*/
|
|
14
|
-
hideHeader: Boolean,
|
|
15
|
-
/**
|
|
16
|
-
* If set to `true` the footer of the modal is hidden.
|
|
17
|
-
*/
|
|
18
|
-
hideFooter: Boolean,
|
|
19
|
-
/**
|
|
20
|
-
* If set to `true` the X-button in the top right is hidden.
|
|
21
|
-
*/
|
|
22
|
-
hideX: Boolean,
|
|
23
|
-
/**
|
|
24
|
-
* The maximum width of the modal. A regular tailwind class.
|
|
25
|
-
*/
|
|
26
|
-
maxWidth: {
|
|
27
|
-
type: String,
|
|
28
|
-
default: 'max-w-md'
|
|
29
|
-
},
|
|
30
|
-
/**
|
|
31
|
-
* The vertical position of the modal. Default is `center`.
|
|
32
|
-
*/
|
|
33
|
-
verticalPosition: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: 'center'
|
|
36
|
-
},
|
|
37
|
-
/**
|
|
38
|
-
* The horizontal position of the modal. Default is `center`.
|
|
39
|
-
*/
|
|
40
|
-
horizontalPosition: {
|
|
41
|
-
type: String,
|
|
42
|
-
default: 'center'
|
|
43
|
-
},
|
|
44
|
-
/**
|
|
45
|
-
* The title of the modal which is displayed in the header.
|
|
46
|
-
*/
|
|
47
|
-
title: String,
|
|
48
|
-
/**
|
|
49
|
-
* The text of the ok-button.
|
|
50
|
-
*/
|
|
51
|
-
okText: {
|
|
52
|
-
type: String,
|
|
53
|
-
default: trsl('vue-collection.action.save')
|
|
54
|
-
},
|
|
55
|
-
/**
|
|
56
|
-
* The color of the ok-button.
|
|
57
|
-
*/
|
|
58
|
-
okColor: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: 'primary'
|
|
61
|
-
},
|
|
62
|
-
/**
|
|
63
|
-
* If set to `true` the modal is closed when `onOk` is called.
|
|
64
|
-
*/
|
|
65
|
-
closeOnOk: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
default: true
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* If set to `true` the ok-button is hidden.
|
|
71
|
-
*/
|
|
72
|
-
hideOk: Boolean,
|
|
73
|
-
/**
|
|
74
|
-
* If set to `true` the ok-button is disabled.
|
|
75
|
-
*/
|
|
76
|
-
okDisabled: Boolean,
|
|
77
|
-
/**
|
|
78
|
-
* The text of the cancel-button.
|
|
79
|
-
*/
|
|
80
|
-
cancelText: {
|
|
81
|
-
type: String,
|
|
82
|
-
default: trsl('vue-collection.action.cancel')
|
|
83
|
-
},
|
|
84
|
-
/**
|
|
85
|
-
* The color of the cancel-button.
|
|
86
|
-
*/
|
|
87
|
-
cancelColor: {
|
|
88
|
-
type: String,
|
|
89
|
-
default: 'default'
|
|
90
|
-
},
|
|
91
|
-
/**
|
|
92
|
-
* If set to `true`, the modal is closed when clicking on the background.
|
|
93
|
-
* This will call `onCancel`. Default is `true`.
|
|
94
|
-
*/
|
|
95
|
-
closeOnBackground: {
|
|
96
|
-
type: Boolean,
|
|
97
|
-
default: true
|
|
98
|
-
},
|
|
99
|
-
/**
|
|
100
|
-
* If set to `true` the cancel-button is hidden.
|
|
101
|
-
*/
|
|
102
|
-
hideCancel: Boolean,
|
|
103
|
-
/**
|
|
104
|
-
* This is called when the ok-button was clicked.
|
|
105
|
-
*/
|
|
106
|
-
onOk: Function,
|
|
107
|
-
/**
|
|
108
|
-
* This is called when the cancel-button or X-button was clicked or
|
|
109
|
-
* if the modal was closed by clicking on the background.
|
|
110
|
-
*/
|
|
111
|
-
onCancel: Function,
|
|
112
|
-
/**
|
|
113
|
-
* A slot to replace the whole modal content including all buttons, header and footer.
|
|
114
|
-
*/
|
|
115
|
-
modal: Function,
|
|
116
|
-
/**
|
|
117
|
-
* A slot to replace the whole content section, i.e. everything between the header and the footer.
|
|
118
|
-
*/
|
|
119
|
-
content: Function,
|
|
120
|
-
/**
|
|
121
|
-
* A slot to replace the whole header section (excluding the x).
|
|
122
|
-
*/
|
|
123
|
-
header: Function,
|
|
124
|
-
/**
|
|
125
|
-
* A slot to replace the whole footer section.
|
|
126
|
-
*/
|
|
127
|
-
footer: Function
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* The `NModal` is the base component for all modals and dialogs.
|
|
131
|
-
* It provides the core mechanics to display a window in front of everything else.
|
|
132
|
-
*/
|
|
133
|
-
const Component = createComponentWithSlots('NModal', nModalProps, ['modal', 'header', 'footer'], (props, {
|
|
134
|
-
slots
|
|
135
|
-
}) => {
|
|
136
|
-
const ok = () => {
|
|
137
|
-
props.onOk?.();
|
|
138
|
-
if (props.closeOnOk) props.onUpdateValue?.(false);
|
|
139
|
-
};
|
|
140
|
-
const cancel = () => {
|
|
141
|
-
props.onCancel?.();
|
|
142
|
-
props.onUpdateValue?.(false);
|
|
143
|
-
};
|
|
144
|
-
return () => _createVNode(TransitionRoot, {
|
|
145
|
-
"as": "template",
|
|
146
|
-
"show": props.value
|
|
147
|
-
}, {
|
|
148
|
-
default: () => [_createVNode(Dialog, {
|
|
149
|
-
"as": "div",
|
|
150
|
-
"static": true,
|
|
151
|
-
"class": "fixed z-40 inset-0 overflow-y-auto",
|
|
152
|
-
"onClose": cancel,
|
|
153
|
-
"open": props.value
|
|
154
|
-
}, {
|
|
155
|
-
default: () => [_createVNode("div", {
|
|
156
|
-
"class": `flex items-${props.verticalPosition} justify-${props.horizontalPosition} min-h-screen`
|
|
157
|
-
}, [_createVNode(TransitionChild, {
|
|
158
|
-
"as": "template",
|
|
159
|
-
"enter": "ease-out duration-300",
|
|
160
|
-
"enter-from": "opacity-0",
|
|
161
|
-
"enter-to": "opacity-100",
|
|
162
|
-
"leave": "ease-in duration-200",
|
|
163
|
-
"leave-from": "opacity-100",
|
|
164
|
-
"leave-to": "opacity-0"
|
|
165
|
-
}, {
|
|
166
|
-
default: () => [props.closeOnBackground ? _createVNode(DialogOverlay, {
|
|
167
|
-
"class": "fixed inset-0 bg-default-700 bg-opacity-75"
|
|
168
|
-
}, null) : _createVNode("div", {
|
|
169
|
-
"class": "fixed inset-0 bg-default-700 bg-opacity-75"
|
|
170
|
-
}, null)]
|
|
171
|
-
}), _createVNode("span", {
|
|
172
|
-
"class": "hidden align-middle h-screen",
|
|
173
|
-
"aria-hidden": "true"
|
|
174
|
-
}, [_createTextVNode("\u200B")]), _createVNode(TransitionChild, {
|
|
175
|
-
"as": "template",
|
|
176
|
-
"enter": "ease-out duration-300",
|
|
177
|
-
"enter-from": "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95",
|
|
178
|
-
"enter-to": "opacity-100 translate-y-0 sm:scale-100",
|
|
179
|
-
"leave": "ease-in duration-200",
|
|
180
|
-
"leave-from": "opacity-100 translate-y-0 sm:scale-100",
|
|
181
|
-
"leave-to": "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
|
|
182
|
-
}, {
|
|
183
|
-
default: () => [_createVNode("div", {
|
|
184
|
-
"class": ['transform m-4 w-full align-middle', props.maxWidth]
|
|
185
|
-
}, [props.modal?.({
|
|
186
|
-
ok,
|
|
187
|
-
cancel
|
|
188
|
-
}) || _createVNode("div", {
|
|
189
|
-
"class": ['shadow-xl rounded-lg bg-white divide-y divide-default-100', props.maxWidth]
|
|
190
|
-
}, [!props.hideX && _createVNode("div", {
|
|
191
|
-
"class": "sm:block absolute top-0 right-0 mt-3 mr-3"
|
|
192
|
-
}, [_createVNode(NIconButton, {
|
|
193
|
-
"icon": XMarkIcon,
|
|
194
|
-
"color": "default",
|
|
195
|
-
"size": 5,
|
|
196
|
-
"onClick": cancel
|
|
197
|
-
}, null)]), !props.hideHeader && _createVNode("div", {
|
|
198
|
-
"class": "px-4 sm:px-6 pt-4 pb-2 bg-default-50 rounded-t-lg"
|
|
199
|
-
}, [props.header?.() || _createVNode(DialogTitle, {
|
|
200
|
-
"as": "h4",
|
|
201
|
-
"class": "text-lg font-semibold"
|
|
202
|
-
}, {
|
|
203
|
-
default: () => [props.title]
|
|
204
|
-
})]), props.content?.({
|
|
205
|
-
ok,
|
|
206
|
-
cancel
|
|
207
|
-
}) || _createVNode("div", {
|
|
208
|
-
"class": "px-4 sm:px-6 py-4 rounded-lg"
|
|
209
|
-
}, [slots.default?.()]), !props.hideFooter && _createVNode("div", {
|
|
210
|
-
"class": "px-4 sm:px-6 pb-4 pt-2 bg-default-50 rounded-b-lg"
|
|
211
|
-
}, [props.footer?.({
|
|
212
|
-
ok,
|
|
213
|
-
cancel
|
|
214
|
-
}) || _createVNode("div", {
|
|
215
|
-
"class": "flex justify-end space-x-2"
|
|
216
|
-
}, [!props.hideCancel && _createVNode(NButton, {
|
|
217
|
-
"color": props.cancelColor,
|
|
218
|
-
"onClick": cancel
|
|
219
|
-
}, {
|
|
220
|
-
default: () => [props.cancelText]
|
|
221
|
-
}), !props.hideOk && _createVNode(NButton, {
|
|
222
|
-
"color": props.okColor,
|
|
223
|
-
"onClick": ok,
|
|
224
|
-
"disabled": props.okDisabled
|
|
225
|
-
}, {
|
|
226
|
-
default: () => [props.okText]
|
|
227
|
-
})])])])])]
|
|
228
|
-
})])]
|
|
229
|
-
})]
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
export { Component as NModal, Component as default };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
.pagination-item {
|
|
2
|
-
@apply h-9 w-9 text-sm inline-flex items-center justify-center border font-medium border-default-300 text-default-500;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.pagination-item.not-small {
|
|
6
|
-
@apply sm:w-11;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.pagination-item.selectable {
|
|
10
|
-
@apply hover:bg-default-50 focus:outline-none focus-visible:border-primary-500 focus-visible:ring-primary-500 focus-visible:ring-1 focus-visible:z-[2];
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.pagination-item.selectable.selected {
|
|
14
|
-
@apply border-primary-500 bg-primary-100 hover:bg-primary-100 text-primary-600 z-[1];
|
|
15
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { type PropType } from 'vue';
|
|
2
|
-
import './NPagination.css';
|
|
3
|
-
export declare const nPaginationProps: {
|
|
4
|
-
/**
|
|
5
|
-
* The page number which is currently selected.
|
|
6
|
-
*/
|
|
7
|
-
readonly value: {
|
|
8
|
-
readonly type: NumberConstructor;
|
|
9
|
-
readonly default: () => number;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* This is called, when a new page number has been selected.
|
|
13
|
-
*/
|
|
14
|
-
readonly onUpdateValue: PropType<(newValue: number) => void>;
|
|
15
|
-
/**
|
|
16
|
-
* The total pages which exists. This is needed to correctly display the selectable pages.
|
|
17
|
-
*/
|
|
18
|
-
readonly total: {
|
|
19
|
-
readonly type: NumberConstructor;
|
|
20
|
-
readonly default: () => number;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* If set to `true`, the pagination is displayed smaller.
|
|
24
|
-
*/
|
|
25
|
-
readonly small: BooleanConstructor;
|
|
26
|
-
/**
|
|
27
|
-
* This is called, when the visible pages, which are selectable in the pagination, have changed.
|
|
28
|
-
* This is useful as only these pages can be navigated to on the next click.
|
|
29
|
-
* This information can be useful for prefetching.
|
|
30
|
-
*/
|
|
31
|
-
readonly onVisiblePagesChanged: PropType<(visiblePages: number[]) => void>;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The `NPagination` is a styled pagination component.
|
|
35
|
-
*/
|
|
36
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
37
|
-
export { Component as NPagination, Component as default };
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode } from "vue";
|
|
2
|
-
import { createComponent } from '../utils/component';
|
|
3
|
-
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/vue/24/solid';
|
|
4
|
-
import { computed, watch } from 'vue';
|
|
5
|
-
import './NPagination.css';
|
|
6
|
-
export const nPaginationProps = {
|
|
7
|
-
/**
|
|
8
|
-
* The page number which is currently selected.
|
|
9
|
-
*/
|
|
10
|
-
value: {
|
|
11
|
-
type: Number,
|
|
12
|
-
default: () => 1
|
|
13
|
-
},
|
|
14
|
-
/**
|
|
15
|
-
* This is called, when a new page number has been selected.
|
|
16
|
-
*/
|
|
17
|
-
onUpdateValue: Function,
|
|
18
|
-
/**
|
|
19
|
-
* The total pages which exists. This is needed to correctly display the selectable pages.
|
|
20
|
-
*/
|
|
21
|
-
total: {
|
|
22
|
-
type: Number,
|
|
23
|
-
default: () => 1
|
|
24
|
-
},
|
|
25
|
-
/**
|
|
26
|
-
* If set to `true`, the pagination is displayed smaller.
|
|
27
|
-
*/
|
|
28
|
-
small: Boolean,
|
|
29
|
-
/**
|
|
30
|
-
* This is called, when the visible pages, which are selectable in the pagination, have changed.
|
|
31
|
-
* This is useful as only these pages can be navigated to on the next click.
|
|
32
|
-
* This information can be useful for prefetching.
|
|
33
|
-
*/
|
|
34
|
-
onVisiblePagesChanged: Function
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* The `NPagination` is a styled pagination component.
|
|
38
|
-
*/
|
|
39
|
-
const Component = createComponent('NPagination', nPaginationProps, props => {
|
|
40
|
-
const numbers = computed(() => {
|
|
41
|
-
if (props.total <= 7) {
|
|
42
|
-
return range(1, props.total);
|
|
43
|
-
} else if (props.value <= 4) {
|
|
44
|
-
return [...range(1, 5), -1, props.total];
|
|
45
|
-
} else if (props.value >= props.total - 3) {
|
|
46
|
-
return [1, -1, ...range(props.total - 4, props.total)];
|
|
47
|
-
} else {
|
|
48
|
-
return [1, -1, ...range(props.value - 1, props.value + 1), -1, props.total];
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
watch(() => numbers.value, () => {
|
|
52
|
-
const visiblePages = numbers.value.filter(value => value != -1);
|
|
53
|
-
props.onVisiblePagesChanged?.(visiblePages);
|
|
54
|
-
}, {
|
|
55
|
-
immediate: true
|
|
56
|
-
});
|
|
57
|
-
const clickedNumber = value => {
|
|
58
|
-
if (value <= props.total && value >= 1) props.onUpdateValue?.(value);
|
|
59
|
-
};
|
|
60
|
-
const next = () => clickedNumber(props.value + 1);
|
|
61
|
-
const previous = () => clickedNumber(props.value - 1);
|
|
62
|
-
const items = computed(() => numbers.value.map(number => {
|
|
63
|
-
if (number == -1) return {
|
|
64
|
-
label: '...',
|
|
65
|
-
selectable: false,
|
|
66
|
-
selected: false
|
|
67
|
-
};else return {
|
|
68
|
-
label: `${number}`,
|
|
69
|
-
selectable: true,
|
|
70
|
-
selected: number == props.value,
|
|
71
|
-
click: () => clickedNumber(number)
|
|
72
|
-
};
|
|
73
|
-
}));
|
|
74
|
-
const classesForItem = item => ['pagination-item', item.selectable ? 'selectable ' : '', item.selected ? 'selected' : '', props.small ? '' : 'not-small'];
|
|
75
|
-
return () => _createVNode("nav", {
|
|
76
|
-
"class": "inline-flex rounded-md shadow -space-x-px"
|
|
77
|
-
}, [_createVNode("button", {
|
|
78
|
-
"class": ['pagination-item selectable rounded-l-md', props.small ? '' : 'not-small'],
|
|
79
|
-
"onClick": previous
|
|
80
|
-
}, [_createVNode(ChevronLeftIcon, {
|
|
81
|
-
"class": "h-5 w-5",
|
|
82
|
-
"aria-hidden": "true"
|
|
83
|
-
}, null)]), items.value.map((item, index) => item.selectable ? _createVNode("button", {
|
|
84
|
-
"key": index,
|
|
85
|
-
"class": classesForItem(item),
|
|
86
|
-
"onClick": item.click
|
|
87
|
-
}, [item.label]) : _createVNode("div", {
|
|
88
|
-
"key": index,
|
|
89
|
-
"class": classesForItem(item)
|
|
90
|
-
}, [item.label])), _createVNode("button", {
|
|
91
|
-
"class": ['pagination-item selectable rounded-r-md', props.small ? '' : 'not-small'],
|
|
92
|
-
"onClick": next
|
|
93
|
-
}, [_createVNode(ChevronRightIcon, {
|
|
94
|
-
"class": "h-5 w-5",
|
|
95
|
-
"aria-hidden": "true"
|
|
96
|
-
}, null)])]);
|
|
97
|
-
});
|
|
98
|
-
export { Component as NPagination, Component as default };
|
|
99
|
-
function range(from, to) {
|
|
100
|
-
const array = [];
|
|
101
|
-
for (let i = from; i <= to; i++) {
|
|
102
|
-
array.push(i);
|
|
103
|
-
}
|
|
104
|
-
return array;
|
|
105
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { type PropType } from 'vue';
|
|
2
|
-
export declare const nSearchbarProps: {
|
|
3
|
-
/**
|
|
4
|
-
* The placeholder of the search-bar.
|
|
5
|
-
*/
|
|
6
|
-
readonly placeholder: {
|
|
7
|
-
readonly type: StringConstructor;
|
|
8
|
-
readonly default: string;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* If set to `true` the search-bar is displayed smaller.
|
|
12
|
-
*/
|
|
13
|
-
readonly small: BooleanConstructor;
|
|
14
|
-
/**
|
|
15
|
-
* Adds the classes directly to the input (e.g. for shadow).
|
|
16
|
-
*/
|
|
17
|
-
readonly inputClass: StringConstructor;
|
|
18
|
-
/**
|
|
19
|
-
* This is called when the search-bar receives focus.
|
|
20
|
-
*/
|
|
21
|
-
readonly onFocus: PropType<() => void>;
|
|
22
|
-
/**
|
|
23
|
-
* This is called when the search-bar looses focus.
|
|
24
|
-
*/
|
|
25
|
-
readonly onBlur: PropType<() => void>;
|
|
26
|
-
readonly value: PropType<string>;
|
|
27
|
-
readonly onUpdateValue: PropType<(newValue: string) => void>;
|
|
28
|
-
};
|
|
29
|
-
export type NSearchbarExposed = {
|
|
30
|
-
/**
|
|
31
|
-
* Request focus on the search-bar.
|
|
32
|
-
*/
|
|
33
|
-
focus(): void;
|
|
34
|
-
};
|
|
35
|
-
/**
|
|
36
|
-
* The `NSearchbar` is a styled input with a search icon.
|
|
37
|
-
*/
|
|
38
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
39
|
-
export { Component as NSearchbar, Component as default };
|
package/components/NSearchbar.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode } from "vue";
|
|
2
|
-
import { trsl } from '../i18n';
|
|
3
|
-
import { createComponent } from '../utils/component';
|
|
4
|
-
import { MagnifyingGlassIcon } from '@heroicons/vue/24/solid';
|
|
5
|
-
import { ref } from 'vue';
|
|
6
|
-
import { vModelProps } from '../utils/vModel';
|
|
7
|
-
export const nSearchbarProps = {
|
|
8
|
-
...vModelProps(String),
|
|
9
|
-
/**
|
|
10
|
-
* The placeholder of the search-bar.
|
|
11
|
-
*/
|
|
12
|
-
placeholder: {
|
|
13
|
-
type: String,
|
|
14
|
-
default: trsl('vue-collection.action.search')
|
|
15
|
-
},
|
|
16
|
-
/**
|
|
17
|
-
* If set to `true` the search-bar is displayed smaller.
|
|
18
|
-
*/
|
|
19
|
-
small: Boolean,
|
|
20
|
-
/**
|
|
21
|
-
* Adds the classes directly to the input (e.g. for shadow).
|
|
22
|
-
*/
|
|
23
|
-
inputClass: String,
|
|
24
|
-
/**
|
|
25
|
-
* This is called when the search-bar receives focus.
|
|
26
|
-
*/
|
|
27
|
-
onFocus: Function,
|
|
28
|
-
/**
|
|
29
|
-
* This is called when the search-bar looses focus.
|
|
30
|
-
*/
|
|
31
|
-
onBlur: Function
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* The `NSearchbar` is a styled input with a search icon.
|
|
35
|
-
*/
|
|
36
|
-
const Component = createComponent('NSearchbar', nSearchbarProps, (props, context) => {
|
|
37
|
-
const inputRef = ref();
|
|
38
|
-
const exposed = {
|
|
39
|
-
focus: () => {
|
|
40
|
-
inputRef.value?.focus();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
context.expose(exposed);
|
|
44
|
-
return () => _createVNode("div", {
|
|
45
|
-
"class": "relative"
|
|
46
|
-
}, [_createVNode("div", {
|
|
47
|
-
"class": "absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"
|
|
48
|
-
}, [_createVNode(MagnifyingGlassIcon, {
|
|
49
|
-
"class": "h-5 w-5 text-default-400",
|
|
50
|
-
"aria-hidden": "true"
|
|
51
|
-
}, null)]), _createVNode("input", {
|
|
52
|
-
"ref": inputRef,
|
|
53
|
-
"value": props.value,
|
|
54
|
-
"onInput": event => props.onUpdateValue?.(event.target.value),
|
|
55
|
-
"type": "text",
|
|
56
|
-
"name": "search",
|
|
57
|
-
"placeholder": props.placeholder,
|
|
58
|
-
"autocomplete": "off",
|
|
59
|
-
"class": ['block w-full pl-10 pr-4 rounded-md border focus:outline-none focus:ring-1 transition placeholder-default-400 border-default-300 focus:border-primary-500 focus:ring-primary-500', props.small ? 'py-1' : 'py-2', props.inputClass],
|
|
60
|
-
"onFocus": props.onFocus,
|
|
61
|
-
"onBlur": props.onBlur
|
|
62
|
-
}, null)]);
|
|
63
|
-
});
|
|
64
|
-
export { Component as NSearchbar, Component as default };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export declare const nSearchbarListProps: {
|
|
2
|
-
/**
|
|
3
|
-
* @see {@link nSearchbarProps.placeholder}
|
|
4
|
-
*/
|
|
5
|
-
readonly placeholder: {
|
|
6
|
-
readonly type: StringConstructor;
|
|
7
|
-
readonly default: string;
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Adds the classes directly to the input (e.g. for shadow).
|
|
11
|
-
*/
|
|
12
|
-
readonly inputClass: StringConstructor;
|
|
13
|
-
readonly value: import("vue").PropType<string>;
|
|
14
|
-
readonly onUpdateValue: import("vue").PropType<(newValue: string) => void>;
|
|
15
|
-
readonly items: {
|
|
16
|
-
readonly type: import("vue").PropType<Array<import("./NSuggestionList").SuggestionItem>>;
|
|
17
|
-
readonly default: () => never[];
|
|
18
|
-
};
|
|
19
|
-
readonly maxItems: {
|
|
20
|
-
readonly type: NumberConstructor;
|
|
21
|
-
readonly default: () => number;
|
|
22
|
-
};
|
|
23
|
-
readonly hideList: BooleanConstructor;
|
|
24
|
-
readonly loading: BooleanConstructor;
|
|
25
|
-
readonly onSelect: import("vue").PropType<(id: string) => void>;
|
|
26
|
-
readonly listItem: import("vue").PropType<(props: import("./NSuggestionList").ItemSlotProps) => JSX.Element>;
|
|
27
|
-
readonly onRealBlur: import("vue").PropType<() => void>;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* The `NSearchbarList` is a {@link NSearchbar} with a {@link NSuggestionList}.
|
|
31
|
-
*/
|
|
32
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
33
|
-
export { Component as NSearchbarList, Component as default };
|