@luck-design-biz/luckda 0.0.25-16 → 0.0.25-18
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.
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
"label": "getInstance",
|
|
83
83
|
"kind": "method",
|
|
84
84
|
"insertText": "getInstance",
|
|
85
|
-
"documentation": " /**\
|
|
85
|
+
"documentation": " /**\n * 获取表格实例\n * @method\n */"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"label": "submit",
|
|
89
89
|
"kind": "method",
|
|
90
90
|
"insertText": "submit",
|
|
91
|
-
"documentation": " /**\
|
|
91
|
+
"documentation": " /**\n * 提交表格数据\n * @method\n */"
|
|
92
92
|
}
|
|
93
93
|
]
|
|
94
94
|
},
|
|
@@ -5,7 +5,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
var _excluded = ["advance"];
|
|
7
7
|
import React, { useRef, forwardRef, Fragment, useImperativeHandle, useEffect } from 'react';
|
|
8
|
-
import { useMemoizedFn, useCreation
|
|
8
|
+
import { useMemoizedFn, useCreation } from 'ahooks';
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import { reduce, includes, isNil, cloneDeep, last, startsWith, isString } from 'lodash';
|
|
11
11
|
import { BasicDivider } from 'luck-design';
|
|
@@ -102,11 +102,6 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
102
102
|
return !hidden;
|
|
103
103
|
});
|
|
104
104
|
}, [blocks]);
|
|
105
|
-
useMount(function () {
|
|
106
|
-
ctx.doAction(advance.events.onMount, {
|
|
107
|
-
instance: formRef.current
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
105
|
useEffect(function () {
|
|
111
106
|
var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref5) {
|
|
112
107
|
var resource = _ref5.resource,
|
|
@@ -126,16 +121,16 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
126
121
|
}, []);
|
|
127
122
|
useImperativeHandle(apiRef, function () {
|
|
128
123
|
return {
|
|
129
|
-
/**
|
|
130
|
-
* 获取表格实例
|
|
131
|
-
* @method
|
|
124
|
+
/**
|
|
125
|
+
* 获取表格实例
|
|
126
|
+
* @method
|
|
132
127
|
*/
|
|
133
128
|
getInstance: function getInstance() {
|
|
134
129
|
return formRef.current;
|
|
135
130
|
},
|
|
136
|
-
/**
|
|
137
|
-
* 提交表格数据
|
|
138
|
-
* @method
|
|
131
|
+
/**
|
|
132
|
+
* 提交表格数据
|
|
133
|
+
* @method
|
|
139
134
|
*/
|
|
140
135
|
submit: function submit() {
|
|
141
136
|
return new Promise(function (resolve) {
|
|
@@ -151,39 +146,39 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
151
146
|
}
|
|
152
147
|
});
|
|
153
148
|
},
|
|
154
|
-
/**
|
|
155
|
-
* @typedef {Object} Field
|
|
156
|
-
* @property {Object} target - 字段引用
|
|
157
|
-
* @property {boolean} disabled - 字段不可维护
|
|
158
|
-
* @property {boolean} required - 字段必填
|
|
159
|
-
* @property {any} value - 字段值
|
|
149
|
+
/**
|
|
150
|
+
* @typedef {Object} Field
|
|
151
|
+
* @property {Object} target - 字段引用
|
|
152
|
+
* @property {boolean} disabled - 字段不可维护
|
|
153
|
+
* @property {boolean} required - 字段必填
|
|
154
|
+
* @property {any} value - 字段值
|
|
160
155
|
*/
|
|
161
|
-
/**
|
|
162
|
-
* @typedef {Object} Block
|
|
163
|
-
* @property {Object} target - 区块引用
|
|
164
|
-
* @property {function(fieldName): Field} getField - 获取区块下的表单域
|
|
156
|
+
/**
|
|
157
|
+
* @typedef {Object} Block
|
|
158
|
+
* @property {Object} target - 区块引用
|
|
159
|
+
* @property {function(fieldName): Field} getField - 获取区块下的表单域
|
|
165
160
|
*/
|
|
166
|
-
/**
|
|
167
|
-
* 获取区块
|
|
168
|
-
* @param {*} blockId - 区块ID
|
|
169
|
-
* @returns {Block}
|
|
161
|
+
/**
|
|
162
|
+
* 获取区块
|
|
163
|
+
* @param {*} blockId - 区块ID
|
|
164
|
+
* @returns {Block}
|
|
170
165
|
*/
|
|
171
166
|
getBlock: function getBlock(blockId) {
|
|
172
167
|
var instance = formRef.current;
|
|
173
168
|
var block = instance.formRefs[blockId];
|
|
174
169
|
if (!block) {
|
|
175
|
-
console.
|
|
170
|
+
console.error('未发现区块');
|
|
176
171
|
return {};
|
|
177
172
|
}
|
|
178
173
|
var getField = function getField(fieldName) {
|
|
179
174
|
if (block.current.props.type !== 'auto') {
|
|
180
|
-
console.
|
|
175
|
+
console.error('该区块无法获取表单域');
|
|
181
176
|
return {};
|
|
182
177
|
}
|
|
183
178
|
var basicForm = block.current.props.wrappedComponentRef.current;
|
|
184
179
|
var field = basicForm.fieldsRef[fieldName];
|
|
185
180
|
if (!field) {
|
|
186
|
-
console.
|
|
181
|
+
console.error("\u672A\u53D1\u73B0".concat(fieldName, "\u5B57\u6BB5"));
|
|
187
182
|
return {};
|
|
188
183
|
}
|
|
189
184
|
return new Proxy({
|
|
@@ -507,6 +502,11 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
507
502
|
};
|
|
508
503
|
}());
|
|
509
504
|
});
|
|
505
|
+
var afterInit = useMemoizedFn(function () {
|
|
506
|
+
ctx.doAction(advance.events.onMount, {
|
|
507
|
+
instance: formRef.current
|
|
508
|
+
});
|
|
509
|
+
});
|
|
510
510
|
var afterSubmit = useMemoizedFn(function (success, mainKey, res) {
|
|
511
511
|
ctx.doAction(advance.events.onSaveCallback, {
|
|
512
512
|
success: success,
|
|
@@ -562,7 +562,8 @@ var LCForm = /*#__PURE__*/forwardRef(function (_ref3, ref) {
|
|
|
562
562
|
rest[_key5] = arguments[_key5];
|
|
563
563
|
}
|
|
564
564
|
return (_promiseRef$current = promiseRef.current) === null || _promiseRef$current === void 0 ? void 0 : _promiseRef$current.call.apply(_promiseRef$current, [promiseRef].concat(rest));
|
|
565
|
-
}
|
|
565
|
+
},
|
|
566
|
+
afterInit: afterInit
|
|
566
567
|
}));
|
|
567
568
|
});
|
|
568
569
|
LCForm.defaultProps = omitBadProps(defaultMeta);
|
|
@@ -82,13 +82,13 @@
|
|
|
82
82
|
"label": "getInstance",
|
|
83
83
|
"kind": "method",
|
|
84
84
|
"insertText": "getInstance",
|
|
85
|
-
"documentation": " /**\
|
|
85
|
+
"documentation": " /**\n * 获取表格实例\n * @method\n */"
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
88
|
"label": "submit",
|
|
89
89
|
"kind": "method",
|
|
90
90
|
"insertText": "submit",
|
|
91
|
-
"documentation": " /**\
|
|
91
|
+
"documentation": " /**\n * 提交表格数据\n * @method\n */"
|
|
92
92
|
}
|
|
93
93
|
]
|
|
94
94
|
},
|
|
@@ -110,11 +110,6 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
110
110
|
return !hidden;
|
|
111
111
|
});
|
|
112
112
|
}, [blocks]);
|
|
113
|
-
(0, _ahooks.useMount)(function () {
|
|
114
|
-
ctx.doAction(advance.events.onMount, {
|
|
115
|
-
instance: formRef.current
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
113
|
(0, _react.useEffect)(function () {
|
|
119
114
|
var tid = ctx.$subscriber(ctx.topics.PAGE_PUBLIC_RESOURCE_CHANGED).on(function (_ref5) {
|
|
120
115
|
var resource = _ref5.resource,
|
|
@@ -134,16 +129,16 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
134
129
|
}, []);
|
|
135
130
|
(0, _react.useImperativeHandle)(apiRef, function () {
|
|
136
131
|
return {
|
|
137
|
-
/**
|
|
138
|
-
* 获取表格实例
|
|
139
|
-
* @method
|
|
132
|
+
/**
|
|
133
|
+
* 获取表格实例
|
|
134
|
+
* @method
|
|
140
135
|
*/
|
|
141
136
|
getInstance: function getInstance() {
|
|
142
137
|
return formRef.current;
|
|
143
138
|
},
|
|
144
|
-
/**
|
|
145
|
-
* 提交表格数据
|
|
146
|
-
* @method
|
|
139
|
+
/**
|
|
140
|
+
* 提交表格数据
|
|
141
|
+
* @method
|
|
147
142
|
*/
|
|
148
143
|
submit: function submit() {
|
|
149
144
|
return new Promise(function (resolve) {
|
|
@@ -159,39 +154,39 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
159
154
|
}
|
|
160
155
|
});
|
|
161
156
|
},
|
|
162
|
-
/**
|
|
163
|
-
* @typedef {Object} Field
|
|
164
|
-
* @property {Object} target - 字段引用
|
|
165
|
-
* @property {boolean} disabled - 字段不可维护
|
|
166
|
-
* @property {boolean} required - 字段必填
|
|
167
|
-
* @property {any} value - 字段值
|
|
157
|
+
/**
|
|
158
|
+
* @typedef {Object} Field
|
|
159
|
+
* @property {Object} target - 字段引用
|
|
160
|
+
* @property {boolean} disabled - 字段不可维护
|
|
161
|
+
* @property {boolean} required - 字段必填
|
|
162
|
+
* @property {any} value - 字段值
|
|
168
163
|
*/
|
|
169
|
-
/**
|
|
170
|
-
* @typedef {Object} Block
|
|
171
|
-
* @property {Object} target - 区块引用
|
|
172
|
-
* @property {function(fieldName): Field} getField - 获取区块下的表单域
|
|
164
|
+
/**
|
|
165
|
+
* @typedef {Object} Block
|
|
166
|
+
* @property {Object} target - 区块引用
|
|
167
|
+
* @property {function(fieldName): Field} getField - 获取区块下的表单域
|
|
173
168
|
*/
|
|
174
|
-
/**
|
|
175
|
-
* 获取区块
|
|
176
|
-
* @param {*} blockId - 区块ID
|
|
177
|
-
* @returns {Block}
|
|
169
|
+
/**
|
|
170
|
+
* 获取区块
|
|
171
|
+
* @param {*} blockId - 区块ID
|
|
172
|
+
* @returns {Block}
|
|
178
173
|
*/
|
|
179
174
|
getBlock: function getBlock(blockId) {
|
|
180
175
|
var instance = formRef.current;
|
|
181
176
|
var block = instance.formRefs[blockId];
|
|
182
177
|
if (!block) {
|
|
183
|
-
console.
|
|
178
|
+
console.error('未发现区块');
|
|
184
179
|
return {};
|
|
185
180
|
}
|
|
186
181
|
var getField = function getField(fieldName) {
|
|
187
182
|
if (block.current.props.type !== 'auto') {
|
|
188
|
-
console.
|
|
183
|
+
console.error('该区块无法获取表单域');
|
|
189
184
|
return {};
|
|
190
185
|
}
|
|
191
186
|
var basicForm = block.current.props.wrappedComponentRef.current;
|
|
192
187
|
var field = basicForm.fieldsRef[fieldName];
|
|
193
188
|
if (!field) {
|
|
194
|
-
console.
|
|
189
|
+
console.error("\u672A\u53D1\u73B0".concat(fieldName, "\u5B57\u6BB5"));
|
|
195
190
|
return {};
|
|
196
191
|
}
|
|
197
192
|
return new Proxy({
|
|
@@ -515,6 +510,11 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
515
510
|
};
|
|
516
511
|
}());
|
|
517
512
|
});
|
|
513
|
+
var afterInit = (0, _ahooks.useMemoizedFn)(function () {
|
|
514
|
+
ctx.doAction(advance.events.onMount, {
|
|
515
|
+
instance: formRef.current
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
518
|
var afterSubmit = (0, _ahooks.useMemoizedFn)(function (success, mainKey, res) {
|
|
519
519
|
ctx.doAction(advance.events.onSaveCallback, {
|
|
520
520
|
success: success,
|
|
@@ -570,7 +570,8 @@ var LCForm = /*#__PURE__*/(0, _react.forwardRef)(function (_ref3, ref) {
|
|
|
570
570
|
rest[_key5] = arguments[_key5];
|
|
571
571
|
}
|
|
572
572
|
return (_promiseRef$current = promiseRef.current) === null || _promiseRef$current === void 0 ? void 0 : _promiseRef$current.call.apply(_promiseRef$current, [promiseRef].concat(rest));
|
|
573
|
-
}
|
|
573
|
+
},
|
|
574
|
+
afterInit: afterInit
|
|
574
575
|
}));
|
|
575
576
|
});
|
|
576
577
|
LCForm.defaultProps = (0, _helper.omitBadProps)(_formPropsDefault.default);
|
package/package.json
CHANGED