@dragonmastery/zinia-forms-core 0.3.15 → 0.3.16
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/index.d.ts +10 -1
- package/dist/index.js +408 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1170,6 +1170,14 @@ interface DeleteModalProps<FormType = any> {
|
|
|
1170
1170
|
interface DataTableProps<FormType> {
|
|
1171
1171
|
class?: string;
|
|
1172
1172
|
name?: string;
|
|
1173
|
+
/**
|
|
1174
|
+
* Height behavior for the table container
|
|
1175
|
+
* - 'auto' (default): Table expands to fill available space with a minimum height to prevent squishing
|
|
1176
|
+
* - 'fixed': Uses fixed height (850px, max 90vh) - original behavior
|
|
1177
|
+
* - number: Fixed pixel height (e.g., 600)
|
|
1178
|
+
* - string: Custom CSS height value (e.g., '50vh', '600px')
|
|
1179
|
+
*/
|
|
1180
|
+
height?: 'auto' | 'fixed' | number | string;
|
|
1173
1181
|
}
|
|
1174
1182
|
|
|
1175
1183
|
/**
|
|
@@ -2048,9 +2056,10 @@ interface ColumnDefinition<TData, TField extends keyof TData> {
|
|
|
2048
2056
|
textWrap?: 'truncate' | 'wrap';
|
|
2049
2057
|
format?: (value: TData[TField], row: TData) => string;
|
|
2050
2058
|
render?: (value: TData[TField], row: TData) => any;
|
|
2051
|
-
filterType?: 'text' | 'select' | 'number' | 'boolean';
|
|
2059
|
+
filterType?: 'text' | 'select' | 'number' | 'boolean' | 'combobox';
|
|
2052
2060
|
filterOptions?: FilterOptionItem[];
|
|
2053
2061
|
filterOptionsLoader?: () => Promise<FilterOptionItem[]>;
|
|
2062
|
+
filterAllowCreate?: boolean;
|
|
2054
2063
|
sortLabels?: {
|
|
2055
2064
|
asc: string;
|
|
2056
2065
|
desc: string;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { watch, provide, ref, computed, unref, inject, getCurrentInstance,
|
|
1
|
+
import { reactive, watch, provide, ref, computed, unref, inject, getCurrentInstance, nextTick, Teleport } from 'vue';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'vue/jsx-runtime';
|
|
4
4
|
|
|
@@ -5261,7 +5261,7 @@ function createDaisyUIComboboxField() {
|
|
|
5261
5261
|
class: inputClass,
|
|
5262
5262
|
placeholder: isBeingPopulated.value ? "Loading..." : isLoadingOptions.value ? "Loading options..." : parentFieldName.value && !parentValue.value ? "Select parent field first" : props.placeholder || "Search or type new value",
|
|
5263
5263
|
disabled: isDisabled.value,
|
|
5264
|
-
autocomplete: "
|
|
5264
|
+
autocomplete: "nope",
|
|
5265
5265
|
"data-testid": `${formState.storeName}-combobox-field-${String(props.name)}`,
|
|
5266
5266
|
...inputProps
|
|
5267
5267
|
}
|
|
@@ -7749,6 +7749,8 @@ function getFilterType(field, column, fieldsMetadata) {
|
|
|
7749
7749
|
return "number";
|
|
7750
7750
|
case "checkbox":
|
|
7751
7751
|
return "boolean";
|
|
7752
|
+
case "combobox":
|
|
7753
|
+
return "combobox";
|
|
7752
7754
|
case "select":
|
|
7753
7755
|
case "radio":
|
|
7754
7756
|
return column.filterOptions || fieldMetadata?.options ? "select" : "text";
|
|
@@ -8242,6 +8244,366 @@ var BooleanFilter = (props) => {
|
|
|
8242
8244
|
}
|
|
8243
8245
|
);
|
|
8244
8246
|
};
|
|
8247
|
+
var comboboxState = reactive({});
|
|
8248
|
+
var ComboboxFilter = (props) => {
|
|
8249
|
+
if (!comboboxState[props.field]) {
|
|
8250
|
+
comboboxState[props.field] = {
|
|
8251
|
+
isOpen: false,
|
|
8252
|
+
selectedIndex: -1
|
|
8253
|
+
};
|
|
8254
|
+
}
|
|
8255
|
+
const state = comboboxState[props.field];
|
|
8256
|
+
const searchQuery = computed(() => props.filterInputValues.value[props.field] || "");
|
|
8257
|
+
const selectedOption = computed(() => {
|
|
8258
|
+
if (!props.value) return "";
|
|
8259
|
+
return props.options.find((opt) => opt.value === props.value)?.label || String(props.value);
|
|
8260
|
+
});
|
|
8261
|
+
if (!(props.field in props.filterInputValues.value) && props.value) {
|
|
8262
|
+
const label = selectedOption.value;
|
|
8263
|
+
if (label) {
|
|
8264
|
+
props.filterInputValues.value[props.field] = label;
|
|
8265
|
+
}
|
|
8266
|
+
}
|
|
8267
|
+
const filteredOptions = computed(() => {
|
|
8268
|
+
const query = searchQuery.value.trim().toLowerCase();
|
|
8269
|
+
if (!query) {
|
|
8270
|
+
return props.options;
|
|
8271
|
+
}
|
|
8272
|
+
return props.options.filter((opt) => opt.label.toLowerCase().includes(query));
|
|
8273
|
+
});
|
|
8274
|
+
const isNewValue = computed(() => {
|
|
8275
|
+
if (!props.allowCreate || !searchQuery.value.trim()) return false;
|
|
8276
|
+
const query = searchQuery.value.trim();
|
|
8277
|
+
return !props.options.some((opt) => opt.label.toLowerCase() === query.toLowerCase());
|
|
8278
|
+
});
|
|
8279
|
+
const isInvalidValue = computed(() => {
|
|
8280
|
+
if (!searchQuery.value.trim()) return false;
|
|
8281
|
+
if (props.allowCreate) return false;
|
|
8282
|
+
const query = searchQuery.value.trim();
|
|
8283
|
+
return !props.options.some((opt) => opt.label.toLowerCase() === query.toLowerCase());
|
|
8284
|
+
});
|
|
8285
|
+
const handleInput = (e) => {
|
|
8286
|
+
const value = e.target.value;
|
|
8287
|
+
props.filterInputValues.value[props.field] = value;
|
|
8288
|
+
state.isOpen = true;
|
|
8289
|
+
state.selectedIndex = -1;
|
|
8290
|
+
const exactMatch = props.options.find((opt) => opt.label.toLowerCase() === value.toLowerCase().trim());
|
|
8291
|
+
if (exactMatch) {
|
|
8292
|
+
props.onFilterChange(props.field, exactMatch.value, "eq");
|
|
8293
|
+
}
|
|
8294
|
+
};
|
|
8295
|
+
const handleSelectOption = (option) => {
|
|
8296
|
+
props.filterInputValues.value[props.field] = option.label;
|
|
8297
|
+
props.onFilterChange(props.field, option.value, "eq");
|
|
8298
|
+
state.isOpen = false;
|
|
8299
|
+
state.selectedIndex = -1;
|
|
8300
|
+
};
|
|
8301
|
+
const handleSelectNewValue = () => {
|
|
8302
|
+
const newValue = searchQuery.value.trim();
|
|
8303
|
+
if (newValue) {
|
|
8304
|
+
props.onFilterChange(props.field, newValue, "eq");
|
|
8305
|
+
state.isOpen = false;
|
|
8306
|
+
state.selectedIndex = -1;
|
|
8307
|
+
}
|
|
8308
|
+
};
|
|
8309
|
+
const handleKeyDown = (e) => {
|
|
8310
|
+
if (e.key === "Escape") {
|
|
8311
|
+
e.preventDefault();
|
|
8312
|
+
e.stopPropagation();
|
|
8313
|
+
state.isOpen = false;
|
|
8314
|
+
state.selectedIndex = -1;
|
|
8315
|
+
if (props.value) {
|
|
8316
|
+
props.filterInputValues.value[props.field] = selectedOption.value;
|
|
8317
|
+
} else {
|
|
8318
|
+
props.filterInputValues.value[props.field] = "";
|
|
8319
|
+
}
|
|
8320
|
+
return;
|
|
8321
|
+
}
|
|
8322
|
+
if (e.key === "Enter") {
|
|
8323
|
+
e.preventDefault();
|
|
8324
|
+
e.stopPropagation();
|
|
8325
|
+
if (state.selectedIndex >= 0 && state.selectedIndex < filteredOptions.value.length) {
|
|
8326
|
+
handleSelectOption(filteredOptions.value[state.selectedIndex]);
|
|
8327
|
+
return;
|
|
8328
|
+
}
|
|
8329
|
+
if (state.selectedIndex === filteredOptions.value.length && isNewValue.value && props.allowCreate) {
|
|
8330
|
+
handleSelectNewValue();
|
|
8331
|
+
return;
|
|
8332
|
+
}
|
|
8333
|
+
if (searchQuery.value.trim() === "") {
|
|
8334
|
+
state.isOpen = false;
|
|
8335
|
+
state.selectedIndex = -1;
|
|
8336
|
+
if (props.value) {
|
|
8337
|
+
props.onFilterChange(props.field, "", "eq");
|
|
8338
|
+
props.filterInputValues.value[props.field] = "";
|
|
8339
|
+
}
|
|
8340
|
+
return;
|
|
8341
|
+
}
|
|
8342
|
+
const currentLabel = selectedOption.value;
|
|
8343
|
+
const queryMatchesCurrentValue = currentLabel && searchQuery.value.trim().toLowerCase() === currentLabel.toLowerCase();
|
|
8344
|
+
if (queryMatchesCurrentValue) {
|
|
8345
|
+
state.isOpen = false;
|
|
8346
|
+
state.selectedIndex = -1;
|
|
8347
|
+
return;
|
|
8348
|
+
}
|
|
8349
|
+
if (isInvalidValue.value) {
|
|
8350
|
+
state.isOpen = false;
|
|
8351
|
+
state.selectedIndex = -1;
|
|
8352
|
+
const currentLabel2 = selectedOption.value;
|
|
8353
|
+
if (currentLabel2) {
|
|
8354
|
+
props.filterInputValues.value[props.field] = currentLabel2;
|
|
8355
|
+
} else {
|
|
8356
|
+
props.filterInputValues.value[props.field] = "";
|
|
8357
|
+
}
|
|
8358
|
+
return;
|
|
8359
|
+
}
|
|
8360
|
+
if (isNewValue.value && state.selectedIndex < 0 && props.allowCreate) {
|
|
8361
|
+
handleSelectNewValue();
|
|
8362
|
+
return;
|
|
8363
|
+
}
|
|
8364
|
+
const matchingOption = props.options.find(
|
|
8365
|
+
(opt) => opt.label.toLowerCase() === searchQuery.value.trim().toLowerCase()
|
|
8366
|
+
);
|
|
8367
|
+
if (matchingOption) {
|
|
8368
|
+
handleSelectOption(matchingOption);
|
|
8369
|
+
return;
|
|
8370
|
+
}
|
|
8371
|
+
state.isOpen = false;
|
|
8372
|
+
state.selectedIndex = -1;
|
|
8373
|
+
return;
|
|
8374
|
+
}
|
|
8375
|
+
if (e.key === "ArrowDown") {
|
|
8376
|
+
e.preventDefault();
|
|
8377
|
+
e.stopPropagation();
|
|
8378
|
+
state.isOpen = true;
|
|
8379
|
+
const totalOptions = filteredOptions.value.length + (isNewValue.value && props.allowCreate ? 1 : 0);
|
|
8380
|
+
if (totalOptions > 0) {
|
|
8381
|
+
const currentIndex = state.selectedIndex;
|
|
8382
|
+
const newIndex = currentIndex < 0 ? 0 : (currentIndex + 1) % totalOptions;
|
|
8383
|
+
state.selectedIndex = newIndex;
|
|
8384
|
+
nextTick(() => {
|
|
8385
|
+
scrollToSelectedOption(newIndex);
|
|
8386
|
+
});
|
|
8387
|
+
}
|
|
8388
|
+
return;
|
|
8389
|
+
}
|
|
8390
|
+
if (e.key === "ArrowUp") {
|
|
8391
|
+
e.preventDefault();
|
|
8392
|
+
e.stopPropagation();
|
|
8393
|
+
state.isOpen = true;
|
|
8394
|
+
const totalOptions = filteredOptions.value.length + (isNewValue.value && props.allowCreate ? 1 : 0);
|
|
8395
|
+
if (totalOptions > 0) {
|
|
8396
|
+
const currentIndex = state.selectedIndex;
|
|
8397
|
+
const newIndex = currentIndex < 0 ? totalOptions - 1 : (currentIndex - 1 + totalOptions) % totalOptions;
|
|
8398
|
+
state.selectedIndex = newIndex;
|
|
8399
|
+
nextTick(() => {
|
|
8400
|
+
scrollToSelectedOption(newIndex);
|
|
8401
|
+
});
|
|
8402
|
+
}
|
|
8403
|
+
return;
|
|
8404
|
+
}
|
|
8405
|
+
};
|
|
8406
|
+
const handleFocus = () => {
|
|
8407
|
+
state.isOpen = true;
|
|
8408
|
+
};
|
|
8409
|
+
const scrollToSelectedOption = (index) => {
|
|
8410
|
+
const container = document.querySelector(`[data-combobox-dropdown="${props.field}"]`);
|
|
8411
|
+
if (!container) return;
|
|
8412
|
+
const optionId = index === filteredOptions.value.length ? "option-new" : `option-${index}`;
|
|
8413
|
+
const selectedElement = container.querySelector(`#${optionId}`);
|
|
8414
|
+
if (!selectedElement) return;
|
|
8415
|
+
const elementTop = selectedElement.offsetTop;
|
|
8416
|
+
const elementHeight = selectedElement.offsetHeight;
|
|
8417
|
+
const containerHeight = container.clientHeight;
|
|
8418
|
+
const containerScrollTop = container.scrollTop;
|
|
8419
|
+
if (elementTop < containerScrollTop) {
|
|
8420
|
+
container.scrollTop = elementTop;
|
|
8421
|
+
} else if (elementTop + elementHeight > containerScrollTop + containerHeight) {
|
|
8422
|
+
container.scrollTop = elementTop + elementHeight - containerHeight;
|
|
8423
|
+
}
|
|
8424
|
+
};
|
|
8425
|
+
const handleBlur = (e) => {
|
|
8426
|
+
const relatedTarget = e.relatedTarget || document.activeElement;
|
|
8427
|
+
const container = document.querySelector(`[data-combobox-container="${props.field}"]`);
|
|
8428
|
+
if (container && container.contains(relatedTarget)) {
|
|
8429
|
+
return;
|
|
8430
|
+
}
|
|
8431
|
+
state.isOpen = false;
|
|
8432
|
+
const currentQuery = searchQuery.value.trim();
|
|
8433
|
+
const currentValue = props.value;
|
|
8434
|
+
const currentLabel = selectedOption.value;
|
|
8435
|
+
if (currentQuery === "") {
|
|
8436
|
+
if (currentValue) {
|
|
8437
|
+
props.onFilterChange(props.field, "", "eq");
|
|
8438
|
+
props.filterInputValues.value[props.field] = "";
|
|
8439
|
+
}
|
|
8440
|
+
} else {
|
|
8441
|
+
const queryMatchesCurrentValue = currentLabel && currentQuery.toLowerCase() === currentLabel.toLowerCase();
|
|
8442
|
+
if (isInvalidValue.value) {
|
|
8443
|
+
if (currentLabel) {
|
|
8444
|
+
props.filterInputValues.value[props.field] = currentLabel;
|
|
8445
|
+
} else {
|
|
8446
|
+
props.filterInputValues.value[props.field] = "";
|
|
8447
|
+
}
|
|
8448
|
+
return;
|
|
8449
|
+
}
|
|
8450
|
+
if (!queryMatchesCurrentValue) {
|
|
8451
|
+
const matchingOption = props.options.find((opt) => opt.label.toLowerCase() === currentQuery.toLowerCase());
|
|
8452
|
+
if (matchingOption) {
|
|
8453
|
+
props.onFilterChange(props.field, matchingOption.value, "eq");
|
|
8454
|
+
} else if (props.allowCreate) {
|
|
8455
|
+
props.onFilterChange(props.field, currentQuery, "eq");
|
|
8456
|
+
} else {
|
|
8457
|
+
if (currentLabel) {
|
|
8458
|
+
props.filterInputValues.value[props.field] = currentLabel;
|
|
8459
|
+
}
|
|
8460
|
+
}
|
|
8461
|
+
} else {
|
|
8462
|
+
if (currentLabel && currentQuery !== currentLabel) {
|
|
8463
|
+
props.filterInputValues.value[props.field] = currentLabel;
|
|
8464
|
+
}
|
|
8465
|
+
}
|
|
8466
|
+
}
|
|
8467
|
+
};
|
|
8468
|
+
return /* @__PURE__ */ jsxs("div", { class: "relative w-full", "data-combobox-container": props.field, children: [
|
|
8469
|
+
/* @__PURE__ */ jsx(
|
|
8470
|
+
"input",
|
|
8471
|
+
{
|
|
8472
|
+
type: "text",
|
|
8473
|
+
value: searchQuery.value,
|
|
8474
|
+
onInput: handleInput,
|
|
8475
|
+
onKeydown: handleKeyDown,
|
|
8476
|
+
onFocus: handleFocus,
|
|
8477
|
+
onBlur: handleBlur,
|
|
8478
|
+
placeholder: props.isOptionsLoading ? "Loading options..." : `Search ${props.label}`,
|
|
8479
|
+
class: "input input-bordered input-sm w-full",
|
|
8480
|
+
disabled: props.isLoading || props.isOptionsLoading,
|
|
8481
|
+
"data-testid": `datatable-filter-${props.field}-input`
|
|
8482
|
+
}
|
|
8483
|
+
),
|
|
8484
|
+
/* @__PURE__ */ jsx("div", { class: "absolute inset-y-0 right-0 flex items-center pr-3 pointer-events-none", children: /* @__PURE__ */ jsx(
|
|
8485
|
+
"svg",
|
|
8486
|
+
{
|
|
8487
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8488
|
+
class: "h-4 w-4 text-base-content/50",
|
|
8489
|
+
fill: "none",
|
|
8490
|
+
viewBox: "0 0 24 24",
|
|
8491
|
+
stroke: "currentColor",
|
|
8492
|
+
"stroke-width": "2",
|
|
8493
|
+
children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M8 9l4-4 4 4m0 6l-4 4-4-4" })
|
|
8494
|
+
}
|
|
8495
|
+
) }),
|
|
8496
|
+
state.isOpen && /* @__PURE__ */ jsx(
|
|
8497
|
+
"div",
|
|
8498
|
+
{
|
|
8499
|
+
"data-combobox-dropdown": props.field,
|
|
8500
|
+
class: "absolute z-50 mt-1 bg-base-100 border border-base-300 rounded-box shadow-lg max-h-60 overflow-auto w-full",
|
|
8501
|
+
children: /* @__PURE__ */ jsx("ul", { class: "menu w-full", role: "listbox", id: `combobox-listbox-${props.field}`, children: props.isOptionsLoading ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", { class: "text-sm text-base-content/70 p-2", children: "Loading options..." }) }) : filteredOptions.value.length === 0 && !isNewValue.value && !isInvalidValue.value ? /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("span", { class: "text-sm text-base-content/70 p-2", children: "No options available" }) }) : isInvalidValue.value ? /* @__PURE__ */ jsx("li", { class: "bg-error/10 border-l-4 border-error", children: /* @__PURE__ */ jsx("div", { class: "p-2", children: /* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2", children: [
|
|
8502
|
+
/* @__PURE__ */ jsx(
|
|
8503
|
+
"svg",
|
|
8504
|
+
{
|
|
8505
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8506
|
+
class: "h-4 w-4 text-error flex-shrink-0",
|
|
8507
|
+
fill: "none",
|
|
8508
|
+
viewBox: "0 0 24 24",
|
|
8509
|
+
stroke: "currentColor",
|
|
8510
|
+
"stroke-width": "2",
|
|
8511
|
+
children: /* @__PURE__ */ jsx(
|
|
8512
|
+
"path",
|
|
8513
|
+
{
|
|
8514
|
+
"stroke-linecap": "round",
|
|
8515
|
+
"stroke-linejoin": "round",
|
|
8516
|
+
d: "M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
8517
|
+
}
|
|
8518
|
+
)
|
|
8519
|
+
}
|
|
8520
|
+
),
|
|
8521
|
+
/* @__PURE__ */ jsxs("div", { class: "text-sm", children: [
|
|
8522
|
+
/* @__PURE__ */ jsx("p", { class: "font-medium text-error", children: "Invalid value" }),
|
|
8523
|
+
/* @__PURE__ */ jsxs("p", { class: "text-error/80", children: [
|
|
8524
|
+
'"',
|
|
8525
|
+
searchQuery.value,
|
|
8526
|
+
'" is not a valid option. Please select from the list.'
|
|
8527
|
+
] })
|
|
8528
|
+
] })
|
|
8529
|
+
] }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8530
|
+
filteredOptions.value.map((option, index) => /* @__PURE__ */ jsx(
|
|
8531
|
+
"li",
|
|
8532
|
+
{
|
|
8533
|
+
id: `option-${index}`,
|
|
8534
|
+
role: "option",
|
|
8535
|
+
"aria-selected": index === state.selectedIndex,
|
|
8536
|
+
class: index === state.selectedIndex ? "bg-base-200" : "",
|
|
8537
|
+
children: /* @__PURE__ */ jsx(
|
|
8538
|
+
"a",
|
|
8539
|
+
{
|
|
8540
|
+
href: "#",
|
|
8541
|
+
tabindex: 0,
|
|
8542
|
+
onClick: (e) => {
|
|
8543
|
+
e.preventDefault();
|
|
8544
|
+
e.stopPropagation();
|
|
8545
|
+
handleSelectOption(option);
|
|
8546
|
+
},
|
|
8547
|
+
onMousedown: (e) => {
|
|
8548
|
+
e.preventDefault();
|
|
8549
|
+
},
|
|
8550
|
+
class: "w-full",
|
|
8551
|
+
children: option.label
|
|
8552
|
+
}
|
|
8553
|
+
)
|
|
8554
|
+
},
|
|
8555
|
+
option.value
|
|
8556
|
+
)),
|
|
8557
|
+
isNewValue.value && props.allowCreate && /* @__PURE__ */ jsx(
|
|
8558
|
+
"li",
|
|
8559
|
+
{
|
|
8560
|
+
id: "option-new",
|
|
8561
|
+
role: "option",
|
|
8562
|
+
"aria-selected": state.selectedIndex === filteredOptions.value.length,
|
|
8563
|
+
class: state.selectedIndex === filteredOptions.value.length ? "bg-base-200" : "",
|
|
8564
|
+
children: /* @__PURE__ */ jsx(
|
|
8565
|
+
"a",
|
|
8566
|
+
{
|
|
8567
|
+
href: "#",
|
|
8568
|
+
tabindex: 0,
|
|
8569
|
+
onClick: (e) => {
|
|
8570
|
+
e.preventDefault();
|
|
8571
|
+
e.stopPropagation();
|
|
8572
|
+
handleSelectNewValue();
|
|
8573
|
+
},
|
|
8574
|
+
onMousedown: (e) => {
|
|
8575
|
+
e.preventDefault();
|
|
8576
|
+
},
|
|
8577
|
+
class: "w-full",
|
|
8578
|
+
children: /* @__PURE__ */ jsxs("div", { class: "flex items-center gap-2", children: [
|
|
8579
|
+
/* @__PURE__ */ jsx(
|
|
8580
|
+
"svg",
|
|
8581
|
+
{
|
|
8582
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
8583
|
+
class: "h-4 w-4 text-success",
|
|
8584
|
+
fill: "none",
|
|
8585
|
+
viewBox: "0 0 24 24",
|
|
8586
|
+
stroke: "currentColor",
|
|
8587
|
+
"stroke-width": "2",
|
|
8588
|
+
children: /* @__PURE__ */ jsx("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M12 4v16m8-8H4" })
|
|
8589
|
+
}
|
|
8590
|
+
),
|
|
8591
|
+
/* @__PURE__ */ jsxs("span", { class: "text-sm", children: [
|
|
8592
|
+
/* @__PURE__ */ jsx("span", { class: "font-medium text-success", children: "New value:" }),
|
|
8593
|
+
' "',
|
|
8594
|
+
searchQuery.value,
|
|
8595
|
+
'"'
|
|
8596
|
+
] })
|
|
8597
|
+
] })
|
|
8598
|
+
}
|
|
8599
|
+
)
|
|
8600
|
+
}
|
|
8601
|
+
)
|
|
8602
|
+
] }) })
|
|
8603
|
+
}
|
|
8604
|
+
)
|
|
8605
|
+
] });
|
|
8606
|
+
};
|
|
8245
8607
|
var FilterDrawer = (props) => {
|
|
8246
8608
|
const injectedFilterOptionsState = inject(
|
|
8247
8609
|
ZINIA_DATA_TABLE_FILTER_OPTIONS_STATE_KEY,
|
|
@@ -8270,8 +8632,7 @@ var FilterDrawer = (props) => {
|
|
|
8270
8632
|
/* @__PURE__ */ jsxs(
|
|
8271
8633
|
"aside",
|
|
8272
8634
|
{
|
|
8273
|
-
class: "absolute top-0 left-0 h-full w-full md:w-80 bg-base-100 flex flex-col shadow-xl transform transition-transform duration-300 ease-out translate-x-0 pointer-events-auto",
|
|
8274
|
-
style: { maxHeight: "100%" },
|
|
8635
|
+
class: "absolute top-0 left-0 h-full h-[600px] max-h-[90vh] w-full md:w-80 bg-base-100 flex flex-col shadow-xl transform transition-transform duration-300 ease-out translate-x-0 pointer-events-auto",
|
|
8275
8636
|
onClick: (e) => e.stopPropagation(),
|
|
8276
8637
|
"data-testid": `${props.tableName || "datatable"}-filter-drawer`,
|
|
8277
8638
|
children: [
|
|
@@ -8388,6 +8749,25 @@ var FilterDrawer = (props) => {
|
|
|
8388
8749
|
isLoading: props.isLoading,
|
|
8389
8750
|
onFilterChange: props.onFilterChange
|
|
8390
8751
|
}
|
|
8752
|
+
),
|
|
8753
|
+
filterType === "combobox" && /* @__PURE__ */ jsx(
|
|
8754
|
+
ComboboxFilter,
|
|
8755
|
+
{
|
|
8756
|
+
field,
|
|
8757
|
+
value: currentValue,
|
|
8758
|
+
options: getFilterOptions(
|
|
8759
|
+
field,
|
|
8760
|
+
column,
|
|
8761
|
+
props.fieldsMetadata,
|
|
8762
|
+
filterOptionsState?.value || {}
|
|
8763
|
+
),
|
|
8764
|
+
label: column.label,
|
|
8765
|
+
isLoading: props.isLoading,
|
|
8766
|
+
isOptionsLoading: filterOptionsLoading?.value?.[field] ?? false,
|
|
8767
|
+
allowCreate: column.filterAllowCreate ?? false,
|
|
8768
|
+
filterInputValues: props.filterInputValues,
|
|
8769
|
+
onFilterChange: props.onFilterChange
|
|
8770
|
+
}
|
|
8391
8771
|
)
|
|
8392
8772
|
]
|
|
8393
8773
|
},
|
|
@@ -9014,6 +9394,27 @@ function createDaisyUIDataTable() {
|
|
|
9014
9394
|
});
|
|
9015
9395
|
const selectionMode = computed(() => options.selection?.mode ?? "none");
|
|
9016
9396
|
const hasSelection = computed(() => selectionMode.value !== "none");
|
|
9397
|
+
const containerHeightClasses = computed(() => {
|
|
9398
|
+
const height = props.height ?? "auto";
|
|
9399
|
+
if (height === "fixed") {
|
|
9400
|
+
return "relative h-[850px] max-h-[90vh] flex flex-col";
|
|
9401
|
+
} else if (height === "auto") {
|
|
9402
|
+
return "relative flex-1 min-h-[670px] flex flex-col";
|
|
9403
|
+
} else if (typeof height === "number") {
|
|
9404
|
+
return `relative flex flex-col`;
|
|
9405
|
+
} else {
|
|
9406
|
+
return "relative flex flex-col";
|
|
9407
|
+
}
|
|
9408
|
+
});
|
|
9409
|
+
const containerHeightStyle = computed(() => {
|
|
9410
|
+
const height = props.height;
|
|
9411
|
+
if (typeof height === "number") {
|
|
9412
|
+
return { height: `${height}px` };
|
|
9413
|
+
} else if (typeof height === "string" && height !== "auto" && height !== "fixed") {
|
|
9414
|
+
return { height };
|
|
9415
|
+
}
|
|
9416
|
+
return {};
|
|
9417
|
+
});
|
|
9017
9418
|
if (filterInputValues && Object.keys(filterInputValues.value).length === 0) {
|
|
9018
9419
|
Object.entries(columns).forEach(([field, column]) => {
|
|
9019
9420
|
if (column?.filterable) {
|
|
@@ -9065,7 +9466,7 @@ function createDaisyUIDataTable() {
|
|
|
9065
9466
|
triggerBulkAction: table.triggerBulkAction
|
|
9066
9467
|
}
|
|
9067
9468
|
),
|
|
9068
|
-
/* @__PURE__ */ jsxs("div", { class:
|
|
9469
|
+
/* @__PURE__ */ jsxs("div", { class: containerHeightClasses.value, style: containerHeightStyle.value, children: [
|
|
9069
9470
|
Object.values(columns).some((col) => col?.filterable) && filterInputValues && filterOperators && /* @__PURE__ */ jsx(
|
|
9070
9471
|
FiltersRow,
|
|
9071
9472
|
{
|
|
@@ -9086,7 +9487,7 @@ function createDaisyUIDataTable() {
|
|
|
9086
9487
|
onCloseFilterDrawer: () => table.ui.closeFilterDrawer()
|
|
9087
9488
|
}
|
|
9088
9489
|
),
|
|
9089
|
-
/* @__PURE__ */ jsx("div", { class: "w-full
|
|
9490
|
+
/* @__PURE__ */ jsx("div", { class: "w-full flex-1 min-h-0 overflow-auto", children: table.isLoading ? /* @__PURE__ */ jsx(
|
|
9090
9491
|
LoadingSkeletons,
|
|
9091
9492
|
{
|
|
9092
9493
|
pageSize: table.pagination.pageSize,
|
|
@@ -9206,7 +9607,7 @@ function createDaisyUIDataTable() {
|
|
|
9206
9607
|
] })
|
|
9207
9608
|
] });
|
|
9208
9609
|
};
|
|
9209
|
-
DaisyUIDataTable.props = ["class"];
|
|
9610
|
+
DaisyUIDataTable.props = ["class", "name", "height"];
|
|
9210
9611
|
return DaisyUIDataTable;
|
|
9211
9612
|
}
|
|
9212
9613
|
|