@naptics/vue-collection 0.0.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/README.md +27 -0
- package/lib/components/NAlert.d.ts +72 -0
- package/lib/components/NAlert.jsx +69 -0
- package/lib/components/NBadge.d.ts +174 -0
- package/lib/components/NBadge.jsx +58 -0
- package/lib/components/NBreadcrub.d.ts +161 -0
- package/lib/components/NBreadcrub.jsx +64 -0
- package/lib/components/NButton.d.ts +149 -0
- package/lib/components/NButton.jsx +58 -0
- package/lib/components/NCheckbox.d.ts +51 -0
- package/lib/components/NCheckbox.jsx +38 -0
- package/lib/components/NCheckboxLabel.d.ts +70 -0
- package/lib/components/NCheckboxLabel.jsx +42 -0
- package/lib/components/NCrudModal.d.ts +301 -0
- package/lib/components/NCrudModal.jsx +89 -0
- package/lib/components/NDialog.d.ts +190 -0
- package/lib/components/NDialog.jsx +144 -0
- package/lib/components/NDropdown.d.ts +116 -0
- package/lib/components/NDropdown.jsx +92 -0
- package/lib/components/NDropzone.d.ts +162 -0
- package/lib/components/NDropzone.jsx +211 -0
- package/lib/components/NForm.d.ts +43 -0
- package/lib/components/NForm.jsx +26 -0
- package/lib/components/NFormModal.d.ts +190 -0
- package/lib/components/NFormModal.jsx +48 -0
- package/lib/components/NIconButton.d.ts +202 -0
- package/lib/components/NIconButton.jsx +71 -0
- package/lib/components/NIconCircle.d.ts +135 -0
- package/lib/components/NIconCircle.jsx +67 -0
- package/lib/components/NInput.css +11 -0
- package/lib/components/NInput.d.ts +232 -0
- package/lib/components/NInput.jsx +97 -0
- package/lib/components/NInputPhone.d.ts +150 -0
- package/lib/components/NInputPhone.jsx +31 -0
- package/lib/components/NInputSelect.d.ts +271 -0
- package/lib/components/NInputSelect.jsx +89 -0
- package/lib/components/NInputSuggestion.d.ts +212 -0
- package/lib/components/NInputSuggestion.jsx +48 -0
- package/lib/components/NLink.d.ts +111 -0
- package/lib/components/NLink.jsx +58 -0
- package/lib/components/NList.d.ts +43 -0
- package/lib/components/NList.jsx +24 -0
- package/lib/components/NLoadingIndicator.css +46 -0
- package/lib/components/NLoadingIndicator.d.ts +77 -0
- package/lib/components/NLoadingIndicator.jsx +42 -0
- package/lib/components/NModal.d.ts +333 -0
- package/lib/components/NModal.jsx +170 -0
- package/lib/components/NPagination.css +15 -0
- package/lib/components/NPagination.d.ts +99 -0
- package/lib/components/NPagination.jsx +104 -0
- package/lib/components/NSearchbar.d.ts +94 -0
- package/lib/components/NSearchbar.jsx +58 -0
- package/lib/components/NSearchbarList.d.ts +90 -0
- package/lib/components/NSearchbarList.jsx +20 -0
- package/lib/components/NSelect.d.ts +159 -0
- package/lib/components/NSelect.jsx +81 -0
- package/lib/components/NSuggestionList.d.ts +275 -0
- package/lib/components/NSuggestionList.jsx +157 -0
- package/lib/components/NTable.css +3 -0
- package/lib/components/NTable.d.ts +187 -0
- package/lib/components/NTable.jsx +146 -0
- package/lib/components/NTableAction.d.ts +74 -0
- package/lib/components/NTableAction.jsx +35 -0
- package/lib/components/NTextArea.d.ts +252 -0
- package/lib/components/NTextArea.jsx +108 -0
- package/lib/components/NTooltip.css +37 -0
- package/lib/components/NTooltip.d.ts +186 -0
- package/lib/components/NTooltip.jsx +161 -0
- package/lib/components/NValInput.d.ts +297 -0
- package/lib/components/NValInput.jsx +101 -0
- package/lib/components/ValidatedForm.d.ts +34 -0
- package/lib/components/ValidatedForm.js +25 -0
- package/lib/i18n/de/template.json +10 -0
- package/lib/i18n/de/vue-collection.json +58 -0
- package/lib/i18n/de.d.ts +61 -0
- package/lib/i18n/de.js +5 -0
- package/lib/i18n/en/template.json +10 -0
- package/lib/i18n/en/vue-collection.json +58 -0
- package/lib/i18n/en.d.ts +61 -0
- package/lib/i18n/en.js +5 -0
- package/lib/i18n/index.d.ts +17 -0
- package/lib/i18n/index.js +34 -0
- package/lib/index.d.ts +64 -0
- package/lib/index.js +65 -0
- package/lib/utils/breakpoints.d.ts +15 -0
- package/lib/utils/breakpoints.js +37 -0
- package/lib/utils/component.d.ts +50 -0
- package/lib/utils/component.js +51 -0
- package/lib/utils/deferred.d.ts +13 -0
- package/lib/utils/deferred.js +17 -0
- package/lib/utils/identifiable.d.ts +57 -0
- package/lib/utils/identifiable.js +78 -0
- package/lib/utils/stringMaxLength.d.ts +14 -0
- package/lib/utils/stringMaxLength.js +28 -0
- package/lib/utils/tailwind.d.ts +2 -0
- package/lib/utils/tailwind.js +1 -0
- package/lib/utils/utils.d.ts +27 -0
- package/lib/utils/utils.js +26 -0
- package/lib/utils/vModel.d.ts +182 -0
- package/lib/utils/vModel.js +215 -0
- package/lib/utils/validation.d.ts +84 -0
- package/lib/utils/validation.js +163 -0
- package/lib/utils/vue.d.ts +13 -0
- package/lib/utils/vue.js +19 -0
- package/package.json +56 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import type { DialogVariant } from './NDialog';
|
|
3
|
+
export declare const nCrudModalProps: {
|
|
4
|
+
/**
|
|
5
|
+
* The text of the remove-button.
|
|
6
|
+
*/
|
|
7
|
+
removeText: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
default: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The color of the remove-button.
|
|
13
|
+
*/
|
|
14
|
+
removeColor: {
|
|
15
|
+
type: StringConstructor;
|
|
16
|
+
default: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The title of the dialog which appears when clicking on the remove-button.
|
|
20
|
+
*/
|
|
21
|
+
removeDialogTitle: StringConstructor;
|
|
22
|
+
/**
|
|
23
|
+
* The text of the dialog which appears when clicking on the remove-button.
|
|
24
|
+
*/
|
|
25
|
+
removeDialogText: StringConstructor;
|
|
26
|
+
/**
|
|
27
|
+
* The variant of the dialog which appears when clicking on the remove-button. Default is `remove`.
|
|
28
|
+
*/
|
|
29
|
+
removeDialogVariant: {
|
|
30
|
+
type: PropType<DialogVariant>;
|
|
31
|
+
default: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The text of the dialog's ok-button. Is already set by the `removeDialogVariant` but can be overridden.
|
|
35
|
+
*/
|
|
36
|
+
removeDialogOkText: StringConstructor;
|
|
37
|
+
/**
|
|
38
|
+
* If set to `true` the modal will close itself when `onRemove` is called.
|
|
39
|
+
*/
|
|
40
|
+
closeOnRemove: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* This is called, when the remove-button has been clicked and the dialog has been accepted.
|
|
46
|
+
*/
|
|
47
|
+
onRemove: PropType<() => void>;
|
|
48
|
+
maxWidth: {
|
|
49
|
+
type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
closeOnBackground: {
|
|
53
|
+
type: BooleanConstructor;
|
|
54
|
+
default: boolean;
|
|
55
|
+
};
|
|
56
|
+
form: PropType<import("./ValidatedForm").ValidatedForm>;
|
|
57
|
+
hideHeader: BooleanConstructor;
|
|
58
|
+
hideFooter: BooleanConstructor;
|
|
59
|
+
hideX: BooleanConstructor;
|
|
60
|
+
title: StringConstructor;
|
|
61
|
+
okText: {
|
|
62
|
+
type: StringConstructor;
|
|
63
|
+
default: string;
|
|
64
|
+
};
|
|
65
|
+
okColor: {
|
|
66
|
+
/**
|
|
67
|
+
* If set to `true` the modal will close itself when `onRemove` is called.
|
|
68
|
+
*/
|
|
69
|
+
type: StringConstructor;
|
|
70
|
+
default: string;
|
|
71
|
+
};
|
|
72
|
+
closeOnOk: {
|
|
73
|
+
type: BooleanConstructor;
|
|
74
|
+
default: boolean;
|
|
75
|
+
};
|
|
76
|
+
hideOk: BooleanConstructor;
|
|
77
|
+
okDisabled: BooleanConstructor;
|
|
78
|
+
cancelText: {
|
|
79
|
+
type: StringConstructor;
|
|
80
|
+
default: string;
|
|
81
|
+
};
|
|
82
|
+
cancelColor: {
|
|
83
|
+
type: StringConstructor;
|
|
84
|
+
default: string;
|
|
85
|
+
};
|
|
86
|
+
hideCancel: BooleanConstructor;
|
|
87
|
+
onOk: PropType<() => void>;
|
|
88
|
+
onCancel: PropType<() => void>;
|
|
89
|
+
modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
90
|
+
header: PropType<() => JSX.Element>;
|
|
91
|
+
footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
92
|
+
value: PropType<boolean>;
|
|
93
|
+
onUpdateValue: PropType<(newValue: boolean) => void>;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* The `NCrudModal` is a {@link NFormModal} which has some convenience features for a CRUD-scenario.
|
|
97
|
+
* It has an integrated remove-button with a user-dialog to remove the editing element.
|
|
98
|
+
* When the dialog is accepted `onRemove` is called.
|
|
99
|
+
*/
|
|
100
|
+
declare const _default: import("vue").DefineComponent<{
|
|
101
|
+
/**
|
|
102
|
+
* The text of the remove-button.
|
|
103
|
+
*/
|
|
104
|
+
removeText: {
|
|
105
|
+
type: StringConstructor;
|
|
106
|
+
default: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* The color of the remove-button.
|
|
110
|
+
*/
|
|
111
|
+
removeColor: {
|
|
112
|
+
type: StringConstructor;
|
|
113
|
+
default: string;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* The title of the dialog which appears when clicking on the remove-button.
|
|
117
|
+
*/
|
|
118
|
+
removeDialogTitle: StringConstructor;
|
|
119
|
+
/**
|
|
120
|
+
* The text of the dialog which appears when clicking on the remove-button.
|
|
121
|
+
*/
|
|
122
|
+
removeDialogText: StringConstructor;
|
|
123
|
+
/**
|
|
124
|
+
* The variant of the dialog which appears when clicking on the remove-button. Default is `remove`.
|
|
125
|
+
*/
|
|
126
|
+
removeDialogVariant: {
|
|
127
|
+
type: PropType<DialogVariant>;
|
|
128
|
+
default: string;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* The text of the dialog's ok-button. Is already set by the `removeDialogVariant` but can be overridden.
|
|
132
|
+
*/
|
|
133
|
+
removeDialogOkText: StringConstructor;
|
|
134
|
+
/**
|
|
135
|
+
* If set to `true` the modal will close itself when `onRemove` is called.
|
|
136
|
+
*/
|
|
137
|
+
closeOnRemove: {
|
|
138
|
+
type: BooleanConstructor;
|
|
139
|
+
default: boolean;
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* This is called, when the remove-button has been clicked and the dialog has been accepted.
|
|
143
|
+
*/
|
|
144
|
+
onRemove: PropType<() => void>;
|
|
145
|
+
maxWidth: {
|
|
146
|
+
type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
147
|
+
default: string;
|
|
148
|
+
};
|
|
149
|
+
closeOnBackground: {
|
|
150
|
+
type: BooleanConstructor;
|
|
151
|
+
default: boolean;
|
|
152
|
+
};
|
|
153
|
+
form: PropType<import("./ValidatedForm").ValidatedForm>;
|
|
154
|
+
hideHeader: BooleanConstructor;
|
|
155
|
+
hideFooter: BooleanConstructor;
|
|
156
|
+
hideX: BooleanConstructor;
|
|
157
|
+
title: StringConstructor;
|
|
158
|
+
okText: {
|
|
159
|
+
type: StringConstructor;
|
|
160
|
+
default: string;
|
|
161
|
+
};
|
|
162
|
+
okColor: {
|
|
163
|
+
/**
|
|
164
|
+
* If set to `true` the modal will close itself when `onRemove` is called.
|
|
165
|
+
*/
|
|
166
|
+
type: StringConstructor;
|
|
167
|
+
default: string;
|
|
168
|
+
};
|
|
169
|
+
closeOnOk: {
|
|
170
|
+
type: BooleanConstructor;
|
|
171
|
+
default: boolean;
|
|
172
|
+
};
|
|
173
|
+
hideOk: BooleanConstructor;
|
|
174
|
+
okDisabled: BooleanConstructor;
|
|
175
|
+
cancelText: {
|
|
176
|
+
type: StringConstructor;
|
|
177
|
+
default: string;
|
|
178
|
+
};
|
|
179
|
+
cancelColor: {
|
|
180
|
+
type: StringConstructor;
|
|
181
|
+
default: string;
|
|
182
|
+
};
|
|
183
|
+
hideCancel: BooleanConstructor;
|
|
184
|
+
onOk: PropType<() => void>;
|
|
185
|
+
onCancel: PropType<() => void>;
|
|
186
|
+
modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
187
|
+
header: PropType<() => JSX.Element>;
|
|
188
|
+
footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
189
|
+
value: PropType<boolean>;
|
|
190
|
+
onUpdateValue: PropType<(newValue: boolean) => void>;
|
|
191
|
+
}, import("vue").RenderFunction, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
192
|
+
/**
|
|
193
|
+
* The text of the remove-button.
|
|
194
|
+
*/
|
|
195
|
+
removeText: {
|
|
196
|
+
type: StringConstructor;
|
|
197
|
+
default: string;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* The color of the remove-button.
|
|
201
|
+
*/
|
|
202
|
+
removeColor: {
|
|
203
|
+
type: StringConstructor;
|
|
204
|
+
default: string;
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* The title of the dialog which appears when clicking on the remove-button.
|
|
208
|
+
*/
|
|
209
|
+
removeDialogTitle: StringConstructor;
|
|
210
|
+
/**
|
|
211
|
+
* The text of the dialog which appears when clicking on the remove-button.
|
|
212
|
+
*/
|
|
213
|
+
removeDialogText: StringConstructor;
|
|
214
|
+
/**
|
|
215
|
+
* The variant of the dialog which appears when clicking on the remove-button. Default is `remove`.
|
|
216
|
+
*/
|
|
217
|
+
removeDialogVariant: {
|
|
218
|
+
type: PropType<DialogVariant>;
|
|
219
|
+
default: string;
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* The text of the dialog's ok-button. Is already set by the `removeDialogVariant` but can be overridden.
|
|
223
|
+
*/
|
|
224
|
+
removeDialogOkText: StringConstructor;
|
|
225
|
+
/**
|
|
226
|
+
* If set to `true` the modal will close itself when `onRemove` is called.
|
|
227
|
+
*/
|
|
228
|
+
closeOnRemove: {
|
|
229
|
+
type: BooleanConstructor;
|
|
230
|
+
default: boolean;
|
|
231
|
+
};
|
|
232
|
+
/**
|
|
233
|
+
* This is called, when the remove-button has been clicked and the dialog has been accepted.
|
|
234
|
+
*/
|
|
235
|
+
onRemove: PropType<() => void>;
|
|
236
|
+
maxWidth: {
|
|
237
|
+
type: PropType<import("../utils/tailwind").TWMaxWidth>;
|
|
238
|
+
default: string;
|
|
239
|
+
};
|
|
240
|
+
closeOnBackground: {
|
|
241
|
+
type: BooleanConstructor;
|
|
242
|
+
default: boolean;
|
|
243
|
+
};
|
|
244
|
+
form: PropType<import("./ValidatedForm").ValidatedForm>;
|
|
245
|
+
hideHeader: BooleanConstructor;
|
|
246
|
+
hideFooter: BooleanConstructor;
|
|
247
|
+
hideX: BooleanConstructor;
|
|
248
|
+
title: StringConstructor;
|
|
249
|
+
okText: {
|
|
250
|
+
type: StringConstructor;
|
|
251
|
+
default: string;
|
|
252
|
+
};
|
|
253
|
+
okColor: {
|
|
254
|
+
/**
|
|
255
|
+
* If set to `true` the modal will close itself when `onRemove` is called.
|
|
256
|
+
*/
|
|
257
|
+
type: StringConstructor;
|
|
258
|
+
default: string;
|
|
259
|
+
};
|
|
260
|
+
closeOnOk: {
|
|
261
|
+
type: BooleanConstructor;
|
|
262
|
+
default: boolean;
|
|
263
|
+
};
|
|
264
|
+
hideOk: BooleanConstructor;
|
|
265
|
+
okDisabled: BooleanConstructor;
|
|
266
|
+
cancelText: {
|
|
267
|
+
type: StringConstructor;
|
|
268
|
+
default: string;
|
|
269
|
+
};
|
|
270
|
+
cancelColor: {
|
|
271
|
+
type: StringConstructor;
|
|
272
|
+
default: string;
|
|
273
|
+
};
|
|
274
|
+
hideCancel: BooleanConstructor;
|
|
275
|
+
onOk: PropType<() => void>;
|
|
276
|
+
onCancel: PropType<() => void>;
|
|
277
|
+
modal: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
278
|
+
header: PropType<() => JSX.Element>;
|
|
279
|
+
footer: PropType<(props: import("./NModal").ModalSlotProps) => JSX.Element>;
|
|
280
|
+
value: PropType<boolean>;
|
|
281
|
+
onUpdateValue: PropType<(newValue: boolean) => void>;
|
|
282
|
+
}>> & {}, {
|
|
283
|
+
maxWidth: import("../utils/tailwind").TWMaxWidth;
|
|
284
|
+
hideX: boolean;
|
|
285
|
+
hideHeader: boolean;
|
|
286
|
+
hideFooter: boolean;
|
|
287
|
+
okText: string;
|
|
288
|
+
okColor: string;
|
|
289
|
+
closeOnOk: boolean;
|
|
290
|
+
hideOk: boolean;
|
|
291
|
+
okDisabled: boolean;
|
|
292
|
+
cancelText: string;
|
|
293
|
+
cancelColor: string;
|
|
294
|
+
closeOnBackground: boolean;
|
|
295
|
+
hideCancel: boolean;
|
|
296
|
+
removeText: string;
|
|
297
|
+
removeColor: string;
|
|
298
|
+
removeDialogVariant: DialogVariant;
|
|
299
|
+
closeOnRemove: boolean;
|
|
300
|
+
}>;
|
|
301
|
+
export default _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { trsl } from '../i18n';
|
|
2
|
+
import { createComponent, createProps } from '../utils/component';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
import NButton from './NButton';
|
|
5
|
+
import NDialog from './NDialog';
|
|
6
|
+
import NFormModal, { nFormModalProps } from './NFormModal';
|
|
7
|
+
export const nCrudModalProps = createProps({
|
|
8
|
+
...nFormModalProps,
|
|
9
|
+
/**
|
|
10
|
+
* The text of the remove-button.
|
|
11
|
+
*/
|
|
12
|
+
removeText: {
|
|
13
|
+
type: String,
|
|
14
|
+
default: trsl('vue-collection.action.remove'),
|
|
15
|
+
},
|
|
16
|
+
/**
|
|
17
|
+
* The color of the remove-button.
|
|
18
|
+
*/
|
|
19
|
+
removeColor: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: 'red',
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* The title of the dialog which appears when clicking on the remove-button.
|
|
25
|
+
*/
|
|
26
|
+
removeDialogTitle: String,
|
|
27
|
+
/**
|
|
28
|
+
* The text of the dialog which appears when clicking on the remove-button.
|
|
29
|
+
*/
|
|
30
|
+
removeDialogText: String,
|
|
31
|
+
/**
|
|
32
|
+
* The variant of the dialog which appears when clicking on the remove-button. Default is `remove`.
|
|
33
|
+
*/
|
|
34
|
+
removeDialogVariant: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: 'remove',
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* The text of the dialog's ok-button. Is already set by the `removeDialogVariant` but can be overridden.
|
|
40
|
+
*/
|
|
41
|
+
removeDialogOkText: String,
|
|
42
|
+
/**
|
|
43
|
+
* If set to `true` the modal will close itself when `onRemove` is called.
|
|
44
|
+
*/
|
|
45
|
+
closeOnRemove: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true,
|
|
48
|
+
},
|
|
49
|
+
/**
|
|
50
|
+
* This is called, when the remove-button has been clicked and the dialog has been accepted.
|
|
51
|
+
*/
|
|
52
|
+
onRemove: Function,
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* The `NCrudModal` is a {@link NFormModal} which has some convenience features for a CRUD-scenario.
|
|
56
|
+
* It has an integrated remove-button with a user-dialog to remove the editing element.
|
|
57
|
+
* When the dialog is accepted `onRemove` is called.
|
|
58
|
+
*/
|
|
59
|
+
export default createComponent('NCrudModal', nCrudModalProps, (props, { slots }) => {
|
|
60
|
+
const removeDialog = ref();
|
|
61
|
+
const remove = () => {
|
|
62
|
+
removeDialog.value?.show().then(result => {
|
|
63
|
+
if (result) {
|
|
64
|
+
props.onRemove?.();
|
|
65
|
+
if (props.closeOnRemove)
|
|
66
|
+
props.onUpdateValue?.(false);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
return () => (<NFormModal {...props} footer={props.footer ||
|
|
71
|
+
(({ ok, cancel }) => (<div class="flex justify-between">
|
|
72
|
+
<div>
|
|
73
|
+
<NButton color={props.removeColor} onClick={remove}>
|
|
74
|
+
{props.removeText}
|
|
75
|
+
</NButton>
|
|
76
|
+
</div>
|
|
77
|
+
<div>
|
|
78
|
+
<NButton color={props.cancelColor} onClick={cancel}>
|
|
79
|
+
{props.cancelText}
|
|
80
|
+
</NButton>
|
|
81
|
+
<NButton color={props.okColor} onClick={ok} class="ml-2" disabled={props.okDisabled}>
|
|
82
|
+
{props.okText}
|
|
83
|
+
</NButton>
|
|
84
|
+
</div>
|
|
85
|
+
</div>))}>
|
|
86
|
+
{slots.default?.()}
|
|
87
|
+
<NDialog ref={removeDialog} variant={props.removeDialogVariant} title={props.removeDialogTitle} text={props.removeDialogText} okText={props.removeDialogOkText}/>
|
|
88
|
+
</NFormModal>);
|
|
89
|
+
});
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import type { HeroIcon } from '../utils/utils';
|
|
3
|
+
export type DialogVariant = 'success' | 'info' | 'warning' | 'danger' | 'remove';
|
|
4
|
+
export declare const nDialogProps: {
|
|
5
|
+
/**
|
|
6
|
+
* The title of the dialog.
|
|
7
|
+
*/
|
|
8
|
+
title: StringConstructor;
|
|
9
|
+
/**
|
|
10
|
+
* The text of the dialog.
|
|
11
|
+
*/
|
|
12
|
+
text: StringConstructor;
|
|
13
|
+
/**
|
|
14
|
+
* The variant of the dialog.
|
|
15
|
+
* This determines the default icon and its color
|
|
16
|
+
* as well as the default text and color of the ok-button.
|
|
17
|
+
*/
|
|
18
|
+
variant: {
|
|
19
|
+
type: PropType<DialogVariant>;
|
|
20
|
+
default: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The icon of the alert. This overrides the `icon` of the `variant`.
|
|
24
|
+
*/
|
|
25
|
+
icon: PropType<HeroIcon>;
|
|
26
|
+
/**
|
|
27
|
+
* The color of the alert's icon. This overrides the `iconColor` of the `variant`.
|
|
28
|
+
*/
|
|
29
|
+
iconColor: StringConstructor;
|
|
30
|
+
/**
|
|
31
|
+
* The text of the ok-button. This overrides the `okText` of the `variant`.
|
|
32
|
+
*/
|
|
33
|
+
okText: StringConstructor;
|
|
34
|
+
/**
|
|
35
|
+
* The color of the ok-button. This overrides the `okColor` of the `variant`.
|
|
36
|
+
*/
|
|
37
|
+
okColor: StringConstructor;
|
|
38
|
+
/**
|
|
39
|
+
* The text of the cancel-button.
|
|
40
|
+
*/
|
|
41
|
+
cancelText: {
|
|
42
|
+
type: StringConstructor;
|
|
43
|
+
default: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The color of the cancel-button.
|
|
47
|
+
*/
|
|
48
|
+
cancelColor: {
|
|
49
|
+
type: StringConstructor;
|
|
50
|
+
default: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* If set to `true` the cancel-button is hidden.
|
|
54
|
+
*/
|
|
55
|
+
hideCancel: BooleanConstructor;
|
|
56
|
+
};
|
|
57
|
+
export type NDialogExposed = {
|
|
58
|
+
/**
|
|
59
|
+
* Shows the alert and returns a promise.
|
|
60
|
+
* When the user interaction occurs the promise is resolved.
|
|
61
|
+
* It is resolved to `true` if the okButton was clicked, `false` if the dialog was cancelled.
|
|
62
|
+
*/
|
|
63
|
+
show(): Promise<boolean>;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* A `NDialog` is an element to interact directly with the user.
|
|
67
|
+
* It can be controlled via a ref to prompt the user and to receive their answer.
|
|
68
|
+
* @example
|
|
69
|
+
* const dialogRef = ref<NDialogExposed>()
|
|
70
|
+
* ...
|
|
71
|
+
* const onShowDialog = () => {
|
|
72
|
+
* dialofRef.value?.show().then(result => {
|
|
73
|
+
* if (result) // dialog accepted
|
|
74
|
+
* else // dialog cancelled
|
|
75
|
+
* })
|
|
76
|
+
* }
|
|
77
|
+
* ...
|
|
78
|
+
* <NDialog ref={dialogRef} />
|
|
79
|
+
*/
|
|
80
|
+
declare const _default: import("vue").DefineComponent<{
|
|
81
|
+
/**
|
|
82
|
+
* The title of the dialog.
|
|
83
|
+
*/
|
|
84
|
+
title: StringConstructor;
|
|
85
|
+
/**
|
|
86
|
+
* The text of the dialog.
|
|
87
|
+
*/
|
|
88
|
+
text: StringConstructor;
|
|
89
|
+
/**
|
|
90
|
+
* The variant of the dialog.
|
|
91
|
+
* This determines the default icon and its color
|
|
92
|
+
* as well as the default text and color of the ok-button.
|
|
93
|
+
*/
|
|
94
|
+
variant: {
|
|
95
|
+
type: PropType<DialogVariant>;
|
|
96
|
+
default: string;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* The icon of the alert. This overrides the `icon` of the `variant`.
|
|
100
|
+
*/
|
|
101
|
+
icon: PropType<HeroIcon>;
|
|
102
|
+
/**
|
|
103
|
+
* The color of the alert's icon. This overrides the `iconColor` of the `variant`.
|
|
104
|
+
*/
|
|
105
|
+
iconColor: StringConstructor;
|
|
106
|
+
/**
|
|
107
|
+
* The text of the ok-button. This overrides the `okText` of the `variant`.
|
|
108
|
+
*/
|
|
109
|
+
okText: StringConstructor;
|
|
110
|
+
/**
|
|
111
|
+
* The color of the ok-button. This overrides the `okColor` of the `variant`.
|
|
112
|
+
*/
|
|
113
|
+
okColor: StringConstructor;
|
|
114
|
+
/**
|
|
115
|
+
* The text of the cancel-button.
|
|
116
|
+
*/
|
|
117
|
+
cancelText: {
|
|
118
|
+
type: StringConstructor;
|
|
119
|
+
default: string;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* The color of the cancel-button.
|
|
123
|
+
*/
|
|
124
|
+
cancelColor: {
|
|
125
|
+
type: StringConstructor;
|
|
126
|
+
default: string;
|
|
127
|
+
};
|
|
128
|
+
/**
|
|
129
|
+
* If set to `true` the cancel-button is hidden.
|
|
130
|
+
*/
|
|
131
|
+
hideCancel: BooleanConstructor;
|
|
132
|
+
}, import("vue").RenderFunction, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, never[], never, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
133
|
+
/**
|
|
134
|
+
* The title of the dialog.
|
|
135
|
+
*/
|
|
136
|
+
title: StringConstructor;
|
|
137
|
+
/**
|
|
138
|
+
* The text of the dialog.
|
|
139
|
+
*/
|
|
140
|
+
text: StringConstructor;
|
|
141
|
+
/**
|
|
142
|
+
* The variant of the dialog.
|
|
143
|
+
* This determines the default icon and its color
|
|
144
|
+
* as well as the default text and color of the ok-button.
|
|
145
|
+
*/
|
|
146
|
+
variant: {
|
|
147
|
+
type: PropType<DialogVariant>;
|
|
148
|
+
default: string;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* The icon of the alert. This overrides the `icon` of the `variant`.
|
|
152
|
+
*/
|
|
153
|
+
icon: PropType<HeroIcon>;
|
|
154
|
+
/**
|
|
155
|
+
* The color of the alert's icon. This overrides the `iconColor` of the `variant`.
|
|
156
|
+
*/
|
|
157
|
+
iconColor: StringConstructor;
|
|
158
|
+
/**
|
|
159
|
+
* The text of the ok-button. This overrides the `okText` of the `variant`.
|
|
160
|
+
*/
|
|
161
|
+
okText: StringConstructor;
|
|
162
|
+
/**
|
|
163
|
+
* The color of the ok-button. This overrides the `okColor` of the `variant`.
|
|
164
|
+
*/
|
|
165
|
+
okColor: StringConstructor;
|
|
166
|
+
/**
|
|
167
|
+
* The text of the cancel-button.
|
|
168
|
+
*/
|
|
169
|
+
cancelText: {
|
|
170
|
+
type: StringConstructor;
|
|
171
|
+
default: string;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* The color of the cancel-button.
|
|
175
|
+
*/
|
|
176
|
+
cancelColor: {
|
|
177
|
+
type: StringConstructor;
|
|
178
|
+
default: string;
|
|
179
|
+
};
|
|
180
|
+
/**
|
|
181
|
+
* If set to `true` the cancel-button is hidden.
|
|
182
|
+
*/
|
|
183
|
+
hideCancel: BooleanConstructor;
|
|
184
|
+
}>> & {}, {
|
|
185
|
+
variant: DialogVariant;
|
|
186
|
+
cancelText: string;
|
|
187
|
+
cancelColor: string;
|
|
188
|
+
hideCancel: boolean;
|
|
189
|
+
}>;
|
|
190
|
+
export default _default;
|