-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: custom widget #325
feat: custom widget #325
Conversation
✔️ Deploy Preview for mystifying-kirch-d00a2f ready! 🔨 Explore the source changes: 5ec71b1 🔍 Inspect the deploy log: https://app.netlify.com/sites/mystifying-kirch-d00a2f/deploys/622579d596b92e0007f813cc 😎 Browse the preview: https://deploy-preview-325--mystifying-kirch-d00a2f.netlify.app/ |
@@ -12,6 +13,7 @@ import { | |||
import { genComponent } from './utils'; | |||
|
|||
export class AppModel implements IAppModel { | |||
widgets: Record<string, Widget> = {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppModel
is the model of application schema. Widgets are not part of application schema, so they should not be registered here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will use a new model to manage the widgets.
"typings": "tsc --emitDeclarationOnly", | ||
"prepublish": "npm run build && npm run typings" | ||
}, | ||
"dependencies": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add peer dependencies like other project.
packages/editor/package.json
Outdated
"@sunmao-ui/chakra-ui-lib": "^0.2.0", | ||
"@sunmao-ui/core": "^0.4.0", | ||
"@sunmao-ui/editor-sdk": "^0.5.0-alpha1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did editor-sdk
publish this version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has not yet been, but the lerna
would parse it as a local package. What version of editor-sdk
should use here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.0.0 for now.
import { Component, ComponentSchema } from '@sunmao-ui/core'; | ||
import { EditorServices } from './editor'; | ||
|
||
export type Schema = Component<string, string, string, string>['spec']['properties']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is JSONSchema7
|
||
export type WidgetProps<WidgetOptions = Record<string, any>> = { | ||
component: ComponentSchema; | ||
schema: Schema & EditorSchema<WidgetOptions>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess here is actually spec. The spec of component properties.
onChange: (v: any) => void; | ||
}; | ||
|
||
export type WidgetOptions = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name should be Widget
according to the naming rule in core
.
}; | ||
}; | ||
|
||
export type Widget<T = Record<string, any>> = WidgetOptions & { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be ImplementedWidget
Still has conflicts. And why there are 15000 lines change? |
…eat/custom-widget
@tanbowensg OK. I think there is a problem with GitHub displaying the changes. After I solve the conflicts the changes become correct. |
Changes:
@sunmao-ui/editor-sdk
packageRef ISSUE: #313