Skip to content

Commit

Permalink
feat(designable-antd): support HistoryWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Aug 6, 2021
1 parent 278e496 commit 8b0705e
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 58 deletions.
8 changes: 4 additions & 4 deletions designable/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"start": "webpack-dev-server --config playground/webpack.dev.ts"
},
"devDependencies": {
"@designable/react-settings-form": "^0.4.26",
"@designable/react-settings-form": "^0.4.29",
"autoprefixer": "^9.0",
"file-loader": "^5.0.2",
"fs-extra": "^8.1.0",
Expand All @@ -56,9 +56,9 @@
"react-is": ">=16.8.0 || >=17.0.0"
},
"dependencies": {
"@designable/core": "^0.4.26",
"@designable/formily": "^0.4.26",
"@designable/react": "^0.4.26",
"@designable/core": "^0.4.29",
"@designable/formily": "^0.4.29",
"@designable/react": "^0.4.29",
"@formily/antd": "2.0.0-beta.87",
"@formily/core": "2.0.0-beta.87",
"@formily/designable-setters": "2.0.0-beta.87",
Expand Down
15 changes: 6 additions & 9 deletions designable/antd/playground/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import React from 'react'
import ReactDOM from 'react-dom'
import {
Designer,
IconWidget,
DesignerToolsWidget,
ViewToolsWidget,
Workspace,
OutlineTreeWidget,
DragSourceWidget,
HistoryWidget,
MainPanel,
CompositePanel,
WorkspacePanel,
Expand Down Expand Up @@ -78,20 +78,17 @@ const App = () => {
<Designer engine={engine} theme="dark">
<MainPanel logo={<LogoWidget />} actions={<ActionsWidget />}>
<CompositePanel>
<CompositePanel.Item
title="panels.Component"
icon={<IconWidget infer="Component" />}
>
<CompositePanel.Item title="panels.Component" icon="Component">
<DragSourceWidget title="sources.Inputs" name="inputs" />
<DragSourceWidget title="sources.Layouts" name="layouts" />
<DragSourceWidget title="sources.Arrays" name="arrays" />
</CompositePanel.Item>
<CompositePanel.Item
title="panels.OutlinedTree"
icon={<IconWidget infer="Outline" />}
>
<CompositePanel.Item title="panels.OutlinedTree" icon="Outline">
<OutlineTreeWidget />
</CompositePanel.Item>
<CompositePanel.Item title="panels.History" icon="History">
<HistoryWidget />
</CompositePanel.Item>
</CompositePanel>
<Workspace id="form">
<WorkspacePanel>
Expand Down
8 changes: 4 additions & 4 deletions designable/antd/src/components/DesignableArrayCards/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export const DesignableArrayCards: React.FC<CardProps> = observer((props) => {
'x-component': 'ArrayCards.Index',
},
})
ensureVoidItemsNode(node).appendNode(indexNode)
ensureVoidItemsNode(node).append(indexNode)
},
},

Expand Down Expand Up @@ -199,7 +199,7 @@ export const DesignableArrayCards: React.FC<CardProps> = observer((props) => {
'ArrayCards.MoveUp',
])
if (!oldRemoveNode) {
ensureVoidItemsNode(node).appendNode(
ensureVoidItemsNode(node).append(
new TreeNode({
componentName: 'DesignableField',
props: {
Expand All @@ -210,7 +210,7 @@ export const DesignableArrayCards: React.FC<CardProps> = observer((props) => {
)
}
if (!oldMoveDownNode) {
ensureVoidItemsNode(node).appendNode(
ensureVoidItemsNode(node).append(
new TreeNode({
componentName: 'DesignableField',
props: {
Expand All @@ -221,7 +221,7 @@ export const DesignableArrayCards: React.FC<CardProps> = observer((props) => {
)
}
if (!oldMoveUpNode) {
ensureVoidItemsNode(node).appendNode(
ensureVoidItemsNode(node).append(
new TreeNode({
componentName: 'DesignableField',
props: {
Expand Down
8 changes: 4 additions & 4 deletions designable/antd/src/components/DesignableArrayTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export const DesignableArrayTable: React.FC<TableProps<any>> = observer(
},
],
})
ensureObjectItemsNode(node).prependNode(tableColumn)
ensureObjectItemsNode(node).prepend(tableColumn)
},
},
{
Expand Down Expand Up @@ -290,7 +290,7 @@ export const DesignableArrayTable: React.FC<TableProps<any>> = observer(
if (sortNode) {
sortNode.parent.insertAfter(tableColumn)
} else {
ensureObjectItemsNode(node).prependNode(tableColumn)
ensureObjectItemsNode(node).prepend(tableColumn)
}
},
},
Expand Down Expand Up @@ -322,7 +322,7 @@ export const DesignableArrayTable: React.FC<TableProps<any>> = observer(
if (operationNode) {
operationNode.parent.insertBefore(tableColumn)
} else {
ensureObjectItemsNode(node).appendNode(tableColumn)
ensureObjectItemsNode(node).append(tableColumn)
}
},
},
Expand Down Expand Up @@ -379,7 +379,7 @@ export const DesignableArrayTable: React.FC<TableProps<any>> = observer(
},
],
})
ensureObjectItemsNode(node).appendNode(operationNode)
ensureObjectItemsNode(node).append(operationNode)
}
if (!oldAdditionNode) {
const additionNode = new TreeNode({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const DesignableFormCollapse: React.FC<CollapseProps> & {
},
},
})
node.appendNode(tabPane)
node.append(tabPane)
const keys = toArr(activeKey)
setActiveKey(keys.concat(tabPane.id))
},
Expand Down
2 changes: 1 addition & 1 deletion designable/antd/src/components/DesignableFormTab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const DesignableFormTab: React.FC<TabsProps> & {
},
},
})
node.appendNode(tabPane)
node.append(tabPane)
setActiveKey(tabPane.id)
},
},
Expand Down
2 changes: 1 addition & 1 deletion designable/antd/src/hooks/useDropTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const useDropTemplate = (
) &&
target.children.length === 0
) {
target.setNodeChildren(...getChildren(source))
target.setChildren(...getChildren(source))
return false
}
})
Expand Down
2 changes: 1 addition & 1 deletion designable/antd/src/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const createEnsureTypeItemsNode = (type: string) => (node: TreeNode) => {
type,
},
})
node.prependNode(newObjectNode)
node.prepend(newObjectNode)
return newObjectNode
}
}
8 changes: 4 additions & 4 deletions designable/setters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@
"react-is": ">=16.8.0 || >=17.0.0"
},
"dependencies": {
"@designable/core": "^0.4.26",
"@designable/formily": "^0.4.26",
"@designable/react": "^0.4.26",
"@designable/react-settings-form": "^0.4.26",
"@designable/core": "^0.4.29",
"@designable/formily": "^0.4.29",
"@designable/react": "^0.4.29",
"@designable/react-settings-form": "^0.4.29",
"@formily/antd": "2.0.0-beta.87",
"@formily/core": "2.0.0-beta.87",
"@formily/react": "2.0.0-beta.87",
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"target": "es5",
"allowJs": false,
"noUnusedLocals": false,
"removeComments": true,
"preserveConstEnums": true,
"sourceMap": true,
"declaration": true,
Expand Down
62 changes: 34 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1156,12 +1156,12 @@
resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f"
integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ==

"@designable/core@0.4.26", "@designable/core@^0.4.26":
version "0.4.26"
resolved "https://registry.yarnpkg.com/@designable/core/-/core-0.4.26.tgz#bf7edbdb02b52ce1bbc6bb1048a76fcc1a4d8206"
integrity sha512-c7DtzVnmnV+RQVBOfjgpVLN0LA1YyUdAe5bexBkw04abYuei9tyq6FjNU0odED6Ig1NjXNkzcSSKRl/vVin+VQ==
"@designable/core@0.4.29", "@designable/core@^0.4.29":
version "0.4.29"
resolved "https://registry.yarnpkg.com/@designable/core/-/core-0.4.29.tgz#0af3835f090181530e434cac85311d56614e9486"
integrity sha512-dccVVEbdy1xFyDAqGDEzPkHA9wcGkEUFUNs0R7eQpxP5lIdOuVjFP7B1DIG2dNnRJV123OCTTvFmIc3cOYtLOw==
dependencies:
"@designable/shared" "0.4.26"
"@designable/shared" "0.4.29"
"@formily/json-schema" "^2.0.0-beta.76"
"@formily/path" "^2.0.0-beta.76"
"@formily/reactive" "^2.0.0-beta.76"
Expand All @@ -1178,25 +1178,25 @@
"@formily/reactive" "^2.0.0-beta.50"
"@juggle/resize-observer" "^3.3.1"

"@designable/formily@^0.4.26":
version "0.4.26"
resolved "https://registry.yarnpkg.com/@designable/formily/-/formily-0.4.26.tgz#f36240db2edf33c9c6028c895f6baed6d59d8d50"
integrity sha512-AgCcYzTwKeimQyIMLpmJea0Cv3FInN+9SjYtv4VImqdboiKg3NQgLRHeyVzy6naXP2y/jMwIRZQ1FIZftISTsw==
"@designable/formily@^0.4.29":
version "0.4.29"
resolved "https://registry.yarnpkg.com/@designable/formily/-/formily-0.4.29.tgz#c6957742a5e419f8d6506c6cb662bf8a0d05731e"
integrity sha512-LKhZOLhht6yI1VcZdZxr1PF5IyzMHQK4EBcxPO4EqYX35ViZKWTY9pIeCVU34ZEb/bLaWT0EPmJNjQT1IN/D+w==
dependencies:
"@designable/core" "0.4.26"
"@designable/shared" "0.4.26"
"@designable/core" "0.4.29"
"@designable/shared" "0.4.29"
"@formily/core" "^2.0.0-beta.76"
"@formily/json-schema" "^2.0.0-beta.76"

"@designable/react-settings-form@^0.4.26":
version "0.4.26"
resolved "https://registry.yarnpkg.com/@designable/react-settings-form/-/react-settings-form-0.4.26.tgz#60ceb3a8db042ca99a0e1a1360abd98e28c8e550"
integrity sha512-K6eA4w9TUPMyAtqrGiR1AawDFOfmMPFU43Zyl75tk2wwlSsUJzWw7TtGxw+66Ym2W4hfI2iKOyU40xWba5u6ZQ==
"@designable/react-settings-form@^0.4.29":
version "0.4.29"
resolved "https://registry.yarnpkg.com/@designable/react-settings-form/-/react-settings-form-0.4.29.tgz#44a51c37266fd5ea7bce7ef230284bd402c473d1"
integrity sha512-mNky2gFQBI8IJjzaZS7IyNBXOnOD5yQhEsFOlKGbWiPWRBGOh6/8ZOkvYcpj4gLFbCoctmhomuXJC9e2s3JcHA==
dependencies:
"@babel/parser" "^7.14.7"
"@designable/core" "0.4.26"
"@designable/react" "0.4.26"
"@designable/shared" "0.4.26"
"@designable/core" "0.4.29"
"@designable/react" "0.4.29"
"@designable/shared" "0.4.29"
"@formily/antd" "^2.0.0-beta.76"
"@formily/core" "^2.0.0-beta.76"
"@formily/react" "^2.0.0-beta.76"
Expand All @@ -1209,16 +1209,17 @@
react-color "^2.19.3"
react-tiny-popover "^6.0.5"

"@designable/react@0.4.26", "@designable/react@^0.4.26":
version "0.4.26"
resolved "https://registry.yarnpkg.com/@designable/react/-/react-0.4.26.tgz#08fbe71b89d9c2703fcb029c4bd1aa96592921d7"
integrity sha512-gOIUkl6aDgi75VU2oSgsjLb9aU/Md3XUoCU54xntKGbG1DIIz+fWJL+dk0LN9ezOwEAuEAs+OTvD/J65bSowJA==
"@designable/react@0.4.29", "@designable/react@^0.4.29":
version "0.4.29"
resolved "https://registry.yarnpkg.com/@designable/react/-/react-0.4.29.tgz#f5af81bd00ea3b7819e807f43632b903949cd8d0"
integrity sha512-pZlO/UwZsYx1EAglrtLz1j1vr+zou8cA+SHKYUYg9RxzQEK5cGrOkYKI7plMsQUUh5R8//pECEavROXOpfjroQ==
dependencies:
"@designable/core" "0.4.26"
"@designable/shared" "0.4.26"
"@designable/core" "0.4.29"
"@designable/shared" "0.4.29"
"@formily/reactive" "^2.0.0-beta.76"
"@formily/reactive-react" "^2.0.0-beta.76"
"@juggle/resize-observer" "^3.3.1"
dateformat "^4.5.1"

"@designable/shared@0.1.51":
version "0.1.51"
Expand All @@ -1227,10 +1228,10 @@
dependencies:
requestidlecallback "^0.3.0"

"@designable/shared@0.4.26":
version "0.4.26"
resolved "https://registry.yarnpkg.com/@designable/shared/-/shared-0.4.26.tgz#3142a67f825b5e675fd0ee0f4256be395f36c74f"
integrity sha512-Ec5HpYVZ9R6nslOuioBvC8lv/8b2d2rQvuGc1N+egCbXvmQT8m9FLW3q4CW/0KIWo3p3KzYDjnUAHP8uy8sG6Q==
"@designable/shared@0.4.29":
version "0.4.29"
resolved "https://registry.yarnpkg.com/@designable/shared/-/shared-0.4.29.tgz#1f73ed310d580ab3c85259a69dd110919ae68d63"
integrity sha512-QjOSnEg2r2orU17LMyD0dvDIAL3M6lkbjseZPGuzg29JGzYkI3R124htazIZsElcPsnHUTKRd7l3HPXJOxOi8w==
dependencies:
requestidlecallback "^0.3.0"

Expand Down Expand Up @@ -6696,6 +6697,11 @@ dateformat@^3.0.0:
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-3.0.3.tgz#a6e37499a4d9a9cf85ef5872044d62901c9889ae"
integrity sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==

dateformat@^4.5.1:
version "4.5.1"
resolved "https://registry.yarnpkg.com/dateformat/-/dateformat-4.5.1.tgz#c20e7a9ca77d147906b6dc2261a8be0a5bd2173c"
integrity sha512-OD0TZ+B7yP7ZgpJf5K2DIbj3FZvFvxgFUuaqA/V5zTjAtAAXZ1E8bktHxmAGs4x5b7PflqA9LeQ84Og7wYtF7Q==

dayjs@1.x, dayjs@^1.9.6:
version "1.10.6"
resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.10.6.tgz#288b2aa82f2d8418a6c9d4df5898c0737ad02a63"
Expand Down

0 comments on commit 8b0705e

Please sign in to comment.