amis-core 3.2.0 → 3.3.0
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/esm/Root.js +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +3 -3
- package/esm/SchemaRenderer.js +5 -2
- package/esm/Scoped.d.ts +4 -1
- package/esm/Scoped.js +8 -5
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +62 -37
- package/esm/actions/AjaxAction.d.ts +6 -8
- package/esm/actions/AjaxAction.js +20 -18
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.d.ts +1 -2
- package/esm/actions/CmptAction.js +46 -31
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -2
- package/esm/actions/DialogAction.js +5 -6
- package/esm/actions/DrawerAction.js +4 -4
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/StatusAction.d.ts +15 -0
- package/esm/actions/StatusAction.js +49 -0
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/actions/index.d.ts +1 -0
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +2 -2
- package/esm/components/PopOver.js +2 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +2 -1
- package/esm/index.js +13 -13
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +6 -6
- package/esm/renderers/Form.js +168 -124
- package/esm/renderers/Item.d.ts +42 -66
- package/esm/renderers/Item.js +11 -41
- package/esm/renderers/Options.js +1 -2
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/register.js +1 -1
- package/esm/renderers/wrapControl.js +101 -47
- package/esm/store/app.js +8 -4
- package/esm/store/combo.d.ts +444 -1912
- package/esm/store/combo.js +9 -2
- package/esm/store/crud.d.ts +1 -0
- package/esm/store/crud.js +11 -5
- package/esm/store/form.d.ts +132 -892
- package/esm/store/form.js +83 -81
- package/esm/store/formItem.d.ts +5 -2
- package/esm/store/formItem.js +13 -2
- package/esm/store/iRenderer.js +2 -2
- package/esm/store/index.js +1 -1
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +2 -2
- package/esm/store/service.js +4 -4
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +503 -2040
- package/esm/store/table.js +79 -55
- package/esm/store/table2.d.ts +49 -0
- package/esm/store/table2.js +37 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +17 -3
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.js +1 -1
- package/esm/utils/DataScope.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.d.ts +2 -2
- package/esm/utils/api.js +113 -81
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +4 -2
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.d.ts +2 -0
- package/esm/utils/debug.js +34 -7
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +1 -1
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.d.ts +0 -1
- package/esm/utils/formula.js +6 -9
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +11 -1
- package/esm/utils/helper.js +14 -2
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +4 -2
- package/esm/utils/icon.js +3 -2
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.d.ts +3 -0
- package/esm/utils/math.js +52 -0
- package/esm/utils/memoryParse.js +1 -1
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.d.ts +7 -0
- package/esm/utils/object.js +13 -2
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +2 -2
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.d.ts +1 -1
- package/esm/utils/renderer-event.js +14 -6
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.js +1 -1
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +1 -1
- package/esm/utils/scrollPosition.js +1 -1
- package/esm/utils/string2regExp.js +1 -1
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style-helper.js +1 -1
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.js +1 -1
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +1 -1
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/lib/Root.js +10 -7
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +11 -8
- package/lib/SchemaRenderer.js +12 -6
- package/lib/Scoped.d.ts +4 -1
- package/lib/Scoped.js +18 -13
- package/lib/StatusScoped.js +5 -2
- package/lib/WithRootStore.js +5 -2
- package/lib/WithStore.js +5 -2
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +62 -37
- package/lib/actions/AjaxAction.d.ts +6 -8
- package/lib/actions/AjaxAction.js +20 -18
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.d.ts +1 -2
- package/lib/actions/CmptAction.js +46 -31
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +8 -5
- package/lib/actions/DialogAction.js +5 -6
- package/lib/actions/DrawerAction.js +4 -4
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/StatusAction.d.ts +15 -0
- package/lib/actions/StatusAction.js +53 -0
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/actions/index.d.ts +1 -0
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/LazyComponent.js +12 -14
- package/lib/components/Overlay.js +14 -14
- package/lib/components/PopOver.js +11 -10
- package/lib/env.js +4 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +11 -9
- package/lib/index.d.ts +2 -1
- package/lib/index.js +21 -19
- package/lib/locale.js +6 -3
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +6 -6
- package/lib/renderers/Form.js +180 -131
- package/lib/renderers/Item.d.ts +42 -66
- package/lib/renderers/Item.js +51 -75
- package/lib/renderers/Options.js +10 -5
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/register.js +1 -1
- package/lib/renderers/wrapControl.js +104 -47
- package/lib/store/app.js +14 -7
- package/lib/store/combo.d.ts +444 -1912
- package/lib/store/combo.js +9 -2
- package/lib/store/crud.d.ts +1 -0
- package/lib/store/crud.js +11 -5
- package/lib/store/form.d.ts +132 -892
- package/lib/store/form.js +81 -79
- package/lib/store/formItem.d.ts +5 -2
- package/lib/store/formItem.js +13 -2
- package/lib/store/iRenderer.js +8 -5
- package/lib/store/index.js +1 -1
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +8 -5
- package/lib/store/service.js +4 -4
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +503 -2040
- package/lib/store/table.js +79 -55
- package/lib/store/table2.d.ts +49 -0
- package/lib/store/table2.js +36 -3
- package/lib/theme.js +6 -3
- package/lib/types.d.ts +17 -3
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.js +1 -1
- package/lib/utils/DataScope.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.d.ts +2 -2
- package/lib/utils/api.js +113 -81
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +8 -6
- package/lib/utils/dataMapping.js +4 -2
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.d.ts +2 -0
- package/lib/utils/debug.js +61 -33
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +7 -5
- package/lib/utils/errors.js +1 -1
- package/lib/utils/escapeHtml.js +1 -1
- package/lib/utils/filter-schema.js +1 -1
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.d.ts +0 -1
- package/lib/utils/formula.js +6 -10
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +11 -1
- package/lib/utils/helper.js +14 -1
- package/lib/utils/highlight.js +8 -9
- package/lib/utils/icon.d.ts +4 -2
- package/lib/utils/icon.js +12 -10
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.d.ts +3 -0
- package/lib/utils/math.js +58 -0
- package/lib/utils/memoryParse.js +1 -1
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.d.ts +7 -0
- package/lib/utils/object.js +13 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +7 -3
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.d.ts +1 -1
- package/lib/utils/renderer-event.js +13 -5
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.js +1 -1
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +1 -1
- package/lib/utils/scrollPosition.js +1 -1
- package/lib/utils/string2regExp.js +1 -1
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style-helper.js +1 -1
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.js +1 -1
- package/lib/utils/tpl-builtin.js +1 -1
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +1 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -32,20 +32,23 @@ var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
|
32
32
|
var hoistNonReactStatic__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatic);
|
|
33
33
|
var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
|
|
34
34
|
|
|
35
|
+
var __react_jsx__ = require('react');
|
|
36
|
+
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
|
|
37
|
+
(__react_jsx__["default"] || __react_jsx__).Fragment;
|
|
35
38
|
function wrapControl(ComposedComponent) {
|
|
36
39
|
var _a;
|
|
37
40
|
var result = hoistNonReactStatic__default["default"](WithRootStore.withRootStore(mobxReact.observer((_a = /** @class */ (function (_super) {
|
|
38
41
|
tslib.__extends(class_1, _super);
|
|
39
42
|
function class_1(props) {
|
|
40
43
|
var _this = this;
|
|
41
|
-
var _a
|
|
44
|
+
var _a;
|
|
42
45
|
_this = _super.call(this, props) || this;
|
|
43
46
|
_this.value = undefined;
|
|
44
47
|
_this.lazyEmitChange = debounce__default["default"](_this.emitChange.bind(_this), 250, {
|
|
45
48
|
trailing: true,
|
|
46
49
|
leading: false
|
|
47
50
|
});
|
|
48
|
-
var
|
|
51
|
+
var _b = _this.props, form = _b.formStore, formItem$1 = _b.formItem, rootStore = _b.rootStore, store = _b.store, onChange = _b.onChange, data = _b.data, inputGroupControl = _b.inputGroupControl, _c = _b.$schema, name = _c.name, id = _c.id, type = _c.type, required = _c.required, validations = _c.validations, validationErrors = _c.validationErrors, unique = _c.unique, value = _c.value, extraName = _c.extraName; _c.multiple; var delimiter = _c.delimiter, valueField = _c.valueField, labelField = _c.labelField, joinValues = _c.joinValues, extractValue = _c.extractValue, selectFirst = _c.selectFirst, autoFill = _c.autoFill, clearValueOnHidden = _c.clearValueOnHidden, validateApi = _c.validateApi, minLength = _c.minLength, maxLength = _c.maxLength, validateOnChange = _c.validateOnChange, label = _c.label;
|
|
49
52
|
_this.getValue = _this.getValue.bind(_this);
|
|
50
53
|
_this.setValue = _this.setValue.bind(_this);
|
|
51
54
|
_this.handleChange = _this.handleChange.bind(_this);
|
|
@@ -76,7 +79,7 @@ function wrapControl(ComposedComponent) {
|
|
|
76
79
|
_this.model = model;
|
|
77
80
|
// @issue 打算干掉这个
|
|
78
81
|
formItem$1 === null || formItem$1 === void 0 ? void 0 : formItem$1.addSubFormItem(model);
|
|
79
|
-
model.config(tslib.__assign(tslib.__assign({}, pick__default["default"](tslib.__assign(tslib.__assign({}, ComposedComponent.defaultProps), _this.props.$schema), ['multiple'])), { id: id, type: type, required: required, unique: unique, value: value, isValueSchemaExp: formula.isExpression(value), rules: validations, messages: validationErrors, delimiter: delimiter, valueField: valueField, labelField: labelField, joinValues: joinValues, extractValue: extractValue, selectFirst: selectFirst, autoFill: autoFill, clearValueOnHidden: clearValueOnHidden, validateApi: validateApi, minLength: minLength, maxLength: maxLength, validateOnChange: validateOnChange, label: label, inputGroupControl: inputGroupControl }));
|
|
82
|
+
model.config(tslib.__assign(tslib.__assign({}, pick__default["default"](tslib.__assign(tslib.__assign({}, ComposedComponent.defaultProps), _this.props.$schema), ['multiple'])), { id: id, type: type, required: required, unique: unique, value: value, isValueSchemaExp: formula.isExpression(value), rules: validations, messages: validationErrors, delimiter: delimiter, valueField: valueField, labelField: labelField, joinValues: joinValues, extractValue: extractValue, selectFirst: selectFirst, autoFill: autoFill, clearValueOnHidden: clearValueOnHidden, validateApi: validateApi, minLength: minLength, maxLength: maxLength, validateOnChange: validateOnChange, label: label, inputGroupControl: inputGroupControl, extraName: extraName }));
|
|
80
83
|
// issue 这个逻辑应该在 combo 里面自己实现。
|
|
81
84
|
if (_this.model.unique &&
|
|
82
85
|
((_a = form === null || form === void 0 ? void 0 : form.parentStore) === null || _a === void 0 ? void 0 : _a.storeType) === combo.ComboStore.name) {
|
|
@@ -88,19 +91,39 @@ function wrapControl(ComposedComponent) {
|
|
|
88
91
|
model.changeTmpValue(propValue, 'controlled');
|
|
89
92
|
}
|
|
90
93
|
else {
|
|
91
|
-
// 备注: 此处的 value 是 schema 中的 value(和props.defaultValue相同)
|
|
92
94
|
var isExp = formula.isExpression(value);
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
if (isExp) {
|
|
96
|
+
model.changeTmpValue(formula.FormulaExec['formula'](value, data), // 对组件默认值进行运算
|
|
97
|
+
'formulaChanged');
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
var initialValue = model.extraName
|
|
101
|
+
? [
|
|
102
|
+
store === null || store === void 0 ? void 0 : store.getValueByName(model.name, form === null || form === void 0 ? void 0 : form.canAccessSuperData),
|
|
103
|
+
store === null || store === void 0 ? void 0 : store.getValueByName(model.extraName, form === null || form === void 0 ? void 0 : form.canAccessSuperData)
|
|
104
|
+
]
|
|
105
|
+
: store === null || store === void 0 ? void 0 : store.getValueByName(model.name, form === null || form === void 0 ? void 0 : form.canAccessSuperData);
|
|
106
|
+
if (model.extraName &&
|
|
107
|
+
initialValue.every(function (item) { return item === undefined; })) {
|
|
108
|
+
initialValue = undefined;
|
|
109
|
+
}
|
|
110
|
+
model.changeTmpValue(initialValue !== null && initialValue !== void 0 ? initialValue : formula.replaceExpression(value), typeof initialValue !== 'undefined'
|
|
111
|
+
? 'initialValue'
|
|
112
|
+
: 'defaultValue');
|
|
113
|
+
}
|
|
98
114
|
}
|
|
99
115
|
if (onChange &&
|
|
100
116
|
value !== undefined &&
|
|
101
117
|
model.tmpValue !== undefined) {
|
|
102
118
|
// 组件默认值支持表达式需要: 避免初始化时上下文中丢失组件默认值
|
|
103
|
-
|
|
119
|
+
if (model.extraName) {
|
|
120
|
+
var values = model.splitExtraValue(model.tmpValue);
|
|
121
|
+
onChange(values[0], model.name, false, true);
|
|
122
|
+
onChange(values[1], model.extraName, false, true);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
onChange(model.tmpValue, model.name, false, true);
|
|
126
|
+
}
|
|
104
127
|
}
|
|
105
128
|
else if (onChange &&
|
|
106
129
|
typeof propValue === 'undefined' &&
|
|
@@ -110,7 +133,14 @@ function wrapControl(ComposedComponent) {
|
|
|
110
133
|
// 对应 issue 为 https://github.com/baidu/amis/issues/2674
|
|
111
134
|
(store === null || store === void 0 ? void 0 : store.storeType) !== table.TableStore.name) {
|
|
112
135
|
// 如果没有初始值,通过 onChange 设置过去
|
|
113
|
-
|
|
136
|
+
if (model.extraName) {
|
|
137
|
+
var values = model.splitExtraValue(model.tmpValue);
|
|
138
|
+
onChange(values[0], model.name, false, true);
|
|
139
|
+
onChange(values[1], model.extraName, false, true);
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
onChange(model.tmpValue, model.name, false, true);
|
|
143
|
+
}
|
|
114
144
|
}
|
|
115
145
|
return _this;
|
|
116
146
|
}
|
|
@@ -137,7 +167,7 @@ function wrapControl(ComposedComponent) {
|
|
|
137
167
|
}
|
|
138
168
|
};
|
|
139
169
|
class_1.prototype.componentDidUpdate = function (prevProps) {
|
|
140
|
-
var _a, _b;
|
|
170
|
+
var _a, _b, _c;
|
|
141
171
|
var props = this.props;
|
|
142
172
|
props.formStore;
|
|
143
173
|
var model = this.model;
|
|
@@ -162,7 +192,8 @@ function wrapControl(ComposedComponent) {
|
|
|
162
192
|
'validateApi',
|
|
163
193
|
'minLength',
|
|
164
194
|
'maxLength',
|
|
165
|
-
'label'
|
|
195
|
+
'label',
|
|
196
|
+
'extraName'
|
|
166
197
|
], prevProps.$schema, props.$schema)) {
|
|
167
198
|
model.config({
|
|
168
199
|
required: props.$schema.required,
|
|
@@ -185,7 +216,8 @@ function wrapControl(ComposedComponent) {
|
|
|
185
216
|
minLength: props.$schema.minLength,
|
|
186
217
|
maxLength: props.$schema.maxLength,
|
|
187
218
|
label: props.$schema.label,
|
|
188
|
-
inputGroupControl: props === null || props === void 0 ? void 0 : props.inputGroupControl
|
|
219
|
+
inputGroupControl: props === null || props === void 0 ? void 0 : props.inputGroupControl,
|
|
220
|
+
extraName: props.$schema.extraName
|
|
189
221
|
});
|
|
190
222
|
}
|
|
191
223
|
// 此处需要同时考虑 defaultValue 和 value
|
|
@@ -199,31 +231,27 @@ function wrapControl(ComposedComponent) {
|
|
|
199
231
|
}
|
|
200
232
|
else if (model &&
|
|
201
233
|
typeof props.defaultValue !== 'undefined' &&
|
|
202
|
-
formula.isExpression(props.defaultValue)
|
|
203
|
-
|
|
204
|
-
// 渲染器中的 defaultValue 优先(备注: SchemaRenderer中会将 value 改成 defaultValue)
|
|
205
|
-
if (!isEqual__default["default"](props.defaultValue, prevProps.defaultValue) ||
|
|
234
|
+
formula.isExpression(props.defaultValue) &&
|
|
235
|
+
(!isEqual__default["default"](props.defaultValue, prevProps.defaultValue) ||
|
|
206
236
|
(props.data !== prevProps.data &&
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
237
|
+
formula.isNeedFormula(props.defaultValue, props.data, prevProps.data)))) {
|
|
238
|
+
var curResult = formula.FormulaExec['formula'](props.defaultValue, props.data);
|
|
239
|
+
var prevResult = formula.FormulaExec['formula'](prevProps.defaultValue, prevProps.data);
|
|
240
|
+
if (!isEqual__default["default"](curResult, prevResult) &&
|
|
241
|
+
!isEqual__default["default"](curResult, model.tmpValue)) {
|
|
242
|
+
// 识别上下文变动、自身数值变动、公式运算结果变动
|
|
243
|
+
model.changeTmpValue(curResult, 'formulaChanged');
|
|
244
|
+
if (model.extraName) {
|
|
245
|
+
var values = model.splitExtraValue(curResult);
|
|
246
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, values[0], model.name, false);
|
|
247
|
+
(_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, values[1], model.extraName, false);
|
|
216
248
|
}
|
|
217
|
-
else
|
|
218
|
-
|
|
219
|
-
// now 表达式,计算后的值永远相同
|
|
220
|
-
model.changeTmpValue(nowData, 'formulaChanged');
|
|
221
|
-
(_b = props.onChange) === null || _b === void 0 ? void 0 : _b.call(props, nowData, model.name, false);
|
|
249
|
+
else {
|
|
250
|
+
(_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, curResult, model.name, false);
|
|
222
251
|
}
|
|
223
252
|
}
|
|
224
253
|
}
|
|
225
254
|
else if (model) {
|
|
226
|
-
var valueByName = getVariable.getVariable(props.data, model.name);
|
|
227
255
|
// value 非公式表达式时,name 值优先,若 defaultValue 主动变动时,则使用 defaultValue
|
|
228
256
|
if (
|
|
229
257
|
// 然后才是查看关联的 name 属性值是否变化
|
|
@@ -231,11 +259,19 @@ function wrapControl(ComposedComponent) {
|
|
|
231
259
|
(!model.emitedValue ||
|
|
232
260
|
isEqual__default["default"](model.emitedValue, model.tmpValue))) {
|
|
233
261
|
model.changeEmitedValue(undefined);
|
|
234
|
-
var
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
getVariable.getVariable(
|
|
238
|
-
|
|
262
|
+
var valueByName = model.extraName
|
|
263
|
+
? [
|
|
264
|
+
getVariable.getVariable(props.data, model.name, false),
|
|
265
|
+
getVariable.getVariable(props.data, model.extraName, false)
|
|
266
|
+
]
|
|
267
|
+
: getVariable.getVariable(props.data, model.name, false);
|
|
268
|
+
if (!isEqual__default["default"](valueByName, model.extraName
|
|
269
|
+
? model.splitExtraValue(model.tmpValue)
|
|
270
|
+
: model.tmpValue) &&
|
|
271
|
+
(!isEqual__default["default"](model.extraName ? valueByName[0] : valueByName, getVariable.getVariable(prevProps.data, model.name, false)) ||
|
|
272
|
+
// extraName
|
|
273
|
+
(model.extraName &&
|
|
274
|
+
!isEqual__default["default"](valueByName[1], getVariable.getVariable(prevProps.data, model.extraName, false))))) {
|
|
239
275
|
model.changeTmpValue(valueByName, props.formInited && !prevProps.formInited
|
|
240
276
|
? 'formInited'
|
|
241
277
|
: 'dataChanged');
|
|
@@ -386,7 +422,7 @@ function wrapControl(ComposedComponent) {
|
|
|
386
422
|
}
|
|
387
423
|
if (pipeOut) {
|
|
388
424
|
var oldValue = this.model.value;
|
|
389
|
-
value = pipeOut(value, oldValue, data);
|
|
425
|
+
value = pipeOut.call(this, value, oldValue, data);
|
|
390
426
|
}
|
|
391
427
|
this.model.changeTmpValue(value, 'input');
|
|
392
428
|
if (changeImmediately || conrolChangeImmediately || !formInited) {
|
|
@@ -403,9 +439,15 @@ function wrapControl(ComposedComponent) {
|
|
|
403
439
|
if (!this.model) {
|
|
404
440
|
return;
|
|
405
441
|
}
|
|
442
|
+
var model = this.model;
|
|
406
443
|
var value = this.model.tmpValue;
|
|
407
|
-
var oldValue =
|
|
408
|
-
|
|
444
|
+
var oldValue = model.extraName
|
|
445
|
+
? [
|
|
446
|
+
getVariable.getVariable(data, model.name, false),
|
|
447
|
+
getVariable.getVariable(data, model.extraName, false)
|
|
448
|
+
]
|
|
449
|
+
: getVariable.getVariable(data, model.name, false);
|
|
450
|
+
if (model.extraName ? isEqual__default["default"](oldValue, value) : oldValue === value) {
|
|
409
451
|
return;
|
|
410
452
|
}
|
|
411
453
|
if (type !== 'input-password') {
|
|
@@ -428,7 +470,14 @@ function wrapControl(ComposedComponent) {
|
|
|
428
470
|
if (!this.model) {
|
|
429
471
|
return;
|
|
430
472
|
}
|
|
431
|
-
|
|
473
|
+
if (model.extraName) {
|
|
474
|
+
var values = model.splitExtraValue(value);
|
|
475
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(values[0], name);
|
|
476
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(values[1], model.extraName, submitOnChange === true);
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value, name, submitOnChange === true);
|
|
480
|
+
}
|
|
432
481
|
this.checkValidate();
|
|
433
482
|
};
|
|
434
483
|
class_1.prototype.handleBlur = function (e) {
|
|
@@ -442,17 +491,25 @@ function wrapControl(ComposedComponent) {
|
|
|
442
491
|
if (!this.model) {
|
|
443
492
|
return;
|
|
444
493
|
}
|
|
494
|
+
var model = this.model;
|
|
445
495
|
var _a = this.props; _a.formStore; var name = _a.name, pipeOut = _a.$schema.pipeOut, onChange = _a.onChange, oldValue = _a.value, data = _a.data;
|
|
446
496
|
if (pipeOut) {
|
|
447
|
-
value = pipeOut(value, oldValue, data);
|
|
497
|
+
value = pipeOut.call(this, value, oldValue, data);
|
|
498
|
+
}
|
|
499
|
+
if (model.extraName) {
|
|
500
|
+
var values = model.splitExtraValue(value);
|
|
501
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(values[0], name, false, true);
|
|
502
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(values[1], model.extraName, false, true);
|
|
503
|
+
}
|
|
504
|
+
else {
|
|
505
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value, name, false, true);
|
|
448
506
|
}
|
|
449
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(value, name, false, true);
|
|
450
507
|
};
|
|
451
508
|
class_1.prototype.getValue = function () {
|
|
452
509
|
var _a = this.props, data = _a.formStore, control = _a.$schema;
|
|
453
510
|
var value = this.model ? this.model.tmpValue : control.value;
|
|
454
511
|
if (control.pipeIn) {
|
|
455
|
-
value = control.pipeIn(value, data);
|
|
512
|
+
value = control.pipeIn.call(this, value, data);
|
|
456
513
|
}
|
|
457
514
|
return value;
|
|
458
515
|
};
|
|
@@ -498,7 +555,7 @@ function wrapControl(ComposedComponent) {
|
|
|
498
555
|
// !没了这个, tree 里的 options 渲染会出问题
|
|
499
556
|
_filteredOptions: (_a = this.model) === null || _a === void 0 ? void 0 : _a.filteredOptions
|
|
500
557
|
};
|
|
501
|
-
return (
|
|
558
|
+
return (_J$X_(ComposedComponent, tslib.__assign({}, this.props, injectedProps)));
|
|
502
559
|
};
|
|
503
560
|
return class_1;
|
|
504
561
|
}(React__default["default"].Component)),
|
package/lib/store/app.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -13,8 +13,7 @@ var helper = require('../utils/helper.js');
|
|
|
13
13
|
var service = require('./service.js');
|
|
14
14
|
require('../utils/api.js');
|
|
15
15
|
require('../utils/ColorScale.js');
|
|
16
|
-
require('
|
|
17
|
-
require('lodash/chunk');
|
|
16
|
+
require('../utils/columnsSplit.js');
|
|
18
17
|
require('amis-formula');
|
|
19
18
|
require('lodash/isPlainObject');
|
|
20
19
|
var object = require('../utils/object.js');
|
|
@@ -22,21 +21,25 @@ require('../utils/DataSchema.js');
|
|
|
22
21
|
require('../utils/DataScope.js');
|
|
23
22
|
require('moment');
|
|
24
23
|
require('../utils/debug.js');
|
|
25
|
-
require('
|
|
24
|
+
require('../utils/dom.js');
|
|
26
25
|
require('../utils/errors.js');
|
|
27
|
-
require('../utils/tpl.js');
|
|
26
|
+
var tpl = require('../utils/tpl.js');
|
|
28
27
|
require('classnames');
|
|
29
28
|
require('../utils/filter.js');
|
|
30
29
|
require('lodash/isObject');
|
|
31
30
|
require('lodash/isString');
|
|
32
31
|
require('lodash/isBoolean');
|
|
33
|
-
require('
|
|
32
|
+
require('../utils/highlight.js');
|
|
33
|
+
require('../utils/icon.js');
|
|
34
34
|
require('../utils/image.js');
|
|
35
|
+
require('lodash/isEqual');
|
|
35
36
|
require('../actions/Action.js');
|
|
36
37
|
require('lodash/debounce');
|
|
37
38
|
require('lodash/cloneDeep');
|
|
38
39
|
require('../utils/resize-sensor.js');
|
|
40
|
+
require('react');
|
|
39
41
|
require('react-overlays/useRootClose');
|
|
42
|
+
require('react-dom');
|
|
40
43
|
require('../utils/SimpleMap.js');
|
|
41
44
|
require('lodash/mapValues');
|
|
42
45
|
require('lodash/camelCase');
|
|
@@ -71,7 +74,11 @@ var AppStore = service.ServiceStore.named('AppStore')
|
|
|
71
74
|
path: item.path,
|
|
72
75
|
children: item.children,
|
|
73
76
|
className: item.className,
|
|
74
|
-
visible: visible
|
|
77
|
+
visible: visible,
|
|
78
|
+
badge: typeof item.badge === 'string'
|
|
79
|
+
? tpl.filter(item.badge, self.data)
|
|
80
|
+
: item.badge,
|
|
81
|
+
badgeClassName: tpl.filter(item.badgeClassName, self.data)
|
|
75
82
|
};
|
|
76
83
|
});
|
|
77
84
|
}
|