amis-core 3.4.0 → 3.4.2
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.js +8 -8
- package/esm/SchemaRenderer.js +16 -12
- package/esm/Scoped.js +3 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +9 -8
- package/esm/actions/Action.js +1 -1
- package/esm/actions/AjaxAction.js +2 -2
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +3 -1
- package/esm/actions/DialogAction.js +1 -1
- package/esm/actions/DrawerAction.js +5 -1
- 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.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.d.ts +5 -6
- package/esm/components/CustomStyle.js +47 -6
- package/esm/components/LazyComponent.d.ts +1 -2
- package/esm/components/LazyComponent.js +12 -8
- package/esm/components/Overlay.js +3 -1
- package/esm/components/PopOver.d.ts +12 -12
- package/esm/components/PopOver.js +3 -1
- package/esm/env.d.ts +2 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +7 -7
- package/esm/factory.js +1 -1
- package/esm/index.js +5 -5
- package/esm/locale.d.ts +1 -1
- package/esm/locale.js +3 -3
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +10 -8
- package/esm/renderers/Item.d.ts +24 -56
- package/esm/renderers/Item.js +25 -31
- package/esm/renderers/Options.js +14 -12
- 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 +70 -80
- package/esm/store/app.js +3 -1
- package/esm/store/combo.d.ts +384 -0
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +31 -25
- package/esm/store/form.d.ts +160 -0
- package/esm/store/form.js +15 -13
- package/esm/store/formItem.d.ts +4 -0
- package/esm/store/formItem.js +42 -26
- package/esm/store/iRenderer.js +3 -1
- 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.d.ts +1 -1
- package/esm/store/root.js +12 -5
- package/esm/store/service.js +38 -33
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +760 -21
- package/esm/store/table.js +157 -57
- package/esm/store/table2.js +11 -8
- package/esm/theme.d.ts +18 -31
- package/esm/theme.js +1 -1
- 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 +3 -3
- package/esm/utils/api.js +3 -2
- 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 +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.d.ts +1 -0
- package/esm/utils/debug.js +24 -2
- 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.js +1 -1
- 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 +13 -1
- package/esm/utils/helper.js +99 -5
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.d.ts +1 -1
- package/esm/utils/keyToPath.js +2 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.js +1 -1
- 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.js +1 -1
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.js +2 -2
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.d.ts +3 -1
- package/esm/utils/resize-sensor.js +34 -22
- 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.d.ts +22 -14
- package/esm/utils/style-helper.js +181 -120
- 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 +1 -1
- package/lib/RootRenderer.js +8 -8
- package/lib/SchemaRenderer.js +16 -12
- package/lib/Scoped.js +3 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +9 -8
- package/lib/actions/Action.js +1 -1
- package/lib/actions/AjaxAction.js +2 -2
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +3 -1
- package/lib/actions/DialogAction.js +1 -1
- package/lib/actions/DrawerAction.js +5 -1
- 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.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.d.ts +5 -6
- package/lib/components/CustomStyle.js +46 -4
- package/lib/components/LazyComponent.d.ts +1 -2
- package/lib/components/LazyComponent.js +12 -9
- package/lib/components/Overlay.js +3 -1
- package/lib/components/PopOver.d.ts +12 -12
- package/lib/components/PopOver.js +3 -1
- package/lib/env.d.ts +2 -2
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +7 -7
- package/lib/factory.js +1 -1
- package/lib/index.js +11 -3
- package/lib/locale.d.ts +1 -1
- package/lib/locale.js +3 -3
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +10 -8
- package/lib/renderers/Item.d.ts +24 -56
- package/lib/renderers/Item.js +26 -31
- package/lib/renderers/Options.js +14 -12
- 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 +70 -79
- package/lib/store/app.js +3 -1
- package/lib/store/combo.d.ts +384 -0
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +31 -25
- package/lib/store/form.d.ts +160 -0
- package/lib/store/form.js +15 -13
- package/lib/store/formItem.d.ts +4 -0
- package/lib/store/formItem.js +41 -25
- package/lib/store/iRenderer.js +3 -1
- 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.d.ts +1 -1
- package/lib/store/root.js +11 -4
- package/lib/store/service.js +38 -33
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +760 -21
- package/lib/store/table.js +157 -57
- package/lib/store/table2.js +11 -8
- package/lib/theme.d.ts +18 -31
- package/lib/theme.js +1 -1
- 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 +3 -3
- package/lib/utils/api.js +3 -2
- 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 +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.d.ts +1 -0
- package/lib/utils/debug.js +24 -1
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +1 -1
- 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.js +1 -1
- 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 +13 -1
- package/lib/utils/helper.js +101 -4
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.d.ts +1 -1
- package/lib/utils/keyToPath.js +2 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.js +1 -1
- 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.js +1 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.js +2 -2
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.d.ts +3 -1
- package/lib/utils/resize-sensor.js +34 -22
- 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.d.ts +22 -14
- package/lib/utils/style-helper.js +188 -120
- 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
package/esm/Root.js
CHANGED
package/esm/RootRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -28,7 +28,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
28
28
|
storeType: RootStore.name,
|
|
29
29
|
parentId: ''
|
|
30
30
|
});
|
|
31
|
-
_this.store.
|
|
31
|
+
_this.store.updateContext(props.context);
|
|
32
32
|
_this.store.initData(props.data);
|
|
33
33
|
_this.store.updateLocation(props.location, (_a = _this.props.env) === null || _a === void 0 ? void 0 : _a.parseLocation);
|
|
34
34
|
// 将数据里面的函数批量的绑定到 this 上
|
|
@@ -54,7 +54,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
54
54
|
this.store.updateLocation(props.location);
|
|
55
55
|
}
|
|
56
56
|
if (props.context !== prevProps.context) {
|
|
57
|
-
this.store.
|
|
57
|
+
this.store.updateContext(props.context);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
RootRenderer.prototype.componentDidCatch = function (error, errorInfo) {
|
|
@@ -127,9 +127,9 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
127
127
|
else if (action.actionType === 'toast') {
|
|
128
128
|
(_b = (_a = action.toast) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {
|
|
129
129
|
env.notify(item.level || 'info', item.body
|
|
130
|
-
? render('body', item.body, __assign(__assign({}, _this.props), { data: ctx }))
|
|
130
|
+
? render('body', item.body, __assign(__assign({}, _this.props), { data: ctx, context: store.context }))
|
|
131
131
|
: '', __assign(__assign(__assign({}, action.toast), item), { title: item.title
|
|
132
|
-
? render('title', item.title, __assign(__assign({}, _this.props), { data: ctx }))
|
|
132
|
+
? render('title', item.title, __assign(__assign({}, _this.props), { data: ctx, context: store.context }))
|
|
133
133
|
: null, mobileUI: mobileUI }));
|
|
134
134
|
});
|
|
135
135
|
}
|
|
@@ -296,13 +296,13 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
296
296
|
var _a = this.props, render = _a.render, rest = __rest(_a, ["render"]);
|
|
297
297
|
var store = this.store;
|
|
298
298
|
return render('dialog', __assign(__assign({}, (store.action &&
|
|
299
|
-
store.action.dialog)), { type: 'dialog' }), __assign(__assign({}, rest), { key: 'dialog', topStore: this.store, data: store.dialogData, onConfirm: this.handleDialogConfirm, onClose: this.handleDialogClose, show: store.dialogOpen, onAction: this.handleAction }));
|
|
299
|
+
store.action.dialog)), { type: 'dialog' }), __assign(__assign({}, rest), { key: 'dialog', topStore: this.store, data: store.dialogData, context: store.context, onConfirm: this.handleDialogConfirm, onClose: this.handleDialogClose, show: store.dialogOpen, onAction: this.handleAction }));
|
|
300
300
|
};
|
|
301
301
|
RootRenderer.prototype.renderDrawer = function () {
|
|
302
302
|
var _a = this.props, render = _a.render, rest = __rest(_a, ["render"]);
|
|
303
303
|
var store = this.store;
|
|
304
304
|
return render('drawer', __assign(__assign({}, (store.action &&
|
|
305
|
-
store.action.drawer)), { type: 'drawer' }), __assign(__assign({}, rest), { key: 'drawer', topStore: this.store, data: store.drawerData, onConfirm: this.handleDrawerConfirm, onClose: this.handleDrawerClose, show: store.drawerOpen, onAction: this.handleAction }));
|
|
305
|
+
store.action.drawer)), { type: 'drawer' }), __assign(__assign({}, rest), { key: 'drawer', topStore: this.store, data: store.drawerData, context: store.context, onConfirm: this.handleDrawerConfirm, onClose: this.handleDrawerClose, show: store.drawerOpen, onAction: this.handleAction }));
|
|
306
306
|
};
|
|
307
307
|
RootRenderer.prototype.render = function () {
|
|
308
308
|
var _a = this.props, pathPrefix = _a.pathPrefix, schema = _a.schema, render = _a.render, rest = __rest(_a, ["pathPrefix", "schema", "render"]);
|
|
@@ -311,7 +311,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
311
311
|
this.renderRuntimeError();
|
|
312
312
|
}
|
|
313
313
|
return (React.createElement(React.Fragment, null,
|
|
314
|
-
render(pathPrefix, schema, __assign(__assign({}, rest), { topStore: this.store, data: this.store.downStream, onAction: this.handleAction })),
|
|
314
|
+
render(pathPrefix, schema, __assign(__assign({}, rest), { topStore: this.store, data: this.store.downStream, context: store.context, onAction: this.handleAction })),
|
|
315
315
|
this.renderSpinner(),
|
|
316
316
|
this.renderError(),
|
|
317
317
|
this.renderDialog(),
|
package/esm/SchemaRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -57,7 +57,8 @@ var RENDERER_TRANSMISSION_OMIT_PROPS = [
|
|
|
57
57
|
'label',
|
|
58
58
|
'renderLabel',
|
|
59
59
|
'trackExpression',
|
|
60
|
-
'editorSetting'
|
|
60
|
+
'editorSetting',
|
|
61
|
+
'updatePristineAfterStoreDataReInit'
|
|
61
62
|
];
|
|
62
63
|
var componentCache = new SimpleMap();
|
|
63
64
|
var SchemaRenderer = /** @class */ (function (_super) {
|
|
@@ -299,16 +300,14 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
299
300
|
if (renderer.storeType) {
|
|
300
301
|
exprProps = {};
|
|
301
302
|
}
|
|
302
|
-
// style 支持公式
|
|
303
|
-
if (schema.style) {
|
|
304
|
-
// schema.style是readonly属性
|
|
305
|
-
schema = __assign(__assign({}, schema), { style: buildStyle(schema.style, detectData) });
|
|
306
|
-
}
|
|
307
303
|
var isClassComponent = (_e = Component.prototype) === null || _e === void 0 ? void 0 : _e.isReactComponent;
|
|
308
|
-
var $schema = __assign(__assign({}, schema), exprProps);
|
|
309
304
|
var props = __assign(__assign(__assign(__assign(__assign({}, theme.getRendererConfig(renderer.name)), restSchema), chainEvents(rest, restSchema)), exprProps), {
|
|
310
305
|
// value: defaultValue, // 备注: 此处并没有将value传递给渲染器
|
|
311
|
-
defaultData: (_f = restSchema.defaultData) !== null && _f !== void 0 ? _f : defaultData, defaultValue: (_g = restSchema.defaultValue) !== null && _g !== void 0 ? _g : defaultValue, defaultActiveKey: defaultActiveKey, propKey: propKey, $path: $path, $schema:
|
|
306
|
+
defaultData: (_f = restSchema.defaultData) !== null && _f !== void 0 ? _f : defaultData, defaultValue: (_g = restSchema.defaultValue) !== null && _g !== void 0 ? _g : defaultValue, defaultActiveKey: defaultActiveKey, propKey: propKey, $path: $path, $schema: schema, ref: this.refFn, render: this.renderChild, rootStore: rootStore, statusStore: statusStore, dispatchEvent: this.dispatchEvent, mobileUI: schema.useMobileUI === false ? false : rest.mobileUI });
|
|
307
|
+
// style 支持公式
|
|
308
|
+
if (schema.style) {
|
|
309
|
+
props.style = buildStyle(schema.style, detectData);
|
|
310
|
+
}
|
|
312
311
|
if (disable !== undefined) {
|
|
313
312
|
props.disabled = disable;
|
|
314
313
|
}
|
|
@@ -318,7 +317,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
318
317
|
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
|
|
319
318
|
if (renderer.autoVar) {
|
|
320
319
|
try {
|
|
321
|
-
for (var _k = __values(Object.keys(
|
|
320
|
+
for (var _k = __values(Object.keys(schema)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
322
321
|
var key = _l.value;
|
|
323
322
|
if (typeof props[key] === 'string') {
|
|
324
323
|
props[key] = resolveVariableAndFilter(props[key], props.data, '| raw');
|
|
@@ -349,12 +348,17 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
349
348
|
var PlaceholderComponent = /** @class */ (function (_super) {
|
|
350
349
|
__extends(PlaceholderComponent, _super);
|
|
351
350
|
function PlaceholderComponent() {
|
|
352
|
-
|
|
351
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
352
|
+
_this.childRef = React.createRef();
|
|
353
|
+
return _this;
|
|
353
354
|
}
|
|
355
|
+
PlaceholderComponent.prototype.getWrappedInstance = function () {
|
|
356
|
+
return this.childRef.current;
|
|
357
|
+
};
|
|
354
358
|
PlaceholderComponent.prototype.render = function () {
|
|
355
359
|
var _a = this.props, renderChildren = _a.renderChildren, rest = __rest(_a, ["renderChildren"]);
|
|
356
360
|
if (typeof renderChildren === 'function') {
|
|
357
|
-
return renderChildren(rest);
|
|
361
|
+
return renderChildren(__assign(__assign({}, rest), { ref: this.childRef }));
|
|
358
362
|
}
|
|
359
363
|
return null;
|
|
360
364
|
};
|
package/esm/Scoped.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -39,6 +39,8 @@ import 'react-overlays/useRootClose';
|
|
|
39
39
|
import './utils/SimpleMap.js';
|
|
40
40
|
import 'lodash/mapValues';
|
|
41
41
|
import 'lodash/camelCase';
|
|
42
|
+
import 'lodash/map';
|
|
43
|
+
import 'lodash/isEmpty';
|
|
42
44
|
import 'uncontrollable';
|
|
43
45
|
import './utils/validations.js';
|
|
44
46
|
import './utils/resolveCondition.js';
|
package/esm/StatusScoped.js
CHANGED
package/esm/WithRootStore.js
CHANGED
package/esm/WithStore.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -108,7 +108,7 @@ function HocStoreFactory(renderer) {
|
|
|
108
108
|
(props.data &&
|
|
109
109
|
prevProps.data &&
|
|
110
110
|
props.data.__super !== prevProps.data.__super))) {
|
|
111
|
-
store.initData(extendObject(props.data, __assign(__assign(__assign({}, (store.hasRemoteData ? store.data : null)), this.formatData(props.defaultData)), this.formatData(props.data))));
|
|
111
|
+
store.initData(extendObject(props.data, __assign(__assign(__assign({}, (store.hasRemoteData ? store.data : null)), this.formatData(props.defaultData)), this.formatData(props.data))), props.updatePristineAfterStoreDataReInit === false);
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
114
|
else if (shouldSync === true ||
|
|
@@ -120,14 +120,14 @@ function HocStoreFactory(renderer) {
|
|
|
120
120
|
isSuperDataModified(props.data, prevProps.data, store)))) {
|
|
121
121
|
if (props.store && props.store.data === props.data) {
|
|
122
122
|
store.initData(createObject(props.store.data, props.syncSuperStore === false
|
|
123
|
-
? __assign({}, store.data) : syncDataFromSuper(store.data, props.store.data, prevProps.scope, store, props.syncSuperStore === true)));
|
|
123
|
+
? __assign({}, store.data) : syncDataFromSuper(store.data, props.store.data, prevProps.scope, store, props.syncSuperStore === true)), props.updatePristineAfterStoreDataReInit === false);
|
|
124
124
|
}
|
|
125
125
|
else if (props.data && props.data.__super) {
|
|
126
126
|
store.initData(extendObject(props.data, store.hasRemoteData || store.path === 'page'
|
|
127
|
-
? __assign(__assign({}, store.data), props.data) :
|
|
127
|
+
? __assign(__assign({}, store.data), props.data) : syncDataFromSuper(props.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
130
|
-
store.initData(createObject(props.scope, props.data));
|
|
130
|
+
store.initData(createObject(props.scope, props.data), props.updatePristineAfterStoreDataReInit === false);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
else if (!props.trackExpression &&
|
|
@@ -137,8 +137,9 @@ function HocStoreFactory(renderer) {
|
|
|
137
137
|
// 这个用法很少,当 data.__super 值发生变化时,更新 store.data
|
|
138
138
|
if (!prevProps.data ||
|
|
139
139
|
isObjectShallowModified(props.data.__super, prevProps.data.__super, false)) {
|
|
140
|
-
store.initData(createObject(props.data.__super, __assign(__assign({}, props.data), store.data)),
|
|
141
|
-
(
|
|
140
|
+
store.initData(createObject(props.data.__super, __assign(__assign({}, props.data), store.data)), props.updatePristineAfterStoreDataReInit === false ||
|
|
141
|
+
(store.storeType === 'FormStore' &&
|
|
142
|
+
((_b = prevProps.store) === null || _b === void 0 ? void 0 : _b.storeType) === 'CRUDStore'));
|
|
142
143
|
}
|
|
143
144
|
// nextProps.data.__super !== props.data.__super) &&
|
|
144
145
|
}
|
|
@@ -148,7 +149,7 @@ function HocStoreFactory(renderer) {
|
|
|
148
149
|
prevProps.data !== props.data) {
|
|
149
150
|
// 只有父级数据变动的时候才应该进来,
|
|
150
151
|
// 目前看来这个 case 很少有情况下能进来
|
|
151
|
-
store.initData(createObject(props.scope, __assign({}, store.data)));
|
|
152
|
+
store.initData(createObject(props.scope, __assign({}, store.data)), props.updatePristineAfterStoreDataReInit === false);
|
|
152
153
|
}
|
|
153
154
|
};
|
|
154
155
|
StoreFactory.prototype.componentWillUnmount = function () {
|
package/esm/actions/Action.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -42,7 +42,7 @@ var AjaxAction = /** @class */ (function () {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
env = event.context.env;
|
|
45
|
-
silent = (_b = action === null || action === void 0 ? void 0 : action.options) === null || _b === void 0 ? void 0 : _b.silent;
|
|
45
|
+
silent = ((_b = action === null || action === void 0 ? void 0 : action.options) === null || _b === void 0 ? void 0 : _b.silent) || (action === null || action === void 0 ? void 0 : action.api).silent;
|
|
46
46
|
messages = (_c = action === null || action === void 0 ? void 0 : action.api) === null || _c === void 0 ? void 0 : _c.messages;
|
|
47
47
|
api = normalizeApi(action.api);
|
|
48
48
|
// 如果没配置data数据映射,则给一个空对象,避免将当前数据域作为接口请求参数
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -33,6 +33,8 @@ import 'react-overlays/useRootClose';
|
|
|
33
33
|
import '../utils/SimpleMap.js';
|
|
34
34
|
import 'lodash/mapValues';
|
|
35
35
|
import 'lodash/camelCase';
|
|
36
|
+
import 'lodash/map';
|
|
37
|
+
import 'lodash/isEmpty';
|
|
36
38
|
import 'uncontrollable';
|
|
37
39
|
import 'hoist-non-react-statics';
|
|
38
40
|
import '../utils/validations.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -20,6 +20,10 @@ var DrawerAction = /** @class */ (function () {
|
|
|
20
20
|
var _a, _b;
|
|
21
21
|
return __awaiter(this, void 0, void 0, function () {
|
|
22
22
|
return __generator(this, function (_c) {
|
|
23
|
+
// 防止editor preview模式下执行
|
|
24
|
+
if (action.$$id !== undefined) {
|
|
25
|
+
return [2 /*return*/];
|
|
26
|
+
}
|
|
23
27
|
(_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, {
|
|
24
28
|
actionType: 'drawer',
|
|
25
29
|
drawer: action.drawer,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { RendererEnv } from '../env';
|
|
2
|
-
import type
|
|
2
|
+
import { type InsertCustomStyle } from '../utils/style-helper';
|
|
3
3
|
interface CustomStyleProps {
|
|
4
4
|
config: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
defaultData?: any;
|
|
9
|
-
};
|
|
5
|
+
wrapperCustomStyle?: any;
|
|
6
|
+
componentId?: string;
|
|
7
|
+
} & InsertCustomStyle;
|
|
10
8
|
env: RendererEnv;
|
|
11
9
|
}
|
|
10
|
+
export declare const styleIdCount: Map<any, any>;
|
|
12
11
|
export default function (props: CustomStyleProps): null;
|
|
13
12
|
export {};
|
|
@@ -1,18 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useEffect } from 'react';
|
|
7
|
-
import { insertCustomStyle } from '../utils/style-helper.js';
|
|
7
|
+
import { insertCustomStyle, removeCustomStyle, insertEditCustomStyle } from '../utils/style-helper.js';
|
|
8
8
|
|
|
9
|
+
var styleIdCount = new Map();
|
|
9
10
|
function CustomStyle (props) {
|
|
10
|
-
var
|
|
11
|
+
var config = props.config, env = props.env;
|
|
12
|
+
var themeCss = config.themeCss, classNames = config.classNames, id = config.id, defaultData = config.defaultData, wrapperCustomStyle = config.wrapperCustomStyle;
|
|
13
|
+
if (!themeCss && !wrapperCustomStyle) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
useEffect(function () {
|
|
17
|
+
if (styleIdCount.has(id)) {
|
|
18
|
+
styleIdCount.set(id, styleIdCount.get(id) + 1);
|
|
19
|
+
}
|
|
20
|
+
else if (id) {
|
|
21
|
+
styleIdCount.set(id, 1);
|
|
22
|
+
}
|
|
23
|
+
return function () {
|
|
24
|
+
if (styleIdCount.has(id)) {
|
|
25
|
+
styleIdCount.set(id, styleIdCount.get(id) - 1);
|
|
26
|
+
if (styleIdCount.get(id) === 0) {
|
|
27
|
+
styleIdCount.delete(id);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
}, [id]);
|
|
32
|
+
useEffect(function () {
|
|
33
|
+
var _a;
|
|
34
|
+
if (themeCss && id) {
|
|
35
|
+
insertCustomStyle(themeCss, classNames, id, defaultData, env === null || env === void 0 ? void 0 : env.customStyleClassPrefix, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
36
|
+
}
|
|
37
|
+
return function () {
|
|
38
|
+
var _a;
|
|
39
|
+
if (id && !styleIdCount.get(id)) {
|
|
40
|
+
removeCustomStyle('', id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
}, [themeCss, id]);
|
|
11
44
|
useEffect(function () {
|
|
12
45
|
var _a;
|
|
13
|
-
|
|
14
|
-
|
|
46
|
+
if (wrapperCustomStyle && id) {
|
|
47
|
+
insertEditCustomStyle(wrapperCustomStyle, id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
48
|
+
}
|
|
49
|
+
return function () {
|
|
50
|
+
var _a;
|
|
51
|
+
if (id && !styleIdCount.get(id)) {
|
|
52
|
+
removeCustomStyle('wrapperCustomStyle', id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}, [wrapperCustomStyle, id]);
|
|
15
56
|
return null;
|
|
16
57
|
}
|
|
17
58
|
|
|
18
|
-
export { CustomStyle as default };
|
|
59
|
+
export { CustomStyle as default, styleIdCount };
|
|
@@ -10,7 +10,6 @@ export interface LazyComponentProps {
|
|
|
10
10
|
placeholder?: React.ReactNode;
|
|
11
11
|
unMountOnHidden?: boolean;
|
|
12
12
|
childProps?: object;
|
|
13
|
-
visiblilityProps?: object;
|
|
14
13
|
[propName: string]: any;
|
|
15
14
|
}
|
|
16
15
|
export interface LazyComponentState {
|
|
@@ -27,6 +26,6 @@ export default class LazyComponent extends React.Component<LazyComponentProps, L
|
|
|
27
26
|
constructor(props: LazyComponentProps);
|
|
28
27
|
componentDidMount(): void;
|
|
29
28
|
componentWillUnmount(): void;
|
|
30
|
-
handleVisibleChange(visible: boolean): void;
|
|
29
|
+
handleVisibleChange(visible: boolean, entry?: any): void;
|
|
31
30
|
render(): React.ReactNode;
|
|
32
31
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __extends, __rest, __assign } from 'tslib';
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
8
|
+
import { InView } from 'react-intersection-observer';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* @file LazyComponent
|
|
@@ -34,7 +34,7 @@ var LazyComponent = /** @class */ (function (_super) {
|
|
|
34
34
|
LazyComponent.prototype.componentWillUnmount = function () {
|
|
35
35
|
this.mounted = false;
|
|
36
36
|
};
|
|
37
|
-
LazyComponent.prototype.handleVisibleChange = function (visible) {
|
|
37
|
+
LazyComponent.prototype.handleVisibleChange = function (visible, entry) {
|
|
38
38
|
var _this = this;
|
|
39
39
|
this.setState({
|
|
40
40
|
visible: visible
|
|
@@ -59,16 +59,20 @@ var LazyComponent = /** @class */ (function (_super) {
|
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
61
|
LazyComponent.prototype.render = function () {
|
|
62
|
-
var _a = this.props, placeholder = _a.placeholder, unMountOnHidden = _a.unMountOnHidden, childProps = _a.childProps,
|
|
62
|
+
var _a = this.props, placeholder = _a.placeholder, unMountOnHidden = _a.unMountOnHidden, childProps = _a.childProps, partialVisibility = _a.partialVisibility, children = _a.children, rest = __rest(_a, ["placeholder", "unMountOnHidden", "childProps", "partialVisibility", "children"]);
|
|
63
63
|
var _b = this.state, visible = _b.visible, Component = _b.component;
|
|
64
64
|
// 需要监听从可见到不可见。
|
|
65
65
|
if (unMountOnHidden) {
|
|
66
|
-
return (React.createElement(
|
|
67
|
-
|
|
66
|
+
return (React.createElement(InView, { onChange: this.handleVisibleChange, threshold: partialVisibility ? 0 : 1 }, function (_a) {
|
|
67
|
+
var ref = _a.ref;
|
|
68
|
+
return (React.createElement("div", { ref: ref, className: "visibility-sensor ".concat(visible ? 'in' : '') }, Component && visible ? (React.createElement(Component, __assign({}, rest, childProps))) : children && visible ? (children) : (placeholder)));
|
|
69
|
+
}));
|
|
68
70
|
}
|
|
69
71
|
if (!visible) {
|
|
70
|
-
return (React.createElement(
|
|
71
|
-
|
|
72
|
+
return (React.createElement(InView, { onChange: this.handleVisibleChange, threshold: partialVisibility ? 0 : 1 }, function (_a) {
|
|
73
|
+
var ref = _a.ref;
|
|
74
|
+
return (React.createElement("div", { ref: ref, className: "visibility-sensor" }, placeholder));
|
|
75
|
+
}));
|
|
72
76
|
}
|
|
73
77
|
else if (Component) {
|
|
74
78
|
// 只监听不可见到可见,一旦可见了,就销毁检查。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.2
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -35,6 +35,8 @@ import { RootClose } from '../utils/RootClose.js';
|
|
|
35
35
|
import '../utils/SimpleMap.js';
|
|
36
36
|
import 'lodash/mapValues';
|
|
37
37
|
import 'lodash/camelCase';
|
|
38
|
+
import 'lodash/map';
|
|
39
|
+
import 'lodash/isEmpty';
|
|
38
40
|
import 'uncontrollable';
|
|
39
41
|
import 'hoist-non-react-statics';
|
|
40
42
|
import '../utils/validations.js';
|
|
@@ -10,7 +10,7 @@ export interface Offset {
|
|
|
10
10
|
x: number;
|
|
11
11
|
y: number;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface PopOverProps {
|
|
14
14
|
className?: string;
|
|
15
15
|
placement?: string;
|
|
16
16
|
positionTop?: number;
|
|
@@ -30,7 +30,7 @@ interface PopOverState {
|
|
|
30
30
|
xOffset: number;
|
|
31
31
|
yOffset: number;
|
|
32
32
|
}
|
|
33
|
-
export declare class PopOver extends React.PureComponent<
|
|
33
|
+
export declare class PopOver extends React.PureComponent<PopOverProps, PopOverState> {
|
|
34
34
|
static defaultProps: {
|
|
35
35
|
className: string;
|
|
36
36
|
offset: {
|
|
@@ -53,31 +53,31 @@ export declare class PopOver extends React.PureComponent<PopOverPorps, PopOverSt
|
|
|
53
53
|
render(): React.JSX.Element;
|
|
54
54
|
}
|
|
55
55
|
declare const _default: {
|
|
56
|
-
new (props: Omit<
|
|
56
|
+
new (props: Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps): {
|
|
57
57
|
ref: any;
|
|
58
58
|
childRef(ref: any): void;
|
|
59
59
|
getWrappedInstance(): any;
|
|
60
60
|
render(): React.JSX.Element;
|
|
61
61
|
context: unknown;
|
|
62
|
-
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<
|
|
62
|
+
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
63
63
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
64
|
-
readonly props: Readonly<Omit<
|
|
64
|
+
readonly props: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>;
|
|
65
65
|
state: Readonly<{}>;
|
|
66
66
|
refs: {
|
|
67
67
|
[key: string]: React.ReactInstance;
|
|
68
68
|
};
|
|
69
69
|
componentDidMount?(): void;
|
|
70
|
-
shouldComponentUpdate?(nextProps: Readonly<Omit<
|
|
70
|
+
shouldComponentUpdate?(nextProps: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): boolean;
|
|
71
71
|
componentWillUnmount?(): void;
|
|
72
72
|
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
73
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<
|
|
74
|
-
componentDidUpdate?(prevProps: Readonly<Omit<
|
|
73
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>, prevState: Readonly<{}>): any;
|
|
74
|
+
componentDidUpdate?(prevProps: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>, prevState: Readonly<{}>, snapshot?: any): void;
|
|
75
75
|
componentWillMount?(): void;
|
|
76
76
|
UNSAFE_componentWillMount?(): void;
|
|
77
|
-
componentWillReceiveProps?(nextProps: Readonly<Omit<
|
|
78
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<
|
|
79
|
-
componentWillUpdate?(nextProps: Readonly<Omit<
|
|
80
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<
|
|
77
|
+
componentWillReceiveProps?(nextProps: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>, nextContext: any): void;
|
|
78
|
+
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>, nextContext: any): void;
|
|
79
|
+
componentWillUpdate?(nextProps: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
80
|
+
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<PopOverProps, keyof import("../theme").ThemeProps> & import("../theme").ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
81
81
|
};
|
|
82
82
|
displayName: string;
|
|
83
83
|
contextType: React.Context<string>;
|