@pisell/materials 1.0.231 → 1.0.232

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const _default: (props: any) => React.JSX.Element;
3
- export default _default;
2
+ declare const Dropdown: (props: any) => React.JSX.Element;
3
+ export default Dropdown;
@@ -2,7 +2,7 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
2
2
  import React from 'react';
3
3
  import { Dropdown as OriginalDropdown } from 'antd';
4
4
  import { withSingleChild } from "../../utils/hoc";
5
- var Dropdown = function Dropdown(props) {
5
+ var _Dropdown = function _Dropdown(props) {
6
6
  var innerProps = {};
7
7
  if (props.__designMode === 'design') {
8
8
  // 低代码编辑态中强制显示,将控制权交给引擎侧
@@ -10,4 +10,6 @@ var Dropdown = function Dropdown(props) {
10
10
  }
11
11
  return /*#__PURE__*/React.createElement(OriginalDropdown, _extends({}, props, innerProps));
12
12
  };
13
- export default withSingleChild(Dropdown, ['children', 'overlay']);
13
+ var Dropdown = withSingleChild(_Dropdown, ['children', 'overlay']);
14
+ Dropdown.Button = OriginalDropdown.Button;
15
+ export default Dropdown;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const _default: (props: any) => React.JSX.Element;
3
- export default _default;
2
+ declare const Dropdown: (props: any) => React.JSX.Element;
3
+ export default Dropdown;
@@ -35,11 +35,13 @@ module.exports = __toCommonJS(dropdown_exports);
35
35
  var import_react = __toESM(require("react"));
36
36
  var import_antd = require("antd");
37
37
  var import_hoc = require("../../utils/hoc");
38
- var Dropdown = (props) => {
38
+ var _Dropdown = (props) => {
39
39
  const innerProps = {};
40
40
  if (props.__designMode === "design") {
41
41
  innerProps.open = true;
42
42
  }
43
43
  return /* @__PURE__ */ import_react.default.createElement(import_antd.Dropdown, { ...props, ...innerProps });
44
44
  };
45
- var dropdown_default = (0, import_hoc.withSingleChild)(Dropdown, ["children", "overlay"]);
45
+ var Dropdown = (0, import_hoc.withSingleChild)(_Dropdown, ["children", "overlay"]);
46
+ Dropdown.Button = import_antd.Dropdown.Button;
47
+ var dropdown_default = Dropdown;
@@ -0,0 +1,221 @@
1
+ import snippets from './snippets';
2
+
3
+ export default {
4
+ snippets,
5
+ componentName: 'Dropdown.Button',
6
+ title: '下拉菜单',
7
+ category: '导航',
8
+ docUrl: "",
9
+ screenshot: "",
10
+ devMode: "proCode",
11
+ npm: {
12
+ package: "@pisell/materials",
13
+ version: "1.0.1",
14
+ exportName: "Dropdown",
15
+ main: "src/index.tsx",
16
+ destructuring: true,
17
+ subName: "Button",
18
+ },
19
+ props: [
20
+ {
21
+ name: 'open',
22
+ title: { label: '菜单是否显示', tip: '菜单是否显示' },
23
+ propType: { type: 'oneOf', value: [true, false, '-'] },
24
+ defaultValue: '-',
25
+ setter: {
26
+ componentName: 'RadioGroupSetter',
27
+ props: {
28
+ options: [
29
+ {
30
+ title: '默认非受控',
31
+ value: '-',
32
+ },
33
+ {
34
+ title: '显示',
35
+ value: true,
36
+ },
37
+ {
38
+ title: '不显示',
39
+ value: false,
40
+ },
41
+ ],
42
+ },
43
+ },
44
+ extraProps: {
45
+ getValue(target, fieldValue) {
46
+ const { node } = target;
47
+ let value = node.getPropValue('open');
48
+ if (value === undefined) {
49
+ value = '-';
50
+ }
51
+ return value;
52
+ },
53
+ setValue(target, value) {
54
+ const { node } = target;
55
+ if (value === '-') {
56
+ setTimeout(() => {
57
+ node.clearPropValue('open');
58
+ });
59
+ }
60
+ },
61
+ },
62
+ },
63
+ {
64
+ name: 'arrow',
65
+ title: { label: '显示下拉箭头', tip: '是否显示下拉箭头' },
66
+ propType: 'bool',
67
+ defaultValue: false,
68
+ },
69
+ {
70
+ name: 'disabled',
71
+ title: { label: '是否禁用', tip: '是否为禁用状态' },
72
+ propType: 'bool',
73
+ },
74
+ // {
75
+ // name: 'getPopupContainer',
76
+ // title: {
77
+ // label: '渲染父节点',
78
+ // tip:
79
+ // '菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codepen.io/afc163/pen/zEjNOy?editors=0010)',
80
+ // },
81
+ // propType: 'func',
82
+ // },
83
+ {
84
+ name: 'overlay',
85
+ title: { label: '菜单', tip: '菜单' },
86
+ propType: { type: 'oneOfType', value: ['node', 'func'] },
87
+ },
88
+ // {
89
+ // name: 'overlayClassName',
90
+ // title: { label: '根元素的类名称', tip: '根元素的类名称' },
91
+ // propType: 'string',
92
+ // },
93
+ // {
94
+ // name: 'overlayStyle',
95
+ // title: { label: '根元素的样式', tip: '根元素的样式' },
96
+ // propType: 'object',
97
+ // },
98
+
99
+ {
100
+ name: "type",
101
+ title: {
102
+ label: "type",
103
+ tip: "set button type",
104
+ },
105
+ propType: {
106
+ type: "oneOf",
107
+ value: ["primary", "ghost", "dashed", "danger", "link", "text"],
108
+ },
109
+ setter: [
110
+ {
111
+ componentName: "SelectSetter",
112
+ props: {
113
+ options: [
114
+ {
115
+ title: "primary button",
116
+ value: "primary",
117
+ },
118
+ {
119
+ title: "dashed button",
120
+ value: "dashed",
121
+ },
122
+ {
123
+ title: "danger button",
124
+ value: "danger",
125
+ },
126
+ {
127
+ title: "link butto",
128
+ value: "link",
129
+ },
130
+ {
131
+ title: "text button",
132
+ value: "text",
133
+ },
134
+ ],
135
+ },
136
+ },
137
+ "VariableSetter",
138
+ ],
139
+ },
140
+ {
141
+ name: "size",
142
+ title: {
143
+ label: "size",
144
+ tip: "set button size",
145
+ },
146
+ propType: { type: "oneOf", value: ["large", "middle", "small"] },
147
+ setter: [
148
+ {
149
+ componentName: "RadioGroupSetter",
150
+ props: {
151
+ options: [
152
+ {
153
+ title: "large",
154
+ value: "large",
155
+ },
156
+ {
157
+ title: "middle",
158
+ value: "middle",
159
+ },
160
+ {
161
+ title: "small",
162
+ value: "small",
163
+ },
164
+ ],
165
+ },
166
+ },
167
+ "VariableSetter",
168
+ ],
169
+ defaultValue: "middle",
170
+ },
171
+ {
172
+ name: 'placement',
173
+ title: {
174
+ label: '弹出位置',
175
+ tip:
176
+ '菜单弹出位置:`bottomLeft` `bottom` `bottomRight` `topLeft` `top` `topRight`',
177
+ },
178
+ propType: {
179
+ type: 'oneOf',
180
+ value: ['bottomLeft', 'bottom', 'bottomRight', 'topLeft', 'top', 'topRight'],
181
+ },
182
+ },
183
+ {
184
+ name: 'trigger',
185
+ title: {
186
+ label: '触发下拉的行为',
187
+ tip: '触发下拉的行为, 移动端不支持 hover',
188
+ },
189
+ propType: {
190
+ type: 'arrayOf',
191
+ value: { type: 'oneOf', value: ['click', 'hover', 'contextMenu'] },
192
+ },
193
+ },
194
+ {
195
+ name: 'onOpenChange',
196
+ title: {
197
+ label: '显示状态回调',
198
+ tip: '菜单显示状态改变时调用,参数为 `open`',
199
+ },
200
+ propType: 'func',
201
+ },
202
+ ],
203
+ configure: {
204
+ component: { isContainer: true },
205
+ supports: {
206
+ style: true,
207
+ events: [
208
+ {
209
+ name: 'onOpenChange',
210
+ template:
211
+ "onOpenChange(open,${extParams}){\n// 菜单显示状态改变时调用\nconsole.log('onOpenChange',open);}",
212
+ },
213
+ {
214
+ name: 'onClick',
215
+ template:
216
+ "onClick(e,${extParams}){\n// 按钮点击时调用\nconsole.log('onClick',e);}",
217
+ },
218
+ ],
219
+ },
220
+ },
221
+ };
@@ -0,0 +1,42 @@
1
+ export default [
2
+ {
3
+ title: "带下拉框的按钮",
4
+ screenshot:
5
+ "https://alifd.alicdn.com/fusion-cool/icons/icon-antd/dropdown-1.png",
6
+ schema: {
7
+ componentName: "Dropdown.Button",
8
+ props: {
9
+ trigger: ["click"],
10
+ overlay: {
11
+ type: "JSSlot",
12
+ value: [
13
+ {
14
+ componentName: "Menu",
15
+ props: {
16
+ items: [
17
+ {
18
+ key: "timeLinei5wd",
19
+ category: "Item",
20
+ title: "菜单名",
21
+ label: "菜单名"
22
+ },
23
+ ],
24
+ },
25
+ },
26
+ ],
27
+ },
28
+ },
29
+ children: [
30
+ {
31
+ componentName: "Typography.Text",
32
+ props: {
33
+ children: "Dropdown",
34
+ style: {
35
+ color: "inherit",
36
+ },
37
+ },
38
+ }
39
+ ],
40
+ },
41
+ },
42
+ ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.0.231",
3
+ "version": "1.0.232",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",