@teamix/pro 1.2.9 → 1.2.13

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.
Files changed (122) hide show
  1. package/dist/212.js +1 -1
  2. package/dist/pro.css +1 -1
  3. package/dist/pro.js +2103 -993
  4. package/dist/pro.min.css +1 -1
  5. package/dist/pro.min.js +1 -1
  6. package/es/actions/base.d.ts +16 -6
  7. package/es/actions/base.js +66 -12
  8. package/es/actions/confirm.d.ts +1 -1
  9. package/es/actions/danger-confirm.d.ts +1 -1
  10. package/es/actions/dialog-component.d.ts +1 -1
  11. package/es/actions/dialog-form.d.ts +1 -1
  12. package/es/actions/dialog-form.js +2 -2
  13. package/es/actions/dialog-info.d.ts +1 -1
  14. package/es/actions/dialog-table.d.ts +1 -1
  15. package/es/actions/dialog.d.ts +6 -2
  16. package/es/actions/dialog.js +9 -5
  17. package/es/actions/drawer-form.d.ts +1 -1
  18. package/es/actions/drawer-info.d.ts +1 -1
  19. package/es/actions/drawer-table.d.ts +1 -1
  20. package/es/actions/drawer.d.ts +1 -1
  21. package/es/actions/error.d.ts +1 -1
  22. package/es/actions/index.js +9 -5
  23. package/es/actions/index.scss +28 -7
  24. package/es/actions/link.d.ts +2 -2
  25. package/es/actions/link.js +2 -2
  26. package/es/actions/notice.d.ts +1 -1
  27. package/es/actions/request.d.ts +1 -1
  28. package/es/actions/request.js +2 -2
  29. package/es/card/index.d.ts +10 -1
  30. package/es/card/index.js +20 -5
  31. package/es/card/index.scss +19 -0
  32. package/es/card/tab.d.ts +6 -0
  33. package/es/card/tab.js +27 -0
  34. package/es/form/Filter/index.d.ts +2 -5
  35. package/es/form/Filter/index.js +3 -44
  36. package/es/form/Filter/index.scss +71 -0
  37. package/es/form/Filter/index2.d.ts +8 -0
  38. package/es/form/Filter/index2.js +318 -0
  39. package/es/form/ProForm/index.js +3 -23
  40. package/es/form/ProForm/index.scss +10 -19
  41. package/es/form/ProForm/useFormDisplayValues.d.ts +3 -5
  42. package/es/form/ProForm/useFormDisplayValues.js +44 -38
  43. package/es/form/SchemaForm/index.js +7 -6
  44. package/es/form/index.d.ts +11 -10
  45. package/es/form/index.js +3 -2
  46. package/es/form/typing.d.ts +3 -0
  47. package/es/index.d.ts +1 -1
  48. package/es/index.js +1 -1
  49. package/es/info/components/ProInfoItem/index.js +3 -1
  50. package/es/nocode/pages/renderer.d.ts +2 -2
  51. package/es/page-header/index.d.ts +20 -11
  52. package/es/page-header/index.js +23 -47
  53. package/es/page-header/index.scss +0 -11
  54. package/es/table/components/Filter/index.js +11 -9
  55. package/es/table/components/Filter/index.scss +7 -3
  56. package/es/table/components/Layout/index.js +10 -1
  57. package/es/table/index.js +21 -11
  58. package/es/table/typing.d.ts +6 -0
  59. package/es/table/utils/columnRender.js +38 -1
  60. package/es/table/utils/index.js +15 -1
  61. package/es/utils/components/tags/index.d.ts +15 -0
  62. package/es/utils/components/tags/index.js +94 -0
  63. package/es/utils/components/tags/index.scss +12 -0
  64. package/lib/actions/base.d.ts +16 -6
  65. package/lib/actions/base.js +67 -12
  66. package/lib/actions/confirm.d.ts +1 -1
  67. package/lib/actions/danger-confirm.d.ts +1 -1
  68. package/lib/actions/dialog-component.d.ts +1 -1
  69. package/lib/actions/dialog-form.d.ts +1 -1
  70. package/lib/actions/dialog-form.js +2 -2
  71. package/lib/actions/dialog-info.d.ts +1 -1
  72. package/lib/actions/dialog-table.d.ts +1 -1
  73. package/lib/actions/dialog.d.ts +6 -2
  74. package/lib/actions/dialog.js +9 -5
  75. package/lib/actions/drawer-form.d.ts +1 -1
  76. package/lib/actions/drawer-info.d.ts +1 -1
  77. package/lib/actions/drawer-table.d.ts +1 -1
  78. package/lib/actions/drawer.d.ts +1 -1
  79. package/lib/actions/error.d.ts +1 -1
  80. package/lib/actions/index.js +9 -5
  81. package/lib/actions/index.scss +28 -7
  82. package/lib/actions/link.d.ts +2 -2
  83. package/lib/actions/link.js +2 -2
  84. package/lib/actions/notice.d.ts +1 -1
  85. package/lib/actions/request.d.ts +1 -1
  86. package/lib/actions/request.js +2 -2
  87. package/lib/card/index.d.ts +10 -1
  88. package/lib/card/index.js +22 -4
  89. package/lib/card/index.scss +19 -0
  90. package/lib/card/tab.d.ts +6 -0
  91. package/lib/card/tab.js +39 -0
  92. package/lib/form/Filter/index.d.ts +2 -5
  93. package/lib/form/Filter/index.js +4 -45
  94. package/lib/form/Filter/index.scss +71 -0
  95. package/lib/form/Filter/index2.d.ts +8 -0
  96. package/lib/form/Filter/index2.js +342 -0
  97. package/lib/form/ProForm/index.js +3 -23
  98. package/lib/form/ProForm/index.scss +10 -19
  99. package/lib/form/ProForm/useFormDisplayValues.d.ts +3 -5
  100. package/lib/form/ProForm/useFormDisplayValues.js +51 -44
  101. package/lib/form/SchemaForm/index.js +7 -6
  102. package/lib/form/index.d.ts +11 -10
  103. package/lib/form/index.js +5 -3
  104. package/lib/form/typing.d.ts +3 -0
  105. package/lib/index.d.ts +1 -1
  106. package/lib/index.js +1 -1
  107. package/lib/info/components/ProInfoItem/index.js +3 -1
  108. package/lib/nocode/pages/renderer.d.ts +2 -2
  109. package/lib/page-header/index.d.ts +20 -11
  110. package/lib/page-header/index.js +22 -45
  111. package/lib/page-header/index.scss +0 -11
  112. package/lib/table/components/Filter/index.js +10 -8
  113. package/lib/table/components/Filter/index.scss +7 -3
  114. package/lib/table/components/Layout/index.js +10 -1
  115. package/lib/table/index.js +20 -10
  116. package/lib/table/typing.d.ts +6 -0
  117. package/lib/table/utils/columnRender.js +38 -1
  118. package/lib/table/utils/index.js +15 -1
  119. package/lib/utils/components/tags/index.d.ts +15 -0
  120. package/lib/utils/components/tags/index.js +114 -0
  121. package/lib/utils/components/tags/index.scss +12 -0
  122. 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); // return outerForm === false ? ( // 特殊表单,无需渲染form实例,例如FormDialog等
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
- export default useFormDisplayValues;
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.default = void 0;
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
- var values = form.values; // 判断值的类型,递归获取每个值在该结构中的完整路径
31
-
32
- var getDisplayValues = function getDisplayValues(values) {
33
- var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
34
- var displayValues;
35
-
36
- if ((0, _utils.isPlainObj)(values)) {
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
- var _default = useFormDisplayValues;
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 schemaPro = (0, _react.useMemo)(function () {
283
+ var proFormSchema = (0, _react.useMemo)(function () {
283
284
  return {
284
285
  type: 'object',
285
286
  properties: formatSchema(schema)
286
287
  };
287
- }, []); // console.log(schemaPro);
288
+ }, []); // console.log(proFormSchema);
288
289
 
289
290
  return /*#__PURE__*/_react.default.createElement(SchemaField, {
290
- schema: schemaPro,
291
+ schema: proFormSchema,
291
292
  components: components,
292
293
  scope: mergedScope
293
294
  });