@innoways/form-generator 9.0.7 → 9.0.8
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/CHANGELOG.md +11 -0
- package/dist/index.js +33 -6
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feat: add dynamic variable support for form data in ActionField and utility functions 9.0.8
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @innoways/utils@9.0.8
|
|
10
|
+
- @innoways/drip-form@9.0.8
|
|
11
|
+
- @innoways/drip-form-theme-antd@9.0.8
|
|
12
|
+
- @innoways/hooks@9.0.8
|
|
13
|
+
|
|
3
14
|
## 9.0.7
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -9177,6 +9177,7 @@ var styles = {"switch":"index-module_switch__1V9Dw"};
|
|
|
9177
9177
|
function ownKeys$1(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; }
|
|
9178
9178
|
|
|
9179
9179
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9180
|
+
var DYNAMIC_VAR_REGEX = /^\{\{formData\.([^.{}]+)\.formvalue\}\}$/; // TODO 支持设置组件的样式(根据组件的样式配置面板自动生成);支持设置组件的校验和错误信息(根据组件的校验配置自动生成)
|
|
9180
9181
|
|
|
9181
9182
|
var typeOptions = [{
|
|
9182
9183
|
label: 'Form style',
|
|
@@ -9191,6 +9192,9 @@ var typeOptions = [{
|
|
|
9191
9192
|
options: [{
|
|
9192
9193
|
label: 'Set component value',
|
|
9193
9194
|
value: 'data'
|
|
9195
|
+
}, {
|
|
9196
|
+
label: 'Set component dynamic value',
|
|
9197
|
+
value: 'dynamic'
|
|
9194
9198
|
}]
|
|
9195
9199
|
}, {
|
|
9196
9200
|
label: 'Interface',
|
|
@@ -9202,10 +9206,20 @@ var typeOptions = [{
|
|
|
9202
9206
|
}];
|
|
9203
9207
|
|
|
9204
9208
|
var Action = function Action(_ref) {
|
|
9209
|
+
var _DYNAMIC_VAR_REGEX$ex, _DYNAMIC_VAR_REGEX$ex2;
|
|
9210
|
+
|
|
9205
9211
|
var effect = _ref.effect,
|
|
9206
9212
|
_onChange = _ref.onChange;
|
|
9207
9213
|
var fieldKey = effect.fieldKey,
|
|
9208
|
-
value = effect.value;
|
|
9214
|
+
value = effect.value; // Track dynamic mode locally so selecting 'dynamic' doesn't revert when value is empty
|
|
9215
|
+
|
|
9216
|
+
var _useState = useState(function () {
|
|
9217
|
+
return typeof value === 'string' && DYNAMIC_VAR_REGEX.test(value);
|
|
9218
|
+
}),
|
|
9219
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9220
|
+
isDynamic = _useState2[0],
|
|
9221
|
+
setIsDynamic = _useState2[1];
|
|
9222
|
+
|
|
9209
9223
|
var actionType = useMemo(function () {
|
|
9210
9224
|
var actionType = 'data';
|
|
9211
9225
|
|
|
@@ -9216,7 +9230,7 @@ var Action = function Action(_ref) {
|
|
|
9216
9230
|
|
|
9217
9231
|
switch (type) {
|
|
9218
9232
|
case 'data':
|
|
9219
|
-
actionType = 'data';
|
|
9233
|
+
actionType = isDynamic ? 'dynamic' : 'data';
|
|
9220
9234
|
break;
|
|
9221
9235
|
|
|
9222
9236
|
case 'uiSchema':
|
|
@@ -9227,7 +9241,7 @@ var Action = function Action(_ref) {
|
|
|
9227
9241
|
}
|
|
9228
9242
|
|
|
9229
9243
|
return actionType;
|
|
9230
|
-
}, [fieldKey]);
|
|
9244
|
+
}, [fieldKey, isDynamic]);
|
|
9231
9245
|
return /*#__PURE__*/React.createElement(Space, {
|
|
9232
9246
|
align: "start"
|
|
9233
9247
|
}, /*#__PURE__*/React.createElement(SelectField$1, {
|
|
@@ -9247,17 +9261,22 @@ var Action = function Action(_ref) {
|
|
|
9247
9261
|
options: typeOptions,
|
|
9248
9262
|
value: actionType,
|
|
9249
9263
|
style: {
|
|
9250
|
-
width:
|
|
9264
|
+
width: 200
|
|
9251
9265
|
},
|
|
9252
9266
|
onChange: function onChange(value) {
|
|
9267
|
+
setIsDynamic(value === 'dynamic');
|
|
9253
9268
|
var fieldKey = effect.fieldKey.split(' ').shift(); // 设置的类型 data、uiSchema、dataSchema
|
|
9269
|
+
// 'dynamic' is a UI-only mode that maps to 'data' in the fieldKey
|
|
9254
9270
|
|
|
9255
|
-
var
|
|
9271
|
+
var effectiveValue = value === 'dynamic' ? 'data' : value;
|
|
9272
|
+
var typeProperty = effectiveValue.split('.');
|
|
9256
9273
|
var type = typeProperty.shift();
|
|
9257
9274
|
var property = typeProperty.join('.');
|
|
9258
9275
|
|
|
9259
9276
|
_onChange(_objectSpread$1(_objectSpread$1({}, effect), {}, {
|
|
9260
|
-
fieldKey: "".concat(fieldKey, " ").concat(type).concat(type != 'data' ? " ".concat(property) : '')
|
|
9277
|
+
fieldKey: "".concat(fieldKey, " ").concat(type).concat(type != 'data' ? " ".concat(property) : ''),
|
|
9278
|
+
// Clear value when switching modes
|
|
9279
|
+
value: value === 'dynamic' ? '' : effect.value
|
|
9261
9280
|
}, property === 'vcontrol' && typeCheck(effect.value) != 'Boolean' && {
|
|
9262
9281
|
value: !!effect.value
|
|
9263
9282
|
}));
|
|
@@ -9283,6 +9302,14 @@ var Action = function Action(_ref) {
|
|
|
9283
9302
|
},
|
|
9284
9303
|
depencyKey: fieldKey,
|
|
9285
9304
|
mode: "set"
|
|
9305
|
+
}), actionType === 'dynamic' && /*#__PURE__*/React.createElement(SelectField$1, {
|
|
9306
|
+
value: typeof value === 'string' ? (_DYNAMIC_VAR_REGEX$ex = (_DYNAMIC_VAR_REGEX$ex2 = DYNAMIC_VAR_REGEX.exec(value)) === null || _DYNAMIC_VAR_REGEX$ex2 === void 0 ? void 0 : _DYNAMIC_VAR_REGEX$ex2[1]) !== null && _DYNAMIC_VAR_REGEX$ex !== void 0 ? _DYNAMIC_VAR_REGEX$ex : '' : '',
|
|
9307
|
+
placeholder: "Select source field",
|
|
9308
|
+
onChange: function onChange(selectedKey) {
|
|
9309
|
+
_onChange(_objectSpread$1(_objectSpread$1({}, effect), {}, {
|
|
9310
|
+
value: selectedKey ? "{{formData.".concat(selectedKey, ".formvalue}}") : ''
|
|
9311
|
+
}));
|
|
9312
|
+
}
|
|
9286
9313
|
}));
|
|
9287
9314
|
};
|
|
9288
9315
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innoways/form-generator",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.8",
|
|
4
4
|
"description": "drip-form 生成器",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"hooks",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"@dnd-kit/modifiers": "^4.0.0",
|
|
38
38
|
"@dnd-kit/sortable": "^5.0.0",
|
|
39
39
|
"@dnd-kit/utilities": "^3.0.0",
|
|
40
|
-
"@innoways/drip-form": "^9.0.
|
|
41
|
-
"@innoways/drip-form-theme-antd": "^9.0.
|
|
42
|
-
"@innoways/hooks": "^9.0.
|
|
43
|
-
"@innoways/utils": "^9.0.
|
|
40
|
+
"@innoways/drip-form": "^9.0.8",
|
|
41
|
+
"@innoways/drip-form-theme-antd": "^9.0.8",
|
|
42
|
+
"@innoways/hooks": "^9.0.8",
|
|
43
|
+
"@innoways/utils": "^9.0.8",
|
|
44
44
|
"@monaco-editor/react": "^4.8.0-rc.2",
|
|
45
45
|
"monaco-editor": "^0.52.0",
|
|
46
46
|
"antd": "^4.16.13",
|