@wordrhyme/auto-crud 1.5.5 → 1.5.6
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.cjs +11 -3
- package/dist/index.d.cts +20 -20
- package/dist/index.d.ts +20 -20
- package/dist/index.js +11 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3236,6 +3236,10 @@ function renderCell(value, type, options) {
|
|
|
3236
3236
|
className: "text-muted-foreground",
|
|
3237
3237
|
children: "-"
|
|
3238
3238
|
});
|
|
3239
|
+
if (Array.isArray(value) && value.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3240
|
+
className: "text-muted-foreground",
|
|
3241
|
+
children: "-"
|
|
3242
|
+
});
|
|
3239
3243
|
const formatOptionValue = (optionValue) => {
|
|
3240
3244
|
const stringValue = String(optionValue);
|
|
3241
3245
|
return options?.find((option) => option.value === stringValue)?.label ?? stringValue;
|
|
@@ -6124,7 +6128,7 @@ function mergeOptionsByField(left, right) {
|
|
|
6124
6128
|
function shouldResolveOptions(field, config, hiddenColumns) {
|
|
6125
6129
|
if (!config) return false;
|
|
6126
6130
|
if (hiddenColumns.has(field)) return false;
|
|
6127
|
-
if (getTableOptions(config)) return false;
|
|
6131
|
+
if (getTableOptions(config) && !getTableConfig(config)?.dataSource) return false;
|
|
6128
6132
|
return normalizeDataSourceConfig(getTableDataSource(config)) !== void 0;
|
|
6129
6133
|
}
|
|
6130
6134
|
function useRegistryVersion(subscribe) {
|
|
@@ -6474,7 +6478,7 @@ function buildTableOverrides(fields, legacyOverrides, dynamicFilterState, dynami
|
|
|
6474
6478
|
const filterDataSourceSearchable = dynamicFilterState?.searchableByField[key];
|
|
6475
6479
|
const currentDynamicOptions = !fieldOptions && filterDataSourceRegistered ? toTableOptions(dynamicFilterState?.optionsByField[key] ?? []) : void 0;
|
|
6476
6480
|
const dynamicFilterLabelOptions = !fieldOptions && filterDataSourceRegistered ? dynamicFilterState?.labelOptionsByField[key] ?? dynamicFilterState?.optionsByField[key] ?? [] : void 0;
|
|
6477
|
-
const dynamicResolveOptions =
|
|
6481
|
+
const dynamicResolveOptions = dynamicResolveState?.optionsByField[key];
|
|
6478
6482
|
const mergedSharedDynamicOptions = mergeFieldOptions(dynamicFilterLabelOptions, tableConfig?.dataSource ? void 0 : dynamicResolveOptions);
|
|
6479
6483
|
const dynamicOptions = !fieldOptions && mergedSharedDynamicOptions ? toTableOptions(mergedSharedDynamicOptions) : void 0;
|
|
6480
6484
|
const tableMeta = config.table !== false && typeof config.table === "object" ? config.table.meta : void 0;
|
|
@@ -6549,7 +6553,7 @@ function buildTableOverrides(fields, legacyOverrides, dynamicFilterState, dynami
|
|
|
6549
6553
|
};
|
|
6550
6554
|
const hasTableLabels = config.table.options !== void 0 || config.table.dataSource !== void 0;
|
|
6551
6555
|
if (display && display !== "auto" || hasTableLabels) {
|
|
6552
|
-
const options =
|
|
6556
|
+
const options = tableConfig?.dataSource ? mergeFieldOptions(dynamicResolveOptions, presentationOptions) : presentationOptions ?? mergedSharedDynamicOptions;
|
|
6553
6557
|
result[key] = {
|
|
6554
6558
|
...result[key],
|
|
6555
6559
|
cell: ({ row }) => renderFieldValue(row.getValue(key), "string", {
|
|
@@ -6662,6 +6666,10 @@ function renderFieldValue(value, type, booleanLocale, options, display = "auto")
|
|
|
6662
6666
|
className: "text-muted-foreground",
|
|
6663
6667
|
children: "-"
|
|
6664
6668
|
});
|
|
6669
|
+
if (Array.isArray(value) && value.length === 0) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
6670
|
+
className: "text-muted-foreground",
|
|
6671
|
+
children: "-"
|
|
6672
|
+
});
|
|
6665
6673
|
const renderText = (item) => getOptionLabel(item, options);
|
|
6666
6674
|
if (display === "text") return Array.isArray(value) ? value.map(renderText).join(", ") : renderText(value);
|
|
6667
6675
|
if (display === "date" || display === "datetime") return formatDate(value, {}, display);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
|
|
4
4
|
import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
@@ -413,7 +413,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
413
413
|
extraActions,
|
|
414
414
|
actions,
|
|
415
415
|
deleteConfirmation
|
|
416
|
-
}: AutoTableActionBarProps<TData>):
|
|
416
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
417
417
|
//#endregion
|
|
418
418
|
//#region src/lib/schema-bridge/types.d.ts
|
|
419
419
|
/**
|
|
@@ -592,7 +592,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
592
592
|
onSelectedCountChange,
|
|
593
593
|
onSelectedRowsChange,
|
|
594
594
|
getSelectedRows
|
|
595
|
-
}: AutoTableProps<T>):
|
|
595
|
+
}: AutoTableProps<T>): react_jsx_runtime3.JSX.Element;
|
|
596
596
|
//#endregion
|
|
597
597
|
//#region src/i18n/locale.d.ts
|
|
598
598
|
/**
|
|
@@ -843,7 +843,7 @@ interface Field {
|
|
|
843
843
|
label?: string;
|
|
844
844
|
/** 排序权重,数值越小越靠前 */
|
|
845
845
|
index?: number;
|
|
846
|
-
/**
|
|
846
|
+
/** 仅用于表格展示的静态值标签;与 dataSource 同时配置时覆盖同值的动态标签 */
|
|
847
847
|
options?: FieldOption[];
|
|
848
848
|
/** 仅用于表格展示的动态值标签源 */
|
|
849
849
|
dataSource?: AutoCrudDataSourceConfig;
|
|
@@ -1093,7 +1093,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1093
1093
|
toolbarActions,
|
|
1094
1094
|
locale: localeProp,
|
|
1095
1095
|
onCreate
|
|
1096
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1096
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
|
|
1097
1097
|
//#endregion
|
|
1098
1098
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1099
1099
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1132,7 +1132,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1132
1132
|
labelAlign,
|
|
1133
1133
|
labelWidth,
|
|
1134
1134
|
showSubmitButton
|
|
1135
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1135
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
|
|
1136
1136
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1137
1137
|
ref?: React.Ref<AutoFormRef>;
|
|
1138
1138
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1346,12 +1346,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
1346
1346
|
variant: z.ZodEnum<{
|
|
1347
1347
|
number: "number";
|
|
1348
1348
|
boolean: "boolean";
|
|
1349
|
-
text: "text";
|
|
1350
|
-
range: "range";
|
|
1351
1349
|
date: "date";
|
|
1352
|
-
|
|
1350
|
+
text: "text";
|
|
1353
1351
|
select: "select";
|
|
1354
1352
|
multiSelect: "multiSelect";
|
|
1353
|
+
dateRange: "dateRange";
|
|
1354
|
+
range: "range";
|
|
1355
1355
|
}>;
|
|
1356
1356
|
operator: z.ZodEnum<{
|
|
1357
1357
|
iLike: "iLike";
|
|
@@ -1448,7 +1448,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1448
1448
|
filters: externalFilters,
|
|
1449
1449
|
onFiltersChange,
|
|
1450
1450
|
leading
|
|
1451
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1451
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
|
|
1452
1452
|
//#endregion
|
|
1453
1453
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1454
1454
|
type ModalVariant = 'dialog' | 'sheet';
|
|
@@ -1492,7 +1492,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1492
1492
|
labelAlign,
|
|
1493
1493
|
labelWidth,
|
|
1494
1494
|
className
|
|
1495
|
-
}: CrudFormModalProps<T>):
|
|
1495
|
+
}: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
|
|
1496
1496
|
//#endregion
|
|
1497
1497
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1498
1498
|
interface ImportDialogProps {
|
|
@@ -1514,7 +1514,7 @@ declare function ImportDialog({
|
|
|
1514
1514
|
columns,
|
|
1515
1515
|
title,
|
|
1516
1516
|
locale
|
|
1517
|
-
}: ImportDialogProps):
|
|
1517
|
+
}: ImportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1518
1518
|
//#endregion
|
|
1519
1519
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1520
1520
|
type ExportMode = 'selected' | 'filtered';
|
|
@@ -1534,7 +1534,7 @@ declare function ExportDialog({
|
|
|
1534
1534
|
selectedCount,
|
|
1535
1535
|
onExport,
|
|
1536
1536
|
canExportFiltered
|
|
1537
|
-
}: ExportDialogProps):
|
|
1537
|
+
}: ExportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1538
1538
|
//#endregion
|
|
1539
1539
|
//#region src/components/data-table/data-table.d.ts
|
|
1540
1540
|
interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1547,7 +1547,7 @@ declare function DataTable<TData>({
|
|
|
1547
1547
|
children,
|
|
1548
1548
|
className,
|
|
1549
1549
|
...props
|
|
1550
|
-
}: DataTableProps<TData>):
|
|
1550
|
+
}: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1551
1551
|
//#endregion
|
|
1552
1552
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1553
1553
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1558,7 +1558,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1558
1558
|
children,
|
|
1559
1559
|
className,
|
|
1560
1560
|
...props
|
|
1561
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1561
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1562
1562
|
//#endregion
|
|
1563
1563
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1564
1564
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1570,7 +1570,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1570
1570
|
label,
|
|
1571
1571
|
className,
|
|
1572
1572
|
...props
|
|
1573
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1573
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1574
1574
|
//#endregion
|
|
1575
1575
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1576
1576
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1584,7 +1584,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1584
1584
|
title,
|
|
1585
1585
|
options,
|
|
1586
1586
|
multiple
|
|
1587
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1587
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1588
1588
|
//#endregion
|
|
1589
1589
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1590
1590
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'> {
|
|
@@ -1596,7 +1596,7 @@ declare function DataTablePagination<TData>({
|
|
|
1596
1596
|
pageSizeOptions,
|
|
1597
1597
|
className,
|
|
1598
1598
|
...props
|
|
1599
|
-
}: DataTablePaginationProps<TData>):
|
|
1599
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1600
1600
|
//#endregion
|
|
1601
1601
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1602
1602
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1607,7 +1607,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1607
1607
|
children,
|
|
1608
1608
|
className,
|
|
1609
1609
|
...props
|
|
1610
|
-
}: DataTableToolbarProps<TData>):
|
|
1610
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1611
1611
|
//#endregion
|
|
1612
1612
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1613
1613
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1618,7 +1618,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1618
1618
|
table,
|
|
1619
1619
|
disabled,
|
|
1620
1620
|
...props
|
|
1621
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1621
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1622
1622
|
//#endregion
|
|
1623
1623
|
//#region src/lib/crud-actions.d.ts
|
|
1624
1624
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import * as _tanstack_react_table0 from "@tanstack/react-table";
|
|
|
3
3
|
import { Column, ColumnDef, ColumnSort, Row, RowData, Table, TableOptions, TableState } from "@tanstack/react-table";
|
|
4
4
|
import { DropdownMenuTrigger, PopoverContent } from "@wordrhyme/shadcn";
|
|
5
5
|
import { ClassValue } from "clsx";
|
|
6
|
-
import * as
|
|
6
|
+
import * as react_jsx_runtime3 from "react/jsx-runtime";
|
|
7
7
|
import { MultiCombobox, MultiComboboxOption, MultiComboboxProps, MultiComboboxTriggerRenderProps, Select, SelectMode, SelectOption, SelectProps, SelectSearchableDynamicProps, SelectSearchableMultipleProps, SelectSearchableProps, SelectSearchableSingleProps, SelectSimpleProps, SelectTriggerRenderProps } from "@wordrhyme/shadcn-ui";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
import { JsonSchemaFormScope } from "@wordrhyme/formily-shadcn";
|
|
@@ -413,7 +413,7 @@ declare function AutoTableActionBar<TData>({
|
|
|
413
413
|
extraActions,
|
|
414
414
|
actions,
|
|
415
415
|
deleteConfirmation
|
|
416
|
-
}: AutoTableActionBarProps<TData>):
|
|
416
|
+
}: AutoTableActionBarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
417
417
|
//#endregion
|
|
418
418
|
//#region src/lib/schema-bridge/types.d.ts
|
|
419
419
|
/**
|
|
@@ -592,7 +592,7 @@ declare function AutoTable<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
592
592
|
onSelectedCountChange,
|
|
593
593
|
onSelectedRowsChange,
|
|
594
594
|
getSelectedRows
|
|
595
|
-
}: AutoTableProps<T>):
|
|
595
|
+
}: AutoTableProps<T>): react_jsx_runtime3.JSX.Element;
|
|
596
596
|
//#endregion
|
|
597
597
|
//#region src/i18n/locale.d.ts
|
|
598
598
|
/**
|
|
@@ -843,7 +843,7 @@ interface Field {
|
|
|
843
843
|
label?: string;
|
|
844
844
|
/** 排序权重,数值越小越靠前 */
|
|
845
845
|
index?: number;
|
|
846
|
-
/**
|
|
846
|
+
/** 仅用于表格展示的静态值标签;与 dataSource 同时配置时覆盖同值的动态标签 */
|
|
847
847
|
options?: FieldOption[];
|
|
848
848
|
/** 仅用于表格展示的动态值标签源 */
|
|
849
849
|
dataSource?: AutoCrudDataSourceConfig;
|
|
@@ -1093,7 +1093,7 @@ declare function AutoCrudTable<TSchema extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1093
1093
|
toolbarActions,
|
|
1094
1094
|
locale: localeProp,
|
|
1095
1095
|
onCreate
|
|
1096
|
-
}: AutoCrudTableProps<TSchema>):
|
|
1096
|
+
}: AutoCrudTableProps<TSchema>): react_jsx_runtime3.JSX.Element;
|
|
1097
1097
|
//#endregion
|
|
1098
1098
|
//#region src/components/auto-crud/auto-form.d.ts
|
|
1099
1099
|
interface AutoFormProps<T extends z.ZodObject<z.ZodRawShape>> {
|
|
@@ -1132,7 +1132,7 @@ declare function AutoFormInner<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1132
1132
|
labelAlign,
|
|
1133
1133
|
labelWidth,
|
|
1134
1134
|
showSubmitButton
|
|
1135
|
-
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>):
|
|
1135
|
+
}: AutoFormProps<T>, ref: React.Ref<AutoFormRef>): react_jsx_runtime3.JSX.Element;
|
|
1136
1136
|
declare const AutoForm: <T extends z.ZodObject<z.ZodRawShape>>(props: AutoFormProps<T> & {
|
|
1137
1137
|
ref?: React.Ref<AutoFormRef>;
|
|
1138
1138
|
}) => ReturnType<typeof AutoFormInner>;
|
|
@@ -1346,12 +1346,12 @@ declare const filterItemSchema: z.ZodObject<{
|
|
|
1346
1346
|
variant: z.ZodEnum<{
|
|
1347
1347
|
number: "number";
|
|
1348
1348
|
boolean: "boolean";
|
|
1349
|
-
text: "text";
|
|
1350
|
-
range: "range";
|
|
1351
1349
|
date: "date";
|
|
1352
|
-
|
|
1350
|
+
text: "text";
|
|
1353
1351
|
select: "select";
|
|
1354
1352
|
multiSelect: "multiSelect";
|
|
1353
|
+
dateRange: "dateRange";
|
|
1354
|
+
range: "range";
|
|
1355
1355
|
}>;
|
|
1356
1356
|
operator: z.ZodEnum<{
|
|
1357
1357
|
iLike: "iLike";
|
|
@@ -1448,7 +1448,7 @@ declare function AutoTableSimpleFilters<TData>({
|
|
|
1448
1448
|
filters: externalFilters,
|
|
1449
1449
|
onFiltersChange,
|
|
1450
1450
|
leading
|
|
1451
|
-
}: AutoTableSimpleFiltersProps<TData>):
|
|
1451
|
+
}: AutoTableSimpleFiltersProps<TData>): react_jsx_runtime3.JSX.Element | null;
|
|
1452
1452
|
//#endregion
|
|
1453
1453
|
//#region src/components/auto-crud/form-modal.d.ts
|
|
1454
1454
|
type ModalVariant = 'dialog' | 'sheet';
|
|
@@ -1492,7 +1492,7 @@ declare function CrudFormModal<T extends z.ZodObject<z.ZodRawShape>>({
|
|
|
1492
1492
|
labelAlign,
|
|
1493
1493
|
labelWidth,
|
|
1494
1494
|
className
|
|
1495
|
-
}: CrudFormModalProps<T>):
|
|
1495
|
+
}: CrudFormModalProps<T>): react_jsx_runtime3.JSX.Element;
|
|
1496
1496
|
//#endregion
|
|
1497
1497
|
//#region src/components/auto-crud/import-dialog.d.ts
|
|
1498
1498
|
interface ImportDialogProps {
|
|
@@ -1514,7 +1514,7 @@ declare function ImportDialog({
|
|
|
1514
1514
|
columns,
|
|
1515
1515
|
title,
|
|
1516
1516
|
locale
|
|
1517
|
-
}: ImportDialogProps):
|
|
1517
|
+
}: ImportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1518
1518
|
//#endregion
|
|
1519
1519
|
//#region src/components/auto-crud/export-dialog.d.ts
|
|
1520
1520
|
type ExportMode = 'selected' | 'filtered';
|
|
@@ -1534,7 +1534,7 @@ declare function ExportDialog({
|
|
|
1534
1534
|
selectedCount,
|
|
1535
1535
|
onExport,
|
|
1536
1536
|
canExportFiltered
|
|
1537
|
-
}: ExportDialogProps):
|
|
1537
|
+
}: ExportDialogProps): react_jsx_runtime3.JSX.Element;
|
|
1538
1538
|
//#endregion
|
|
1539
1539
|
//#region src/components/data-table/data-table.d.ts
|
|
1540
1540
|
interface DataTableProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1547,7 +1547,7 @@ declare function DataTable<TData>({
|
|
|
1547
1547
|
children,
|
|
1548
1548
|
className,
|
|
1549
1549
|
...props
|
|
1550
|
-
}: DataTableProps<TData>):
|
|
1550
|
+
}: DataTableProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1551
1551
|
//#endregion
|
|
1552
1552
|
//#region src/components/data-table/data-table-advanced-toolbar.d.ts
|
|
1553
1553
|
interface DataTableAdvancedToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1558,7 +1558,7 @@ declare function DataTableAdvancedToolbar<TData>({
|
|
|
1558
1558
|
children,
|
|
1559
1559
|
className,
|
|
1560
1560
|
...props
|
|
1561
|
-
}: DataTableAdvancedToolbarProps<TData>):
|
|
1561
|
+
}: DataTableAdvancedToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1562
1562
|
//#endregion
|
|
1563
1563
|
//#region src/components/data-table/data-table-column-header.d.ts
|
|
1564
1564
|
interface DataTableColumnHeaderProps<TData, TValue> extends React.ComponentProps<typeof DropdownMenuTrigger> {
|
|
@@ -1570,7 +1570,7 @@ declare function DataTableColumnHeader<TData, TValue>({
|
|
|
1570
1570
|
label,
|
|
1571
1571
|
className,
|
|
1572
1572
|
...props
|
|
1573
|
-
}: DataTableColumnHeaderProps<TData, TValue>):
|
|
1573
|
+
}: DataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1574
1574
|
//#endregion
|
|
1575
1575
|
//#region src/components/data-table/data-table-faceted-filter.d.ts
|
|
1576
1576
|
interface DataTableFacetedFilterProps<TData, TValue> {
|
|
@@ -1584,7 +1584,7 @@ declare function DataTableFacetedFilter<TData, TValue>({
|
|
|
1584
1584
|
title,
|
|
1585
1585
|
options,
|
|
1586
1586
|
multiple
|
|
1587
|
-
}: DataTableFacetedFilterProps<TData, TValue>):
|
|
1587
|
+
}: DataTableFacetedFilterProps<TData, TValue>): react_jsx_runtime3.JSX.Element;
|
|
1588
1588
|
//#endregion
|
|
1589
1589
|
//#region src/components/data-table/data-table-pagination.d.ts
|
|
1590
1590
|
interface DataTablePaginationProps<TData> extends React.ComponentProps<'div'> {
|
|
@@ -1596,7 +1596,7 @@ declare function DataTablePagination<TData>({
|
|
|
1596
1596
|
pageSizeOptions,
|
|
1597
1597
|
className,
|
|
1598
1598
|
...props
|
|
1599
|
-
}: DataTablePaginationProps<TData>):
|
|
1599
|
+
}: DataTablePaginationProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1600
1600
|
//#endregion
|
|
1601
1601
|
//#region src/components/data-table/data-table-toolbar.d.ts
|
|
1602
1602
|
interface DataTableToolbarProps<TData> extends React$1.ComponentProps<'div'> {
|
|
@@ -1607,7 +1607,7 @@ declare function DataTableToolbar<TData>({
|
|
|
1607
1607
|
children,
|
|
1608
1608
|
className,
|
|
1609
1609
|
...props
|
|
1610
|
-
}: DataTableToolbarProps<TData>):
|
|
1610
|
+
}: DataTableToolbarProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1611
1611
|
//#endregion
|
|
1612
1612
|
//#region src/components/data-table/data-table-view-options.d.ts
|
|
1613
1613
|
interface DataTableViewOptionsProps<TData> extends React$1.ComponentProps<typeof PopoverContent> {
|
|
@@ -1618,7 +1618,7 @@ declare function DataTableViewOptions<TData>({
|
|
|
1618
1618
|
table,
|
|
1619
1619
|
disabled,
|
|
1620
1620
|
...props
|
|
1621
|
-
}: DataTableViewOptionsProps<TData>):
|
|
1621
|
+
}: DataTableViewOptionsProps<TData>): react_jsx_runtime3.JSX.Element;
|
|
1622
1622
|
//#endregion
|
|
1623
1623
|
//#region src/lib/crud-actions.d.ts
|
|
1624
1624
|
type CrudActionZone = 'toolbar' | 'row' | 'batch';
|
package/dist/index.js
CHANGED
|
@@ -3199,6 +3199,10 @@ function renderCell(value, type, options) {
|
|
|
3199
3199
|
className: "text-muted-foreground",
|
|
3200
3200
|
children: "-"
|
|
3201
3201
|
});
|
|
3202
|
+
if (Array.isArray(value) && value.length === 0) return /* @__PURE__ */ jsx("span", {
|
|
3203
|
+
className: "text-muted-foreground",
|
|
3204
|
+
children: "-"
|
|
3205
|
+
});
|
|
3202
3206
|
const formatOptionValue = (optionValue) => {
|
|
3203
3207
|
const stringValue = String(optionValue);
|
|
3204
3208
|
return options?.find((option) => option.value === stringValue)?.label ?? stringValue;
|
|
@@ -6087,7 +6091,7 @@ function mergeOptionsByField(left, right) {
|
|
|
6087
6091
|
function shouldResolveOptions(field, config, hiddenColumns) {
|
|
6088
6092
|
if (!config) return false;
|
|
6089
6093
|
if (hiddenColumns.has(field)) return false;
|
|
6090
|
-
if (getTableOptions(config)) return false;
|
|
6094
|
+
if (getTableOptions(config) && !getTableConfig(config)?.dataSource) return false;
|
|
6091
6095
|
return normalizeDataSourceConfig(getTableDataSource(config)) !== void 0;
|
|
6092
6096
|
}
|
|
6093
6097
|
function useRegistryVersion(subscribe) {
|
|
@@ -6437,7 +6441,7 @@ function buildTableOverrides(fields, legacyOverrides, dynamicFilterState, dynami
|
|
|
6437
6441
|
const filterDataSourceSearchable = dynamicFilterState?.searchableByField[key];
|
|
6438
6442
|
const currentDynamicOptions = !fieldOptions && filterDataSourceRegistered ? toTableOptions(dynamicFilterState?.optionsByField[key] ?? []) : void 0;
|
|
6439
6443
|
const dynamicFilterLabelOptions = !fieldOptions && filterDataSourceRegistered ? dynamicFilterState?.labelOptionsByField[key] ?? dynamicFilterState?.optionsByField[key] ?? [] : void 0;
|
|
6440
|
-
const dynamicResolveOptions =
|
|
6444
|
+
const dynamicResolveOptions = dynamicResolveState?.optionsByField[key];
|
|
6441
6445
|
const mergedSharedDynamicOptions = mergeFieldOptions(dynamicFilterLabelOptions, tableConfig?.dataSource ? void 0 : dynamicResolveOptions);
|
|
6442
6446
|
const dynamicOptions = !fieldOptions && mergedSharedDynamicOptions ? toTableOptions(mergedSharedDynamicOptions) : void 0;
|
|
6443
6447
|
const tableMeta = config.table !== false && typeof config.table === "object" ? config.table.meta : void 0;
|
|
@@ -6512,7 +6516,7 @@ function buildTableOverrides(fields, legacyOverrides, dynamicFilterState, dynami
|
|
|
6512
6516
|
};
|
|
6513
6517
|
const hasTableLabels = config.table.options !== void 0 || config.table.dataSource !== void 0;
|
|
6514
6518
|
if (display && display !== "auto" || hasTableLabels) {
|
|
6515
|
-
const options =
|
|
6519
|
+
const options = tableConfig?.dataSource ? mergeFieldOptions(dynamicResolveOptions, presentationOptions) : presentationOptions ?? mergedSharedDynamicOptions;
|
|
6516
6520
|
result[key] = {
|
|
6517
6521
|
...result[key],
|
|
6518
6522
|
cell: ({ row }) => renderFieldValue(row.getValue(key), "string", {
|
|
@@ -6625,6 +6629,10 @@ function renderFieldValue(value, type, booleanLocale, options, display = "auto")
|
|
|
6625
6629
|
className: "text-muted-foreground",
|
|
6626
6630
|
children: "-"
|
|
6627
6631
|
});
|
|
6632
|
+
if (Array.isArray(value) && value.length === 0) return /* @__PURE__ */ jsx("span", {
|
|
6633
|
+
className: "text-muted-foreground",
|
|
6634
|
+
children: "-"
|
|
6635
|
+
});
|
|
6628
6636
|
const renderText = (item) => getOptionLabel(item, options);
|
|
6629
6637
|
if (display === "text") return Array.isArray(value) ? value.map(renderText).join(", ") : renderText(value);
|
|
6630
6638
|
if (display === "date" || display === "datetime") return formatDate(value, {}, display);
|