Skip to content

Commit

Permalink
fix: generator pass schemaFunctionPreprocessor prop
Browse files Browse the repository at this point in the history
  • Loading branch information
helloqian12138 committed Sep 2, 2024
1 parent 3359905 commit 8d6aa56
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/drip-table-generator/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "drip-table-generator",
"version": "3.2.1-alpha.6",
"version": "3.2.1-alpha.7",
"description": "A visualization tool for generating schema of drip-table.",
"main": "dist/index.min.js",
"module": "lib/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import { createEvaluator, evaluate, finalizeString, safeEvaluate } from '@/utils
import { DataSourceTypeAbbr, DripTableGeneratorProps } from '@/typing';

export interface CommonCellProps<
RecordType extends DataSourceTypeAbbr<NonNullable<ExtraOptions['SubtableDataSourceKey']>>,
ExtraOptions extends Partial<DripTableExtraOptions> = never,
RecordType extends DataSourceTypeAbbr<NonNullable<ExtraOptions['SubtableDataSourceKey']>>,
ExtraOptions extends Partial<DripTableExtraOptions> = never,
> {
column: DripTableBuiltInColumnSchema;
schema: DripTableProps<RecordType, ExtraOptions>['schema'];
Expand All @@ -35,6 +35,7 @@ ExtraOptions extends Partial<DripTableExtraOptions> = never,
preview?: DripTableGeneratorProps<RecordType, ExtraOptions>['preview'];
onEvent?: DripTableGeneratorProps<RecordType, ExtraOptions>['onEvent'];
defaultComponentLib?: DripTableGeneratorProps<RecordType, ExtraOptions>['defaultComponentLib'];
schemaFunctionPreprocessor?: DripTableGeneratorProps<RecordType, ExtraOptions>['schemaFunctionPreprocessor'];
}

const generatorComponentSchema = <T extends DripTableBuiltInColumnSchema | null>(column: T): T => (
Expand All @@ -49,8 +50,8 @@ const generatorComponentSchema = <T extends DripTableBuiltInColumnSchema | null>
);

function CommonCell<
RecordType extends DataSourceTypeAbbr<NonNullable<ExtraOptions['SubtableDataSourceKey']>>,
ExtraOptions extends Partial<DripTableExtraOptions> = never,
RecordType extends DataSourceTypeAbbr<NonNullable<ExtraOptions['SubtableDataSourceKey']>>,
ExtraOptions extends Partial<DripTableExtraOptions> = never,
>(props: CommonCellProps<RecordType, ExtraOptions>) {
if (props.column?.component === 'group' || props.column?.component === 'popover') {
return null;
Expand All @@ -77,7 +78,7 @@ ExtraOptions extends Partial<DripTableExtraOptions> = never,
evaluate,
safeEvaluate,
finalizeString,
schemaFunctionPreprocessor: void 0,
schemaFunctionPreprocessor: props.schemaFunctionPreprocessor,
},
)
: () => <div />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ interface TableCellProps<
defaultComponentLib?: DripTableGeneratorProps<RecordType, ExtraOptions>['defaultComponentLib'];
onClick?: DripTableGeneratorProps<RecordType, ExtraOptions>['onClick'];
onColumnItemChanged?: DripTableGeneratorProps<RecordType, ExtraOptions>['onColumnItemChanged'];
schemaFunctionPreprocessor?: DripTableGeneratorProps<RecordType, ExtraOptions>['schemaFunctionPreprocessor'];
}

function TableCell<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ ExtraOptions extends Partial<DripTableExtraOptions> = never,
onClick: DripTableGeneratorProps<RecordType, ExtraOptions>['onClick'];
onColumnItemChanged: DripTableGeneratorProps<RecordType, ExtraOptions>['onColumnItemChanged'];
renderSelection: DripTableGeneratorProps<RecordType, ExtraOptions>['renderSelection'];
schemaFunctionPreprocessor?: DripTableGeneratorProps<RecordType, ExtraOptions>['schemaFunctionPreprocessor'];
}

const VerticalAligns = {
Expand Down Expand Up @@ -127,6 +128,7 @@ ExtraOptions extends Partial<DripTableExtraOptions> = never,
onEvent={props.onEvent}
onClick={props.onClick}
onColumnItemChanged={props.onColumnItemChanged}
schemaFunctionPreprocessor={props.schemaFunctionPreprocessor}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ ExtraOptions extends Partial<DripTableExtraOptions> = never,
onClick={props.onClick}
onColumnItemChanged={props.onColumnItemChanged}
containerWidth={tableWidth}
schemaFunctionPreprocessor={props.schemaFunctionPreprocessor}
/>
{ (props.tableConfig.hasSubTable && hasSubTable)
&& (
Expand Down

0 comments on commit 8d6aa56

Please sign in to comment.