@teamix/pro 1.3.15 → 1.3.16

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 (39) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +4953 -730
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/form/Filter/index.js +46 -29
  6. package/es/form/Filter/layout.scss +4 -0
  7. package/es/form/Filter/useBindUrl.d.ts +2 -0
  8. package/es/form/Filter/useBindUrl.js +118 -0
  9. package/es/form/ProForm/index.js +5 -3
  10. package/es/form/ProForm/useFieldSchema.js +53 -32
  11. package/es/form/SchemaForm/reactions.js +9 -3
  12. package/es/form/typing.d.ts +3 -0
  13. package/es/form/utils.d.ts +9 -1
  14. package/es/form/utils.js +6 -30
  15. package/es/global.scss +45 -0
  16. package/es/index.d.ts +2 -1
  17. package/es/index.js +3 -2
  18. package/es/page-header/index.d.ts +2 -0
  19. package/es/page-header/index.js +13 -3
  20. package/es/page-header/index.scss +8 -0
  21. package/es/table/components/Layout/index.scss +5 -5
  22. package/lib/form/Filter/index.js +47 -29
  23. package/lib/form/Filter/layout.scss +4 -0
  24. package/lib/form/Filter/useBindUrl.d.ts +2 -0
  25. package/lib/form/Filter/useBindUrl.js +129 -0
  26. package/lib/form/ProForm/index.js +5 -3
  27. package/lib/form/ProForm/useFieldSchema.js +52 -31
  28. package/lib/form/SchemaForm/reactions.js +9 -3
  29. package/lib/form/typing.d.ts +3 -0
  30. package/lib/form/utils.d.ts +9 -1
  31. package/lib/form/utils.js +5 -29
  32. package/lib/global.scss +45 -0
  33. package/lib/index.d.ts +2 -1
  34. package/lib/index.js +3 -1
  35. package/lib/page-header/index.d.ts +2 -0
  36. package/lib/page-header/index.js +12 -2
  37. package/lib/page-header/index.scss +8 -0
  38. package/lib/table/components/Layout/index.scss +5 -5
  39. package/package.json +1 -1
@@ -28,45 +28,70 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
28
28
  * @returns schema 配置
29
29
  */
30
30
  var getMergedSchema = function getMergedSchema(field, extra, wholeExtra) {
31
- return field.reduce(function (prev, curr, index) {
31
+ return [].concat(field).reduce(function (prev, curr, index) {
32
+ var _curr$type;
33
+
32
34
  var _ref = curr.props || {},
33
35
  id = _ref.id,
34
36
  _ref$children = _ref.children,
35
37
  children = _ref$children === void 0 ? [] : _ref$children,
36
38
  _ref$reactions = _ref.reactions,
37
39
  reactions = _ref$reactions === void 0 ? [] : _ref$reactions,
38
- rest = _objectWithoutProperties(_ref, _excluded); // 获取字段额外的 schema 配置(From ProForm)
40
+ rest = _objectWithoutProperties(_ref, _excluded);
39
41
 
42
+ var displayName = curr === null || curr === void 0 ? void 0 : (_curr$type = curr.type) === null || _curr$type === void 0 ? void 0 : _curr$type.displayName; // 自定义组件
40
43
 
41
- var extraFieldProps = extra[index] || {};
44
+ var type = curr === null || curr === void 0 ? void 0 : curr.type; // 基本Dom元素
42
45
 
43
- if (id !== extraFieldProps.id) {
44
- // 索引不匹配,通过 id 查找获取
45
- extraFieldProps = (0, _utils.getValueByValue)(extra, id, {
46
- inputKey: 'id',
47
- outputKey: '__whole__'
48
- }) || (0, _utils.getValueByValue)(wholeExtra, id, {
49
- inputKey: 'id',
50
- outputKey: '__whole__'
51
- });
46
+ if (displayName === 'ProFormField') {
47
+ // 获取字段额外的 schema 配置(From ProForm)
48
+ var extraFieldProps = extra[index] || {};
52
49
 
53
- if (extraFieldProps) {
54
- console.warn("Field id \"".concat(id, "\" is not found by index in ProForm schema props, Please pay attention to the order."));
50
+ if (id !== extraFieldProps.id) {
51
+ // 索引不匹配,通过 id 查找获取
52
+ extraFieldProps = (0, _utils.getValueByValue)(extra, id, {
53
+ inputKey: 'id',
54
+ outputKey: '__whole__'
55
+ }) || (0, _utils.getValueByValue)(wholeExtra, id, {
56
+ inputKey: 'id',
57
+ outputKey: '__whole__'
58
+ });
59
+
60
+ if (extraFieldProps) {
61
+ console.warn("Field id \"".concat(id, "\" is not found by index in ProForm schema props, Please pay attention to the order."));
62
+ }
55
63
  }
64
+
65
+ var _ref2 = extraFieldProps || {},
66
+ extraId = _ref2.id,
67
+ _ref2$children = _ref2.children,
68
+ extraChildren = _ref2$children === void 0 ? [] : _ref2$children,
69
+ _ref2$reactions = _ref2.reactions,
70
+ extraReactions = _ref2$reactions === void 0 ? [] : _ref2$reactions,
71
+ extraRest = _objectWithoutProperties(_ref2, _excluded2);
72
+
73
+ var mergedReactions = [].concat(reactions, extraReactions);
74
+ var mergedChildren = children ? getMergedSchema(children, extraChildren, wholeExtra) : [];
75
+ prev.push(_objectSpread(_objectSpread(_objectSpread({}, (0, _utils.deepMerge)(rest, extraRest)), mergedReactions.length && {
76
+ reactions: mergedReactions
77
+ }), mergedChildren.length && {
78
+ children: mergedChildren
79
+ }));
80
+ } else if ((0, _utils.isStr)(type)) {
81
+ prev.push({
82
+ component: type,
83
+ props: curr.props
84
+ });
85
+ } else if ((0, _utils.isStr)(displayName)) {
86
+ prev.push({
87
+ decorator: displayName,
88
+ decoratorProps: _objectSpread({
89
+ id: id
90
+ }, rest),
91
+ children: children ? getMergedSchema(children, [], wholeExtra) : []
92
+ });
56
93
  }
57
94
 
58
- var _ref2 = extraFieldProps || {},
59
- extraId = _ref2.id,
60
- _ref2$children = _ref2.children,
61
- extraChildren = _ref2$children === void 0 ? [] : _ref2$children,
62
- _ref2$reactions = _ref2.reactions,
63
- extraReactions = _ref2$reactions === void 0 ? [] : _ref2$reactions,
64
- extraRest = _objectWithoutProperties(_ref2, _excluded2);
65
-
66
- prev.push(_objectSpread(_objectSpread({}, (0, _utils.deepMerge)(rest, extraRest)), {}, {
67
- reactions: [].concat(reactions, extraReactions),
68
- children: (children === null || children === void 0 ? void 0 : children.length) ? getMergedSchema(children, extraChildren, wholeExtra) : []
69
- }));
70
95
  return prev;
71
96
  }, []);
72
97
  };
@@ -80,11 +105,7 @@ var getMergedSchema = function getMergedSchema(field, extra, wholeExtra) {
80
105
  var _default = function _default(_ref3) {
81
106
  var children = _ref3.children,
82
107
  schema = _ref3.schema;
83
- var field = [].concat(children !== null && children !== void 0 ? children : []).filter(function (item) {
84
- var _item$type, _item$props;
85
-
86
- return (item === null || item === void 0 ? void 0 : (_item$type = item.type) === null || _item$type === void 0 ? void 0 : _item$type.name) === '' && (item === null || item === void 0 ? void 0 : (_item$props = item.props) === null || _item$props === void 0 ? void 0 : _item$props.component);
87
- }); // 如果 ProForm 的 children 含有 Field 字段,则优先使用 Field 渲染表单(仅合并 ProForm 的 schema 属性 )
108
+ var field = [].concat(children !== null && children !== void 0 ? children : []); // 如果 ProForm 的 children 含有 Field 字段,则优先使用 Field 渲染表单(仅合并 ProForm 的 schema 属性 )
88
109
 
89
110
  if (field.length) {
90
111
  return getMergedSchema(field, schema !== null && schema !== void 0 ? schema : [], schema !== null && schema !== void 0 ? schema : []);
@@ -35,10 +35,13 @@ var $request = function $request(field, context, _ref, type) {
35
35
  var beforeRequestResult = (0, _utils.isFn)(beforeRequest) ? beforeRequest(field, context) : {}; // 通过字段 data 的 refresh 主动触发的请求刷新
36
36
 
37
37
  var refresh = (_field$data = field.data) === null || _field$data === void 0 ? void 0 : _field$data.refresh;
38
- var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {}; // 执行通用数据请求
38
+ var refreshResult = (0, _utils.isPlainObj)(refresh) ? refresh : {}; // 合并请求参数
39
+
40
+ var mergedParams = _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult); // 执行通用数据请求
41
+
39
42
 
40
43
  return (0, _utils.doCommonRequest)(_objectSpread(_objectSpread({}, requestConfig), {}, {
41
- params: _objectSpread(_objectSpread(_objectSpread({}, params), beforeRequestResult), refreshResult),
44
+ params: mergedParams,
42
45
  beforeRequest: function beforeRequest() {
43
46
  return beforeRequestResult;
44
47
  },
@@ -48,7 +51,10 @@ var $request = function $request(field, context, _ref, type) {
48
51
  onSuccess: (0, _utils.isFn)(onSuccess) ? function (res) {
49
52
  return onSuccess(res, field, context);
50
53
  } : onSuccess
51
- }), context);
54
+ }), _objectSpread(_objectSpread({}, context), {}, {
55
+ field: field,
56
+ params: mergedParams
57
+ }));
52
58
  }; // 通用请求配置上下文
53
59
 
54
60
 
@@ -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 type { CommonRequestConfig } from '@teamix/utils';
5
+ import type { UrlStateOptions } from '@teamix/hooks';
5
6
  import React from 'react';
6
7
  interface AnyObject {
7
8
  [propName: string]: any;
@@ -124,6 +125,8 @@ export interface QueryFilterProps extends ProFormProps {
124
125
  formRef?: React.MutableRefObject<any>;
125
126
  /** onChange事件的防抖时间 */
126
127
  filterDebounce?: number;
128
+ /** 绑定URL参数 */
129
+ bindUrl?: boolean | UrlStateOptions;
127
130
  /** 表单初始化(含异步默认值)后回调函数 */
128
131
  onInit?: (values: any) => void;
129
132
  /** 表单筛选回调函数 */
@@ -43,5 +43,13 @@ declare const mergeArrayValue: (arr: any[], v?: any) => any[];
43
43
  * @param suffix scope名称后缀
44
44
  * @returns 表达式和scope上下文
45
45
  */
46
- declare const initializeRequestExpression: (config?: any, mode?: string | undefined, suffix?: string | undefined) => any;
46
+ declare const initializeRequestExpression: (config?: any, mode?: string | undefined, suffix?: string | undefined) => {
47
+ expression: string;
48
+ scope: {
49
+ [x: string]: object;
50
+ };
51
+ } | {
52
+ expression?: undefined;
53
+ scope?: undefined;
54
+ };
47
55
  export { mapSize, mapStatus, mapDataSource, mapMode, mergeArrayValue, getFieldName, mapSchemaName, initializeRequestExpression, };
package/lib/form/utils.js CHANGED
@@ -13,14 +13,8 @@ var _utils = require("@teamix/utils");
13
13
 
14
14
  var _schemaNameMap = _interopRequireDefault(require("./schemaNameMap"));
15
15
 
16
- var _excluded = ["customRequest"];
17
-
18
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
17
 
20
- 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; }
21
-
22
- 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; }
23
-
24
18
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
25
19
 
26
20
  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."); }
@@ -218,33 +212,15 @@ var mergeArrayValue = function mergeArrayValue(arr, v) {
218
212
  exports.mergeArrayValue = mergeArrayValue;
219
213
 
220
214
  var initializeRequestExpression = function initializeRequestExpression(config, mode, suffix) {
221
- var schema = {};
222
-
223
215
  if ((0, _utils.isPlainObj)(config)) {
224
- var customRequest = config.customRequest,
225
- requestConfig = _objectWithoutProperties(config, _excluded);
226
-
227
216
  var requestConfigName = "$requestConfig_".concat(suffix);
228
-
229
- if ((0, _utils.isFn)(customRequest)) {
230
- var _scope;
231
-
232
- // 自定义请求方法 customRequest
233
- var customRequestName = "$customRequest_".concat(suffix);
234
- schema = {
235
- expression: "{{".concat(mode, "(").concat(customRequestName, ",context,").concat(requestConfigName, ")}}"),
236
- scope: (_scope = {}, _defineProperty(_scope, customRequestName, customRequest), _defineProperty(_scope, requestConfigName, requestConfig), _scope)
237
- };
238
- } else {
239
- // pro 通用数据请求 $request
240
- schema = {
241
- expression: "{{".concat(mode, "($request,context,").concat(requestConfigName, ")}}"),
242
- scope: _defineProperty({}, requestConfigName, requestConfig)
243
- };
244
- }
217
+ return {
218
+ expression: "{{".concat(mode, "($request,context,").concat(requestConfigName, ")}}"),
219
+ scope: _defineProperty({}, requestConfigName, config)
220
+ };
245
221
  }
246
222
 
247
- return schema;
223
+ return {};
248
224
  };
249
225
 
250
226
  exports.initializeRequestExpression = initializeRequestExpression;
@@ -0,0 +1,45 @@
1
+ // transition 切换主题优化,暂时先写到 pro 里,后面加到基础组件里
2
+
3
+ // table 行背景色
4
+ tr.next-table-row{
5
+ transition: color 0s;
6
+ }
7
+
8
+ // normal 按钮
9
+ button.next-btn.next-medium.next-btn-normal {
10
+ transition: color 0s;
11
+ }
12
+
13
+ // input 背景色
14
+ .next-input.next-medium {
15
+ transition: color 0s;
16
+ }
17
+
18
+ // radio 背景色
19
+ .next-radio-wrapper.checked .next-radio-inner:after {
20
+ transition: color 0s;
21
+ }
22
+
23
+ .next-radio-wrapper .next-radio-inner {
24
+ transition: color 0s;
25
+ }
26
+
27
+ // checkbox 背景色
28
+ .next-checkbox-wrapper .next-checkbox-inner {
29
+ transition: color 0s;
30
+ }
31
+
32
+ // 侧导背景色
33
+ .next-menu-item.next-nav-item {
34
+ transition: color 0s;
35
+ }
36
+
37
+ // 标签背景色
38
+ .next-tag {
39
+ transition: color 0s;
40
+ }
41
+
42
+ // 可关闭tag
43
+ .next-tag.next-tag.next-tag.next-tag-closable.next-tag-level-normal.next-tag-closable {
44
+ transition: color 0s;
45
+ }
package/lib/index.d.ts CHANGED
@@ -13,6 +13,7 @@ import ProSidebar from './sidebar';
13
13
  import { ProTimeline } from './timeline';
14
14
  import * as nocode from './nocode';
15
15
  import * as templates from './templates';
16
+ import './global.scss';
16
17
  export * from './actions';
17
18
  export * from './card';
18
19
  export * from './field';
@@ -26,5 +27,5 @@ export * from './table';
26
27
  export * from './sidebar';
27
28
  export * from './utils';
28
29
  export * from './timeline';
29
- declare const version = "1.3.15";
30
+ declare const version = "1.3.16";
30
31
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, hooks, nocode, templates, utils, };
package/lib/index.js CHANGED
@@ -295,6 +295,8 @@ exports.templates = templates;
295
295
 
296
296
  var _icon = _interopRequireDefault(require("@teamix/icon"));
297
297
 
298
+ require("./global.scss");
299
+
298
300
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
299
301
 
300
302
  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); }
@@ -305,5 +307,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
305
307
  // 设置图标源
306
308
  _icon.default.setConfig(_utils.default.getTeamixIconConfig());
307
309
 
308
- var version = '1.3.15';
310
+ var version = '1.3.16';
309
311
  exports.version = version;
@@ -20,6 +20,8 @@ export declare type ProPageHeaderDataItem = {
20
20
  export declare type ProPageHeaderProps = {
21
21
  /** 标题 */
22
22
  title?: React.ReactNode;
23
+ /** 标题说明 */
24
+ titleTooltip?: React.ReactNode;
23
25
  /** 描述 */
24
26
  description?: React.ReactNode;
25
27
  /** 图标 */
@@ -27,7 +27,7 @@ require("./index.scss");
27
27
 
28
28
  var _excluded = ["text", "children"],
29
29
  _excluded2 = ["color", "title", "num", "className"],
30
- _excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
30
+ _excluded3 = ["title", "titleTooltip", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style", "tabs"];
31
31
 
32
32
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
33
 
@@ -42,6 +42,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
42
42
  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; }
43
43
 
44
44
  var cls = (0, _utils.baseClass)('teamix-pro-page-header');
45
+ var Tooltip = _components.Balloon.Tooltip;
45
46
 
46
47
  var renderNav = function renderNav(breadcrumbs) {
47
48
  if (breadcrumbs && breadcrumbs.length) {
@@ -152,6 +153,7 @@ var renderTabs = function renderTabs(tabs) {
152
153
 
153
154
  var ProPageHeader = function ProPageHeader(props) {
154
155
  var title = props.title,
156
+ titleTooltip = props.titleTooltip,
155
157
  description = props.description,
156
158
  icon = props.icon,
157
159
  iconColor = props.iconColor,
@@ -219,7 +221,15 @@ var ProPageHeader = function ProPageHeader(props) {
219
221
  size: "large"
220
222
  }) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon)), /*#__PURE__*/_react.default.createElement("span", {
221
223
  className: cls('title-name')
222
- }, title), (0, _utils.renderTags)(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
224
+ }, title, titleTooltip && /*#__PURE__*/_react.default.createElement(Tooltip, {
225
+ trigger: /*#__PURE__*/_react.default.createElement("span", {
226
+ className: cls('title-tooltip-icon')
227
+ }, /*#__PURE__*/_react.default.createElement(_icon.default, {
228
+ type: "info-circle-line",
229
+ size: "xs"
230
+ })),
231
+ align: "t"
232
+ }, titleTooltip)), (0, _utils.renderTags)(tags, 'large'), renderTabs(tabs !== null && tabs !== void 0 ? tabs : {}));
223
233
  };
224
234
 
225
235
  return /*#__PURE__*/_react.default.createElement("header", _objectSpread({
@@ -43,6 +43,7 @@ $prefix: 'teamix-pro-page-header';
43
43
  font-weight: 500;
44
44
  align-items: center;
45
45
  word-break: break-all;
46
+ color: var(--color-text1-4);
46
47
 
47
48
  &-name {
48
49
  white-space: nowrap;
@@ -50,6 +51,13 @@ $prefix: 'teamix-pro-page-header';
50
51
  text-overflow: ellipsis;
51
52
  }
52
53
 
54
+ &-tooltip-icon {
55
+ position: relative;
56
+ margin-left: 2px;
57
+ display: inline-flex;
58
+ top: -7px;
59
+ }
60
+
53
61
  &-icon {
54
62
  padding: var(--s-1, 4px);
55
63
  }
@@ -32,11 +32,11 @@ $prefix: 'teamix-pro-table-layout';
32
32
  &-filter-btn:not(:first-child) {
33
33
  margin-left: 8px;
34
34
  }
35
- &-panel-filter {
36
- margin: 8px 0;
37
- padding: 16px;
38
- background: var(--panel-filter-bg, var(--color-fill1-2));
39
- }
35
+ // &-panel-filter {
36
+ // margin: 8px 0;
37
+ // padding: 16px;
38
+ // background: var(--panel-filter-bg, var(--color-fill1-2));
39
+ // }
40
40
  &-main-action {
41
41
  margin-bottom: 8px;
42
42
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.3.15",
3
+ "version": "1.3.16",
4
4
  "description": "TeamixPro大包",
5
5
  "keywords": [
6
6
  "aliyun",