@naptics/vue-collection 0.3.2 → 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 +31 -30
- 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 +1 -1
- 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 +1 -1
- 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 -73
- 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 -64
- 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 -83
- 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 -94
- package/components/NInput.js +0 -110
- package/components/NInputPhone.d.ts +0 -58
- package/components/NInputPhone.js +0 -47
- package/components/NInputSelect.d.ts +0 -103
- package/components/NInputSelect.js +0 -115
- package/components/NInputSuggestion.d.ts +0 -79
- 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 -82
- 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 -96
- package/components/NTextArea.js +0 -133
- package/components/NTooltip.css +0 -37
- package/components/NTooltip.d.ts +0 -152
- package/components/NTooltip.js +0 -241
- package/components/NValInput.d.ts +0 -159
- 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.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 };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
|
|
2
|
-
import { createComponentWithSlots } from '../utils/component';
|
|
3
|
-
import { ref } from 'vue';
|
|
4
|
-
import { vModelProps } from '../utils/vModel';
|
|
5
|
-
import NSearchbar, { nSearchbarProps } from './NSearchbar';
|
|
6
|
-
import NSuggestionList, { nSuggestionListPropsForConfig } from './NSuggestionList';
|
|
7
|
-
export const nSearchbarListProps = {
|
|
8
|
-
...nSuggestionListPropsForConfig,
|
|
9
|
-
...vModelProps(String),
|
|
10
|
-
/**
|
|
11
|
-
* @see {@link nSearchbarProps.placeholder}
|
|
12
|
-
*/
|
|
13
|
-
placeholder: nSearchbarProps.placeholder,
|
|
14
|
-
/**
|
|
15
|
-
* Adds the classes directly to the input (e.g. for shadow).
|
|
16
|
-
*/
|
|
17
|
-
inputClass: String
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* The `NSearchbarList` is a {@link NSearchbar} with a {@link NSuggestionList}.
|
|
21
|
-
*/
|
|
22
|
-
const Component = createComponentWithSlots('NSearchbarList', nSearchbarListProps, ['listItem'], props => {
|
|
23
|
-
const searchbarRef = ref();
|
|
24
|
-
return () => _createVNode(NSuggestionList, _mergeProps(props, {
|
|
25
|
-
"inputValue": props.value || '',
|
|
26
|
-
"input": ({
|
|
27
|
-
onFocus,
|
|
28
|
-
onBlur
|
|
29
|
-
}) => _createVNode(NSearchbar, {
|
|
30
|
-
"ref": searchbarRef,
|
|
31
|
-
"value": props.value,
|
|
32
|
-
"onUpdateValue": props.onUpdateValue,
|
|
33
|
-
"placeholder": props.placeholder,
|
|
34
|
-
"inputClass": `shadow-lg ${props.inputClass}`,
|
|
35
|
-
"onFocus": onFocus,
|
|
36
|
-
"onBlur": onBlur
|
|
37
|
-
}, null),
|
|
38
|
-
"onRequestInputFocus": () => searchbarRef.value?.focus()
|
|
39
|
-
}), null);
|
|
40
|
-
});
|
|
41
|
-
export { Component as NSearchbarList, Component as default };
|
package/components/NSelect.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import type { Identifiable } from '../utils/identifiable';
|
|
2
|
-
import { type PropType } from 'vue';
|
|
3
|
-
import { type NValInputExposed } from './NValInput';
|
|
4
|
-
export declare const nSelectProps: {
|
|
5
|
-
readonly tooltipText: StringConstructor;
|
|
6
|
-
readonly tooltipContent: PropType<() => JSX.Element>;
|
|
7
|
-
readonly tooltipHide: BooleanConstructor;
|
|
8
|
-
readonly tooltipShow: BooleanConstructor;
|
|
9
|
-
readonly tooltipPlacement: {
|
|
10
|
-
readonly type: PropType<import("./NTooltip").TooltipPlacement>;
|
|
11
|
-
readonly default: "auto";
|
|
12
|
-
};
|
|
13
|
-
readonly tooltipMaxWidth: {
|
|
14
|
-
readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
15
|
-
readonly default: "max-w-xs";
|
|
16
|
-
};
|
|
17
|
-
readonly tooltipWrapperClass: StringConstructor;
|
|
18
|
-
readonly tooltipContentClass: StringConstructor;
|
|
19
|
-
readonly tooltipArrowClass: StringConstructor;
|
|
20
|
-
readonly tooltipDelay: {
|
|
21
|
-
readonly type: NumberConstructor;
|
|
22
|
-
readonly default: 0;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* The id of the currently selected option of this input.
|
|
26
|
-
*/
|
|
27
|
-
readonly value: StringConstructor;
|
|
28
|
-
/**
|
|
29
|
-
* This is called with the newly selected id when the selection has changed.
|
|
30
|
-
* If no id is selected, the empty string is passed, in order to
|
|
31
|
-
* match the API of all other inputs who never pass `undefined`.
|
|
32
|
-
*/
|
|
33
|
-
readonly onUpdateValue: PropType<(newValue: string) => void>;
|
|
34
|
-
/**
|
|
35
|
-
* The different options which can be selected.
|
|
36
|
-
*/
|
|
37
|
-
readonly options: {
|
|
38
|
-
readonly type: PropType<SelectionOption[]>;
|
|
39
|
-
readonly default: () => never[];
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* The value which is shown in the empty state.
|
|
43
|
-
* The "nothing-option" will be called like this.
|
|
44
|
-
*/
|
|
45
|
-
readonly placeholder: {
|
|
46
|
-
readonly type: StringConstructor;
|
|
47
|
-
readonly default: () => string;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* @see {@link nValInputProps.name}
|
|
51
|
-
*/
|
|
52
|
-
readonly name: StringConstructor;
|
|
53
|
-
/**
|
|
54
|
-
* @see {@link nValInputProps.optional}
|
|
55
|
-
*/
|
|
56
|
-
readonly optional: BooleanConstructor;
|
|
57
|
-
/**
|
|
58
|
-
* @see {@link nValInputProps.disabled}
|
|
59
|
-
*/
|
|
60
|
-
readonly disabled: BooleanConstructor;
|
|
61
|
-
/**
|
|
62
|
-
* @see {@link nValInputProps.form}
|
|
63
|
-
*/
|
|
64
|
-
readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
|
|
65
|
-
/**
|
|
66
|
-
* @see {@link nValInputProps.hideLabel}
|
|
67
|
-
*/
|
|
68
|
-
readonly hideLabel: BooleanConstructor;
|
|
69
|
-
/**
|
|
70
|
-
* @see {@link nValInputProps.inputClass}
|
|
71
|
-
*/
|
|
72
|
-
readonly inputClass: StringConstructor;
|
|
73
|
-
};
|
|
74
|
-
export type SelectionOption = Identifiable & {
|
|
75
|
-
label: string;
|
|
76
|
-
};
|
|
77
|
-
export type NSelectExposed = NValInputExposed;
|
|
78
|
-
/**
|
|
79
|
-
* The `NSelect` is a styled html select-input.
|
|
80
|
-
*/
|
|
81
|
-
declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
|
|
82
|
-
export { Component as NSelect, Component as default };
|