imean-service-engine-htmx-plugin 2.1.0 → 2.1.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/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +5 -1
- package/dist/index.mjs +5 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -754,6 +754,7 @@ declare class DefaultListFeature<T extends {
|
|
|
754
754
|
private deleteItem?;
|
|
755
755
|
private listFieldNames?;
|
|
756
756
|
private filterSchema?;
|
|
757
|
+
private columnRenderers?;
|
|
757
758
|
constructor(options: {
|
|
758
759
|
/** 列表数据的 Schema(用于字段推断和显示) */
|
|
759
760
|
schema: z.ZodObject<any>;
|
|
@@ -773,6 +774,8 @@ declare class DefaultListFeature<T extends {
|
|
|
773
774
|
listFieldNames?: string[];
|
|
774
775
|
/** 筛选表单的 Schema(可选,不提供则不显示筛选表单) */
|
|
775
776
|
filterSchema?: z.ZodObject<any>;
|
|
777
|
+
/** 自定义列渲染函数(可选,key 为字段名,value 为渲染函数) */
|
|
778
|
+
columnRenderers?: Record<string, (value: any, item: T) => any>;
|
|
776
779
|
});
|
|
777
780
|
getRoutes(): {
|
|
778
781
|
method: "get";
|
package/dist/index.d.ts
CHANGED
|
@@ -754,6 +754,7 @@ declare class DefaultListFeature<T extends {
|
|
|
754
754
|
private deleteItem?;
|
|
755
755
|
private listFieldNames?;
|
|
756
756
|
private filterSchema?;
|
|
757
|
+
private columnRenderers?;
|
|
757
758
|
constructor(options: {
|
|
758
759
|
/** 列表数据的 Schema(用于字段推断和显示) */
|
|
759
760
|
schema: z.ZodObject<any>;
|
|
@@ -773,6 +774,8 @@ declare class DefaultListFeature<T extends {
|
|
|
773
774
|
listFieldNames?: string[];
|
|
774
775
|
/** 筛选表单的 Schema(可选,不提供则不显示筛选表单) */
|
|
775
776
|
filterSchema?: z.ZodObject<any>;
|
|
777
|
+
/** 自定义列渲染函数(可选,key 为字段名,value 为渲染函数) */
|
|
778
|
+
columnRenderers?: Record<string, (value: any, item: T) => any>;
|
|
776
779
|
});
|
|
777
780
|
getRoutes(): {
|
|
778
781
|
method: "get";
|
package/dist/index.js
CHANGED
|
@@ -1835,6 +1835,7 @@ var DefaultListFeature = class extends BaseFeature {
|
|
|
1835
1835
|
deleteItem;
|
|
1836
1836
|
listFieldNames;
|
|
1837
1837
|
filterSchema;
|
|
1838
|
+
columnRenderers;
|
|
1838
1839
|
constructor(options) {
|
|
1839
1840
|
super({
|
|
1840
1841
|
name: "list",
|
|
@@ -1849,6 +1850,7 @@ var DefaultListFeature = class extends BaseFeature {
|
|
|
1849
1850
|
this.deleteItem = options.deleteItem;
|
|
1850
1851
|
this.listFieldNames = options.listFieldNames;
|
|
1851
1852
|
this.filterSchema = options.filterSchema;
|
|
1853
|
+
this.columnRenderers = options.columnRenderers;
|
|
1852
1854
|
}
|
|
1853
1855
|
getRoutes() {
|
|
1854
1856
|
return [{ method: "get", path: "/list" }];
|
|
@@ -1861,7 +1863,9 @@ var DefaultListFeature = class extends BaseFeature {
|
|
|
1861
1863
|
const filterFields = this.filterSchema ? modelFieldsToFormFields(parseSchemaToFields(this.filterSchema)) : [];
|
|
1862
1864
|
const columns = listFieldNames.map((fieldName) => ({
|
|
1863
1865
|
key: fieldName,
|
|
1864
|
-
label: getFieldLabelFromFields(this.fields || [], fieldName)
|
|
1866
|
+
label: getFieldLabelFromFields(this.fields || [], fieldName),
|
|
1867
|
+
render: this.columnRenderers?.[fieldName]
|
|
1868
|
+
// 如果有自定义渲染函数则使用
|
|
1865
1869
|
}));
|
|
1866
1870
|
const model = context.model;
|
|
1867
1871
|
const prefix = context.prefix || "";
|
package/dist/index.mjs
CHANGED
|
@@ -1833,6 +1833,7 @@ var DefaultListFeature = class extends BaseFeature {
|
|
|
1833
1833
|
deleteItem;
|
|
1834
1834
|
listFieldNames;
|
|
1835
1835
|
filterSchema;
|
|
1836
|
+
columnRenderers;
|
|
1836
1837
|
constructor(options) {
|
|
1837
1838
|
super({
|
|
1838
1839
|
name: "list",
|
|
@@ -1847,6 +1848,7 @@ var DefaultListFeature = class extends BaseFeature {
|
|
|
1847
1848
|
this.deleteItem = options.deleteItem;
|
|
1848
1849
|
this.listFieldNames = options.listFieldNames;
|
|
1849
1850
|
this.filterSchema = options.filterSchema;
|
|
1851
|
+
this.columnRenderers = options.columnRenderers;
|
|
1850
1852
|
}
|
|
1851
1853
|
getRoutes() {
|
|
1852
1854
|
return [{ method: "get", path: "/list" }];
|
|
@@ -1859,7 +1861,9 @@ var DefaultListFeature = class extends BaseFeature {
|
|
|
1859
1861
|
const filterFields = this.filterSchema ? modelFieldsToFormFields(parseSchemaToFields(this.filterSchema)) : [];
|
|
1860
1862
|
const columns = listFieldNames.map((fieldName) => ({
|
|
1861
1863
|
key: fieldName,
|
|
1862
|
-
label: getFieldLabelFromFields(this.fields || [], fieldName)
|
|
1864
|
+
label: getFieldLabelFromFields(this.fields || [], fieldName),
|
|
1865
|
+
render: this.columnRenderers?.[fieldName]
|
|
1866
|
+
// 如果有自定义渲染函数则使用
|
|
1863
1867
|
}));
|
|
1864
1868
|
const model = context.model;
|
|
1865
1869
|
const prefix = context.prefix || "";
|