nuxt-ui-tools 1.5.0 → 1.6.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/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/i18n/locales/en.js +23 -2
- package/dist/runtime/i18n/locales/fr.js +23 -2
- package/dist/runtime/i18n/types.d.ts +21 -0
- package/dist/runtime/table/components/data-list/data-list-content.vue +7 -1
- package/dist/runtime/table/components/data-list/data-list-error-state.d.vue.ts +18 -1
- package/dist/runtime/table/components/data-list/data-list-error-state.vue +65 -41
- package/dist/runtime/table/components/data-list/data-list-error-state.vue.d.ts +18 -1
- package/dist/runtime/table/components/data-list/sort-menu-panel.vue +33 -25
- package/dist/runtime/table/components/drawers/column-panel.vue +19 -6
- package/dist/runtime/table/components/filters/shared/dynamic-filter-picker.vue +1 -1
- package/dist/runtime/table/components/filters/shared/filter-editor-header.d.vue.ts +16 -0
- package/dist/runtime/table/components/filters/shared/filter-editor-header.vue +46 -0
- package/dist/runtime/table/components/filters/shared/filter-editor-header.vue.d.ts +16 -0
- package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.d.vue.ts +3 -1
- package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue +5 -4
- package/dist/runtime/table/components/filters/shared/filter-option-multiple-list.vue.d.ts +3 -1
- package/dist/runtime/table/components/filters/shared/filter-option-picker-content.vue +4 -1
- package/dist/runtime/table/components/filters/shared/filter-option-single-list.vue +3 -3
- package/dist/runtime/table/components/filters/shared/filter-option-tree-content.vue +7 -3
- package/dist/runtime/table/components/filters/shared/filter-popover-shell.vue +10 -1
- package/dist/runtime/table/components/filters/shared/filter-searchable-panel.vue +14 -6
- package/dist/runtime/table/components/filters/shared/filter-trigger-tag.vue +5 -1
- package/dist/runtime/table/components/filters/tags/boolean-filter-tag.d.vue.ts +6 -1
- package/dist/runtime/table/components/filters/tags/boolean-filter-tag.vue +19 -5
- package/dist/runtime/table/components/filters/tags/boolean-filter-tag.vue.d.ts +6 -1
- package/dist/runtime/table/components/filters/tags/date-filter-tag.d.vue.ts +6 -1
- package/dist/runtime/table/components/filters/tags/date-filter-tag.vue +65 -29
- package/dist/runtime/table/components/filters/tags/date-filter-tag.vue.d.ts +6 -1
- package/dist/runtime/table/components/filters/tags/number-filter-tag.d.vue.ts +6 -1
- package/dist/runtime/table/components/filters/tags/number-filter-tag.vue +66 -18
- package/dist/runtime/table/components/filters/tags/number-filter-tag.vue.d.ts +6 -1
- package/dist/runtime/table/components/filters/tags/option-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/option-filter-tag.vue +10 -34
- package/dist/runtime/table/components/filters/tags/option-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/text-filter-tag.d.vue.ts +6 -1
- package/dist/runtime/table/components/filters/tags/text-filter-tag.vue +39 -14
- package/dist/runtime/table/components/filters/tags/text-filter-tag.vue.d.ts +6 -1
- package/dist/runtime/table/components/grid/grid-renderer.d.vue.ts +8 -2
- package/dist/runtime/table/components/grid/grid-renderer.vue +47 -115
- package/dist/runtime/table/components/grid/grid-renderer.vue.d.ts +8 -2
- package/dist/runtime/table/components/layout/progress-line.d.vue.ts +9 -0
- package/dist/runtime/table/components/layout/progress-line.vue +43 -0
- package/dist/runtime/table/components/layout/progress-line.vue.d.ts +9 -0
- package/dist/runtime/table/components/table/table-empty-state.d.vue.ts +1 -1
- package/dist/runtime/table/components/table/table-empty-state.vue +1 -1
- package/dist/runtime/table/components/table/table-empty-state.vue.d.ts +1 -1
- package/dist/runtime/table/components/table/table-layout.d.ts +57 -0
- package/dist/runtime/table/components/table/table-layout.js +23 -0
- package/dist/runtime/table/components/table/table-renderer.d.vue.ts +8 -16
- package/dist/runtime/table/components/table/table-renderer.vue +180 -274
- package/dist/runtime/table/components/table/table-renderer.vue.d.ts +8 -16
- package/dist/runtime/table/components/table/table-row.d.vue.ts +19 -0
- package/dist/runtime/table/components/table/table-row.vue +51 -0
- package/dist/runtime/table/components/table/table-row.vue.d.ts +19 -0
- package/dist/runtime/table/components/table/table-skeleton-cell.d.ts +9 -0
- package/dist/runtime/table/components/table/table-skeleton-cell.js +104 -0
- package/dist/runtime/table/components/utils/search-query-input.vue +27 -1
- package/dist/runtime/table/composables/use-deferred-commit.d.ts +20 -0
- package/dist/runtime/table/composables/use-deferred-commit.js +31 -0
- package/dist/runtime/table/composables/use-table-data.d.ts +5 -1
- package/dist/runtime/table/composables/use-table-data.js +20 -2
- package/dist/runtime/table/composables/use-table-summaries.js +10 -1
- package/dist/runtime/table/types/columns.d.ts +18 -3
- package/dist/runtime/table/types/data-list.d.ts +1 -0
- package/dist/runtime/table/types/layout.d.ts +1 -1
- package/dist/runtime/table/utils/columns/defs.js +1 -1
- package/dist/runtime/table/utils/filters/date.d.ts +6 -0
- package/dist/runtime/table/utils/filters/date.js +26 -2
- package/dist/runtime/table/utils/filters/index.d.ts +1 -0
- package/dist/runtime/table/utils/filters/index.js +1 -0
- package/dist/runtime/table/utils/filters/number.d.ts +5 -0
- package/dist/runtime/table/utils/filters/number.js +11 -0
- package/dist/runtime/table/utils/filters/ui.js +5 -5
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ export function resolveDateFilterScalarPresets(options) {
|
|
|
6
6
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
7
7
|
return presetDefinitions.map((preset) => {
|
|
8
8
|
const resolved = {
|
|
9
|
-
label:
|
|
9
|
+
label: presetLabel(preset, options.translate),
|
|
10
10
|
value: resolveScalarPresetValue({ now, preset })
|
|
11
11
|
};
|
|
12
12
|
if (preset.description) {
|
|
@@ -20,7 +20,7 @@ export function resolveDateFilterRangePresets(options) {
|
|
|
20
20
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
21
21
|
return presetDefinitions.map((preset) => {
|
|
22
22
|
const resolved = {
|
|
23
|
-
label:
|
|
23
|
+
label: presetLabel(preset, options.translate),
|
|
24
24
|
value: resolveRangePresetValue({ now, preset })
|
|
25
25
|
};
|
|
26
26
|
if (preset.description) {
|
|
@@ -135,20 +135,29 @@ function endOfMonth(value) {
|
|
|
135
135
|
function startOfYear(value) {
|
|
136
136
|
return new Date(value.getFullYear(), 0, 1);
|
|
137
137
|
}
|
|
138
|
+
function presetLabel(preset, translate) {
|
|
139
|
+
if (translate && "key" in preset && typeof preset.key === "string") {
|
|
140
|
+
return translate(preset.key);
|
|
141
|
+
}
|
|
142
|
+
return resolveTextValue(preset.label);
|
|
143
|
+
}
|
|
138
144
|
const DEFAULT_SCALAR_PRESETS = {
|
|
139
145
|
after: [
|
|
140
146
|
{
|
|
141
147
|
description: "Everything after today.",
|
|
148
|
+
key: "today",
|
|
142
149
|
label: "Today",
|
|
143
150
|
value: ({ now }) => startOfDay(now)
|
|
144
151
|
},
|
|
145
152
|
{
|
|
146
153
|
description: "Everything after the last 7 days.",
|
|
154
|
+
key: "sevenDaysAgo",
|
|
147
155
|
label: "7 days ago",
|
|
148
156
|
value: ({ now }) => startOfDay(addDays(now, -7))
|
|
149
157
|
},
|
|
150
158
|
{
|
|
151
159
|
description: "Everything after the first day of this year.",
|
|
160
|
+
key: "startOfYear",
|
|
152
161
|
label: "Start of year",
|
|
153
162
|
value: ({ now }) => startOfYear(now)
|
|
154
163
|
}
|
|
@@ -156,16 +165,19 @@ const DEFAULT_SCALAR_PRESETS = {
|
|
|
156
165
|
before: [
|
|
157
166
|
{
|
|
158
167
|
description: "Everything earlier than today.",
|
|
168
|
+
key: "today",
|
|
159
169
|
label: "Today",
|
|
160
170
|
value: ({ now }) => startOfDay(now)
|
|
161
171
|
},
|
|
162
172
|
{
|
|
163
173
|
description: "Everything earlier than the last 7 days.",
|
|
174
|
+
key: "sevenDaysAgo",
|
|
164
175
|
label: "7 days ago",
|
|
165
176
|
value: ({ now }) => startOfDay(addDays(now, -7))
|
|
166
177
|
},
|
|
167
178
|
{
|
|
168
179
|
description: "Everything before this month.",
|
|
180
|
+
key: "startOfMonth",
|
|
169
181
|
label: "Start of month",
|
|
170
182
|
value: ({ now }) => startOfMonth(now)
|
|
171
183
|
}
|
|
@@ -173,16 +185,19 @@ const DEFAULT_SCALAR_PRESETS = {
|
|
|
173
185
|
is: [
|
|
174
186
|
{
|
|
175
187
|
description: "Use the current day.",
|
|
188
|
+
key: "today",
|
|
176
189
|
label: "Today",
|
|
177
190
|
value: ({ now }) => startOfDay(now)
|
|
178
191
|
},
|
|
179
192
|
{
|
|
180
193
|
description: "Use the previous day.",
|
|
194
|
+
key: "yesterday",
|
|
181
195
|
label: "Yesterday",
|
|
182
196
|
value: ({ now }) => startOfDay(addDays(now, -1))
|
|
183
197
|
},
|
|
184
198
|
{
|
|
185
199
|
description: "Jump to the first day of this month.",
|
|
200
|
+
key: "startOfMonth",
|
|
186
201
|
label: "Start of month",
|
|
187
202
|
value: ({ now }) => startOfMonth(now)
|
|
188
203
|
}
|
|
@@ -190,16 +205,19 @@ const DEFAULT_SCALAR_PRESETS = {
|
|
|
190
205
|
isNot: [
|
|
191
206
|
{
|
|
192
207
|
description: "Exclude the current day.",
|
|
208
|
+
key: "today",
|
|
193
209
|
label: "Today",
|
|
194
210
|
value: ({ now }) => startOfDay(now)
|
|
195
211
|
},
|
|
196
212
|
{
|
|
197
213
|
description: "Exclude the previous day.",
|
|
214
|
+
key: "yesterday",
|
|
198
215
|
label: "Yesterday",
|
|
199
216
|
value: ({ now }) => startOfDay(addDays(now, -1))
|
|
200
217
|
},
|
|
201
218
|
{
|
|
202
219
|
description: "Exclude the first day of this month.",
|
|
220
|
+
key: "startOfMonth",
|
|
203
221
|
label: "Start of month",
|
|
204
222
|
value: ({ now }) => startOfMonth(now)
|
|
205
223
|
}
|
|
@@ -208,6 +226,7 @@ const DEFAULT_SCALAR_PRESETS = {
|
|
|
208
226
|
const DEFAULT_RANGE_PRESETS = [
|
|
209
227
|
{
|
|
210
228
|
description: "Only the current day.",
|
|
229
|
+
key: "today",
|
|
211
230
|
label: "Today",
|
|
212
231
|
value: ({ now }) => ({
|
|
213
232
|
from: startOfDay(now),
|
|
@@ -216,6 +235,7 @@ const DEFAULT_RANGE_PRESETS = [
|
|
|
216
235
|
},
|
|
217
236
|
{
|
|
218
237
|
description: "The previous 7 calendar days.",
|
|
238
|
+
key: "last7Days",
|
|
219
239
|
label: "Last 7 days",
|
|
220
240
|
value: ({ now }) => ({
|
|
221
241
|
from: startOfDay(addDays(now, -6)),
|
|
@@ -224,6 +244,7 @@ const DEFAULT_RANGE_PRESETS = [
|
|
|
224
244
|
},
|
|
225
245
|
{
|
|
226
246
|
description: "The previous 30 calendar days.",
|
|
247
|
+
key: "last30Days",
|
|
227
248
|
label: "Last 30 days",
|
|
228
249
|
value: ({ now }) => ({
|
|
229
250
|
from: startOfDay(addDays(now, -29)),
|
|
@@ -232,6 +253,7 @@ const DEFAULT_RANGE_PRESETS = [
|
|
|
232
253
|
},
|
|
233
254
|
{
|
|
234
255
|
description: "From the first day of this month until today.",
|
|
256
|
+
key: "thisMonth",
|
|
235
257
|
label: "This month",
|
|
236
258
|
value: ({ now }) => ({
|
|
237
259
|
from: startOfMonth(now),
|
|
@@ -240,6 +262,7 @@ const DEFAULT_RANGE_PRESETS = [
|
|
|
240
262
|
},
|
|
241
263
|
{
|
|
242
264
|
description: "The full previous month.",
|
|
265
|
+
key: "lastMonth",
|
|
243
266
|
label: "Last month",
|
|
244
267
|
value: ({ now }) => {
|
|
245
268
|
const previousMonth = new Date(now.getFullYear(), now.getMonth() - 1, 1);
|
|
@@ -251,6 +274,7 @@ const DEFAULT_RANGE_PRESETS = [
|
|
|
251
274
|
},
|
|
252
275
|
{
|
|
253
276
|
description: "From the first day of the year until today.",
|
|
277
|
+
key: "yearToDate",
|
|
254
278
|
label: "Year to date",
|
|
255
279
|
value: ({ now }) => ({
|
|
256
280
|
from: startOfYear(now),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function parseTypedNumber(params) {
|
|
2
|
+
const parts = new Intl.NumberFormat(params.locale).formatToParts(-1234.5);
|
|
3
|
+
const group = parts.find((part) => part.type === "group")?.value;
|
|
4
|
+
const decimal = parts.find((part) => part.type === "decimal")?.value ?? ".";
|
|
5
|
+
const normalized = (group ? params.text.replaceAll(group, "") : params.text).replaceAll(/\s/gu, "").replace(decimal, ".").replaceAll(/[^\d.-]/gu, "");
|
|
6
|
+
if (!/\d/u.test(normalized)) {
|
|
7
|
+
return void 0;
|
|
8
|
+
}
|
|
9
|
+
const value = Number(normalized);
|
|
10
|
+
return Number.isFinite(value) ? value : void 0;
|
|
11
|
+
}
|
|
@@ -17,7 +17,7 @@ export function resolveTextFilterUi(definition, operator) {
|
|
|
17
17
|
actions: resolveActions({ common: definition.actions }),
|
|
18
18
|
autocomplete: definition.editor?.autocomplete ?? "off",
|
|
19
19
|
clearOnOperatorChange: definition.behavior?.clearOnOperatorChange ?? true,
|
|
20
|
-
commitMode: definition.behavior?.commitMode ?? "
|
|
20
|
+
commitMode: definition.behavior?.commitMode ?? "auto",
|
|
21
21
|
input: {
|
|
22
22
|
autofocus: definition.editor?.input?.autofocus ?? false,
|
|
23
23
|
fixed: definition.editor?.input?.fixed ?? false,
|
|
@@ -64,7 +64,7 @@ export function resolveOptionFilterUi(definition, operator) {
|
|
|
64
64
|
}),
|
|
65
65
|
clearOnOperatorChange: definition.behavior?.clearOnOperatorChange ?? true,
|
|
66
66
|
closeOnSelect: definition.editor?.closeOnSelect ?? false,
|
|
67
|
-
commitMode: definition.behavior?.commitMode ?? "
|
|
67
|
+
commitMode: definition.behavior?.commitMode ?? "auto",
|
|
68
68
|
labels: {
|
|
69
69
|
empty: getFilterTextValue({
|
|
70
70
|
fallback: t("table.filters.options.empty"),
|
|
@@ -124,7 +124,7 @@ export function resolveBooleanFilterUi(definition, operator) {
|
|
|
124
124
|
local: labels
|
|
125
125
|
}),
|
|
126
126
|
clearOnOperatorChange: definition.behavior?.clearOnOperatorChange ?? true,
|
|
127
|
-
commitMode: definition.behavior?.commitMode ?? "
|
|
127
|
+
commitMode: definition.behavior?.commitMode ?? "auto",
|
|
128
128
|
icons: {
|
|
129
129
|
false: icons.false,
|
|
130
130
|
true: icons.true
|
|
@@ -167,7 +167,7 @@ export function resolveNumberFilterUi(definition, operator) {
|
|
|
167
167
|
return {
|
|
168
168
|
actions: resolveActions({ common: definition.actions }),
|
|
169
169
|
clearOnOperatorChange: definition.behavior?.clearOnOperatorChange ?? true,
|
|
170
|
-
commitMode: definition.behavior?.commitMode ?? "
|
|
170
|
+
commitMode: definition.behavior?.commitMode ?? "auto",
|
|
171
171
|
formatOptions: definition.editor?.formatOptions,
|
|
172
172
|
max: definition.editor?.max,
|
|
173
173
|
min: definition.editor?.min,
|
|
@@ -238,7 +238,7 @@ export function resolveDateFilterUi(definition, operator) {
|
|
|
238
238
|
return {
|
|
239
239
|
actions: resolveActions({ common: definition.actions }),
|
|
240
240
|
clearOnOperatorChange: definition.behavior?.clearOnOperatorChange ?? true,
|
|
241
|
-
commitMode: definition.behavior?.commitMode ?? "
|
|
241
|
+
commitMode: definition.behavior?.commitMode ?? "auto",
|
|
242
242
|
preview: resolveDatePreview({
|
|
243
243
|
base: definition.preview,
|
|
244
244
|
empty: t("table.filters.preview.empty"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-ui-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.1",
|
|
4
4
|
"description": "Nuxt module and runtime toolkit for UI-heavy Nuxt applications",
|
|
5
5
|
"homepage": "https://github.com/ChronicStone/nuxt-ui-tools#readme",
|
|
6
6
|
"bugs": "https://github.com/ChronicStone/nuxt-ui-tools/issues",
|