@teamix/pro 1.2.8 → 1.2.12
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.
- package/dist/pro.css +1 -1
- package/dist/pro.js +1787 -812
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +16 -6
- package/es/actions/base.js +66 -12
- package/es/actions/confirm.d.ts +1 -1
- package/es/actions/danger-confirm.d.ts +1 -1
- package/es/actions/dialog-component.d.ts +1 -1
- package/es/actions/dialog-form.d.ts +1 -1
- package/es/actions/dialog-form.js +4 -4
- package/es/actions/dialog-info.d.ts +1 -1
- package/es/actions/dialog-table.d.ts +1 -1
- package/es/actions/dialog.d.ts +6 -2
- package/es/actions/dialog.js +19 -24
- package/es/actions/drawer-form.d.ts +1 -1
- package/es/actions/drawer-info.d.ts +1 -1
- package/es/actions/drawer-table.d.ts +1 -1
- package/es/actions/drawer.d.ts +1 -1
- package/es/actions/error.d.ts +1 -1
- package/es/actions/index.js +25 -22
- package/es/actions/index.scss +28 -7
- package/es/actions/link.d.ts +2 -2
- package/es/actions/link.js +2 -2
- package/es/actions/notice.d.ts +1 -1
- package/es/actions/request.d.ts +1 -1
- package/es/actions/request.js +2 -2
- package/es/card/index.d.ts +10 -1
- package/es/card/index.js +20 -6
- package/es/card/index.scss +19 -0
- package/es/card/tab.d.ts +6 -0
- package/es/card/tab.js +27 -0
- package/es/form/Filter/index.d.ts +2 -5
- package/es/form/Filter/index.js +3 -44
- package/es/form/Filter/index.scss +71 -0
- package/es/form/Filter/index2.d.ts +8 -0
- package/es/form/Filter/index2.js +318 -0
- package/es/form/ProForm/index.js +3 -23
- package/es/form/ProForm/index.scss +10 -19
- package/es/form/ProForm/useFormDisplayValues.d.ts +3 -5
- package/es/form/ProForm/useFormDisplayValues.js +44 -38
- package/es/form/SchemaForm/index.js +7 -6
- package/es/form/index.d.ts +2 -1
- package/es/form/index.js +3 -2
- package/es/form/typing.d.ts +3 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/page-header/index.d.ts +20 -11
- package/es/page-header/index.js +23 -47
- package/es/page-header/index.scss +0 -11
- package/es/sidebar/components/tree/index.js +85 -18
- package/es/sidebar/index.js +9 -5
- package/es/sidebar/typing.d.ts +14 -1
- package/es/table/components/Filter/index.js +11 -9
- package/es/table/components/Filter/index.scss +7 -3
- package/es/table/components/Layout/index.js +10 -1
- package/es/table/index.js +3 -4
- package/es/utils/components/tags/index.d.ts +11 -0
- package/es/utils/components/tags/index.js +50 -0
- package/es/utils/components/tags/index.scss +12 -0
- package/lib/actions/base.d.ts +16 -6
- package/lib/actions/base.js +67 -12
- package/lib/actions/confirm.d.ts +1 -1
- package/lib/actions/danger-confirm.d.ts +1 -1
- package/lib/actions/dialog-component.d.ts +1 -1
- package/lib/actions/dialog-form.d.ts +1 -1
- package/lib/actions/dialog-form.js +3 -3
- package/lib/actions/dialog-info.d.ts +1 -1
- package/lib/actions/dialog-table.d.ts +1 -1
- package/lib/actions/dialog.d.ts +6 -2
- package/lib/actions/dialog.js +18 -23
- package/lib/actions/drawer-form.d.ts +1 -1
- package/lib/actions/drawer-info.d.ts +1 -1
- package/lib/actions/drawer-table.d.ts +1 -1
- package/lib/actions/drawer.d.ts +1 -1
- package/lib/actions/error.d.ts +1 -1
- package/lib/actions/index.js +25 -22
- package/lib/actions/index.scss +28 -7
- package/lib/actions/link.d.ts +2 -2
- package/lib/actions/link.js +2 -2
- package/lib/actions/notice.d.ts +1 -1
- package/lib/actions/request.d.ts +1 -1
- package/lib/actions/request.js +2 -2
- package/lib/card/index.d.ts +10 -1
- package/lib/card/index.js +22 -5
- package/lib/card/index.scss +19 -0
- package/lib/card/tab.d.ts +6 -0
- package/lib/card/tab.js +39 -0
- package/lib/form/Filter/index.d.ts +2 -5
- package/lib/form/Filter/index.js +4 -45
- package/lib/form/Filter/index.scss +71 -0
- package/lib/form/Filter/index2.d.ts +8 -0
- package/lib/form/Filter/index2.js +342 -0
- package/lib/form/ProForm/index.js +3 -23
- package/lib/form/ProForm/index.scss +10 -19
- package/lib/form/ProForm/useFormDisplayValues.d.ts +3 -5
- package/lib/form/ProForm/useFormDisplayValues.js +51 -44
- package/lib/form/SchemaForm/index.js +7 -6
- package/lib/form/index.d.ts +2 -1
- package/lib/form/index.js +5 -3
- package/lib/form/typing.d.ts +3 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/page-header/index.d.ts +20 -11
- package/lib/page-header/index.js +22 -45
- package/lib/page-header/index.scss +0 -11
- package/lib/sidebar/components/tree/index.js +83 -16
- package/lib/sidebar/index.js +9 -5
- package/lib/sidebar/typing.d.ts +14 -1
- package/lib/table/components/Filter/index.js +10 -8
- package/lib/table/components/Filter/index.scss +7 -3
- package/lib/table/components/Layout/index.js +10 -1
- package/lib/table/index.js +2 -3
- package/lib/utils/components/tags/index.d.ts +11 -0
- package/lib/utils/components/tags/index.js +66 -0
- package/lib/utils/components/tags/index.scss +12 -0
- package/package.json +4 -4
@@ -0,0 +1,342 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
4
|
+
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.QueryFilter = void 0;
|
9
|
+
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
11
|
+
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
|
14
|
+
var _components = require("@alicloudfe/components");
|
15
|
+
|
16
|
+
var _icon = _interopRequireDefault(require("@teamix/icon"));
|
17
|
+
|
18
|
+
var _core = require("@formily/core");
|
19
|
+
|
20
|
+
var _utils = require("@teamix/utils");
|
21
|
+
|
22
|
+
var _ProForm = _interopRequireDefault(require("../ProForm"));
|
23
|
+
|
24
|
+
var _useFormDisplayValues = require("../ProForm/useFormDisplayValues");
|
25
|
+
|
26
|
+
var _utils2 = require("../utils");
|
27
|
+
|
28
|
+
require("./index.scss");
|
29
|
+
|
30
|
+
var _excluded = ["schema", "triggerType", "onFilter"];
|
31
|
+
|
32
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
|
+
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
35
|
+
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
37
|
+
|
38
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
39
|
+
|
40
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
41
|
+
|
42
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
43
|
+
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
45
|
+
|
46
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
47
|
+
|
48
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
49
|
+
|
50
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
51
|
+
|
52
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
53
|
+
|
54
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
55
|
+
|
56
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
57
|
+
|
58
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
59
|
+
|
60
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
61
|
+
|
62
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
63
|
+
|
64
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
65
|
+
|
66
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
67
|
+
|
68
|
+
var getEventProps = function getEventProps(triggerType, onFilter) {
|
69
|
+
var keydownEvent = {
|
70
|
+
onSubmit: onFilter
|
71
|
+
};
|
72
|
+
var changeEvent = {
|
73
|
+
onChange: onFilter
|
74
|
+
};
|
75
|
+
var eventMap = {
|
76
|
+
keydown: keydownEvent,
|
77
|
+
change: _objectSpread(_objectSpread({}, keydownEvent), changeEvent),
|
78
|
+
submit: keydownEvent
|
79
|
+
};
|
80
|
+
return eventMap[triggerType];
|
81
|
+
};
|
82
|
+
|
83
|
+
var schemaTemp = [{
|
84
|
+
name: 'taskName',
|
85
|
+
title: '实例名称',
|
86
|
+
component: 'Input',
|
87
|
+
required: true,
|
88
|
+
props: {
|
89
|
+
style: {
|
90
|
+
width: 180
|
91
|
+
},
|
92
|
+
placeholder: '请输入'
|
93
|
+
}
|
94
|
+
}];
|
95
|
+
/**
|
96
|
+
* 简单筛选
|
97
|
+
*/
|
98
|
+
|
99
|
+
var SimpleFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
100
|
+
var schema = props.schema,
|
101
|
+
triggerType = props.triggerType,
|
102
|
+
onFilter = props.onFilter,
|
103
|
+
otherProps = _objectWithoutProperties(props, _excluded);
|
104
|
+
|
105
|
+
var prefixCls = (0, _utils.usePrefixCls)('', {
|
106
|
+
prefix: 'teamix-pro-form-filter-simple'
|
107
|
+
});
|
108
|
+
var simpleSchema = (0, _react.useMemo)(function () {
|
109
|
+
return [{
|
110
|
+
component: 'FormFlex',
|
111
|
+
props: {
|
112
|
+
size: 8
|
113
|
+
},
|
114
|
+
children: [].concat(_toConsumableArray(schema), [{
|
115
|
+
type: 'void',
|
116
|
+
decorator: null,
|
117
|
+
component: 'Submit',
|
118
|
+
props: {
|
119
|
+
style: _objectSpread({}, triggerType === 'submit' ? {} : {
|
120
|
+
display: 'none'
|
121
|
+
})
|
122
|
+
}
|
123
|
+
}])
|
124
|
+
}];
|
125
|
+
}, []);
|
126
|
+
var eventProps = getEventProps(triggerType, onFilter);
|
127
|
+
return /*#__PURE__*/_react.default.createElement(_ProForm.default, _objectSpread(_objectSpread(_objectSpread({
|
128
|
+
feedbackLayout: "popover",
|
129
|
+
breakpoints: [],
|
130
|
+
inset: true
|
131
|
+
}, otherProps), eventProps), {}, {
|
132
|
+
className: (0, _classnames.default)(prefixCls, props.className),
|
133
|
+
schema: simpleSchema
|
134
|
+
}));
|
135
|
+
});
|
136
|
+
SimpleFilter.defaultProps = {
|
137
|
+
triggerType: 'change'
|
138
|
+
};
|
139
|
+
/**
|
140
|
+
* 高级筛选
|
141
|
+
*/
|
142
|
+
|
143
|
+
var AdvancedFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
144
|
+
var form = (0, _react.useMemo)(function () {
|
145
|
+
return (props === null || props === void 0 ? void 0 : props.form) || (0, _core.createForm)();
|
146
|
+
}, []);
|
147
|
+
var schema = props.schema,
|
148
|
+
triggerType = props.triggerType,
|
149
|
+
onFilter = props.onFilter,
|
150
|
+
onReset = props.onReset,
|
151
|
+
layout = props.layout,
|
152
|
+
labelAlign = props.labelAlign,
|
153
|
+
wrapperAlign = props.wrapperAlign,
|
154
|
+
labelCol = props.labelCol,
|
155
|
+
wrapperCol = props.wrapperCol;
|
156
|
+
var prefixCls = (0, _utils.usePrefixCls)('', {
|
157
|
+
prefix: 'teamix-pro-form-filter-advanced'
|
158
|
+
});
|
159
|
+
var gridSchema = (0, _react.useMemo)(function () {
|
160
|
+
return [{
|
161
|
+
name: 'FormGrid',
|
162
|
+
component: 'FormGrid',
|
163
|
+
props: {
|
164
|
+
breakpoints: [480, 720, 990, 1200, Infinity],
|
165
|
+
maxColumns: [1, 2, 3, 3, 4],
|
166
|
+
columnGap: 16,
|
167
|
+
rowGap: 12
|
168
|
+
},
|
169
|
+
children: [].concat(_toConsumableArray(schema), [{
|
170
|
+
component: 'FormGrid.GridColumn',
|
171
|
+
props: {
|
172
|
+
gridSpan: -1
|
173
|
+
},
|
174
|
+
children: [{
|
175
|
+
component: 'FormButtonGroup',
|
176
|
+
props: {
|
177
|
+
align: 'right'
|
178
|
+
},
|
179
|
+
children: [{
|
180
|
+
component: 'Reset',
|
181
|
+
props: {
|
182
|
+
onResetValidateSuccess: onReset,
|
183
|
+
style: _objectSpread({}, triggerType === 'submit' ? {} : {
|
184
|
+
marginRight: -16
|
185
|
+
}),
|
186
|
+
children: (0, _utils.getMessage)('reset')
|
187
|
+
}
|
188
|
+
}, {
|
189
|
+
component: 'Submit',
|
190
|
+
props: {
|
191
|
+
style: _objectSpread({}, triggerType === 'submit' ? {
|
192
|
+
marginRight: -8
|
193
|
+
} : {
|
194
|
+
display: 'none'
|
195
|
+
}),
|
196
|
+
children: (0, _utils.getMessage)('search')
|
197
|
+
}
|
198
|
+
}]
|
199
|
+
}]
|
200
|
+
}])
|
201
|
+
}];
|
202
|
+
}, []);
|
203
|
+
var getTeamixLayout = (0, _react.useMemo)(function () {
|
204
|
+
return {
|
205
|
+
breakpoints: [990],
|
206
|
+
layout: (0, _utils2.mergeArrayValue)(['vertical'], layout),
|
207
|
+
labelAlign: (0, _utils2.mergeArrayValue)(['left'], labelAlign),
|
208
|
+
wrapperAlign: (0, _utils2.mergeArrayValue)(['left'], wrapperAlign),
|
209
|
+
labelCol: (0, _utils2.mergeArrayValue)([24], labelCol),
|
210
|
+
wrapperCol: (0, _utils2.mergeArrayValue)([24], wrapperCol)
|
211
|
+
};
|
212
|
+
}, [layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
213
|
+
var eventProps = getEventProps(triggerType, onFilter);
|
214
|
+
return /*#__PURE__*/_react.default.createElement(_ProForm.default, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
215
|
+
feedbackLayout: "popover"
|
216
|
+
}, props), eventProps), getTeamixLayout), {}, {
|
217
|
+
form: form,
|
218
|
+
className: (0, _classnames.default)(prefixCls, props.className),
|
219
|
+
schema: gridSchema,
|
220
|
+
onSubmit: onFilter
|
221
|
+
}));
|
222
|
+
});
|
223
|
+
AdvancedFilter.defaultProps = {
|
224
|
+
triggerType: 'change',
|
225
|
+
layout: 'horizontal',
|
226
|
+
labelAlign: 'right',
|
227
|
+
labelCol: 6,
|
228
|
+
wrapperCol: 18
|
229
|
+
};
|
230
|
+
/**
|
231
|
+
* 查询筛选
|
232
|
+
*/
|
233
|
+
|
234
|
+
var QueryFilter = /*#__PURE__*/(0, _react.memo)(function (props) {
|
235
|
+
var _useState = (0, _react.useState)(true),
|
236
|
+
_useState2 = _slicedToArray(_useState, 2),
|
237
|
+
advancedFilterVisible = _useState2[0],
|
238
|
+
setAdvancedFilterVisible = _useState2[1];
|
239
|
+
|
240
|
+
var _useState3 = (0, _react.useState)([]),
|
241
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
242
|
+
tagDataSource = _useState4[0],
|
243
|
+
setTagDataSource = _useState4[1]; // const [values, setValues] = useState<any>();
|
244
|
+
|
245
|
+
|
246
|
+
var form = (0, _react.useMemo)(function () {
|
247
|
+
return (props === null || props === void 0 ? void 0 : props.form) || (0, _core.createForm)({
|
248
|
+
validateFirst: true
|
249
|
+
});
|
250
|
+
}, []);
|
251
|
+
var schema = props.schema,
|
252
|
+
addonAfter = props.addonAfter,
|
253
|
+
addonBefore = props.addonBefore;
|
254
|
+
var prefixCls = (0, _utils.usePrefixCls)('', {
|
255
|
+
prefix: 'teamix-pro-form-query-filter'
|
256
|
+
}); // 展开收起高级筛选
|
257
|
+
|
258
|
+
var toggleAdvancedFilter = (0, _react.useCallback)(function () {
|
259
|
+
setAdvancedFilterVisible(function (visible) {
|
260
|
+
return !visible;
|
261
|
+
});
|
262
|
+
}, []); // 获取标签数据
|
263
|
+
|
264
|
+
var getTagDataSource = (0, _react.useCallback)(function (form) {
|
265
|
+
var displayValues = (0, _useFormDisplayValues.getFormDisplayValues)(form);
|
266
|
+
return Object.entries(displayValues).map(function (_ref) {
|
267
|
+
var _data$displayValue;
|
268
|
+
|
269
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
270
|
+
key = _ref2[0],
|
271
|
+
data = _ref2[1];
|
272
|
+
|
273
|
+
return {
|
274
|
+
key: key,
|
275
|
+
label: data.title,
|
276
|
+
value: (_data$displayValue = data.displayValue) !== null && _data$displayValue !== void 0 ? _data$displayValue : data.value
|
277
|
+
};
|
278
|
+
}); // .filter((item) => isValid(item.value));
|
279
|
+
}, []); // 表单值变化
|
280
|
+
|
281
|
+
var onFormValueChange = (0, _react.useCallback)(function (values) {
|
282
|
+
setTagDataSource(getTagDataSource(form));
|
283
|
+
}, []);
|
284
|
+
console.log(tagDataSource); // useEffect(() => {
|
285
|
+
// console.log(form.values);
|
286
|
+
// }, [form.values]);
|
287
|
+
|
288
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
289
|
+
className: (0, _classnames.default)(prefixCls, props.className)
|
290
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
291
|
+
className: "".concat(prefixCls, "-inline")
|
292
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
293
|
+
className: "".concat(prefixCls, "-left")
|
294
|
+
}, addonBefore ? /*#__PURE__*/_react.default.createElement("div", {
|
295
|
+
className: "".concat(prefixCls, "-addonBefore")
|
296
|
+
}, addonBefore) : null, /*#__PURE__*/_react.default.createElement("div", {
|
297
|
+
className: "".concat(prefixCls, "-simple")
|
298
|
+
}, /*#__PURE__*/_react.default.createElement(SimpleFilter, {
|
299
|
+
schema: schemaTemp
|
300
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
301
|
+
className: "".concat(prefixCls, "-toggle")
|
302
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Badge, {
|
303
|
+
count: tagDataSource.length,
|
304
|
+
style: _objectSpread({
|
305
|
+
backgroundColor: 'var(--color-brand1-6, #0064c8)',
|
306
|
+
color: 'var(--color-white, #fff)'
|
307
|
+
}, advancedFilterVisible ? {
|
308
|
+
display: 'none'
|
309
|
+
} : {})
|
310
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Button, {
|
311
|
+
onClick: toggleAdvancedFilter
|
312
|
+
}, advancedFilterVisible ? /*#__PURE__*/_react.default.createElement(_icon.default, {
|
313
|
+
type: "up-line"
|
314
|
+
}) : /*#__PURE__*/_react.default.createElement(_icon.default, {
|
315
|
+
type: "filter-line"
|
316
|
+
}), (0, _utils.getMessage)('advancedFilter'))))), addonAfter ? /*#__PURE__*/_react.default.createElement("div", {
|
317
|
+
className: "".concat(prefixCls, "-addonAfter")
|
318
|
+
}, addonAfter) : null), /*#__PURE__*/_react.default.createElement("div", {
|
319
|
+
className: "".concat(prefixCls, "-panel")
|
320
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
321
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-tag"), !advancedFilterVisible ? "".concat(prefixCls, "-tag-hidden") : '')
|
322
|
+
}, /*#__PURE__*/_react.default.createElement(_components.Tag.Group, null, tagDataSource.map(function (_ref3) {
|
323
|
+
var key = _ref3.key,
|
324
|
+
label = _ref3.label,
|
325
|
+
value = _ref3.value;
|
326
|
+
return /*#__PURE__*/_react.default.createElement(_components.Tag.Closeable, {
|
327
|
+
key: key,
|
328
|
+
afterClose: console.log
|
329
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
330
|
+
className: "".concat(prefixCls, "-tag-title")
|
331
|
+
}, label), /*#__PURE__*/_react.default.createElement("span", {
|
332
|
+
className: "".concat(prefixCls, "-tag-content")
|
333
|
+
}, value));
|
334
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
335
|
+
className: (0, _classnames.default)("".concat(prefixCls, "-advanced"), !advancedFilterVisible ? "".concat(prefixCls, "-advanced-hidden") : '')
|
336
|
+
}, /*#__PURE__*/_react.default.createElement(AdvancedFilter, _objectSpread(_objectSpread({
|
337
|
+
form: form
|
338
|
+
}, props), {}, {
|
339
|
+
onFilter: onFormValueChange
|
340
|
+
})))));
|
341
|
+
});
|
342
|
+
exports.QueryFilter = QueryFilter;
|
@@ -84,7 +84,8 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
84
84
|
context: context
|
85
85
|
});
|
86
86
|
}, [scope, context]);
|
87
|
-
var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit);
|
87
|
+
var onAutoSubmit = (0, _useAutoSubmit.default)(onSubmit); // todo 需要formily支持断点下的属性更新
|
88
|
+
|
88
89
|
var getTeamixLayout = (0, _react.useMemo)(function () {
|
89
90
|
return breakpoints ? {
|
90
91
|
breakpoints: breakpoints,
|
@@ -136,28 +137,7 @@ var ProForm = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
136
137
|
schema: schema,
|
137
138
|
scope: mergedScope,
|
138
139
|
components: components
|
139
|
-
}), children);
|
140
|
-
// <FormLayout
|
141
|
-
// className={cls(prefixCls, className)}
|
142
|
-
// {...otherProps}
|
143
|
-
// {...getTeamixLayout}
|
144
|
-
// >
|
145
|
-
// <SchemaForm schema={schema} scope={scope} components={components} />
|
146
|
-
// {children}
|
147
|
-
// </FormLayout>
|
148
|
-
// ) : (
|
149
|
-
// <Form
|
150
|
-
// className={cls(prefixCls, className)}
|
151
|
-
// {...otherProps}
|
152
|
-
// {...getTeamixLayout}
|
153
|
-
// form={form}
|
154
|
-
// onAutoSubmit={onAutoSubmit}
|
155
|
-
// onAutoSubmitFailed={onSubmitFailed}
|
156
|
-
// >
|
157
|
-
// <SchemaForm schema={schema} scope={scope} components={components} />
|
158
|
-
// {children}
|
159
|
-
// </Form>
|
160
|
-
// );
|
140
|
+
}), children);
|
161
141
|
});
|
162
142
|
ProForm.defaultProps = {
|
163
143
|
colon: false,
|
@@ -230,14 +230,12 @@
|
|
230
230
|
}
|
231
231
|
}
|
232
232
|
|
233
|
-
//
|
234
|
-
.#{$teamix-pro-form}-filter-advanced,
|
233
|
+
// 抽屉按钮
|
235
234
|
.#{$css-prefix}drawer-footer {
|
236
235
|
.#{$css-prefix}formily-button-group {
|
237
236
|
margin-top: 0;
|
238
237
|
}
|
239
238
|
}
|
240
|
-
|
241
239
|
.#{$teamix-pro-form}-button-affix-auto.#{$css-prefix}affix,
|
242
240
|
.#{$teamix-pro-form}-button-affix-always.#{$css-prefix}affix {
|
243
241
|
left: 0;
|
@@ -259,22 +257,6 @@
|
|
259
257
|
}
|
260
258
|
}
|
261
259
|
|
262
|
-
// 高级筛选
|
263
|
-
.#{$teamix-pro-form}-filter-advanced,
|
264
|
-
.#{$teamix-pro-form}-filter-simple {
|
265
|
-
.#{$form-item-cls}-feedback-layout-popover {
|
266
|
-
margin-bottom: 0;
|
267
|
-
}
|
268
|
-
.#{$css-prefix}date-picker2-input {
|
269
|
-
.#{$css-prefix}input {
|
270
|
-
width: inherit;
|
271
|
-
input {
|
272
|
-
width: inherit;
|
273
|
-
}
|
274
|
-
}
|
275
|
-
}
|
276
|
-
}
|
277
|
-
|
278
260
|
// ArrayItems
|
279
261
|
.#{$css-prefix}formily-array-items {
|
280
262
|
.#{$css-prefix}formily-grid-layout {
|
@@ -288,3 +270,12 @@
|
|
288
270
|
cursor: pointer;
|
289
271
|
}
|
290
272
|
}
|
273
|
+
|
274
|
+
/* hack todo remove */
|
275
|
+
.#{$form-item-cls}-control-content-component {
|
276
|
+
.teamix-pro-field-tooltip.teamix-pro-field-checkbox {
|
277
|
+
.teamix-pro-lable-icon-tip-icon {
|
278
|
+
transform: translate(0px, 4px);
|
279
|
+
}
|
280
|
+
}
|
281
|
+
}
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
|
-
* 获取表单值的可显示值
|
3
|
-
* @returns 如果某字段有dataSource,则返回value对应label
|
4
|
-
*/
|
1
|
+
import type { Form } from '@formily/core';
|
5
2
|
declare const useFormDisplayValues: () => any;
|
6
|
-
|
3
|
+
declare const getFormDisplayValues: (form: Form) => any;
|
4
|
+
export { useFormDisplayValues, getFormDisplayValues };
|
@@ -3,7 +3,7 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.
|
6
|
+
exports.useFormDisplayValues = exports.getFormDisplayValues = void 0;
|
7
7
|
|
8
8
|
var _react = require("@formily/react");
|
9
9
|
|
@@ -24,51 +24,58 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
24
|
/**
|
25
25
|
* 获取表单值的可显示值
|
26
26
|
* @returns 如果某字段有dataSource,则返回value对应label
|
27
|
+
* @example const example = {
|
28
|
+
a: [
|
29
|
+
[{ b: 'a.0.0.b', c: 'a.0.0.c' }, { d: 'a.0.1.d' }],
|
30
|
+
{ e: [{ f: { g: [{ h: 'a.1.e.0.f.g.0.h' }] } }, 'a.1.e.1'] },
|
31
|
+
],
|
32
|
+
};
|
33
|
+
console.log(getDisplayValues(example));
|
27
34
|
*/
|
35
|
+
var getDisplayValues = function getDisplayValues(form, values) {
|
36
|
+
var prefix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
37
|
+
var displayValues; // 判断值的类型,递归获取每个值在该结构中的完整路径
|
38
|
+
|
39
|
+
if ((0, _utils.isPlainObj)(values)) {
|
40
|
+
displayValues = {};
|
41
|
+
Object.entries(values).forEach(function (_ref) {
|
42
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
43
|
+
key = _ref2[0],
|
44
|
+
value = _ref2[1];
|
45
|
+
|
46
|
+
var path = prefix ? "".concat(prefix, ".").concat(key) : "".concat(key);
|
47
|
+
displayValues[key] = getDisplayValues(form, value, path);
|
48
|
+
});
|
49
|
+
} else if ((0, _utils.isArr)(values)) {
|
50
|
+
displayValues = []; // todo 如果对象或数组的值不再是对象或数组,并且找不到路径,判断为非复合组件,直接返回原始值
|
51
|
+
|
52
|
+
values.map(function (value, index) {
|
53
|
+
var path = prefix ? "".concat(prefix, ".").concat(index) : "".concat(index);
|
54
|
+
displayValues[index] = getDisplayValues(form, value, path);
|
55
|
+
});
|
56
|
+
} else {
|
57
|
+
// 通过值的完整路径获取字段address(从form实例的indexes中),然后获取该字段的value在该字段dataSource中对应的label
|
58
|
+
var address = form.indexes[prefix];
|
59
|
+
var field = form.query(address).take();
|
60
|
+
displayValues = {
|
61
|
+
title: field === null || field === void 0 ? void 0 : field.title,
|
62
|
+
value: values,
|
63
|
+
displayValue: (0, _utils.getValueByValue)(field === null || field === void 0 ? void 0 : field.dataSource, values)
|
64
|
+
};
|
65
|
+
}
|
66
|
+
|
67
|
+
return displayValues;
|
68
|
+
};
|
69
|
+
|
28
70
|
var useFormDisplayValues = function useFormDisplayValues() {
|
29
71
|
var form = (0, _react.useForm)();
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
displayValues = {};
|
38
|
-
Object.entries(values).forEach(function (_ref) {
|
39
|
-
var _ref2 = _slicedToArray(_ref, 2),
|
40
|
-
key = _ref2[0],
|
41
|
-
value = _ref2[1];
|
42
|
-
|
43
|
-
var path = prefix ? "".concat(prefix, ".").concat(key) : "".concat(key);
|
44
|
-
displayValues[key] = getDisplayValues(value, path);
|
45
|
-
});
|
46
|
-
} else if ((0, _utils.isArr)(values)) {
|
47
|
-
displayValues = [];
|
48
|
-
values.map(function (value, index) {
|
49
|
-
var path = prefix ? "".concat(prefix, ".").concat(index) : "".concat(index);
|
50
|
-
displayValues[index] = getDisplayValues(value, path);
|
51
|
-
});
|
52
|
-
} else {
|
53
|
-
// 通过值的完整路径获取字段address(从form实例的indexes中),然后获取该字段的value在该字段dataSource中对应的label
|
54
|
-
var address = form.indexes[prefix];
|
55
|
-
var field = form.query(address).take();
|
56
|
-
displayValues = (0, _utils.getValueByValue)(field === null || field === void 0 ? void 0 : field.dataSource, values) || values;
|
57
|
-
}
|
58
|
-
|
59
|
-
return displayValues;
|
60
|
-
}; // 测试样例
|
61
|
-
// const example = {
|
62
|
-
// a: [
|
63
|
-
// [{ b: 'a.0.0.b', c: 'a.0.0.c' }, { d: 'a.0.1.d' }],
|
64
|
-
// { e: [{ f: { g: [{ h: 'a.1.e.0.f.g.0.h' }] } }, 'a.1.e.1'] },
|
65
|
-
// ],
|
66
|
-
// };
|
67
|
-
// console.log(getDisplayValues(example));
|
68
|
-
|
69
|
-
|
70
|
-
return getDisplayValues(values);
|
72
|
+
return getDisplayValues(form, form.values);
|
73
|
+
};
|
74
|
+
|
75
|
+
exports.useFormDisplayValues = useFormDisplayValues;
|
76
|
+
|
77
|
+
var getFormDisplayValues = function getFormDisplayValues(form) {
|
78
|
+
return getDisplayValues(form, form.values);
|
71
79
|
};
|
72
80
|
|
73
|
-
|
74
|
-
exports.default = _default;
|
81
|
+
exports.getFormDisplayValues = getFormDisplayValues;
|
@@ -105,6 +105,7 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
105
105
|
var schema = _ref.schema,
|
106
106
|
scope = _ref.scope,
|
107
107
|
components = _ref.components;
|
108
|
+
// 创建 SchemaField
|
108
109
|
var SchemaField = (0, _react.useMemo)(function () {
|
109
110
|
return (0, _react2.createSchemaField)({
|
110
111
|
components: _objectSpread(_objectSpread({}, _ProField.default), {}, {
|
@@ -135,15 +136,15 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
135
136
|
Text: _index.default
|
136
137
|
})
|
137
138
|
});
|
138
|
-
}, []); // 合并schema中request的scope
|
139
|
+
}, []); // 合并 schema 中 request 的 scope
|
139
140
|
|
140
141
|
var mergedScope = (0, _react.useMemo)(function () {
|
141
142
|
return _objectSpread({}, scope);
|
142
|
-
}, [scope]); // 格式化schema
|
143
|
+
}, [scope]); // 格式化 schema
|
143
144
|
|
144
145
|
var formatSchema = (0, _react.useCallback)(function (schema) {
|
145
146
|
var schemaProperties = {};
|
146
|
-
schema.forEach(function (item) {
|
147
|
+
schema === null || schema === void 0 ? void 0 : schema.forEach(function (item) {
|
147
148
|
var newItem = (0, _warning.default)(item);
|
148
149
|
var _newItem = newItem,
|
149
150
|
originalComponent = _newItem.component; // 根据component的不同,初始化为内置的item
|
@@ -279,15 +280,15 @@ var _default = /*#__PURE__*/(0, _react.memo)(function (_ref) {
|
|
279
280
|
});
|
280
281
|
return schemaProperties;
|
281
282
|
}, [mergedScope]);
|
282
|
-
var
|
283
|
+
var proFormSchema = (0, _react.useMemo)(function () {
|
283
284
|
return {
|
284
285
|
type: 'object',
|
285
286
|
properties: formatSchema(schema)
|
286
287
|
};
|
287
|
-
}, []); // console.log(
|
288
|
+
}, []); // console.log(proFormSchema);
|
288
289
|
|
289
290
|
return /*#__PURE__*/_react.default.createElement(SchemaField, {
|
290
|
-
schema:
|
291
|
+
schema: proFormSchema,
|
291
292
|
components: components,
|
292
293
|
scope: mergedScope
|
293
294
|
});
|
package/lib/form/index.d.ts
CHANGED
@@ -108,7 +108,8 @@ export { createForm, FormConsumer, FormDialog, FormDrawer, FormStep, FormTab, Fo
|
|
108
108
|
/**
|
109
109
|
* 导出 Filter 组件
|
110
110
|
*/
|
111
|
-
import { AdvancedFilter, SimpleFilter
|
111
|
+
import { AdvancedFilter, SimpleFilter } from './Filter';
|
112
|
+
import { QueryFilter } from './Filter/index2';
|
112
113
|
export { AdvancedFilter, SimpleFilter, QueryFilter };
|
113
114
|
/**
|
114
115
|
* 导出 ProForm 组件,支持快速搭建表单
|
package/lib/form/index.js
CHANGED
@@ -71,7 +71,7 @@ Object.defineProperty(exports, "FormTab", {
|
|
71
71
|
Object.defineProperty(exports, "QueryFilter", {
|
72
72
|
enumerable: true,
|
73
73
|
get: function get() {
|
74
|
-
return
|
74
|
+
return _index.QueryFilter;
|
75
75
|
}
|
76
76
|
});
|
77
77
|
Object.defineProperty(exports, "SimpleFilter", {
|
@@ -146,12 +146,14 @@ exports.formilyTeamix = _formilyTeamix;
|
|
146
146
|
|
147
147
|
var originalFormilyReact = _interopRequireWildcard(require("@formily/react"));
|
148
148
|
|
149
|
-
var _useFormDisplayValues =
|
149
|
+
var _useFormDisplayValues = require("./ProForm/useFormDisplayValues");
|
150
150
|
|
151
151
|
var _useFieldRequest = _interopRequireDefault(require("./ProForm/useFieldRequest"));
|
152
152
|
|
153
153
|
var _Filter = require("./Filter");
|
154
154
|
|
155
|
+
var _index = require("./Filter/index2");
|
156
|
+
|
155
157
|
var _ProForm = _interopRequireDefault(require("./ProForm"));
|
156
158
|
|
157
159
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -168,7 +170,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
168
170
|
|
169
171
|
var formilyReact = _objectSpread(_objectSpread({}, originalFormilyReact), {}, {
|
170
172
|
useFieldRequest: _useFieldRequest.default,
|
171
|
-
useFormDisplayValues: _useFormDisplayValues.
|
173
|
+
useFormDisplayValues: _useFormDisplayValues.useFormDisplayValues
|
172
174
|
});
|
173
175
|
|
174
176
|
exports.formilyReact = formilyReact;
|
package/lib/form/typing.d.ts
CHANGED
@@ -2,6 +2,7 @@ import type { ReactNode } from 'react';
|
|
2
2
|
import type { IFormFeedback, Form as FormType, FieldPatternTypes } from '@formily/core';
|
3
3
|
import type { IFormLayoutProps } from '@teamix/formily';
|
4
4
|
import { CommonRequestConfig } from '@teamix/utils';
|
5
|
+
import React from 'react';
|
5
6
|
interface AnyObject {
|
6
7
|
[propName: string]: any;
|
7
8
|
}
|
@@ -64,6 +65,8 @@ export interface ProFormProps extends IFormLayoutProps {
|
|
64
65
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
65
66
|
}
|
66
67
|
export interface QueryFilterProps extends ProFormProps {
|
68
|
+
addonBefore?: ReactNode;
|
69
|
+
addonAfter?: ReactNode;
|
67
70
|
onFilter?: (values: any) => void;
|
68
71
|
onReset?: (payload?: any) => void;
|
69
72
|
}
|
package/lib/index.d.ts
CHANGED
@@ -21,5 +21,5 @@ export * from './page-container';
|
|
21
21
|
export * from './page-header';
|
22
22
|
export * from './skeleton';
|
23
23
|
export * from './table';
|
24
|
-
declare const version = "1.2.
|
24
|
+
declare const version = "1.2.11";
|
25
25
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, hooks, nocode, templates, utils, };
|