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/utils/tpl.js
CHANGED
package/esm/utils/validations.js
CHANGED
package/lib/Root.js
CHANGED
package/lib/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
|
|
|
@@ -42,7 +42,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
42
42
|
storeType: root.RootStore.name,
|
|
43
43
|
parentId: ''
|
|
44
44
|
});
|
|
45
|
-
_this.store.
|
|
45
|
+
_this.store.updateContext(props.context);
|
|
46
46
|
_this.store.initData(props.data);
|
|
47
47
|
_this.store.updateLocation(props.location, (_a = _this.props.env) === null || _a === void 0 ? void 0 : _a.parseLocation);
|
|
48
48
|
// 将数据里面的函数批量的绑定到 this 上
|
|
@@ -68,7 +68,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
68
68
|
this.store.updateLocation(props.location);
|
|
69
69
|
}
|
|
70
70
|
if (props.context !== prevProps.context) {
|
|
71
|
-
this.store.
|
|
71
|
+
this.store.updateContext(props.context);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
RootRenderer.prototype.componentDidCatch = function (error, errorInfo) {
|
|
@@ -141,9 +141,9 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
141
141
|
else if (action.actionType === 'toast') {
|
|
142
142
|
(_b = (_a = action.toast) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {
|
|
143
143
|
env.notify(item.level || 'info', item.body
|
|
144
|
-
? render('body', item.body, tslib.__assign(tslib.__assign({}, _this.props), { data: ctx }))
|
|
144
|
+
? render('body', item.body, tslib.__assign(tslib.__assign({}, _this.props), { data: ctx, context: store.context }))
|
|
145
145
|
: '', tslib.__assign(tslib.__assign(tslib.__assign({}, action.toast), item), { title: item.title
|
|
146
|
-
? render('title', item.title, tslib.__assign(tslib.__assign({}, _this.props), { data: ctx }))
|
|
146
|
+
? render('title', item.title, tslib.__assign(tslib.__assign({}, _this.props), { data: ctx, context: store.context }))
|
|
147
147
|
: null, mobileUI: mobileUI }));
|
|
148
148
|
});
|
|
149
149
|
}
|
|
@@ -310,13 +310,13 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
310
310
|
var _a = this.props, render = _a.render, rest = tslib.__rest(_a, ["render"]);
|
|
311
311
|
var store = this.store;
|
|
312
312
|
return render('dialog', tslib.__assign(tslib.__assign({}, (store.action &&
|
|
313
|
-
store.action.dialog)), { type: 'dialog' }), tslib.__assign(tslib.__assign({}, rest), { key: 'dialog', topStore: this.store, data: store.dialogData, onConfirm: this.handleDialogConfirm, onClose: this.handleDialogClose, show: store.dialogOpen, onAction: this.handleAction }));
|
|
313
|
+
store.action.dialog)), { type: 'dialog' }), tslib.__assign(tslib.__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 }));
|
|
314
314
|
};
|
|
315
315
|
RootRenderer.prototype.renderDrawer = function () {
|
|
316
316
|
var _a = this.props, render = _a.render, rest = tslib.__rest(_a, ["render"]);
|
|
317
317
|
var store = this.store;
|
|
318
318
|
return render('drawer', tslib.__assign(tslib.__assign({}, (store.action &&
|
|
319
|
-
store.action.drawer)), { type: 'drawer' }), tslib.__assign(tslib.__assign({}, rest), { key: 'drawer', topStore: this.store, data: store.drawerData, onConfirm: this.handleDrawerConfirm, onClose: this.handleDrawerClose, show: store.drawerOpen, onAction: this.handleAction }));
|
|
319
|
+
store.action.drawer)), { type: 'drawer' }), tslib.__assign(tslib.__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 }));
|
|
320
320
|
};
|
|
321
321
|
RootRenderer.prototype.render = function () {
|
|
322
322
|
var _a = this.props, pathPrefix = _a.pathPrefix, schema = _a.schema, render = _a.render, rest = tslib.__rest(_a, ["pathPrefix", "schema", "render"]);
|
|
@@ -325,7 +325,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
325
325
|
this.renderRuntimeError();
|
|
326
326
|
}
|
|
327
327
|
return (_J$X_(React__default["default"].Fragment, null,
|
|
328
|
-
render(pathPrefix, schema, tslib.__assign(tslib.__assign({}, rest), { topStore: this.store, data: this.store.downStream, onAction: this.handleAction })),
|
|
328
|
+
render(pathPrefix, schema, tslib.__assign(tslib.__assign({}, rest), { topStore: this.store, data: this.store.downStream, context: store.context, onAction: this.handleAction })),
|
|
329
329
|
this.renderSpinner(),
|
|
330
330
|
this.renderError(),
|
|
331
331
|
this.renderDialog(),
|
package/lib/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
|
|
|
@@ -70,7 +70,8 @@ var RENDERER_TRANSMISSION_OMIT_PROPS = [
|
|
|
70
70
|
'label',
|
|
71
71
|
'renderLabel',
|
|
72
72
|
'trackExpression',
|
|
73
|
-
'editorSetting'
|
|
73
|
+
'editorSetting',
|
|
74
|
+
'updatePristineAfterStoreDataReInit'
|
|
74
75
|
];
|
|
75
76
|
var componentCache = new SimpleMap.SimpleMap();
|
|
76
77
|
var SchemaRenderer = /** @class */ (function (_super) {
|
|
@@ -312,16 +313,14 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
312
313
|
if (renderer.storeType) {
|
|
313
314
|
exprProps = {};
|
|
314
315
|
}
|
|
315
|
-
// style 支持公式
|
|
316
|
-
if (schema.style) {
|
|
317
|
-
// schema.style是readonly属性
|
|
318
|
-
schema = tslib.__assign(tslib.__assign({}, schema), { style: style.buildStyle(schema.style, detectData) });
|
|
319
|
-
}
|
|
320
316
|
var isClassComponent = (_e = Component.prototype) === null || _e === void 0 ? void 0 : _e.isReactComponent;
|
|
321
|
-
var $schema = tslib.__assign(tslib.__assign({}, schema), exprProps);
|
|
322
317
|
var props = tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, theme.getRendererConfig(renderer.name)), restSchema), helper.chainEvents(rest, restSchema)), exprProps), {
|
|
323
318
|
// value: defaultValue, // 备注: 此处并没有将value传递给渲染器
|
|
324
|
-
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:
|
|
319
|
+
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 });
|
|
320
|
+
// style 支持公式
|
|
321
|
+
if (schema.style) {
|
|
322
|
+
props.style = style.buildStyle(schema.style, detectData);
|
|
323
|
+
}
|
|
325
324
|
if (disable !== undefined) {
|
|
326
325
|
props.disabled = disable;
|
|
327
326
|
}
|
|
@@ -331,7 +330,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
331
330
|
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
|
|
332
331
|
if (renderer.autoVar) {
|
|
333
332
|
try {
|
|
334
|
-
for (var _k = tslib.__values(Object.keys(
|
|
333
|
+
for (var _k = tslib.__values(Object.keys(schema)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
335
334
|
var key = _l.value;
|
|
336
335
|
if (typeof props[key] === 'string') {
|
|
337
336
|
props[key] = resolveVariableAndFilter.resolveVariableAndFilter(props[key], props.data, '| raw');
|
|
@@ -362,12 +361,17 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
362
361
|
var PlaceholderComponent = /** @class */ (function (_super) {
|
|
363
362
|
tslib.__extends(PlaceholderComponent, _super);
|
|
364
363
|
function PlaceholderComponent() {
|
|
365
|
-
|
|
364
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
365
|
+
_this.childRef = React__default["default"].createRef();
|
|
366
|
+
return _this;
|
|
366
367
|
}
|
|
368
|
+
PlaceholderComponent.prototype.getWrappedInstance = function () {
|
|
369
|
+
return this.childRef.current;
|
|
370
|
+
};
|
|
367
371
|
PlaceholderComponent.prototype.render = function () {
|
|
368
372
|
var _a = this.props, renderChildren = _a.renderChildren, rest = tslib.__rest(_a, ["renderChildren"]);
|
|
369
373
|
if (typeof renderChildren === 'function') {
|
|
370
|
-
return renderChildren(rest);
|
|
374
|
+
return renderChildren(tslib.__assign(tslib.__assign({}, rest), { ref: this.childRef }));
|
|
371
375
|
}
|
|
372
376
|
return null;
|
|
373
377
|
};
|
package/lib/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
|
|
|
@@ -46,6 +46,8 @@ require('react-dom');
|
|
|
46
46
|
require('./utils/SimpleMap.js');
|
|
47
47
|
require('lodash/mapValues');
|
|
48
48
|
require('lodash/camelCase');
|
|
49
|
+
require('lodash/map');
|
|
50
|
+
require('lodash/isEmpty');
|
|
49
51
|
require('uncontrollable');
|
|
50
52
|
require('./utils/validations.js');
|
|
51
53
|
require('./utils/resolveCondition.js');
|
package/lib/StatusScoped.js
CHANGED
package/lib/WithRootStore.js
CHANGED
package/lib/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
|
|
|
@@ -120,7 +120,7 @@ function HocStoreFactory(renderer) {
|
|
|
120
120
|
(props.data &&
|
|
121
121
|
prevProps.data &&
|
|
122
122
|
props.data.__super !== prevProps.data.__super))) {
|
|
123
|
-
store.initData(object.extendObject(props.data, tslib.__assign(tslib.__assign(tslib.__assign({}, (store.hasRemoteData ? store.data : null)), this.formatData(props.defaultData)), this.formatData(props.data))));
|
|
123
|
+
store.initData(object.extendObject(props.data, tslib.__assign(tslib.__assign(tslib.__assign({}, (store.hasRemoteData ? store.data : null)), this.formatData(props.defaultData)), this.formatData(props.data))), props.updatePristineAfterStoreDataReInit === false);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
else if (shouldSync === true ||
|
|
@@ -132,14 +132,14 @@ function HocStoreFactory(renderer) {
|
|
|
132
132
|
helper.isSuperDataModified(props.data, prevProps.data, store)))) {
|
|
133
133
|
if (props.store && props.store.data === props.data) {
|
|
134
134
|
store.initData(object.createObject(props.store.data, props.syncSuperStore === false
|
|
135
|
-
? tslib.__assign({}, store.data) : helper.syncDataFromSuper(store.data, props.store.data, prevProps.scope, store, props.syncSuperStore === true)));
|
|
135
|
+
? tslib.__assign({}, store.data) : helper.syncDataFromSuper(store.data, props.store.data, prevProps.scope, store, props.syncSuperStore === true)), props.updatePristineAfterStoreDataReInit === false);
|
|
136
136
|
}
|
|
137
137
|
else if (props.data && props.data.__super) {
|
|
138
138
|
store.initData(object.extendObject(props.data, store.hasRemoteData || store.path === 'page'
|
|
139
|
-
? tslib.__assign(tslib.__assign({}, store.data), props.data) :
|
|
139
|
+
? tslib.__assign(tslib.__assign({}, store.data), props.data) : helper.syncDataFromSuper(props.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
|
|
140
140
|
}
|
|
141
141
|
else {
|
|
142
|
-
store.initData(object.createObject(props.scope, props.data));
|
|
142
|
+
store.initData(object.createObject(props.scope, props.data), props.updatePristineAfterStoreDataReInit === false);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
else if (!props.trackExpression &&
|
|
@@ -149,8 +149,9 @@ function HocStoreFactory(renderer) {
|
|
|
149
149
|
// 这个用法很少,当 data.__super 值发生变化时,更新 store.data
|
|
150
150
|
if (!prevProps.data ||
|
|
151
151
|
helper.isObjectShallowModified(props.data.__super, prevProps.data.__super, false)) {
|
|
152
|
-
store.initData(object.createObject(props.data.__super, tslib.__assign(tslib.__assign({}, props.data), store.data)),
|
|
153
|
-
(
|
|
152
|
+
store.initData(object.createObject(props.data.__super, tslib.__assign(tslib.__assign({}, props.data), store.data)), props.updatePristineAfterStoreDataReInit === false ||
|
|
153
|
+
(store.storeType === 'FormStore' &&
|
|
154
|
+
((_b = prevProps.store) === null || _b === void 0 ? void 0 : _b.storeType) === 'CRUDStore'));
|
|
154
155
|
}
|
|
155
156
|
// nextProps.data.__super !== props.data.__super) &&
|
|
156
157
|
}
|
|
@@ -160,7 +161,7 @@ function HocStoreFactory(renderer) {
|
|
|
160
161
|
prevProps.data !== props.data) {
|
|
161
162
|
// 只有父级数据变动的时候才应该进来,
|
|
162
163
|
// 目前看来这个 case 很少有情况下能进来
|
|
163
|
-
store.initData(object.createObject(props.scope, tslib.__assign({}, store.data)));
|
|
164
|
+
store.initData(object.createObject(props.scope, tslib.__assign({}, store.data)), props.updatePristineAfterStoreDataReInit === false);
|
|
164
165
|
}
|
|
165
166
|
};
|
|
166
167
|
StoreFactory.prototype.componentWillUnmount = function () {
|
package/lib/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
|
|
|
@@ -46,7 +46,7 @@ var AjaxAction = /** @class */ (function () {
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
env = event.context.env;
|
|
49
|
-
silent = (_b = action === null || action === void 0 ? void 0 : action.options) === null || _b === void 0 ? void 0 : _b.silent;
|
|
49
|
+
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;
|
|
50
50
|
messages = (_c = action === null || action === void 0 ? void 0 : action.api) === null || _c === void 0 ? void 0 : _c.messages;
|
|
51
51
|
api$1 = api.normalizeApi(action.api);
|
|
52
52
|
// 如果没配置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
|
|
|
@@ -40,6 +40,8 @@ require('react-dom');
|
|
|
40
40
|
require('../utils/SimpleMap.js');
|
|
41
41
|
require('lodash/mapValues');
|
|
42
42
|
require('lodash/camelCase');
|
|
43
|
+
require('lodash/map');
|
|
44
|
+
require('lodash/isEmpty');
|
|
43
45
|
require('uncontrollable');
|
|
44
46
|
require('hoist-non-react-statics');
|
|
45
47
|
require('../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
|
|
|
@@ -24,6 +24,10 @@ var DrawerAction = /** @class */ (function () {
|
|
|
24
24
|
var _a, _b;
|
|
25
25
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
26
26
|
return tslib.__generator(this, function (_c) {
|
|
27
|
+
// 防止editor preview模式下执行
|
|
28
|
+
if (action.$$id !== undefined) {
|
|
29
|
+
return [2 /*return*/];
|
|
30
|
+
}
|
|
27
31
|
(_b = (_a = renderer.props).onAction) === null || _b === void 0 ? void 0 : _b.call(_a, event, {
|
|
28
32
|
actionType: 'drawer',
|
|
29
33
|
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,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
|
|
|
@@ -10,13 +10,55 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
var React = require('react');
|
|
11
11
|
var styleHelper = require('../utils/style-helper.js');
|
|
12
12
|
|
|
13
|
+
var styleIdCount = new Map();
|
|
13
14
|
function CustomStyle (props) {
|
|
14
|
-
var
|
|
15
|
+
var config = props.config, env = props.env;
|
|
16
|
+
var themeCss = config.themeCss, classNames = config.classNames, id = config.id, defaultData = config.defaultData, wrapperCustomStyle = config.wrapperCustomStyle;
|
|
17
|
+
if (!themeCss && !wrapperCustomStyle) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
React.useEffect(function () {
|
|
21
|
+
if (styleIdCount.has(id)) {
|
|
22
|
+
styleIdCount.set(id, styleIdCount.get(id) + 1);
|
|
23
|
+
}
|
|
24
|
+
else if (id) {
|
|
25
|
+
styleIdCount.set(id, 1);
|
|
26
|
+
}
|
|
27
|
+
return function () {
|
|
28
|
+
if (styleIdCount.has(id)) {
|
|
29
|
+
styleIdCount.set(id, styleIdCount.get(id) - 1);
|
|
30
|
+
if (styleIdCount.get(id) === 0) {
|
|
31
|
+
styleIdCount.delete(id);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}, [id]);
|
|
36
|
+
React.useEffect(function () {
|
|
37
|
+
var _a;
|
|
38
|
+
if (themeCss && id) {
|
|
39
|
+
styleHelper.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);
|
|
40
|
+
}
|
|
41
|
+
return function () {
|
|
42
|
+
var _a;
|
|
43
|
+
if (id && !styleIdCount.get(id)) {
|
|
44
|
+
styleHelper.removeCustomStyle('', id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}, [themeCss, id]);
|
|
15
48
|
React.useEffect(function () {
|
|
16
49
|
var _a;
|
|
17
|
-
|
|
18
|
-
|
|
50
|
+
if (wrapperCustomStyle && id) {
|
|
51
|
+
styleHelper.insertEditCustomStyle(wrapperCustomStyle, id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
52
|
+
}
|
|
53
|
+
return function () {
|
|
54
|
+
var _a;
|
|
55
|
+
if (id && !styleIdCount.get(id)) {
|
|
56
|
+
styleHelper.removeCustomStyle('wrapperCustomStyle', id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}, [wrapperCustomStyle, id]);
|
|
19
60
|
return null;
|
|
20
61
|
}
|
|
21
62
|
|
|
22
63
|
exports["default"] = CustomStyle;
|
|
64
|
+
exports.styleIdCount = 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,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
|
|
|
@@ -9,12 +9,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
9
9
|
|
|
10
10
|
var tslib = require('tslib');
|
|
11
11
|
var React = require('react');
|
|
12
|
-
var
|
|
12
|
+
var reactIntersectionObserver = require('react-intersection-observer');
|
|
13
13
|
|
|
14
14
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
15
15
|
|
|
16
16
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
17
|
-
var VisibilitySensor__default = /*#__PURE__*/_interopDefaultLegacy(VisibilitySensor);
|
|
18
17
|
|
|
19
18
|
var __react_jsx__ = require('react');
|
|
20
19
|
var _J$X_ = (__react_jsx__["default"] || __react_jsx__).createElement;
|
|
@@ -41,7 +40,7 @@ var LazyComponent = /** @class */ (function (_super) {
|
|
|
41
40
|
LazyComponent.prototype.componentWillUnmount = function () {
|
|
42
41
|
this.mounted = false;
|
|
43
42
|
};
|
|
44
|
-
LazyComponent.prototype.handleVisibleChange = function (visible) {
|
|
43
|
+
LazyComponent.prototype.handleVisibleChange = function (visible, entry) {
|
|
45
44
|
var _this = this;
|
|
46
45
|
this.setState({
|
|
47
46
|
visible: visible
|
|
@@ -66,16 +65,20 @@ var LazyComponent = /** @class */ (function (_super) {
|
|
|
66
65
|
});
|
|
67
66
|
};
|
|
68
67
|
LazyComponent.prototype.render = function () {
|
|
69
|
-
var _a = this.props, placeholder = _a.placeholder, unMountOnHidden = _a.unMountOnHidden, childProps = _a.childProps,
|
|
68
|
+
var _a = this.props, placeholder = _a.placeholder, unMountOnHidden = _a.unMountOnHidden, childProps = _a.childProps, partialVisibility = _a.partialVisibility, children = _a.children, rest = tslib.__rest(_a, ["placeholder", "unMountOnHidden", "childProps", "partialVisibility", "children"]);
|
|
70
69
|
var _b = this.state, visible = _b.visible, Component = _b.component;
|
|
71
70
|
// 需要监听从可见到不可见。
|
|
72
71
|
if (unMountOnHidden) {
|
|
73
|
-
return (_J$X_(
|
|
74
|
-
|
|
72
|
+
return (_J$X_(reactIntersectionObserver.InView, { onChange: this.handleVisibleChange, threshold: partialVisibility ? 0 : 1 }, function (_a) {
|
|
73
|
+
var ref = _a.ref;
|
|
74
|
+
return (_J$X_("div", { ref: ref, className: "visibility-sensor ".concat(visible ? 'in' : '') }, Component && visible ? (_J$X_(Component, tslib.__assign({}, rest, childProps))) : children && visible ? (children) : (placeholder)));
|
|
75
|
+
}));
|
|
75
76
|
}
|
|
76
77
|
if (!visible) {
|
|
77
|
-
return (_J$X_(
|
|
78
|
-
|
|
78
|
+
return (_J$X_(reactIntersectionObserver.InView, { onChange: this.handleVisibleChange, threshold: partialVisibility ? 0 : 1 }, function (_a) {
|
|
79
|
+
var ref = _a.ref;
|
|
80
|
+
return (_J$X_("div", { ref: ref, className: "visibility-sensor" }, placeholder));
|
|
81
|
+
}));
|
|
79
82
|
}
|
|
80
83
|
else if (Component) {
|
|
81
84
|
// 只监听不可见到可见,一旦可见了,就销毁检查。
|
|
@@ -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
|
|
|
@@ -41,6 +41,8 @@ var RootClose = require('../utils/RootClose.js');
|
|
|
41
41
|
require('../utils/SimpleMap.js');
|
|
42
42
|
require('lodash/mapValues');
|
|
43
43
|
require('lodash/camelCase');
|
|
44
|
+
require('lodash/map');
|
|
45
|
+
require('lodash/isEmpty');
|
|
44
46
|
require('uncontrollable');
|
|
45
47
|
require('hoist-non-react-statics');
|
|
46
48
|
require('../utils/validations.js');
|