@naptics/vue-collection 0.2.15 → 0.3.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.
Files changed (171) hide show
  1. package/.github/workflows/build.yml +26 -0
  2. package/.github/workflows/deploy-demo.yml +46 -0
  3. package/.github/workflows/deploy-lib.yml +59 -0
  4. package/.gitlab-ci.yml +57 -0
  5. package/.nvmrc +1 -0
  6. package/.prettierrc +8 -0
  7. package/.vscode/extensions.json +10 -0
  8. package/.vscode/launch.json +23 -0
  9. package/.vscode/settings.json +13 -0
  10. package/babel.config.json +3 -0
  11. package/components/NAlert.d.ts +1 -44
  12. package/components/NBadge.d.ts +1 -133
  13. package/components/NBreadcrub.d.ts +2 -106
  14. package/components/NBreadcrub.js +1 -1
  15. package/components/NButton.d.ts +2 -118
  16. package/components/NCheckbox.d.ts +1 -32
  17. package/components/NCheckboxLabel.d.ts +1 -45
  18. package/components/NCheckboxLabel.js +1 -1
  19. package/components/NCrudModal.d.ts +7 -251
  20. package/components/NCrudModal.js +1 -1
  21. package/components/NDialog.d.ts +1 -110
  22. package/components/NDialog.js +1 -1
  23. package/components/NDropdown.d.ts +1 -69
  24. package/components/NDropdown.js +1 -1
  25. package/components/NDropzone.d.ts +1 -115
  26. package/components/NDropzone.js +1 -1
  27. package/components/NForm.d.ts +1 -23
  28. package/components/NFormModal.d.ts +7 -151
  29. package/components/NIconButton.d.ts +3 -159
  30. package/components/NIconButton.js +1 -1
  31. package/components/NIconCircle.d.ts +1 -87
  32. package/components/NInput.d.ts +1 -164
  33. package/components/NInput.js +1 -1
  34. package/components/NInputPhone.d.ts +2 -114
  35. package/components/NInputPhone.js +1 -1
  36. package/components/NInputSelect.d.ts +2 -187
  37. package/components/NInputSelect.js +1 -1
  38. package/components/NInputSuggestion.d.ts +2 -155
  39. package/components/NInputSuggestion.js +1 -1
  40. package/components/NLink.d.ts +6 -70
  41. package/components/NLink.js +8 -1
  42. package/components/NList.d.ts +1 -43
  43. package/components/NList.js +1 -1
  44. package/components/NLoadingIndicator.d.ts +1 -49
  45. package/components/NModal.d.ts +12 -250
  46. package/components/NModal.js +15 -9
  47. package/components/NPagination.d.ts +1 -63
  48. package/components/NSearchbar.d.ts +1 -56
  49. package/components/NSearchbarList.d.ts +3 -63
  50. package/components/NSearchbarList.js +1 -1
  51. package/components/NSelect.d.ts +2 -148
  52. package/components/NSelect.js +1 -1
  53. package/components/NSuggestionList.d.ts +3 -126
  54. package/components/NSuggestionList.js +5 -2
  55. package/components/NTable.d.ts +1 -85
  56. package/components/NTable.js +12 -6
  57. package/components/NTableAction.d.ts +2 -46
  58. package/components/NTableAction.js +1 -1
  59. package/components/NTextArea.d.ts +2 -181
  60. package/components/NTextArea.js +1 -1
  61. package/components/NTooltip.d.ts +1 -105
  62. package/components/NTooltip.js +1 -1
  63. package/components/NValInput.d.ts +7 -182
  64. package/components/NValInput.js +1 -1
  65. package/env.d.ts +15 -0
  66. package/eslint.config.cjs +29 -0
  67. package/index.html +13 -0
  68. package/package.json +21 -19
  69. package/postcss.config.js +6 -0
  70. package/public/favicon.ico +0 -0
  71. package/scripts/build-lib.sh +52 -0
  72. package/scripts/sync-node-types.js +70 -0
  73. package/src/demo/App.css +9 -0
  74. package/src/demo/App.tsx +5 -0
  75. package/src/demo/components/ColorGrid.tsx +26 -0
  76. package/src/demo/components/ComponentGrid.tsx +26 -0
  77. package/src/demo/components/ComponentSection.tsx +30 -0
  78. package/src/demo/components/VariantSection.tsx +18 -0
  79. package/src/demo/i18n/de.ts +7 -0
  80. package/src/demo/i18n/en.ts +7 -0
  81. package/src/demo/i18n/index.ts +24 -0
  82. package/src/demo/main.ts +13 -0
  83. package/src/demo/router/index.ts +21 -0
  84. package/src/demo/views/HomeView.tsx +94 -0
  85. package/src/demo/views/NavigationView.tsx +43 -0
  86. package/src/demo/views/presentation/AlertView.tsx +40 -0
  87. package/src/demo/views/presentation/BadgeView.tsx +61 -0
  88. package/src/demo/views/presentation/BreadcrumbView.tsx +52 -0
  89. package/src/demo/views/presentation/ButtonView.tsx +49 -0
  90. package/src/demo/views/presentation/CheckboxView.tsx +59 -0
  91. package/src/demo/views/presentation/DropdownView.tsx +59 -0
  92. package/src/demo/views/presentation/DropzoneView.tsx +39 -0
  93. package/src/demo/views/presentation/IconButtonView.tsx +47 -0
  94. package/src/demo/views/presentation/IconCircleView.tsx +38 -0
  95. package/src/demo/views/presentation/InputView.tsx +179 -0
  96. package/src/demo/views/presentation/LinkView.tsx +60 -0
  97. package/src/demo/views/presentation/ListView.tsx +29 -0
  98. package/src/demo/views/presentation/LoadingIndicatorView.tsx +38 -0
  99. package/src/demo/views/presentation/ModalView.tsx +210 -0
  100. package/src/demo/views/presentation/PaginationView.tsx +25 -0
  101. package/src/demo/views/presentation/SearchbarView.tsx +80 -0
  102. package/src/demo/views/presentation/TableView.tsx +146 -0
  103. package/src/demo/views/presentation/TooltipView.tsx +86 -0
  104. package/src/lib/components/NAlert.tsx +85 -0
  105. package/src/lib/components/NBadge.tsx +75 -0
  106. package/src/lib/components/NBreadcrub.tsx +97 -0
  107. package/src/lib/components/NButton.tsx +80 -0
  108. package/src/lib/components/NCheckbox.tsx +55 -0
  109. package/src/lib/components/NCheckboxLabel.tsx +51 -0
  110. package/src/lib/components/NCrudModal.tsx +133 -0
  111. package/src/lib/components/NDialog.tsx +182 -0
  112. package/src/lib/components/NDropdown.tsx +167 -0
  113. package/src/lib/components/NDropzone.tsx +265 -0
  114. package/src/lib/components/NForm.tsx +32 -0
  115. package/src/lib/components/NFormModal.tsx +66 -0
  116. package/src/lib/components/NIconButton.tsx +92 -0
  117. package/src/lib/components/NIconCircle.tsx +78 -0
  118. package/src/lib/components/NInput.css +11 -0
  119. package/src/lib/components/NInput.tsx +139 -0
  120. package/src/lib/components/NInputPhone.tsx +53 -0
  121. package/src/lib/components/NInputSelect.tsx +126 -0
  122. package/src/lib/components/NInputSuggestion.tsx +80 -0
  123. package/src/lib/components/NLink.tsx +82 -0
  124. package/src/lib/components/NList.tsx +67 -0
  125. package/src/lib/components/NLoadingIndicator.css +46 -0
  126. package/src/lib/components/NLoadingIndicator.tsx +63 -0
  127. package/src/lib/components/NModal.tsx +243 -0
  128. package/src/lib/components/NPagination.css +15 -0
  129. package/src/lib/components/NPagination.tsx +131 -0
  130. package/src/lib/components/NSearchbar.tsx +78 -0
  131. package/src/lib/components/NSearchbarList.tsx +47 -0
  132. package/src/lib/components/NSelect.tsx +128 -0
  133. package/src/lib/components/NSuggestionList.tsx +216 -0
  134. package/src/lib/components/NTable.css +3 -0
  135. package/src/lib/components/NTable.tsx +247 -0
  136. package/src/lib/components/NTableAction.tsx +49 -0
  137. package/src/lib/components/NTextArea.tsx +159 -0
  138. package/src/lib/components/NTooltip.css +37 -0
  139. package/src/lib/components/NTooltip.tsx +250 -0
  140. package/src/lib/components/NValInput.tsx +163 -0
  141. package/src/lib/components/ValidatedForm.ts +71 -0
  142. package/src/lib/components/__tests__/NButton.spec.tsx +26 -0
  143. package/src/lib/components/__tests__/NCheckbox.spec.tsx +39 -0
  144. package/src/lib/i18n/de/vue-collection.json +58 -0
  145. package/src/lib/i18n/en/vue-collection.json +58 -0
  146. package/src/lib/i18n/index.ts +54 -0
  147. package/src/lib/index.ts +2 -0
  148. package/src/lib/jsx.d.ts +13 -0
  149. package/src/lib/utils/__tests__/identifiable.spec.ts +72 -0
  150. package/src/lib/utils/__tests__/validation.spec.ts +92 -0
  151. package/src/lib/utils/breakpoints.ts +47 -0
  152. package/src/lib/utils/component.tsx +131 -0
  153. package/src/lib/utils/deferred.ts +28 -0
  154. package/src/lib/utils/identifiable.ts +87 -0
  155. package/src/lib/utils/stringMaxLength.ts +25 -0
  156. package/src/lib/utils/tailwind.ts +41 -0
  157. package/src/lib/utils/utils.ts +90 -0
  158. package/src/lib/utils/vModel.ts +260 -0
  159. package/src/lib/utils/validation.ts +189 -0
  160. package/src/lib/utils/vue.ts +25 -0
  161. package/tailwind.config.js +38 -0
  162. package/tsconfig.config.json +9 -0
  163. package/tsconfig.demo.json +19 -0
  164. package/tsconfig.json +16 -0
  165. package/tsconfig.lib.json +18 -0
  166. package/tsconfig.vitest.json +8 -0
  167. package/utils/breakpoints.d.ts +1 -1
  168. package/utils/component.d.ts +3 -7
  169. package/utils/component.js +5 -2
  170. package/utils/identifiable.js +5 -1
  171. package/vite.config.ts +28 -0
@@ -8,9 +8,7 @@ export declare const nSelectProps: {
8
8
  readonly tooltipShow: BooleanConstructor;
9
9
  readonly tooltipPlacement: {
10
10
  readonly type: PropType<import("./NTooltip").TooltipPlacement>;
11
- readonly default: "auto"; /**
12
- * @see {@link nValInputProps.name}
13
- */
11
+ readonly default: "auto";
14
12
  };
15
13
  readonly tooltipMaxWidth: {
16
14
  readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
@@ -76,149 +74,5 @@ export type NSelectExposed = NValInputExposed;
76
74
  /**
77
75
  * The `NSelect` is a styled html select-input.
78
76
  */
79
- declare const Component: import("vue").DefineComponent<{
80
- readonly tooltipText: StringConstructor;
81
- readonly tooltipContent: PropType<() => JSX.Element>;
82
- readonly tooltipHide: BooleanConstructor;
83
- readonly tooltipShow: BooleanConstructor;
84
- readonly tooltipPlacement: {
85
- readonly type: PropType<import("./NTooltip").TooltipPlacement>;
86
- readonly default: "auto"; /**
87
- * @see {@link nValInputProps.name}
88
- */
89
- };
90
- readonly tooltipMaxWidth: {
91
- readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
92
- readonly default: "max-w-xs";
93
- };
94
- readonly tooltipWrapperClass: StringConstructor;
95
- readonly tooltipContentClass: StringConstructor;
96
- readonly tooltipArrowClass: StringConstructor;
97
- /**
98
- * The id of the currently selected option of this input.
99
- */
100
- readonly value: StringConstructor;
101
- /**
102
- * This is called with the newly selected id when the selection has changed.
103
- * If no id is selected, the empty string is passed, in order to
104
- * match the API of all other inputs who never pass `undefined`.
105
- */
106
- readonly onUpdateValue: PropType<(newValue: string) => void>;
107
- /**
108
- * The different options which can be selected.
109
- */
110
- readonly options: {
111
- readonly type: PropType<SelectionOption[]>;
112
- readonly default: () => never[];
113
- };
114
- /**
115
- * The value which is shown in the empty state.
116
- * The "nothing-option" will be called like this.
117
- */
118
- readonly placeholder: {
119
- readonly type: StringConstructor;
120
- readonly default: () => string;
121
- };
122
- /**
123
- * @see {@link nValInputProps.name}
124
- */
125
- readonly name: StringConstructor;
126
- /**
127
- * @see {@link nValInputProps.optional}
128
- */
129
- readonly optional: BooleanConstructor;
130
- /**
131
- * @see {@link nValInputProps.disabled}
132
- */
133
- readonly disabled: BooleanConstructor;
134
- /**
135
- * @see {@link nValInputProps.form}
136
- */
137
- readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
138
- /**
139
- * @see {@link nValInputProps.hideLabel}
140
- */
141
- readonly hideLabel: BooleanConstructor;
142
- /**
143
- * @see {@link nValInputProps.inputClass}
144
- */
145
- readonly inputClass: StringConstructor;
146
- }, 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<{
147
- readonly tooltipText: StringConstructor;
148
- readonly tooltipContent: PropType<() => JSX.Element>;
149
- readonly tooltipHide: BooleanConstructor;
150
- readonly tooltipShow: BooleanConstructor;
151
- readonly tooltipPlacement: {
152
- readonly type: PropType<import("./NTooltip").TooltipPlacement>;
153
- readonly default: "auto"; /**
154
- * @see {@link nValInputProps.name}
155
- */
156
- };
157
- readonly tooltipMaxWidth: {
158
- readonly type: PropType<import("../utils/tailwind").TWMaxWidth>;
159
- readonly default: "max-w-xs";
160
- };
161
- readonly tooltipWrapperClass: StringConstructor;
162
- readonly tooltipContentClass: StringConstructor;
163
- readonly tooltipArrowClass: StringConstructor;
164
- /**
165
- * The id of the currently selected option of this input.
166
- */
167
- readonly value: StringConstructor;
168
- /**
169
- * This is called with the newly selected id when the selection has changed.
170
- * If no id is selected, the empty string is passed, in order to
171
- * match the API of all other inputs who never pass `undefined`.
172
- */
173
- readonly onUpdateValue: PropType<(newValue: string) => void>;
174
- /**
175
- * The different options which can be selected.
176
- */
177
- readonly options: {
178
- readonly type: PropType<SelectionOption[]>;
179
- readonly default: () => never[];
180
- };
181
- /**
182
- * The value which is shown in the empty state.
183
- * The "nothing-option" will be called like this.
184
- */
185
- readonly placeholder: {
186
- readonly type: StringConstructor;
187
- readonly default: () => string;
188
- };
189
- /**
190
- * @see {@link nValInputProps.name}
191
- */
192
- readonly name: StringConstructor;
193
- /**
194
- * @see {@link nValInputProps.optional}
195
- */
196
- readonly optional: BooleanConstructor;
197
- /**
198
- * @see {@link nValInputProps.disabled}
199
- */
200
- readonly disabled: BooleanConstructor;
201
- /**
202
- * @see {@link nValInputProps.form}
203
- */
204
- readonly form: PropType<import("./ValidatedForm").ValidatedForm>;
205
- /**
206
- * @see {@link nValInputProps.hideLabel}
207
- */
208
- readonly hideLabel: BooleanConstructor;
209
- /**
210
- * @see {@link nValInputProps.inputClass}
211
- */
212
- readonly inputClass: StringConstructor;
213
- }>> & {}, {
214
- readonly tooltipHide: boolean;
215
- readonly tooltipShow: boolean;
216
- readonly tooltipPlacement: import("./NTooltip").TooltipPlacement;
217
- readonly tooltipMaxWidth: import("../utils/tailwind").TWMaxWidth;
218
- readonly options: SelectionOption[];
219
- readonly disabled: boolean;
220
- readonly placeholder: string;
221
- readonly hideLabel: boolean;
222
- readonly optional: boolean;
223
- }>;
77
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
224
78
  export { Component as NSelect, Component as default };
@@ -1,4 +1,4 @@
1
- import { mergeProps as _mergeProps, createVNode as _createVNode, Fragment as _Fragment } from "vue";
1
+ import { Fragment as _Fragment, createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { trsl } from '../i18n';
3
3
  import { createComponent } from '../utils/component';
4
4
  import { ref } from 'vue';
@@ -6,7 +6,7 @@ export declare const nSuggestionListPropsForConfig: {
6
6
  * The items which are available to show in the list. The first `maxItems` will be displayed.
7
7
  */
8
8
  readonly items: {
9
- readonly type: PropType<SuggestionItem[]>;
9
+ readonly type: PropType<Array<SuggestionItem>>;
10
10
  readonly default: () => never[];
11
11
  };
12
12
  /**
@@ -90,7 +90,7 @@ export declare const nSuggestionListProps: {
90
90
  * The items which are available to show in the list. The first `maxItems` will be displayed.
91
91
  */
92
92
  readonly items: {
93
- readonly type: PropType<SuggestionItem[]>;
93
+ readonly type: PropType<Array<SuggestionItem>>;
94
94
  readonly default: () => never[];
95
95
  };
96
96
  /**
@@ -149,128 +149,5 @@ export type SuggestionItem = Identifiable & {
149
149
  /**
150
150
  * The `NSuggestionList` can be added to an input and adds a list below it which is shown when the input is focused.
151
151
  */
152
- declare const Component: import("vue").DefineComponent<{
153
- /**
154
- * The slot for the input, which will be enhanced with the suggestion list.
155
- */
156
- readonly input: {
157
- readonly type: PropType<(props: InputSlotProps) => JSX.Element>;
158
- readonly required: true;
159
- };
160
- /**
161
- * When this function is called, the parent is required to call focus() on the input element.
162
- * It won't work properly if the parent does not request focus on the input.
163
- */
164
- readonly onRequestInputFocus: {
165
- readonly type: PropType<() => void>;
166
- readonly required: true;
167
- };
168
- /**
169
- * The current value of the input. This is just needed to display the «No results found for {value}» message.
170
- */
171
- readonly inputValue: {
172
- readonly type: StringConstructor;
173
- readonly required: true;
174
- };
175
- /**
176
- * The items which are available to show in the list. The first `maxItems` will be displayed.
177
- */
178
- readonly items: {
179
- readonly type: PropType<SuggestionItem[]>;
180
- readonly default: () => never[];
181
- };
182
- /**
183
- * The maximum items which are displayed in the list.
184
- */
185
- readonly maxItems: {
186
- readonly type: NumberConstructor;
187
- readonly default: () => number;
188
- };
189
- /**
190
- * If set to `true` the list is hidden.
191
- */
192
- readonly hideList: BooleanConstructor;
193
- /**
194
- * If set to `true` the list shows a loading indicator when the `items` array is empty.
195
- */
196
- readonly loading: BooleanConstructor;
197
- /**
198
- * This is called with the id of the selected item.
199
- */
200
- readonly onSelect: PropType<(id: string) => void>;
201
- /**
202
- * The slot for every item of the list.
203
- */
204
- readonly listItem: PropType<(props: ItemSlotProps) => JSX.Element>;
205
- /**
206
- * This function is called, when the input and the suggestion list are really blurred.
207
- * This means, it's not just the input temporarly beeing blurred because the user clicks on the item list,
208
- * but the focus has completely disappeared from the input and the list.
209
- */
210
- readonly onRealBlur: PropType<() => void>;
211
- }, 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<{
212
- /**
213
- * The slot for the input, which will be enhanced with the suggestion list.
214
- */
215
- readonly input: {
216
- readonly type: PropType<(props: InputSlotProps) => JSX.Element>;
217
- readonly required: true;
218
- };
219
- /**
220
- * When this function is called, the parent is required to call focus() on the input element.
221
- * It won't work properly if the parent does not request focus on the input.
222
- */
223
- readonly onRequestInputFocus: {
224
- readonly type: PropType<() => void>;
225
- readonly required: true;
226
- };
227
- /**
228
- * The current value of the input. This is just needed to display the «No results found for {value}» message.
229
- */
230
- readonly inputValue: {
231
- readonly type: StringConstructor;
232
- readonly required: true;
233
- };
234
- /**
235
- * The items which are available to show in the list. The first `maxItems` will be displayed.
236
- */
237
- readonly items: {
238
- readonly type: PropType<SuggestionItem[]>;
239
- readonly default: () => never[];
240
- };
241
- /**
242
- * The maximum items which are displayed in the list.
243
- */
244
- readonly maxItems: {
245
- readonly type: NumberConstructor;
246
- readonly default: () => number;
247
- };
248
- /**
249
- * If set to `true` the list is hidden.
250
- */
251
- readonly hideList: BooleanConstructor;
252
- /**
253
- * If set to `true` the list shows a loading indicator when the `items` array is empty.
254
- */
255
- readonly loading: BooleanConstructor;
256
- /**
257
- * This is called with the id of the selected item.
258
- */
259
- readonly onSelect: PropType<(id: string) => void>;
260
- /**
261
- * The slot for every item of the list.
262
- */
263
- readonly listItem: PropType<(props: ItemSlotProps) => JSX.Element>;
264
- /**
265
- * This function is called, when the input and the suggestion list are really blurred.
266
- * This means, it's not just the input temporarly beeing blurred because the user clicks on the item list,
267
- * but the focus has completely disappeared from the input and the list.
268
- */
269
- readonly onRealBlur: PropType<() => void>;
270
- }>> & {}, {
271
- readonly loading: boolean;
272
- readonly items: SuggestionItem[];
273
- readonly maxItems: number;
274
- readonly hideList: boolean;
275
- }>;
152
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
276
153
  export { Component as NSuggestionList, Component as default };
@@ -1,4 +1,4 @@
1
- import { createTextVNode as _createTextVNode, createVNode as _createVNode } from "vue";
1
+ import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
2
2
  import { trsl } from '../i18n';
3
3
  import { createComponentWithSlots } from '../utils/component';
4
4
  import { computed, ref } from 'vue';
@@ -103,7 +103,10 @@ const Component = createComponentWithSlots('NSuggestionList', nSuggestionListPro
103
103
  event.preventDefault();
104
104
  const index = selectedIndex.value;
105
105
  if (index != null && index < displayItems.value.length) {
106
- onSelect(displayItems.value[index].id);
106
+ const item = displayItems.value[index];
107
+ if (item) {
108
+ onSelect(item.id);
109
+ }
107
110
  }
108
111
  }
109
112
  };
@@ -93,89 +93,5 @@ export declare const nTableProps: {
93
93
  /**
94
94
  * The `NTable` is a styled html table which accepts data and displays it appropriately.
95
95
  */
96
- declare const Component: import("vue").DefineComponent<{
97
- /**
98
- * The headings of the table. These define which columns are shown in the table and in which order.
99
- */
100
- readonly headings: {
101
- readonly type: PropType<TableHeading[]>;
102
- readonly required: true;
103
- };
104
- /**
105
- * Adds the classes to all headings at the top of the table.
106
- */
107
- readonly headingsClass: StringConstructor;
108
- /**
109
- * Adds the classes to all headings in the details of the table.
110
- */
111
- readonly headingDetailsClass: StringConstructor;
112
- /**
113
- * The items of the table. They consist of an array of table rows.
114
- * Every tablerow is an object containing elements for the heading keys.
115
- * The elements can either be a primitive value or a function which returns a {@link JSX.Element}.
116
- * If the item should be treated as an action (e.g. icon-button to display at the end of the row)
117
- * the dedicated key 'action' can be used.
118
- * @see TableRow
119
- * @example
120
- * // These headings are defined
121
- * const headings: TableHeading[] = [
122
- * { key: 'id', label: 'ID' },
123
- * { key: 'name', label: 'Name' },
124
- * { key: 'status', label: 'Status' }
125
- * ]
126
- *
127
- * // Appropriate rows for these headings
128
- * const items: TableRow[] = [
129
- * { id: 1, name: 'Hubert', status: () => <NBadge ... />, action: ... }, // Row 1
130
- * { id: 2, name: 'Franzi', status: () => <NBadge ... />, action: ... } // Row 2
131
- * ]
132
- */
133
- readonly items: {
134
- readonly type: PropType<TableRow[]>;
135
- readonly default: () => never[];
136
- };
137
- }, 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<{
138
- /**
139
- * The headings of the table. These define which columns are shown in the table and in which order.
140
- */
141
- readonly headings: {
142
- readonly type: PropType<TableHeading[]>;
143
- readonly required: true;
144
- };
145
- /**
146
- * Adds the classes to all headings at the top of the table.
147
- */
148
- readonly headingsClass: StringConstructor;
149
- /**
150
- * Adds the classes to all headings in the details of the table.
151
- */
152
- readonly headingDetailsClass: StringConstructor;
153
- /**
154
- * The items of the table. They consist of an array of table rows.
155
- * Every tablerow is an object containing elements for the heading keys.
156
- * The elements can either be a primitive value or a function which returns a {@link JSX.Element}.
157
- * If the item should be treated as an action (e.g. icon-button to display at the end of the row)
158
- * the dedicated key 'action' can be used.
159
- * @see TableRow
160
- * @example
161
- * // These headings are defined
162
- * const headings: TableHeading[] = [
163
- * { key: 'id', label: 'ID' },
164
- * { key: 'name', label: 'Name' },
165
- * { key: 'status', label: 'Status' }
166
- * ]
167
- *
168
- * // Appropriate rows for these headings
169
- * const items: TableRow[] = [
170
- * { id: 1, name: 'Hubert', status: () => <NBadge ... />, action: ... }, // Row 1
171
- * { id: 2, name: 'Franzi', status: () => <NBadge ... />, action: ... } // Row 2
172
- * ]
173
- */
174
- readonly items: {
175
- readonly type: PropType<TableRow[]>;
176
- readonly default: () => never[];
177
- };
178
- }>> & {}, {
179
- readonly items: TableRow[];
180
- }>;
96
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
181
97
  export { Component as NTable, Component as default };
@@ -1,7 +1,7 @@
1
- import { Fragment as _Fragment, createVNode as _createVNode } from "vue";
1
+ import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
2
2
  import { isWidthBreakpoint } from '../utils/breakpoints';
3
3
  import { createComponent } from '../utils/component';
4
- import { ChevronDownIcon, ChevronUpIcon } from '@heroicons/vue/24/solid';
4
+ import { ChevronLeftIcon } from '@heroicons/vue/24/solid';
5
5
  import { computed, Fragment, ref, watch } from 'vue';
6
6
  import NIconButton from './NIconButton';
7
7
  import './NTable.css';
@@ -95,17 +95,23 @@ const Component = createComponent('NTable', nTableProps, props => {
95
95
  "class": "p-4"
96
96
  }, [_createVNode("div", {
97
97
  "class": ['flex', heading.emph ? 'font-medium text-default-900' : '', heading.cellClass, heading.key == N_TABLE_ACTION_KEY ? 'justify-end items-center space-x-3' : '']
98
- }, [item[heading.key] && buildItem(item[heading.key]), heading.key == N_TABLE_ACTION_KEY && showDetails.value && _createVNode(NIconButton, {
99
- "icon": isDetailsOpen(itemIndex) ? ChevronDownIcon : ChevronUpIcon,
98
+ }, [item[heading.key] && buildItem(item[heading.key]), heading.key == N_TABLE_ACTION_KEY && showDetails.value && _createVNode("div", {
99
+ "class": "inline-flex transition-transform duration-200",
100
+ "style": {
101
+ transform: isDetailsOpen(itemIndex) ? 'rotate(-90deg)' : 'rotate(0deg)',
102
+ transformOrigin: 'center center'
103
+ }
104
+ }, [_createVNode(NIconButton, {
105
+ "icon": ChevronLeftIcon,
100
106
  "onClick": () => toggleDetailsOpen(itemIndex)
101
- }, null)])]))])]), showDetails.value && isDetailsOpen(itemIndex) && _createVNode("tbody", {
107
+ }, null)])])]))])]), showDetails.value && isDetailsOpen(itemIndex) && _createVNode("tbody", {
102
108
  "class": [itemIndex % 2 === 0 ? 'bg-white' : 'bg-default-50', item.detailsClass]
103
109
  }, [details.value.map((detail, detailIndex) => _createVNode("tr", {
104
110
  "key": `detail-${detailIndex}`
105
111
  }, [_createVNode("td", {
106
112
  "class": ['table-heading px-4 py-1', props.headingDetailsClass, details.value.length - 1 == detailIndex ? 'pb-4' : '']
107
113
  }, [buildItem(detail.label)]), _createVNode("td", {
108
- "class": ['px-4 py-1', details.value[detailIndex].detailsClass, details.value.length - 1 == detailIndex ? 'pb-4' : ''],
114
+ "class": ['px-4 py-1', details.value[detailIndex]?.detailsClass, details.value.length - 1 == detailIndex ? 'pb-4' : ''],
109
115
  "colspan": headings.value.length - 1
110
116
  }, [item[detail.key] && buildItem(item[detail.key])])]))])]))])]);
111
117
  });
@@ -13,7 +13,7 @@ export declare const nTableActionProps: {
13
13
  * The html attribute, which indicates the type of the button.
14
14
  */
15
15
  readonly type: {
16
- readonly type: PropType<"button" | "submit" | "reset">;
16
+ readonly type: PropType<"submit" | "button" | "reset">;
17
17
  readonly default: "button";
18
18
  };
19
19
  /**
@@ -26,49 +26,5 @@ export declare const nTableActionProps: {
26
26
  * The `NTableAction` is a button or {@link RouterLink} which is styled to fit into a table.
27
27
  * It is basically styled as an emphasized text in the table.
28
28
  */
29
- declare const Component: import("vue").DefineComponent<{
30
- /**
31
- * The route of the action. If set the component will be a {@link RouterLink}.
32
- */
33
- readonly route: PropType<RouteLocationRaw>;
34
- /**
35
- * The text of the action.
36
- */
37
- readonly text: StringConstructor;
38
- /**
39
- * The html attribute, which indicates the type of the button.
40
- */
41
- readonly type: {
42
- readonly type: PropType<"button" | "submit" | "reset">;
43
- readonly default: "button";
44
- };
45
- /**
46
- * This is called when the action is clicked.
47
- * It is only called when the `route` prop is not set on the action.
48
- */
49
- readonly onClick: PropType<() => void>;
50
- }, 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<{
51
- /**
52
- * The route of the action. If set the component will be a {@link RouterLink}.
53
- */
54
- readonly route: PropType<RouteLocationRaw>;
55
- /**
56
- * The text of the action.
57
- */
58
- readonly text: StringConstructor;
59
- /**
60
- * The html attribute, which indicates the type of the button.
61
- */
62
- readonly type: {
63
- readonly type: PropType<"button" | "submit" | "reset">;
64
- readonly default: "button";
65
- };
66
- /**
67
- * This is called when the action is clicked.
68
- * It is only called when the `route` prop is not set on the action.
69
- */
70
- readonly onClick: PropType<() => void>;
71
- }>> & {}, {
72
- readonly type: "button" | "submit" | "reset";
73
- }>;
29
+ declare const Component: import("vue").DefineSetupFnComponent<Record<string, any>, {}, {}, Record<string, any> & {}, import("vue").PublicProps>;
74
30
  export { Component as NTableAction, Component as default };
@@ -1,4 +1,4 @@
1
- import { isVNode as _isVNode, createVNode as _createVNode, Fragment as _Fragment } from "vue";
1
+ import { Fragment as _Fragment, createVNode as _createVNode, isVNode as _isVNode } from "vue";
2
2
  import { createComponent } from '../utils/component';
3
3
  import { RouterLink } from 'vue-router';
4
4
  import { nButtonProps } from './NButton';