@teamix/pro 1.4.13 → 1.4.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.
- package/dist/pro.css +1 -1
- package/dist/pro.js +334 -92
- package/dist/pro.min.css +1 -1
- package/dist/pro.min.js +1 -1
- package/es/actions/base.d.ts +2 -1
- package/es/actions/base.js +11 -1
- package/es/actions/dialog.d.ts +2 -0
- package/es/actions/dialog.js +26 -1
- package/es/actions/drawer.js +7 -0
- package/es/form/ProForm/index.js +16 -32
- package/es/form/ProForm/index.scss +9 -2
- package/es/form/ProForm/useAutoLayout.d.ts +9 -0
- package/es/form/ProForm/useAutoLayout.js +114 -0
- package/es/form/SchemaForm/initializeArrayTable.js +42 -7
- package/es/form/typing.d.ts +4 -0
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/nocode/index.scss +2 -2
- package/es/nocode/pages/playground.js +1 -1
- package/es/nocode/pages/renderer.js +1 -1
- package/es/nocode/playground.js +1 -1
- package/es/table/components/Layout/index.js +12 -6
- package/es/table/components/QuickAction/index.js +1 -1
- package/es/table/index.js +31 -9
- package/lib/actions/base.d.ts +2 -1
- package/lib/actions/base.js +11 -1
- package/lib/actions/dialog.d.ts +2 -0
- package/lib/actions/dialog.js +27 -1
- package/lib/actions/drawer.js +8 -0
- package/lib/form/ProForm/index.js +15 -31
- package/lib/form/ProForm/index.scss +9 -2
- package/lib/form/ProForm/useAutoLayout.d.ts +9 -0
- package/lib/form/ProForm/useAutoLayout.js +124 -0
- package/lib/form/SchemaForm/initializeArrayTable.js +42 -7
- package/lib/form/typing.d.ts +4 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/nocode/index.scss +2 -2
- package/lib/nocode/pages/playground.js +1 -1
- package/lib/nocode/pages/renderer.js +1 -1
- package/lib/nocode/playground.js +1 -1
- package/lib/table/components/Layout/index.js +12 -6
- package/lib/table/components/QuickAction/index.js +1 -1
- package/lib/table/index.js +30 -8
- package/package.json +1 -1
package/es/actions/base.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { MaybePromise } from '@teamix/utils';
|
3
|
+
import { DialogAction } from './dialog';
|
3
4
|
export interface BaseAction {
|
4
5
|
/** 事件触发方式,默认是 onClick */
|
5
6
|
trigger?: string;
|
@@ -18,7 +19,7 @@ export interface BaseAction {
|
|
18
19
|
/** 事件开始执行完毕的回调函数 */
|
19
20
|
onFinish?: (params?: any) => any;
|
20
21
|
}
|
21
|
-
export declare function eventHandler(action: BaseAction, actionContext: any, onTrigger: (context: any, e: React.MouseEvent<HTMLElement>) => void): {
|
22
|
+
export declare function eventHandler(action: BaseAction & DialogAction, actionContext: any, onTrigger: (context: any, e: React.MouseEvent<HTMLElement>) => void): {
|
22
23
|
[x: string]: (e: React.MouseEvent<HTMLElement>) => Promise<void>;
|
23
24
|
};
|
24
25
|
export default eventHandler;
|
package/es/actions/base.js
CHANGED
@@ -11,7 +11,9 @@ export function eventHandler(action, actionContext, onTrigger) {
|
|
11
11
|
preventDefault = action.preventDefault,
|
12
12
|
stopPropagation = action.stopPropagation,
|
13
13
|
beforeAction = action.beforeAction;
|
14
|
-
|
14
|
+
var openIdentifier = action.openIdentifier;
|
15
|
+
|
16
|
+
var baseProps = _defineProperty({}, "".concat(trigger), function () {
|
15
17
|
var _2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(e) {
|
16
18
|
var _action$onTrigger;
|
17
19
|
|
@@ -73,5 +75,13 @@ export function eventHandler(action, actionContext, onTrigger) {
|
|
73
75
|
|
74
76
|
return _;
|
75
77
|
}());
|
78
|
+
|
79
|
+
if (openIdentifier) {
|
80
|
+
baseProps = Object.assign({}, baseProps, {
|
81
|
+
id: openIdentifier
|
82
|
+
});
|
83
|
+
}
|
84
|
+
|
85
|
+
return baseProps;
|
76
86
|
}
|
77
87
|
export default eventHandler;
|
package/es/actions/dialog.d.ts
CHANGED
@@ -29,6 +29,8 @@ export interface DialogAction extends Omit<RequestAction, 'url'>, Omit<QuickShow
|
|
29
29
|
onOk?: any;
|
30
30
|
/** 点击取消自定义回调函数 */
|
31
31
|
onCancel?: any;
|
32
|
+
/** 打开工作区 id */
|
33
|
+
openIdentifier?: string | number;
|
32
34
|
}
|
33
35
|
export declare function useDialogAction(action: DialogAction, actionContext?: any, hasForm?: boolean): {
|
34
36
|
[x: string]: (e: React.MouseEvent<HTMLElement, MouseEvent>) => Promise<void>;
|
package/es/actions/dialog.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
var _excluded = ["trigger", "url", "customRequest", "method", "params", "data", "extendParams", "successMsg", "errorMsg", "formatParams", "formatResult", "onSuccess", "onError", "onOk", "onCancel"],
|
2
|
-
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className"];
|
2
|
+
_excluded2 = ["title", "content", "component", "schema", "onFinish", "dialogType", "dialogQuickShowType", "messageType", "popType", "beforeRequest", "onTrigger", "link", "beforeContent", "afterContent", "message", "footerDescription", "footerAlign", "className", "openIdentifier"];
|
3
3
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
5
5
|
|
@@ -38,6 +38,7 @@ import { renderProMessage } from '../utils/message';
|
|
38
38
|
import { eventHandler } from './base';
|
39
39
|
import { doRequest } from './request';
|
40
40
|
import { addContext } from './utils';
|
41
|
+
import { useUrlState } from '@teamix/hooks';
|
41
42
|
|
42
43
|
function addContextForReactNode(content, context) {
|
43
44
|
if (typeof content === 'function' && context) {
|
@@ -81,6 +82,11 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
81
82
|
var footerDescriptionRef = useRef();
|
82
83
|
var history = useHistory();
|
83
84
|
|
85
|
+
var _useUrlState = useUrlState(),
|
86
|
+
_useUrlState2 = _slicedToArray(_useUrlState, 2),
|
87
|
+
urlState = _useUrlState2[0],
|
88
|
+
setUrlState = _useUrlState2[1];
|
89
|
+
|
84
90
|
var onActionStart = function onActionStart(context, e) {
|
85
91
|
var _objectSpread2;
|
86
92
|
|
@@ -121,7 +127,18 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
121
127
|
footerDescription = _getTargetValue.footerDescription,
|
122
128
|
footerAlign = _getTargetValue.footerAlign,
|
123
129
|
className = _getTargetValue.className,
|
130
|
+
openIdentifier = _getTargetValue.openIdentifier,
|
124
131
|
containerOtherProps = _objectWithoutProperties(_getTargetValue, _excluded2);
|
132
|
+
/**
|
133
|
+
* 判断是否含有 openIdentifierIdentifiy参数 ,更改对应 url
|
134
|
+
*/
|
135
|
+
|
136
|
+
|
137
|
+
if (openIdentifier) {
|
138
|
+
setUrlState({
|
139
|
+
openIdentifier: openIdentifier
|
140
|
+
});
|
141
|
+
}
|
125
142
|
|
126
143
|
var isDrawer = dialogType === 'drawer';
|
127
144
|
var isPop = dialogType === 'pop';
|
@@ -230,7 +247,15 @@ export function useDialogAction(action, actionContext, hasForm) {
|
|
230
247
|
var dialogContent = Component ? /*#__PURE__*/React.createElement(Component, _objectSpread({}, addContext(componentProps, dialogContext))) : addContextForReactNode(content, dialogContext);
|
231
248
|
|
232
249
|
var quickShowProps = _objectSpread(_objectSpread((_objectSpread2 = {}, _defineProperty(_objectSpread2, "".concat(isPop ? 'onConfirm' : 'onOk'), onOk), _defineProperty(_objectSpread2, "onCancel", function onCancel() {
|
250
|
+
setUrlState({
|
251
|
+
openIdentifier: undefined
|
252
|
+
});
|
233
253
|
propsOnCancel && propsOnCancel(context);
|
254
|
+
}), _defineProperty(_objectSpread2, "onClose", function onClose() {
|
255
|
+
setUrlState({
|
256
|
+
openIdentifier: undefined
|
257
|
+
});
|
258
|
+
hide === null || hide === void 0 ? void 0 : hide();
|
234
259
|
}), _defineProperty(_objectSpread2, "title", addContextForReactNode(title, dialogContext)), _defineProperty(_objectSpread2, "content", /*#__PURE__*/React.createElement(React.Fragment, null, beforeContent && /*#__PURE__*/React.createElement("div", {
|
235
260
|
className: "teamix-pro-dialog-before-content"
|
236
261
|
}, addContextForReactNode(beforeContent, dialogContext)), message && /*#__PURE__*/React.createElement("div", {
|
package/es/actions/drawer.js
CHANGED
@@ -1,5 +1,12 @@
|
|
1
|
+
import { useEffect } from 'react';
|
1
2
|
import useDialogAction from './dialog';
|
2
3
|
export function useDrawerAction(action, context) {
|
4
|
+
useEffect(function () {
|
5
|
+
var _action$openIdentifie, _action$openIdentifie2;
|
6
|
+
|
7
|
+
var dom = document.getElementById((_action$openIdentifie = (_action$openIdentifie2 = action.openIdentifier) === null || _action$openIdentifie2 === void 0 ? void 0 : _action$openIdentifie2.toString()) !== null && _action$openIdentifie !== void 0 ? _action$openIdentifie : '');
|
8
|
+
dom === null || dom === void 0 ? void 0 : dom.click();
|
9
|
+
}, []);
|
3
10
|
return useDialogAction(Object.assign({
|
4
11
|
dialogType: 'drawer'
|
5
12
|
}, action), context);
|
package/es/form/ProForm/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "
|
1
|
+
var _excluded = ["form", "initialValues", "initialRequest", "scope", "context", "components", "onChange", "onChangeType", "onSubmit", "onSubmitFailed", "onInitialComplete", "className", "validateFirst", "schema", "children"];
|
2
2
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
4
|
|
@@ -10,8 +10,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
10
10
|
|
11
11
|
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; }
|
12
12
|
|
13
|
-
import React, { memo, useEffect, useMemo } from 'react';
|
14
|
-
import { usePrefixCls, cls, getLanguage, getGlobalConfig
|
13
|
+
import React, { memo, useEffect, useMemo, useRef } from 'react';
|
14
|
+
import { usePrefixCls, cls, getLanguage, getGlobalConfig } from '@teamix/utils';
|
15
15
|
import { createForm, onFieldValueChange, onFormValuesChange, registerValidateLocale, setValidateLanguage } from '@formily/core';
|
16
16
|
import { toJS } from '@formily/reactive';
|
17
17
|
import { Form, Upload, SelectTable, FormLayout, FormItem, ArrayCollapse, ArrayCards, ArrayItems, ArrayTable, Space, FormGrid, FormTab, FormCollapse, FormStep, Editable, FormDialog, FormDrawer, FormButtonGroup, Submit, Reset } from '@teamix/formily';
|
@@ -22,8 +22,8 @@ import FormGroup from '../Components/FormGroup';
|
|
22
22
|
import LightFilter from '../Components/LightFilter';
|
23
23
|
import Text from '../Components/Text/index';
|
24
24
|
import SchemaForm from '../SchemaForm';
|
25
|
-
import { mergeArrayValue } from '../utils';
|
26
25
|
import useAutoSubmit from './useAutoSubmit';
|
26
|
+
import useAutoLayout from './useAutoLayout';
|
27
27
|
import useInitialRequest from './useInitialRequest';
|
28
28
|
import validateLocale from '../locales/validate';
|
29
29
|
import './index.scss';
|
@@ -63,12 +63,6 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
63
63
|
scope = _ref.scope,
|
64
64
|
context = _ref.context,
|
65
65
|
components = _ref.components,
|
66
|
-
layout = _ref.layout,
|
67
|
-
labelAlign = _ref.labelAlign,
|
68
|
-
wrapperAlign = _ref.wrapperAlign,
|
69
|
-
labelCol = _ref.labelCol,
|
70
|
-
wrapperCol = _ref.wrapperCol,
|
71
|
-
breakpoints = _ref.breakpoints,
|
72
66
|
onChange = _ref.onChange,
|
73
67
|
onChangeType = _ref.onChangeType,
|
74
68
|
onSubmit = _ref.onSubmit,
|
@@ -80,7 +74,8 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
80
74
|
children = _ref.children,
|
81
75
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
82
76
|
|
83
|
-
// 获取全局配置
|
77
|
+
var formRef = useRef(); // 获取全局配置
|
78
|
+
|
84
79
|
var _ref2 = getGlobalConfig('ProForm') || {},
|
85
80
|
globalComponents = _ref2.components,
|
86
81
|
globalScope = _ref2.scope;
|
@@ -98,25 +93,12 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
98
93
|
|
99
94
|
var mergedComponents = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, globalComponents), components), formilyComponents), ProFieldComponents);
|
100
95
|
|
101
|
-
var onAutoSubmit = useAutoSubmit(onSubmit, context);
|
102
|
-
|
103
|
-
var
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
labelAlign: mergeArrayValue(['left'], labelAlign),
|
108
|
-
wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
|
109
|
-
labelCol: mergeArrayValue([24], labelCol),
|
110
|
-
wrapperCol: mergeArrayValue([24], wrapperCol)
|
111
|
-
} : {
|
112
|
-
breakpoints: isBool(breakpoints) ? undefined : breakpoints,
|
113
|
-
layout: layout,
|
114
|
-
labelAlign: labelAlign,
|
115
|
-
wrapperAlign: wrapperAlign,
|
116
|
-
labelCol: labelCol,
|
117
|
-
wrapperCol: wrapperCol
|
118
|
-
};
|
119
|
-
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
96
|
+
var onAutoSubmit = useAutoSubmit(onSubmit, context);
|
97
|
+
console.log(otherProps);
|
98
|
+
var autoTeamixLayout = useAutoLayout(_objectSpread(_objectSpread({}, otherProps), {}, {
|
99
|
+
schema: schema
|
100
|
+
}), formRef);
|
101
|
+
console.log(autoTeamixLayout);
|
120
102
|
useMemo(function () {
|
121
103
|
// 配置表单默认值
|
122
104
|
if (initialValues) {
|
@@ -157,7 +139,7 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
157
139
|
}, []);
|
158
140
|
return /*#__PURE__*/React.createElement(Form, _objectSpread(_objectSpread(_objectSpread({
|
159
141
|
className: cls(prefixCls(), className)
|
160
|
-
}, otherProps),
|
142
|
+
}, otherProps), autoTeamixLayout), {}, {
|
161
143
|
form: form,
|
162
144
|
onAutoSubmit: onAutoSubmit,
|
163
145
|
onAutoSubmitFailed: onSubmitFailed
|
@@ -165,7 +147,9 @@ var ProForm = /*#__PURE__*/memo(function (_ref) {
|
|
165
147
|
schema: schema,
|
166
148
|
scope: mergedScope,
|
167
149
|
components: mergedComponents
|
168
|
-
}) : null,
|
150
|
+
}) : null, /*#__PURE__*/React.createElement("div", {
|
151
|
+
ref: formRef
|
152
|
+
}), children);
|
169
153
|
});
|
170
154
|
ProForm.defaultProps = {
|
171
155
|
colon: false,
|
@@ -338,8 +338,15 @@
|
|
338
338
|
}
|
339
339
|
|
340
340
|
// ArrayTable
|
341
|
-
.#{$form-array}-table
|
342
|
-
|
341
|
+
.#{$form-array}-table {
|
342
|
+
&-status-select {
|
343
|
+
display: none;
|
344
|
+
}
|
345
|
+
.#{$css-prefix}formily-item:not(.#{$form-item-cls}-feedback-layout-popover) {
|
346
|
+
.#{$form-item-cls}-help {
|
347
|
+
z-index: 2 !important;
|
348
|
+
}
|
349
|
+
}
|
343
350
|
}
|
344
351
|
|
345
352
|
// SelectTable
|
@@ -0,0 +1,9 @@
|
|
1
|
+
declare const useAutoLayout: ({ breakpoints: outBreakpoints, layout, labelAlign, wrapperAlign, labelCol: outLabelCol, wrapperCol: outWrapperCol, autoLayout, schema, }: any, formRef: any) => {
|
2
|
+
breakpoints: any;
|
3
|
+
layout: any;
|
4
|
+
labelAlign: any;
|
5
|
+
wrapperAlign: any;
|
6
|
+
labelCol: any;
|
7
|
+
wrapperCol: any;
|
8
|
+
};
|
9
|
+
export default useAutoLayout;
|
@@ -0,0 +1,114 @@
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
2
|
+
|
3
|
+
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."); }
|
4
|
+
|
5
|
+
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); }
|
6
|
+
|
7
|
+
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; }
|
8
|
+
|
9
|
+
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; }
|
10
|
+
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
12
|
+
|
13
|
+
import { useEffect, useMemo, useState } from 'react';
|
14
|
+
import { isPlainObj, isBool, autoWidthBySpace, getWidthByCharacterMap, isStr } from '@teamix/utils';
|
15
|
+
import { mergeArrayValue } from '../utils';
|
16
|
+
|
17
|
+
var useAutoLayout = function useAutoLayout(_ref, formRef) {
|
18
|
+
var outBreakpoints = _ref.breakpoints,
|
19
|
+
layout = _ref.layout,
|
20
|
+
labelAlign = _ref.labelAlign,
|
21
|
+
wrapperAlign = _ref.wrapperAlign,
|
22
|
+
outLabelCol = _ref.labelCol,
|
23
|
+
outWrapperCol = _ref.wrapperCol,
|
24
|
+
autoLayout = _ref.autoLayout,
|
25
|
+
schema = _ref.schema;
|
26
|
+
|
27
|
+
var _ref2 = isPlainObj(autoLayout) ? autoLayout : {
|
28
|
+
autoLabel: autoLayout
|
29
|
+
},
|
30
|
+
autoLabel = _ref2.autoLabel;
|
31
|
+
|
32
|
+
var breakpoints = useMemo(function () {
|
33
|
+
return autoLabel ? false : outBreakpoints;
|
34
|
+
}, []); // 当前断点不支持Col更新
|
35
|
+
|
36
|
+
var _useState = useState({
|
37
|
+
labelCol: outLabelCol,
|
38
|
+
wrapperCol: outWrapperCol
|
39
|
+
}),
|
40
|
+
_useState2 = _slicedToArray(_useState, 2),
|
41
|
+
autoCol = _useState2[0],
|
42
|
+
setAutoCol = _useState2[1];
|
43
|
+
|
44
|
+
var labelCol = autoCol.labelCol,
|
45
|
+
wrapperCol = autoCol.wrapperCol;
|
46
|
+
useEffect(function () {
|
47
|
+
/**
|
48
|
+
* autolayout
|
49
|
+
*/
|
50
|
+
if (autoLabel) {
|
51
|
+
var formWidth = formRef.current.getBoundingClientRect().width; // 表单宽度
|
52
|
+
|
53
|
+
var labelArray = schema.map(function (item) {
|
54
|
+
var text = item.title;
|
55
|
+
|
56
|
+
if (isStr(text)) {
|
57
|
+
var _item$decoratorProps;
|
58
|
+
|
59
|
+
if (item.required) {
|
60
|
+
text += '一'; // 必填 + 12
|
61
|
+
}
|
62
|
+
|
63
|
+
if ((_item$decoratorProps = item.decoratorProps) === null || _item$decoratorProps === void 0 ? void 0 : _item$decoratorProps.tooltip) {
|
64
|
+
text += '一'; // 提示 + 18
|
65
|
+
}
|
66
|
+
|
67
|
+
return text;
|
68
|
+
}
|
69
|
+
|
70
|
+
return '';
|
71
|
+
}); // 标题内容集合
|
72
|
+
|
73
|
+
var labelWidthArray = getWidthByCharacterMap(labelArray); // 标题宽度集合
|
74
|
+
|
75
|
+
var _autoWidthBySpace = autoWidthBySpace(labelWidthArray),
|
76
|
+
expectedWidth = _autoWidthBySpace.expectedWidth,
|
77
|
+
consoleArray = _autoWidthBySpace.consoleArray; // 智能计算预期宽度
|
78
|
+
|
79
|
+
|
80
|
+
var expectedCol = Math.ceil(expectedWidth / formWidth * 24); // 预期宽度转换为 Col 值
|
81
|
+
|
82
|
+
setAutoCol({
|
83
|
+
labelCol: expectedCol,
|
84
|
+
wrapperCol: wrapperCol
|
85
|
+
});
|
86
|
+
} else {
|
87
|
+
setAutoCol({
|
88
|
+
labelCol: outLabelCol,
|
89
|
+
wrapperCol: outWrapperCol
|
90
|
+
});
|
91
|
+
}
|
92
|
+
}, [outLabelCol, outWrapperCol]); // Layout配置By断点(配置断点后,目前不支持 Col 更新)
|
93
|
+
|
94
|
+
var autoTeamixLayout = useMemo(function () {
|
95
|
+
return breakpoints === true ? {
|
96
|
+
breakpoints: [480],
|
97
|
+
layout: mergeArrayValue(['vertical'], layout),
|
98
|
+
labelAlign: mergeArrayValue(['left'], labelAlign),
|
99
|
+
wrapperAlign: mergeArrayValue(['left'], wrapperAlign),
|
100
|
+
labelCol: mergeArrayValue([24], labelCol),
|
101
|
+
wrapperCol: mergeArrayValue([24], wrapperCol)
|
102
|
+
} : {
|
103
|
+
breakpoints: isBool(breakpoints) ? undefined : breakpoints,
|
104
|
+
layout: layout,
|
105
|
+
labelAlign: labelAlign,
|
106
|
+
wrapperAlign: wrapperAlign,
|
107
|
+
labelCol: labelCol,
|
108
|
+
wrapperCol: wrapperCol
|
109
|
+
};
|
110
|
+
}, [breakpoints, layout, labelAlign, wrapperAlign, labelCol, wrapperCol]);
|
111
|
+
return autoTeamixLayout;
|
112
|
+
};
|
113
|
+
|
114
|
+
export default useAutoLayout;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
var _excluded = ["title", "decoratorProps"]
|
1
|
+
var _excluded = ["title", "decoratorProps"],
|
2
|
+
_excluded2 = ["title", "dataIndex", "cell", "htmlTitle", "sortable", "width", "align", "alignHeader", "filters", "filterMode", "filterMenuProps", "lock", "resizable", "colSpan"];
|
2
3
|
|
3
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
5
|
|
@@ -12,15 +13,49 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
12
13
|
|
13
14
|
var initializeColumn = function initializeColumn(item) {
|
14
15
|
var title = item.title,
|
15
|
-
decoratorProps = item.decoratorProps,
|
16
|
-
|
16
|
+
_item$decoratorProps = item.decoratorProps,
|
17
|
+
decoratorProps = _item$decoratorProps === void 0 ? {} : _item$decoratorProps,
|
18
|
+
children = _objectWithoutProperties(item, _excluded); // 将Table.Column属性和组件FormItem属性通过decoratorProps统一传入,再分别赋值
|
17
19
|
|
20
|
+
|
21
|
+
var columnTitle = decoratorProps.title,
|
22
|
+
dataIndex = decoratorProps.dataIndex,
|
23
|
+
cell = decoratorProps.cell,
|
24
|
+
htmlTitle = decoratorProps.htmlTitle,
|
25
|
+
sortable = decoratorProps.sortable,
|
26
|
+
width = decoratorProps.width,
|
27
|
+
align = decoratorProps.align,
|
28
|
+
alignHeader = decoratorProps.alignHeader,
|
29
|
+
filters = decoratorProps.filters,
|
30
|
+
filterMode = decoratorProps.filterMode,
|
31
|
+
filterMenuProps = decoratorProps.filterMenuProps,
|
32
|
+
lock = decoratorProps.lock,
|
33
|
+
resizable = decoratorProps.resizable,
|
34
|
+
colSpan = decoratorProps.colSpan,
|
35
|
+
formItemDecoratorProps = _objectWithoutProperties(decoratorProps, _excluded2);
|
36
|
+
|
37
|
+
var columnProperties = {
|
38
|
+
title: title !== null && title !== void 0 ? title : columnTitle,
|
39
|
+
dataIndex: dataIndex,
|
40
|
+
cell: cell,
|
41
|
+
htmlTitle: htmlTitle,
|
42
|
+
sortable: sortable,
|
43
|
+
width: width,
|
44
|
+
align: align,
|
45
|
+
alignHeader: alignHeader,
|
46
|
+
filters: filters,
|
47
|
+
filterMode: filterMode,
|
48
|
+
filterMenuProps: filterMenuProps,
|
49
|
+
lock: lock,
|
50
|
+
resizable: resizable,
|
51
|
+
colSpan: colSpan
|
52
|
+
};
|
18
53
|
return {
|
19
54
|
component: 'ArrayTable.Column',
|
20
|
-
props:
|
21
|
-
|
22
|
-
|
23
|
-
|
55
|
+
props: columnProperties,
|
56
|
+
children: [_objectSpread(_objectSpread({}, children), {}, {
|
57
|
+
decoratorProps: formItemDecoratorProps
|
58
|
+
})]
|
24
59
|
};
|
25
60
|
};
|
26
61
|
|
package/es/form/typing.d.ts
CHANGED
@@ -59,6 +59,9 @@ export interface ProFormSchemaItem {
|
|
59
59
|
data?: AnyObject;
|
60
60
|
}
|
61
61
|
export declare type ProFormSchema = ProFormSchemaItem[];
|
62
|
+
interface AutoLayout {
|
63
|
+
autoLabel?: boolean;
|
64
|
+
}
|
62
65
|
export interface ProFormProps extends Omit<IFormLayoutProps, 'breakpoints'> {
|
63
66
|
form?: FormType | false;
|
64
67
|
schema?: ProFormSchema;
|
@@ -78,6 +81,7 @@ export interface ProFormProps extends Omit<IFormLayoutProps, 'breakpoints'> {
|
|
78
81
|
onSubmitFailed?: (feedbacks: IFormFeedback[]) => void;
|
79
82
|
onInitialComplete?: (form: FormType) => void;
|
80
83
|
breakpoints?: number[] | boolean;
|
84
|
+
autoLayout?: AutoLayout | boolean;
|
81
85
|
}
|
82
86
|
export interface FilterProps extends ProFormProps {
|
83
87
|
form: FormType;
|
package/es/index.d.ts
CHANGED
@@ -28,5 +28,5 @@ export * from './table';
|
|
28
28
|
export * from './sidebar';
|
29
29
|
export * from './utils';
|
30
30
|
export * from './timeline';
|
31
|
-
declare const version = "1.4.
|
31
|
+
declare const version = "1.4.16";
|
32
32
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils, };
|
package/es/index.js
CHANGED
@@ -36,6 +36,6 @@ export * from './table';
|
|
36
36
|
export * from './sidebar';
|
37
37
|
export * from './utils';
|
38
38
|
export * from './timeline';
|
39
|
-
var version = '1.4.
|
39
|
+
var version = '1.4.16';
|
40
40
|
export { version, ProAction, ProCard, ProField, ProForm, ProInfo, // ProLayout,
|
41
41
|
ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, hooks, nocode, templates, utils };
|
package/es/nocode/index.scss
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
.teamix-nocode {
|
1
|
+
.teamix-pro-nocode {
|
2
2
|
&-empty {
|
3
3
|
display: flex;
|
4
4
|
flex-direction: column;
|
@@ -75,7 +75,7 @@
|
|
75
75
|
right: 20px;
|
76
76
|
bottom: 20px;
|
77
77
|
|
78
|
-
|
78
|
+
& > i {
|
79
79
|
cursor: pointer;
|
80
80
|
color: var(--color-text1-8, #848484);
|
81
81
|
background-color: rgba(0, 0, 0, 0.06);
|
@@ -26,7 +26,7 @@ import { useAction } from '../../actions';
|
|
26
26
|
import { initConfigurator } from '../configurators';
|
27
27
|
import { ComponentConfiguratorMap } from '../configurators/map';
|
28
28
|
import { PlayGroundLayout } from '../playground';
|
29
|
-
var cls = usePrefixCls('teamix-nocode');
|
29
|
+
var cls = usePrefixCls('teamix-pro-nocode');
|
30
30
|
export var PagePlayground = function PagePlayground(props) {
|
31
31
|
var _useState = useState(undefined),
|
32
32
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -40,7 +40,7 @@ import PageHeader from '../../page-header';
|
|
40
40
|
import { ProSkeletonRaw } from '../../skeleton';
|
41
41
|
import { usePrefixCls } from '@teamix/utils';
|
42
42
|
import { PageMap } from '.';
|
43
|
-
var cls = usePrefixCls('teamix-nocode');
|
43
|
+
var cls = usePrefixCls('teamix-pro-nocode');
|
44
44
|
|
45
45
|
var Loading = function Loading(props) {
|
46
46
|
return /*#__PURE__*/React.createElement(PageContainer, _objectSpread({
|
package/es/nocode/playground.js
CHANGED
@@ -20,7 +20,7 @@ import React, { useMemo } from 'react';
|
|
20
20
|
import { usePrefixCls } from '@teamix/utils';
|
21
21
|
import { useDebounceFn } from '@teamix/hooks';
|
22
22
|
import { initConfigurator } from './configurators';
|
23
|
-
var cls = usePrefixCls('teamix-nocode-playground');
|
23
|
+
var cls = usePrefixCls('teamix-pro-nocode-playground');
|
24
24
|
export var PlayGroundLayout = function PlayGroundLayout(props) {
|
25
25
|
return /*#__PURE__*/React.createElement("div", {
|
26
26
|
className: cls()
|
@@ -122,14 +122,20 @@ var Layout = function Layout(props) {
|
|
122
122
|
}
|
123
123
|
} else if (mainAction) {
|
124
124
|
// 没传 dataFilter 但是传了 mainAction
|
125
|
-
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
125
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
126
126
|
addonBefore: renderMainAction(),
|
127
|
-
addonAfter: renderAddonAfter()
|
128
|
-
|
127
|
+
addonAfter: renderAddonAfter(),
|
128
|
+
children: afterDataFilter ? /*#__PURE__*/React.createElement("div", {
|
129
|
+
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
130
|
+
}, afterDataFilter) : null
|
131
|
+
}));
|
129
132
|
} else {
|
130
|
-
return /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
131
|
-
addonAfter: renderAddonAfter()
|
132
|
-
|
133
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(QueryFilterLayout, {
|
134
|
+
addonAfter: renderAddonAfter(),
|
135
|
+
children: afterDataFilter ? /*#__PURE__*/React.createElement("div", {
|
136
|
+
className: "mb8 ".concat(cls('after-data-filter-wrapper'))
|
137
|
+
}, afterDataFilter) : null
|
138
|
+
}));
|
133
139
|
}
|
134
140
|
}; // 区域组合渲染
|
135
141
|
|
@@ -15,7 +15,7 @@ var QuickAction = function QuickAction(props) {
|
|
15
15
|
actionRef = props.actionRef,
|
16
16
|
rowSelection = props.rowSelection; // 如果传对象的话,默认为主要文字类型的 ProActionButton
|
17
17
|
|
18
|
-
if (_typeof(quickAction) === 'object') {
|
18
|
+
if (_typeof(quickAction) === 'object' && (quickAction === null || quickAction === void 0 ? void 0 : quickAction.config)) {
|
19
19
|
// 默认 context
|
20
20
|
var defaultContext = {
|
21
21
|
action: actionRef.current,
|
package/es/table/index.js
CHANGED
@@ -32,7 +32,7 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
32
32
|
|
33
33
|
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; }
|
34
34
|
|
35
|
-
import React, { useState, useEffect, useRef } from 'react';
|
35
|
+
import React, { useState, useEffect, useRef, useMemo } from 'react';
|
36
36
|
import { Table, Checkbox } from '@alicloudfe/components';
|
37
37
|
import Pagination from './components/Pagination';
|
38
38
|
import genProColumnToColumn from './utils/genProColumnToColumn';
|
@@ -316,7 +316,11 @@ var ProTable = function ProTable(props) {
|
|
316
316
|
}, []); // 获取header高度,用作全屏吸底吸底高度计算以及固定body高度计算(滚动条在底部)
|
317
317
|
|
318
318
|
var getHeaderHeight = function getHeaderHeight(isFullscreen, offset) {
|
319
|
-
var _tableDom$getElements, _tableDom$getElements2;
|
319
|
+
var _tableDom$getElements, _tableDom$getElements2, _document$querySelect, _document$querySelect2, _document$querySelect3;
|
320
|
+
|
321
|
+
if (!fixedTableBody) {
|
322
|
+
return;
|
323
|
+
}
|
320
324
|
|
321
325
|
var tableDom = tableRef.current;
|
322
326
|
var headerDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements = tableDom.getElementsByClassName('teamix-pro-table-layout')) === null || _tableDom$getElements === void 0 ? void 0 : _tableDom$getElements[0];
|
@@ -326,8 +330,9 @@ var ProTable = function ProTable(props) {
|
|
326
330
|
var tableHeaderDom = tableDom === null || tableDom === void 0 ? void 0 : (_tableDom$getElements2 = tableDom.getElementsByClassName(basePrefix('table-header-inner'))) === null || _tableDom$getElements2 === void 0 ? void 0 : _tableDom$getElements2[0];
|
327
331
|
var pageContainerDom = document.querySelector('.teamix-pro-page-container-header');
|
328
332
|
var teamixNavDom = document.querySelector('.teamix-nav-console');
|
329
|
-
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer');
|
330
|
-
|
333
|
+
var footerRowSelectionDom = document.querySelector('.teamix-pro-page-container-footer'); // 这边不能直接取 next-table-body
|
334
|
+
|
335
|
+
var tableBodyDom = (_document$querySelect = document.querySelector('.teamix-pro-table')) === null || _document$querySelect === void 0 ? void 0 : (_document$querySelect2 = _document$querySelect.getElementsByTagName('table')) === null || _document$querySelect2 === void 0 ? void 0 : (_document$querySelect3 = _document$querySelect2[1]) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.parentNode;
|
331
336
|
var headerFixedTopSectionDom = document.querySelector('.teamix-pro-page-container-fixed-top');
|
332
337
|
setTimeout(function () {
|
333
338
|
var _headerDom$offsetHeig, _tableHeaderDom$offse;
|
@@ -345,9 +350,8 @@ var ProTable = function ProTable(props) {
|
|
345
350
|
var teamixNavHeight = (_teamixNavDom$offsetH = teamixNavDom === null || teamixNavDom === void 0 ? void 0 : teamixNavDom.offsetHeight) !== null && _teamixNavDom$offsetH !== void 0 ? _teamixNavDom$offsetH : 0; // 1 为预留值,js无法取出精确高度,会被四舍五入
|
346
351
|
|
347
352
|
var offsetHeaderHeight = headerHeight + tableHeaderHeight + pageHeaderHeight + teamixNavHeight + footerRowSelectionHeight + 16 + (offset !== null && offset !== void 0 ? offset : 0) + 1;
|
348
|
-
var clientTableBodyHeight = document.body.clientHeight - offsetHeaderHeight;
|
349
353
|
|
350
|
-
if (tableBodyDom.clientHeight <
|
354
|
+
if (tableBodyDom.clientHeight < tableBodyDom.scrollHeight) {
|
351
355
|
setFooterSuctionState(true);
|
352
356
|
} else {
|
353
357
|
setFooterSuctionState(false);
|
@@ -405,6 +409,10 @@ var ProTable = function ProTable(props) {
|
|
405
409
|
|
406
410
|
|
407
411
|
var getFooterSuctionState = function getFooterSuctionState() {
|
412
|
+
if (!footerSuction) {
|
413
|
+
return;
|
414
|
+
}
|
415
|
+
|
408
416
|
var containerDom = document.querySelector('.teamix-pro-page-container-scroll-container');
|
409
417
|
|
410
418
|
if (containerDom) {
|
@@ -803,7 +811,7 @@ var ProTable = function ProTable(props) {
|
|
803
811
|
if (Number.isInteger(time) && time >= 1000) {
|
804
812
|
autoRefreshTimerRef.current = setTimeout(function () {
|
805
813
|
// 自动刷新不显示 loading
|
806
|
-
_request(
|
814
|
+
_request(requestData, true);
|
807
815
|
}, Number(time));
|
808
816
|
}
|
809
817
|
});
|
@@ -1039,8 +1047,22 @@ var ProTable = function ProTable(props) {
|
|
1039
1047
|
className: cls('footer-right-wrapper')
|
1040
1048
|
}, showSkeleton ? /*#__PURE__*/React.createElement(Skeleton.Footer.Pagination, null) : footer));
|
1041
1049
|
}
|
1042
|
-
};
|
1050
|
+
}; // 判断是否需要吸底
|
1043
1051
|
|
1052
|
+
|
1053
|
+
var fixFooterState = useMemo(function () {
|
1054
|
+
if (fullscreenState) {
|
1055
|
+
return true;
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
if (fixedTableBody || footerSuction) {
|
1059
|
+
if (footerSuctionState) {
|
1060
|
+
return true;
|
1061
|
+
}
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
return false;
|
1065
|
+
}, [fullscreenState, fixedTableBody, footerSuction, footerSuctionState]);
|
1044
1066
|
return /*#__PURE__*/React.createElement(FullScreen, {
|
1045
1067
|
visible: fullscreenState,
|
1046
1068
|
actionRef: actionRef
|
@@ -1052,7 +1074,7 @@ var ProTable = function ProTable(props) {
|
|
1052
1074
|
|
1053
1075
|
}),
|
1054
1076
|
ref: tableRef
|
1055
|
-
}, renderTable(isFullScreen),
|
1077
|
+
}, renderTable(isFullScreen), fixFooterState && /*#__PURE__*/React.createElement(ProPageContainer.FixedFooter, null, renderFooter()), !fixFooterState && renderFooter());
|
1056
1078
|
});
|
1057
1079
|
};
|
1058
1080
|
|