Skip to content

Commit

Permalink
feat(designable): add icons for drag source
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Aug 24, 2021
1 parent a6fb168 commit 8c14fa6
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 42 deletions.
8 changes: 4 additions & 4 deletions designable/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"start": "webpack-dev-server --config playground/webpack.dev.ts"
},
"devDependencies": {
"@designable/react-settings-form": "^0.5.4",
"@designable/react-settings-form": "^0.5.6",
"autoprefixer": "^9.0",
"file-loader": "^5.0.2",
"fs-extra": "^8.1.0",
Expand All @@ -55,9 +55,9 @@
"react-is": ">=16.8.0 || >=17.0.0"
},
"dependencies": {
"@designable/core": "^0.5.4",
"@designable/formily": "^0.5.4",
"@designable/react": "^0.5.4",
"@designable/core": "^0.5.6",
"@designable/formily": "^0.5.6",
"@designable/react": "^0.5.6",
"@formily/antd": "2.0.0-rc.3",
"@formily/core": "2.0.0-rc.3",
"@formily/designable-setters": "2.0.0-rc.3",
Expand Down
3 changes: 2 additions & 1 deletion designable/antd/src/components/DesignableField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,10 @@ export const createDesignableField = (
: isVoidNode
? GlobalRegistry.getDesignerMessage('components.Void')
: '')
const sourceIcon = realOptions.componentsSourceIcon?.[componentName]
return {
title: nodeTitle,
sourceIcon: realOptions.componentsSourceIcon?.[componentName],
sourceIcon: isObjectNode ? 'ObjectSource' : sourceIcon,
icon: realOptions.componentsIcon?.[componentName],
draggable: true,
droppable: isObjectNode || isArrayNode || isVoidNode,
Expand Down
30 changes: 30 additions & 0 deletions designable/antd/src/components/DesignableField/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,36 @@ export const createOptions = (
'FormCollapse.CollapsePanel': ['FormCollapse.CollapsePanel'],
'ArrayTable.Column': ['ArrayTable.Column'],
},
componentsSourceIcon: {
...options.componentsSourceIcon,
Space: 'SpaceSource',
FormGrid: 'GridSource',
FormTab: 'TabSource',
FormCollapse: 'CollapseSource',
ArrayTable: 'ArrayTableSource',
ArrayCards: 'ArrayCardsSource',
DatePicker: 'DatePickerSource',
'DatePicker.RangePicker': 'DateRangePickerSource',
'Checkbox.Group': 'CheckboxGroupSource',
'Radio.Group': 'RadioGroupSource',
Slider: 'SliderSource',
Rate: 'RateSource',
TimePicker: 'TimePickerSource',
'TimePicker.RangePicker': 'TimeRangePickerSource',
Cascader: 'CascaderSource',
TreeSelect: 'TreeSelectSource',
Select: 'SelectSource',
'Input.TextArea': 'TextAreaSource',
Input: 'InputSource',
NumberPicker: 'NumberPickerSource',
Password: 'PasswordSource',
Transfer: 'TransferSource',
Switch: 'SwitchSource',
Upload: 'UploadSource',
'Upload.Dragger': 'UploadDraggerSource',
Card: 'CardSource',
FormLayout: 'FormLayoutSource',
},
components: {
...options.components,
Space: createDesignableContainer(Space),
Expand Down
8 changes: 4 additions & 4 deletions designable/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"start": "webpack-dev-server --config playground/webpack.dev.ts"
},
"devDependencies": {
"@designable/react-settings-form": "^0.5.4",
"@designable/react-settings-form": "^0.5.6",
"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.5.4",
"@designable/formily": "^0.5.4",
"@designable/react": "^0.5.4",
"@designable/core": "^0.5.6",
"@designable/formily": "^0.5.6",
"@designable/react": "^0.5.6",
"@formily/core": "2.0.0-rc.3",
"@formily/designable-setters": "2.0.0-rc.3",
"@formily/next": "2.0.0-rc.3",
Expand Down
3 changes: 2 additions & 1 deletion designable/next/src/components/DesignableField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,10 @@ export const createDesignableField = (
: isVoidNode
? GlobalRegistry.getDesignerMessage('components.Void')
: '')
const sourceIcon = realOptions.componentsSourceIcon?.[componentName]
return {
title: nodeTitle,
sourceIcon: realOptions.componentsSourceIcon?.[componentName],
sourceIcon: isObjectNode ? 'ObjectSource' : sourceIcon,
icon: realOptions.componentsIcon?.[componentName],
draggable: true,
droppable: isObjectNode || isArrayNode || isVoidNode,
Expand Down
30 changes: 30 additions & 0 deletions designable/next/src/components/DesignableField/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,36 @@ export const createOptions = (
'FormCollapse.CollapsePanel': ['FormCollapse.CollapsePanel'],
'ArrayTable.Column': ['ArrayTable.Column'],
},
componentsSourceIcon: {
...options.componentsSourceIcon,
Space: 'SpaceSource',
FormGrid: 'GridSource',
FormTab: 'TabSource',
FormCollapse: 'CollapseSource',
ArrayTable: 'ArrayTableSource',
ArrayCards: 'ArrayCardsSource',
DatePicker: 'DatePickerSource',
'DatePicker.RangePicker': 'DateRangePickerSource',
'Checkbox.Group': 'CheckboxGroupSource',
'Radio.Group': 'RadioGroupSource',
Slider: 'SliderSource',
Rate: 'RateSource',
TimePicker: 'TimePickerSource',
'TimePicker.RangePicker': 'TimeRangePickerSource',
Cascader: 'CascaderSource',
TreeSelect: 'TreeSelectSource',
Select: 'SelectSource',
'Input.TextArea': 'TextAreaSource',
Input: 'InputSource',
NumberPicker: 'NumberPickerSource',
Password: 'PasswordSource',
Transfer: 'TransferSource',
Switch: 'SwitchSource',
Upload: 'UploadSource',
'Upload.Dragger': 'UploadDraggerSource',
Card: 'CardSource',
FormLayout: 'FormLayoutSource',
},
components: {
...options.components,
Space: createDesignableContainer(Space),
Expand Down
8 changes: 4 additions & 4 deletions designable/setters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
"react-is": ">=16.8.0 || >=17.0.0"
},
"dependencies": {
"@designable/core": "^0.5.4",
"@designable/formily": "^0.5.4",
"@designable/react": "^0.5.4",
"@designable/react-settings-form": "^0.5.4",
"@designable/core": "^0.5.6",
"@designable/formily": "^0.5.6",
"@designable/react": "^0.5.6",
"@designable/react-settings-form": "^0.5.6",
"@formily/antd": "2.0.0-rc.3",
"@formily/core": "2.0.0-rc.3",
"@formily/react": "2.0.0-rc.3",
Expand Down
56 changes: 28 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1161,36 +1161,36 @@
resolved "https://registry.yarnpkg.com/@ctrl/tinycolor/-/tinycolor-3.4.0.tgz#c3c5ae543c897caa9c2a68630bed355be5f9990f"
integrity sha512-JZButFdZ1+/xAfpguQHoabIXkcqRRKpMrWKBkpEZZyxfY9C1DpADFB8PEqGSTeFr135SaTRfKqGKx5xSCLI7ZQ==

"@designable/core@0.5.4", "@designable/core@^0.5.4":
version "0.5.4"
resolved "https://registry.yarnpkg.com/@designable/core/-/core-0.5.4.tgz#41f7d975d1158f0bad510f764de98f6c92c5c6ab"
integrity sha512-7XAWFQEg/LdsTj5rvKczdVJ7LAWJ91NJu4yjWJRpK9u7LE2xUJ+yDCSrAW2qk60lRbbfgJAuGuB7DISLhb2wwA==
"@designable/core@0.5.6", "@designable/core@^0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@designable/core/-/core-0.5.6.tgz#36bd5faa88f9503f3413cd898952776db22091a4"
integrity sha512-cxvyadmDT1Vfxoeus7YoitGiOur8T/gs4OA8cJra/IH9ebAdfmsxiv2axy+VLDYWFR+WVlfu2GxDlTUn8mpCdw==
dependencies:
"@designable/shared" "0.5.4"
"@designable/shared" "0.5.6"
"@formily/json-schema" "^2.0.0-beta.84"
"@formily/path" "^2.0.0-beta.84"
"@formily/reactive" "^2.0.0-beta.84"
"@juggle/resize-observer" "^3.3.1"

"@designable/formily@^0.5.4":
version "0.5.4"
resolved "https://registry.yarnpkg.com/@designable/formily/-/formily-0.5.4.tgz#092e93925b811fb753d1e661f359be8eabd84ce1"
integrity sha512-fhc0B7pd7meSabgYFMvsiedNs+tz1aHBu2vQueUTeXvoLR3P+PjxHfVef1e8vO04NN/QsROQv0YkkuptsS985w==
"@designable/formily@^0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@designable/formily/-/formily-0.5.6.tgz#85b5d0ebb9cc9d286acb73cde2e5f3b20274076d"
integrity sha512-BTsOZGrMafsOwNM9FbwV/3FrDzOMWDqWtrXoNkIifdIUPMLKQPKFO5VBF4M8J7/LEpaOvh241EROxUUGhgNBZQ==
dependencies:
"@designable/core" "0.5.4"
"@designable/shared" "0.5.4"
"@designable/core" "0.5.6"
"@designable/shared" "0.5.6"
"@formily/core" "^2.0.0-beta.84"
"@formily/json-schema" "^2.0.0-beta.84"

"@designable/react-settings-form@^0.5.4":
version "0.5.4"
resolved "https://registry.yarnpkg.com/@designable/react-settings-form/-/react-settings-form-0.5.4.tgz#5072ab9c4b7012fc96ce5f197d01a9d24cc52bbc"
integrity sha512-JO1ArMKsnVW0RcHZRRlHe5SxzG2LI3UvBAWbJGwcjRpySEmiZjt8gYYNDbJ18rxqh6/X3I8qq+GOA2sqIKPNjg==
"@designable/react-settings-form@^0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@designable/react-settings-form/-/react-settings-form-0.5.6.tgz#3173d3e310469e9dce84df41abce873c4732fb6f"
integrity sha512-eGIyghX9E/fTvVd+lsmSgJK6rWtRTAY4+2jjq4IEoS3cfU4cbhQ3/or5VV0s2UdhNygmJyzTujP6l2B1GfuMSw==
dependencies:
"@babel/parser" "^7.14.7"
"@designable/core" "0.5.4"
"@designable/react" "0.5.4"
"@designable/shared" "0.5.4"
"@designable/core" "0.5.6"
"@designable/react" "0.5.6"
"@designable/shared" "0.5.6"
"@formily/antd" "^2.0.0-beta.84"
"@formily/core" "^2.0.0-beta.84"
"@formily/react" "^2.0.0-beta.84"
Expand All @@ -1203,22 +1203,22 @@
react-color "^2.19.3"
react-tiny-popover "^6.0.5"

"@designable/react@0.5.4", "@designable/react@^0.5.4":
version "0.5.4"
resolved "https://registry.yarnpkg.com/@designable/react/-/react-0.5.4.tgz#5ead6768245c793ccfe83e7fff0454e0793d4fce"
integrity sha512-x7LbJxcBBOyBqFvwM7k3yNv+y3axnwcWsAd2zfIz095+AyUIZgfcqzAUbA5O2M0ZT1Jwb9i0Pdf2T/Jj+MEH/w==
"@designable/react@0.5.6", "@designable/react@^0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@designable/react/-/react-0.5.6.tgz#b587c909ebea35d8313772b8cd15e86024f97d3f"
integrity sha512-/LgbQAUHCXgRAIPwDDQPRT2xwnleIoQBAdMsmC+NIMhbNGAR6cPCc4HmKzJar329z24vSc08wqEwDepxuIbTtw==
dependencies:
"@designable/core" "0.5.4"
"@designable/shared" "0.5.4"
"@designable/core" "0.5.6"
"@designable/shared" "0.5.6"
"@formily/reactive" "^2.0.0-beta.84"
"@formily/reactive-react" "^2.0.0-beta.84"
"@juggle/resize-observer" "^3.3.1"
dateformat "^4.5.1"

"@designable/shared@0.5.4":
version "0.5.4"
resolved "https://registry.yarnpkg.com/@designable/shared/-/shared-0.5.4.tgz#61f5bb53760d5da35ba872c30c4a14c45272b958"
integrity sha512-lgO6olUlczbACcXL5oe58v60LSbnO4daHgG5i5GVxhkFy6qRSVH0N/9nFrGsJ4+KOfqXiXwmoeLLMPH1+xbW6g==
"@designable/shared@0.5.6":
version "0.5.6"
resolved "https://registry.yarnpkg.com/@designable/shared/-/shared-0.5.6.tgz#b5f6e8a365112a3451faf639e5921cf0b39755f5"
integrity sha512-ANZIE2j6woHcgy+Qsa7mzQyw8MtnM8J2OenR/y2ec99e3ScBcqHgC8zs9w/xGjiP7X4A9WXBw1ZoDfxubFWSSw==
dependencies:
requestidlecallback "^0.3.0"

Expand Down

0 comments on commit 8c14fa6

Please sign in to comment.