amis-core 3.4.0-beta.12 → 3.4.1
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 +6 -1
- package/esm/RootRenderer.js +53 -27
- package/esm/SchemaRenderer.js +23 -16
- 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 +1 -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 +4 -6
- package/esm/components/CustomStyle.js +29 -5
- 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.d.ts +1 -0
- package/esm/index.js +7 -7
- 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 +8 -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 +98 -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 +43 -27
- 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 +2 -3
- 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 +759 -44
- package/esm/store/table.js +171 -83
- package/esm/store/table2.js +11 -8
- package/esm/theme.d.ts +18 -31
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +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 +4 -3
- package/esm/utils/api.js +16 -3
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.d.ts +4 -2
- package/esm/utils/autobind.js +9 -11
- 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.d.ts +17 -0
- package/esm/utils/math.js +31 -2
- 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.d.ts +6 -1
- package/lib/RootRenderer.js +53 -27
- package/lib/SchemaRenderer.js +23 -16
- 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 +1 -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 +4 -6
- package/lib/components/CustomStyle.js +28 -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.d.ts +1 -0
- package/lib/index.js +13 -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 +8 -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 +100 -79
- package/lib/store/app.js +3 -1
- package/lib/store/combo.d.ts +408 -24
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +31 -25
- package/lib/store/form.d.ts +170 -10
- package/lib/store/form.js +15 -13
- package/lib/store/formItem.d.ts +4 -0
- package/lib/store/formItem.js +42 -26
- 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 +2 -3
- 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 +779 -64
- package/lib/store/table.js +171 -83
- package/lib/store/table2.js +11 -8
- package/lib/theme.d.ts +18 -31
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +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 +4 -3
- package/lib/utils/api.js +16 -2
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.d.ts +4 -2
- package/lib/utils/autobind.js +9 -11
- 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.d.ts +17 -0
- package/lib/utils/math.js +31 -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.d.ts
CHANGED
|
@@ -25,5 +25,10 @@ export declare class RootRenderer extends React.Component<RootRendererProps> {
|
|
|
25
25
|
handleDrawerClose(): void;
|
|
26
26
|
openFeedback(dialog: any, ctx: any): Promise<unknown>;
|
|
27
27
|
reloadTarget(scoped: IScopedContext, target: string, data?: any): void;
|
|
28
|
-
|
|
28
|
+
renderRuntimeError(): React.ReactNode;
|
|
29
|
+
renderSpinner(): React.ReactNode;
|
|
30
|
+
renderError(): React.ReactNode;
|
|
31
|
+
renderDialog(): React.ReactNode;
|
|
32
|
+
renderDrawer(): React.ReactNode;
|
|
33
|
+
render(): React.JSX.Element;
|
|
29
34
|
}
|
package/esm/RootRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.1
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -28,9 +28,10 @@ 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
|
+
// 将数据里面的函数批量的绑定到 this 上
|
|
34
35
|
bulkBindFunctions(_this, [
|
|
35
36
|
'handleAction',
|
|
36
37
|
'handleDialogConfirm',
|
|
@@ -53,7 +54,7 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
53
54
|
this.store.updateLocation(props.location);
|
|
54
55
|
}
|
|
55
56
|
if (props.context !== prevProps.context) {
|
|
56
|
-
this.store.
|
|
57
|
+
this.store.updateContext(props.context);
|
|
57
58
|
}
|
|
58
59
|
};
|
|
59
60
|
RootRenderer.prototype.componentDidCatch = function (error, errorInfo) {
|
|
@@ -126,9 +127,9 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
126
127
|
else if (action.actionType === 'toast') {
|
|
127
128
|
(_b = (_a = action.toast) === null || _a === void 0 ? void 0 : _a.items) === null || _b === void 0 ? void 0 : _b.forEach(function (item) {
|
|
128
129
|
env.notify(item.level || 'info', item.body
|
|
129
|
-
? render('body', item.body, __assign(__assign({}, _this.props), { data: ctx }))
|
|
130
|
+
? render('body', item.body, __assign(__assign({}, _this.props), { data: ctx, context: store.context }))
|
|
130
131
|
: '', __assign(__assign(__assign({}, action.toast), item), { title: item.title
|
|
131
|
-
? render('title', item.title, __assign(__assign({}, _this.props), { data: ctx }))
|
|
132
|
+
? render('title', item.title, __assign(__assign({}, _this.props), { data: ctx, context: store.context }))
|
|
132
133
|
: null, mobileUI: mobileUI }));
|
|
133
134
|
});
|
|
134
135
|
}
|
|
@@ -263,33 +264,58 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
263
264
|
RootRenderer.prototype.reloadTarget = function (scoped, target, data) {
|
|
264
265
|
scoped.reload(target, data);
|
|
265
266
|
};
|
|
266
|
-
RootRenderer.prototype.
|
|
267
|
+
RootRenderer.prototype.renderRuntimeError = function () {
|
|
267
268
|
var _a;
|
|
268
|
-
var _b = this.props,
|
|
269
|
+
var _b = this.props, render = _b.render, rest = __rest(_b, ["render"]);
|
|
270
|
+
var store = this.store;
|
|
271
|
+
return render('error', {
|
|
272
|
+
type: 'alert',
|
|
273
|
+
level: 'danger'
|
|
274
|
+
}, __assign(__assign({}, rest), { topStore: store, body: (React.createElement(React.Fragment, null,
|
|
275
|
+
React.createElement("h3", null, (_a = store.runtimeError) === null || _a === void 0 ? void 0 : _a.toString()),
|
|
276
|
+
React.createElement("pre", null,
|
|
277
|
+
React.createElement("code", null, store.runtimeErrorStack.componentStack)))) }));
|
|
278
|
+
};
|
|
279
|
+
RootRenderer.prototype.renderSpinner = function () {
|
|
280
|
+
var _a = this.props, render = _a.render, rest = __rest(_a, ["render"]);
|
|
281
|
+
var store = this.store;
|
|
282
|
+
return render('spinner', {
|
|
283
|
+
type: 'spinner'
|
|
284
|
+
}, __assign(__assign({}, rest), { topStore: store, show: store.loading }));
|
|
285
|
+
};
|
|
286
|
+
RootRenderer.prototype.renderError = function () {
|
|
287
|
+
var _a = this.props, render = _a.render, rest = __rest(_a, ["render"]);
|
|
288
|
+
var store = this.store;
|
|
289
|
+
return store.error
|
|
290
|
+
? render('error', {
|
|
291
|
+
type: 'alert'
|
|
292
|
+
}, __assign(__assign({}, rest), { topStore: this.store, body: store.msg, showCloseButton: true, onClose: store.clearMessage }))
|
|
293
|
+
: null;
|
|
294
|
+
};
|
|
295
|
+
RootRenderer.prototype.renderDialog = function () {
|
|
296
|
+
var _a = this.props, render = _a.render, rest = __rest(_a, ["render"]);
|
|
297
|
+
var store = this.store;
|
|
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, context: store.context, onConfirm: this.handleDialogConfirm, onClose: this.handleDialogClose, show: store.dialogOpen, onAction: this.handleAction }));
|
|
300
|
+
};
|
|
301
|
+
RootRenderer.prototype.renderDrawer = function () {
|
|
302
|
+
var _a = this.props, render = _a.render, rest = __rest(_a, ["render"]);
|
|
303
|
+
var store = this.store;
|
|
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, context: store.context, onConfirm: this.handleDrawerConfirm, onClose: this.handleDrawerClose, show: store.drawerOpen, onAction: this.handleAction }));
|
|
306
|
+
};
|
|
307
|
+
RootRenderer.prototype.render = function () {
|
|
308
|
+
var _a = this.props, pathPrefix = _a.pathPrefix, schema = _a.schema, render = _a.render, rest = __rest(_a, ["pathPrefix", "schema", "render"]);
|
|
269
309
|
var store = this.store;
|
|
270
310
|
if (store.runtimeError) {
|
|
271
|
-
|
|
272
|
-
type: 'alert',
|
|
273
|
-
level: 'danger'
|
|
274
|
-
}, __assign(__assign({}, rest), { topStore: this.store, body: (React.createElement(React.Fragment, null,
|
|
275
|
-
React.createElement("h3", null, (_a = this.store.runtimeError) === null || _a === void 0 ? void 0 : _a.toString()),
|
|
276
|
-
React.createElement("pre", null,
|
|
277
|
-
React.createElement("code", null, this.store.runtimeErrorStack.componentStack)))) }));
|
|
311
|
+
this.renderRuntimeError();
|
|
278
312
|
}
|
|
279
313
|
return (React.createElement(React.Fragment, null,
|
|
280
|
-
render(pathPrefix, schema, __assign(__assign({}, rest), { topStore: this.store, data: this.store.downStream, onAction: this.handleAction })),
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
? render('error', {
|
|
286
|
-
type: 'alert'
|
|
287
|
-
}, __assign(__assign({}, rest), { topStore: this.store, body: store.msg, showCloseButton: true, onClose: store.clearMessage }))
|
|
288
|
-
: null,
|
|
289
|
-
render('dialog', __assign(__assign({}, (store.action &&
|
|
290
|
-
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 })),
|
|
291
|
-
render('drawer', __assign(__assign({}, (store.action &&
|
|
292
|
-
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 }))));
|
|
314
|
+
render(pathPrefix, schema, __assign(__assign({}, rest), { topStore: this.store, data: this.store.downStream, context: store.context, onAction: this.handleAction })),
|
|
315
|
+
this.renderSpinner(),
|
|
316
|
+
this.renderError(),
|
|
317
|
+
this.renderDialog(),
|
|
318
|
+
this.renderDrawer()));
|
|
293
319
|
};
|
|
294
320
|
RootRenderer.contextType = ScopedContext;
|
|
295
321
|
RootRenderer = __decorate([
|
package/esm/SchemaRenderer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.1
|
|
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) {
|
|
@@ -176,9 +177,9 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
176
177
|
});
|
|
177
178
|
};
|
|
178
179
|
SchemaRenderer.prototype.renderChild = function (region, node, subProps) {
|
|
179
|
-
var _a, _b;
|
|
180
|
+
var _a, _b, _c, _d;
|
|
180
181
|
if (subProps === void 0) { subProps = {}; }
|
|
181
|
-
var
|
|
182
|
+
var _e = this.props, _ = _e.schema; _e.$path; var env = _e.env, render = _e.render, rest = __rest(_e, ["schema", "$path", "env", "render"]);
|
|
182
183
|
var $path = this.resolveRenderer(this.props).path;
|
|
183
184
|
var omitList = RENDERER_TRANSMISSION_OMIT_PROPS.concat();
|
|
184
185
|
if (this.renderer) {
|
|
@@ -186,9 +187,12 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
186
187
|
Component.propsList &&
|
|
187
188
|
omitList.push.apply(omitList, Component.propsList);
|
|
188
189
|
}
|
|
189
|
-
return render("".concat($path).concat(region ? "/".concat(region) : ''), node || '', __assign(__assign(__assign(__assign({}, omit(rest, omitList)), { defaultStatic: (_a = this.
|
|
190
|
+
return render("".concat($path).concat(region ? "/".concat(region) : ''), node || '', __assign(__assign(__assign(__assign({}, omit(rest, omitList)), { defaultStatic: (_c = (_b = (((_a = this.renderer) === null || _a === void 0 ? void 0 : _a.type) &&
|
|
191
|
+
['drawer', 'dialog'].includes(this.renderer.type)
|
|
192
|
+
? false
|
|
193
|
+
: undefined)) !== null && _b !== void 0 ? _b : this.isStatic) !== null && _c !== void 0 ? _c : (_.staticOn
|
|
190
194
|
? evalExpression(_.staticOn, rest.data)
|
|
191
|
-
: (
|
|
195
|
+
: (_d = _.static) !== null && _d !== void 0 ? _d : rest.defaultStatic) }), subProps), { data: subProps.data || rest.data, env: env }));
|
|
192
196
|
};
|
|
193
197
|
SchemaRenderer.prototype.reRender = function () {
|
|
194
198
|
this.resolveRenderer(this.props, true);
|
|
@@ -296,16 +300,14 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
296
300
|
if (renderer.storeType) {
|
|
297
301
|
exprProps = {};
|
|
298
302
|
}
|
|
299
|
-
// style 支持公式
|
|
300
|
-
if (schema.style) {
|
|
301
|
-
// schema.style是readonly属性
|
|
302
|
-
schema = __assign(__assign({}, schema), { style: buildStyle(schema.style, detectData) });
|
|
303
|
-
}
|
|
304
303
|
var isClassComponent = (_e = Component.prototype) === null || _e === void 0 ? void 0 : _e.isReactComponent;
|
|
305
|
-
var $schema = __assign(__assign({}, schema), exprProps);
|
|
306
304
|
var props = __assign(__assign(__assign(__assign(__assign({}, theme.getRendererConfig(renderer.name)), restSchema), chainEvents(rest, restSchema)), exprProps), {
|
|
307
305
|
// value: defaultValue, // 备注: 此处并没有将value传递给渲染器
|
|
308
|
-
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
|
+
}
|
|
309
311
|
if (disable !== undefined) {
|
|
310
312
|
props.disabled = disable;
|
|
311
313
|
}
|
|
@@ -315,7 +317,7 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
315
317
|
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
|
|
316
318
|
if (renderer.autoVar) {
|
|
317
319
|
try {
|
|
318
|
-
for (var _k = __values(Object.keys(
|
|
320
|
+
for (var _k = __values(Object.keys(schema)), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
319
321
|
var key = _l.value;
|
|
320
322
|
if (typeof props[key] === 'string') {
|
|
321
323
|
props[key] = resolveVariableAndFilter(props[key], props.data, '| raw');
|
|
@@ -346,12 +348,17 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
346
348
|
var PlaceholderComponent = /** @class */ (function (_super) {
|
|
347
349
|
__extends(PlaceholderComponent, _super);
|
|
348
350
|
function PlaceholderComponent() {
|
|
349
|
-
|
|
351
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
352
|
+
_this.childRef = React.createRef();
|
|
353
|
+
return _this;
|
|
350
354
|
}
|
|
355
|
+
PlaceholderComponent.prototype.getWrappedInstance = function () {
|
|
356
|
+
return this.childRef.current;
|
|
357
|
+
};
|
|
351
358
|
PlaceholderComponent.prototype.render = function () {
|
|
352
359
|
var _a = this.props, renderChildren = _a.renderChildren, rest = __rest(_a, ["renderChildren"]);
|
|
353
360
|
if (typeof renderChildren === 'function') {
|
|
354
|
-
return renderChildren(rest);
|
|
361
|
+
return renderChildren(__assign(__assign({}, rest), { ref: this.childRef }));
|
|
355
362
|
}
|
|
356
363
|
return null;
|
|
357
364
|
};
|
package/esm/Scoped.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.1
|
|
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.1
|
|
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.1
|
|
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.1
|
|
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,12 +1,10 @@
|
|
|
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
|
}
|
|
12
10
|
export default function (props: CustomStyleProps): null;
|
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.4.
|
|
2
|
+
* amis-core v3.4.1
|
|
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
9
|
function CustomStyle (props) {
|
|
10
|
-
var
|
|
10
|
+
var config = props.config, env = props.env;
|
|
11
|
+
var themeCss = config.themeCss, classNames = config.classNames, id = config.id, defaultData = config.defaultData, wrapperCustomStyle = config.wrapperCustomStyle;
|
|
12
|
+
if (!themeCss && !wrapperCustomStyle) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
11
15
|
useEffect(function () {
|
|
12
16
|
var _a;
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
if (themeCss && id) {
|
|
18
|
+
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);
|
|
19
|
+
}
|
|
20
|
+
return function () {
|
|
21
|
+
var _a;
|
|
22
|
+
if (id) {
|
|
23
|
+
removeCustomStyle('', id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}, [themeCss, id]);
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
var _a;
|
|
29
|
+
if (wrapperCustomStyle && id) {
|
|
30
|
+
insertEditCustomStyle(wrapperCustomStyle, id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
31
|
+
}
|
|
32
|
+
return function () {
|
|
33
|
+
var _a;
|
|
34
|
+
if (id) {
|
|
35
|
+
removeCustomStyle('wrapperCustomStyle', id, (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env).ownerDocument);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}, [wrapperCustomStyle, id]);
|
|
15
39
|
return null;
|
|
16
40
|
}
|
|
17
41
|
|
|
@@ -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.1
|
|
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.1
|
|
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';
|