venus-design 1.0.26 → 1.0.27
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.
|
@@ -27,9 +27,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
27
27
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
28
28
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
29
29
|
import React, { useState } from 'react';
|
|
30
|
-
import ReactDOM from 'react-dom
|
|
31
|
-
// 你的类型
|
|
32
|
-
|
|
30
|
+
import ReactDOM from 'react-dom';
|
|
33
31
|
import { computePosition, offset, flip, shift } from '@floating-ui/dom';
|
|
34
32
|
import moment from 'moment';
|
|
35
33
|
var FilterPanel = /*#__PURE__*/function () {
|
|
@@ -37,12 +35,10 @@ var FilterPanel = /*#__PURE__*/function () {
|
|
|
37
35
|
var _this = this;
|
|
38
36
|
_classCallCheck(this, FilterPanel);
|
|
39
37
|
_defineProperty(this, "ctx", void 0);
|
|
40
|
-
_defineProperty(this, "wrap",
|
|
38
|
+
_defineProperty(this, "wrap", document.createElement('div'));
|
|
41
39
|
_defineProperty(this, "curHeader", void 0);
|
|
42
40
|
_defineProperty(this, "filterMap", new Map());
|
|
43
|
-
_defineProperty(this, "root", null);
|
|
44
41
|
this.ctx = ctx;
|
|
45
|
-
this.wrap = document.createElement('div'); // 仍用原生节点当浮层容器
|
|
46
42
|
document.body.appendChild(this.wrap);
|
|
47
43
|
this.ctx.on('filterClick', function (h) {
|
|
48
44
|
return _this.show(h);
|
|
@@ -86,9 +82,9 @@ var FilterPanel = /*#__PURE__*/function () {
|
|
|
86
82
|
start: '',
|
|
87
83
|
end: ''
|
|
88
84
|
} : ''
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
|
|
85
|
+
};
|
|
86
|
+
/* ② React 16 用 ReactDOM.render */
|
|
87
|
+
ReactDOM.render( /*#__PURE__*/React.createElement(_ConfigProvider, null, /*#__PURE__*/React.createElement(AntFilterContent, {
|
|
92
88
|
type: type,
|
|
93
89
|
column: col,
|
|
94
90
|
lastValue: last.val,
|
|
@@ -98,9 +94,9 @@ var FilterPanel = /*#__PURE__*/function () {
|
|
|
98
94
|
onReset: function onReset() {
|
|
99
95
|
return _this2.applyFilter(undefined);
|
|
100
96
|
}
|
|
101
|
-
})));
|
|
97
|
+
})), this.wrap);
|
|
102
98
|
|
|
103
|
-
|
|
99
|
+
/* 定位照旧 */
|
|
104
100
|
this.wrap.style.position = 'absolute';
|
|
105
101
|
this.wrap.style.zIndex = '2000';
|
|
106
102
|
btn = h.filterBtnRect;
|
|
@@ -119,14 +115,14 @@ var FilterPanel = /*#__PURE__*/function () {
|
|
|
119
115
|
};
|
|
120
116
|
}
|
|
121
117
|
};
|
|
122
|
-
_context.next =
|
|
118
|
+
_context.next = 12;
|
|
123
119
|
return computePosition(virtualEl, this.wrap, {
|
|
124
120
|
placement: 'bottom-end',
|
|
125
121
|
middleware: [offset(4), flip(), shift({
|
|
126
122
|
padding: 4
|
|
127
123
|
})]
|
|
128
124
|
});
|
|
129
|
-
case
|
|
125
|
+
case 12:
|
|
130
126
|
_yield$computePositio = _context.sent;
|
|
131
127
|
x = _yield$computePositio.x;
|
|
132
128
|
y = _yield$computePositio.y;
|
|
@@ -134,7 +130,7 @@ var FilterPanel = /*#__PURE__*/function () {
|
|
|
134
130
|
left: "".concat(x, "px"),
|
|
135
131
|
top: "".concat(y, "px")
|
|
136
132
|
});
|
|
137
|
-
case
|
|
133
|
+
case 16:
|
|
138
134
|
case "end":
|
|
139
135
|
return _context.stop();
|
|
140
136
|
}
|
|
@@ -167,10 +163,8 @@ var FilterPanel = /*#__PURE__*/function () {
|
|
|
167
163
|
}, {
|
|
168
164
|
key: "hide",
|
|
169
165
|
value: function hide() {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
this.root = null;
|
|
173
|
-
}
|
|
166
|
+
/* ③ React 16 卸载方式 */
|
|
167
|
+
ReactDOM.unmountComponentAtNode(this.wrap);
|
|
174
168
|
}
|
|
175
169
|
}, {
|
|
176
170
|
key: "destroy",
|
|
@@ -181,7 +175,7 @@ var FilterPanel = /*#__PURE__*/function () {
|
|
|
181
175
|
}]);
|
|
182
176
|
return FilterPanel;
|
|
183
177
|
}();
|
|
184
|
-
/*
|
|
178
|
+
/* **************** UI 部分(无需改动) **************** */
|
|
185
179
|
export { FilterPanel as default };
|
|
186
180
|
function AntFilterContent(_ref) {
|
|
187
181
|
var type = _ref.type,
|
|
@@ -201,8 +195,6 @@ function AntFilterContent(_ref) {
|
|
|
201
195
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
202
196
|
checked = _useState6[0],
|
|
203
197
|
setChecked = _useState6[1];
|
|
204
|
-
|
|
205
|
-
// select 场景:把 options 提出来
|
|
206
198
|
var options = React.useMemo(function () {
|
|
207
199
|
var _column$editorProps;
|
|
208
200
|
if (type !== 'select') return [];
|
|
@@ -217,10 +209,10 @@ function AntFilterContent(_ref) {
|
|
|
217
209
|
style: {
|
|
218
210
|
padding: 12,
|
|
219
211
|
width: type === 'date' ? 280 : 200,
|
|
220
|
-
|
|
212
|
+
background: '#fff',
|
|
221
213
|
borderRadius: 8,
|
|
222
214
|
marginTop: 6,
|
|
223
|
-
boxShadow: '0 2px 8px rgba(0,
|
|
215
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.15)'
|
|
224
216
|
}
|
|
225
217
|
}, type === 'text' && /*#__PURE__*/React.createElement(_Input, {
|
|
226
218
|
placeholder: "\u5173\u952E\u5B57",
|