GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(setter): add field ts · vanestone/lowcode-engine@6e89d4d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages
    • editor-core/src/di
      • setter.ts
    • editor-skeleton/src
      • components/settings
        • settings-pane.tsx
      • transducers
        • parse-props.ts
    • types/src/shell/type
      • field-extra-props.ts
      • registered-setter.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/editor-core/src/di/setter.ts‎

Copy file name to clipboardExpand all lines: packages/editor-core/src/di/setter.ts
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactNode } from 'react';
2-
import { IPublicApiSetters, IPublicTypeCustomView, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types';
2+
import { IPublicApiSetters, IPublicModelSettingField, IPublicTypeCustomView, IPublicTypeRegisteredSetter } from '@alilc/lowcode-types';
33
import { createContent, isCustomView } from '@alilc/lowcode-utils';
44

55
const settersMap = new Map<string, IPublicTypeRegisteredSetter & {
@@ -28,7 +28,7 @@ export function registerSetter(
2828
if (!setter.initialValue) {
2929
const initial = getInitialFromSetter(setter.component);
3030
if (initial) {
31-
setter.initialValue = (field: any) => {
31+
setter.initialValue = (field: IPublicModelSettingField) => {
3232
return initial.call(field, field.getValue());
3333
};
3434
}
@@ -81,7 +81,7 @@ export class Setters implements ISetters {
8181
if (!setter.initialValue) {
8282
const initial = getInitialFromSetter(setter.component);
8383
if (initial) {
84-
setter.initialValue = (field: any) => {
84+
setter.initialValue = (field: IPublicModelSettingField) => {
8585
return initial.call(field, field.getValue());
8686
};
8787
}
Collapse file

‎packages/editor-skeleton/src/components/settings/settings-pane.tsx‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/components/settings/settings-pane.tsx
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
225225

226226
const value = this.value;
227227

228-
let _onChange = extraProps?.onChange;
228+
let onChangeAPI = extraProps?.onChange;
229229
let stageName = this.stageName;
230230

231231
return createField(
@@ -261,7 +261,7 @@ class SettingFieldView extends Component<SettingFieldViewProps, SettingFieldView
261261
value,
262262
});
263263
field.setValue(value, true);
264-
if (_onChange) _onChange(value, field);
264+
if (onChangeAPI) onChangeAPI(value, field.internalToShellField());
265265
},
266266
onInitial: () => {
267267
if (initialValue == null) {
Collapse file

‎packages/editor-skeleton/src/transducers/parse-props.ts‎

Copy file name to clipboardExpand all lines: packages/editor-skeleton/src/transducers/parse-props.ts
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
IPublicTypeTransformedComponentMetadata,
1010
IPublicTypeOneOfType,
1111
ConfigureSupportEvent,
12+
IPublicModelSettingField,
1213
} from '@alilc/lowcode-types';
1314

1415
function propConfigToFieldConfig(propConfig: IPublicTypePropConfig): IPublicTypeFieldConfig {
@@ -102,7 +103,7 @@ function propTypeToSetter(propType: IPublicTypePropType): IPublicTypeSetterType
102103
},
103104
},
104105
isRequired,
105-
initialValue: (field: any) => {
106+
initialValue: (field: IPublicModelSettingField) => {
106107
const data: any = {};
107108
items.forEach((item: any) => {
108109
let initial = item.defaultValue;
Collapse file

‎packages/types/src/shell/type/field-extra-props.ts‎

Copy file name to clipboardExpand all lines: packages/types/src/shell/type/field-extra-props.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ export interface IPublicTypeFieldExtraProps {
7777
/**
7878
* onChange 事件
7979
*/
80-
onChange?: (value: any, field: any) => void;
80+
onChange?: (value: any, field: IPublicModelSettingField) => void;
8181
}
Collapse file

‎packages/types/src/shell/type/registered-setter.ts‎

Copy file name to clipboardExpand all lines: packages/types/src/shell/type/registered-setter.ts
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1+
import { IPublicModelSettingField } from '../model';
12
import { IPublicTypeCustomView, IPublicTypeTitleContent } from './';
23

34
export interface IPublicTypeRegisteredSetter {
45
component: IPublicTypeCustomView;
56
defaultProps?: object;
67
title?: IPublicTypeTitleContent;
8+
79
/**
810
* for MixedSetter to check this setter if available
911
*/
10-
condition?: (field: any) => boolean;
12+
condition?: (field: IPublicModelSettingField) => boolean;
13+
1114
/**
1215
* for MixedSetter to manual change to this setter
1316
*/
14-
initialValue?: any | ((field: any) => any);
17+
initialValue?: any | ((field: IPublicModelSettingField) => any);
1518
recommend?: boolean;
1619
// 标识是否为动态 setter,默认为 true
1720
isDynamic?: boolean;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.