amis-core 6.0.0 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/Root.js +2 -2
- package/esm/RootRenderer.js +4 -3
- package/esm/SchemaRenderer.js +5 -2
- package/esm/Scoped.d.ts +6 -0
- package/esm/Scoped.js +45 -8
- package/esm/StatusScoped.js +2 -2
- package/esm/WithRootStore.js +2 -2
- package/esm/WithStore.js +4 -6
- package/esm/actions/Action.js +2 -2
- package/esm/actions/AjaxAction.js +2 -2
- package/esm/actions/BreakAction.js +2 -2
- package/esm/actions/BroadcastAction.js +2 -2
- package/esm/actions/CmptAction.js +2 -2
- package/esm/actions/ContinueAction.js +2 -2
- package/esm/actions/CopyAction.js +2 -2
- package/esm/actions/CustomAction.js +3 -3
- package/esm/actions/DialogAction.js +2 -2
- package/esm/actions/DrawerAction.js +2 -2
- package/esm/actions/EmailAction.js +2 -2
- package/esm/actions/LinkAction.js +10 -5
- package/esm/actions/LoopAction.js +2 -2
- package/esm/actions/PageAction.js +2 -2
- package/esm/actions/ParallelAction.js +2 -2
- package/esm/actions/StatusAction.js +2 -2
- package/esm/actions/SwitchAction.js +2 -2
- package/esm/actions/ToastAction.js +2 -2
- package/esm/components/CustomStyle.d.ts +1 -2
- package/esm/components/CustomStyle.js +20 -7
- package/esm/components/ErrorBoundary.js +2 -2
- package/esm/components/LazyComponent.js +2 -2
- package/esm/components/Overlay.js +11 -9
- package/esm/components/PopOver.js +7 -5
- package/esm/env.d.ts +4 -0
- package/esm/env.js +2 -2
- package/esm/envOverwrite.js +2 -2
- package/esm/factory.js +15 -2
- package/esm/index.d.ts +2 -2
- package/esm/index.js +13 -8
- package/esm/locale.js +2 -2
- package/esm/polyfills.js +2 -2
- package/esm/renderers/Form.d.ts +4 -3
- package/esm/renderers/Form.js +94 -42
- package/esm/renderers/Item.d.ts +1 -0
- package/esm/renderers/Item.js +15 -16
- package/esm/renderers/Options.d.ts +5 -0
- package/esm/renderers/Options.js +27 -10
- package/esm/renderers/Placeholder.js +2 -2
- package/esm/renderers/builtin.js +2 -2
- package/esm/renderers/register.js +2 -2
- package/esm/renderers/wrapControl.js +37 -29
- package/esm/store/app.js +3 -3
- package/esm/store/combo.d.ts +48 -24
- package/esm/store/combo.js +2 -2
- package/esm/store/crud.js +2 -2
- package/esm/store/form.d.ts +20 -10
- package/esm/store/form.js +2 -2
- package/esm/store/formItem.d.ts +2 -1
- package/esm/store/formItem.js +4 -3
- package/esm/store/iRenderer.js +5 -3
- package/esm/store/index.js +2 -2
- package/esm/store/list.js +2 -2
- package/esm/store/manager.js +2 -2
- package/esm/store/modal.js +2 -2
- package/esm/store/node.js +2 -2
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.js +3 -3
- package/esm/store/service.js +2 -2
- package/esm/store/status.js +2 -2
- package/esm/store/table.d.ts +42 -20
- package/esm/store/table.js +33 -19
- package/esm/store/table2.js +2 -2
- package/esm/theme.js +2 -2
- package/esm/utils/Animation.js +2 -2
- package/esm/utils/ColorScale.js +2 -2
- package/esm/utils/DataSchema.js +2 -2
- package/esm/utils/DataScope.js +2 -2
- package/esm/utils/RootClose.js +2 -2
- package/esm/utils/SimpleMap.js +2 -2
- package/esm/utils/api.js +2 -2
- package/esm/utils/arraySlice.js +2 -2
- package/esm/utils/attachmentAdpator.js +2 -2
- package/esm/utils/autobind.js +2 -2
- package/esm/utils/browser.js +2 -2
- package/esm/utils/columnsSplit.js +2 -2
- package/esm/utils/concatData.js +2 -2
- package/esm/utils/dataMapping.js +2 -2
- package/esm/utils/date.js +2 -2
- package/esm/utils/debug.js +2 -2
- package/esm/utils/decodeEntity.js +2 -2
- package/esm/utils/dom.js +2 -2
- package/esm/utils/errors.js +2 -2
- package/esm/utils/escapeHtml.js +2 -2
- package/esm/utils/filter-schema.js +2 -2
- package/esm/utils/filter.js +2 -2
- package/esm/utils/formatDuration.js +2 -2
- package/esm/utils/formula.js +2 -2
- package/esm/utils/getVariable.js +2 -2
- package/esm/utils/grammar.js +2 -2
- package/esm/utils/handleAction.js +2 -2
- package/esm/utils/helper.d.ts +8 -1
- package/esm/utils/helper.js +28 -10
- package/esm/utils/highlight.js +4 -3
- package/esm/utils/icon.js +2 -2
- package/esm/utils/image.js +2 -2
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/isPureVariable.js +2 -2
- package/esm/utils/json-schema-2-amis-schema.js +2 -2
- package/esm/utils/keyToPath.js +2 -2
- package/esm/utils/labelToString.d.ts +1 -0
- package/esm/utils/labelToString.js +38 -0
- package/esm/utils/makeSorter.js +2 -2
- package/esm/utils/math.js +2 -2
- package/esm/utils/memoryParse.js +2 -2
- package/esm/utils/normalizeLink.js +2 -2
- package/esm/utils/normalizeOptions.js +2 -2
- package/esm/utils/object.js +2 -2
- package/esm/utils/offset.js +2 -2
- package/esm/utils/offsetParent.js +2 -2
- package/esm/utils/optionValueCompare.js +2 -2
- package/esm/utils/position.js +2 -2
- package/esm/utils/prettyBytes.js +2 -2
- package/esm/utils/renderer-event.js +2 -2
- package/esm/utils/replaceText.js +10 -12
- package/esm/utils/resize-sensor.js +2 -2
- package/esm/utils/resolveCondition.js +2 -2
- package/esm/utils/resolveVariable.js +2 -2
- package/esm/utils/resolveVariableAndFilter.js +2 -2
- package/esm/utils/resolveVariableAndFilterForAsync.js +2 -2
- package/esm/utils/scrollPosition.js +2 -2
- package/esm/utils/string2regExp.d.ts +1 -1
- package/esm/utils/string2regExp.js +5 -4
- package/esm/utils/stripNumber.js +2 -2
- package/esm/utils/style-helper.d.ts +24 -5
- package/esm/utils/style-helper.js +47 -17
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +2 -2
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +11 -4
- package/esm/utils/tpl-builtin.js +2 -2
- package/esm/utils/tpl-lodash.js +2 -2
- package/esm/utils/tpl.js +7 -9
- package/esm/utils/uncontrollable.js +2 -2
- package/esm/utils/validateId.d.ts +16 -0
- package/esm/utils/validateId.js +154 -0
- package/esm/utils/validations.js +17 -9
- package/lib/Root.js +2 -2
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +4 -3
- package/lib/SchemaRenderer.js +5 -2
- package/lib/Scoped.d.ts +6 -0
- package/lib/Scoped.js +45 -7
- package/lib/StatusScoped.js +2 -2
- package/lib/WithRootStore.js +2 -2
- package/lib/WithStore.js +4 -6
- package/lib/actions/Action.js +2 -2
- package/lib/actions/AjaxAction.js +2 -2
- package/lib/actions/BreakAction.js +2 -2
- package/lib/actions/BroadcastAction.js +2 -2
- package/lib/actions/CmptAction.js +2 -2
- package/lib/actions/ContinueAction.js +2 -2
- package/lib/actions/CopyAction.js +2 -2
- package/lib/actions/CustomAction.js +3 -3
- package/lib/actions/DialogAction.js +2 -2
- package/lib/actions/DrawerAction.js +2 -2
- package/lib/actions/EmailAction.js +2 -2
- package/lib/actions/LinkAction.js +10 -5
- package/lib/actions/LoopAction.js +2 -2
- package/lib/actions/PageAction.js +2 -2
- package/lib/actions/ParallelAction.js +2 -2
- package/lib/actions/StatusAction.js +2 -2
- package/lib/actions/SwitchAction.js +2 -2
- package/lib/actions/ToastAction.js +2 -2
- package/lib/components/CustomStyle.d.ts +1 -2
- package/lib/components/CustomStyle.js +20 -7
- package/lib/components/ErrorBoundary.js +2 -2
- package/lib/components/LazyComponent.js +2 -2
- package/lib/components/Overlay.js +10 -8
- package/lib/components/PopOver.js +7 -5
- package/lib/env.d.ts +4 -0
- package/lib/env.js +2 -2
- package/lib/envOverwrite.js +2 -2
- package/lib/factory.js +15 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +16 -5
- package/lib/locale.js +2 -2
- package/lib/polyfills.js +2 -2
- package/lib/renderers/Form.d.ts +4 -3
- package/lib/renderers/Form.js +94 -42
- package/lib/renderers/Item.d.ts +1 -0
- package/lib/renderers/Item.js +15 -16
- package/lib/renderers/Options.d.ts +5 -0
- package/lib/renderers/Options.js +27 -10
- package/lib/renderers/Placeholder.js +2 -2
- package/lib/renderers/builtin.js +2 -2
- package/lib/renderers/register.js +2 -2
- package/lib/renderers/wrapControl.js +36 -28
- package/lib/store/app.js +3 -3
- package/lib/store/combo.d.ts +72 -49
- package/lib/store/combo.js +2 -2
- package/lib/store/crud.js +2 -2
- package/lib/store/form.d.ts +30 -21
- package/lib/store/form.js +2 -2
- package/lib/store/formItem.d.ts +2 -1
- package/lib/store/formItem.js +4 -3
- package/lib/store/iRenderer.js +5 -3
- package/lib/store/index.js +2 -2
- package/lib/store/list.js +2 -2
- package/lib/store/manager.js +2 -2
- package/lib/store/modal.js +2 -2
- package/lib/store/node.js +2 -2
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.js +3 -3
- package/lib/store/service.js +2 -2
- package/lib/store/status.js +2 -2
- package/lib/store/table.d.ts +62 -41
- package/lib/store/table.js +33 -19
- package/lib/store/table2.js +2 -2
- package/lib/theme.js +2 -2
- package/lib/utils/Animation.js +2 -2
- package/lib/utils/ColorScale.js +2 -2
- package/lib/utils/DataSchema.js +2 -2
- package/lib/utils/DataScope.js +2 -2
- package/lib/utils/RootClose.js +2 -2
- package/lib/utils/SimpleMap.js +2 -2
- package/lib/utils/api.js +2 -2
- package/lib/utils/arraySlice.js +2 -2
- package/lib/utils/attachmentAdpator.js +2 -2
- package/lib/utils/autobind.js +2 -2
- package/lib/utils/browser.js +2 -2
- package/lib/utils/columnsSplit.js +2 -2
- package/lib/utils/concatData.js +2 -2
- package/lib/utils/dataMapping.js +2 -2
- package/lib/utils/date.js +2 -2
- package/lib/utils/debug.js +2 -2
- package/lib/utils/decodeEntity.js +2 -2
- package/lib/utils/dom.js +2 -2
- package/lib/utils/errors.js +2 -2
- package/lib/utils/escapeHtml.js +2 -2
- package/lib/utils/filter-schema.js +2 -2
- package/lib/utils/filter.js +2 -2
- package/lib/utils/formatDuration.js +2 -2
- package/lib/utils/formula.js +2 -2
- package/lib/utils/getVariable.js +2 -2
- package/lib/utils/grammar.js +2 -2
- package/lib/utils/handleAction.js +2 -2
- package/lib/utils/helper.d.ts +8 -1
- package/lib/utils/helper.js +29 -8
- package/lib/utils/highlight.js +4 -3
- package/lib/utils/icon.js +2 -2
- package/lib/utils/image.js +2 -2
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/isPureVariable.js +2 -2
- package/lib/utils/json-schema-2-amis-schema.js +2 -2
- package/lib/utils/keyToPath.js +2 -2
- package/lib/utils/labelToString.d.ts +1 -0
- package/lib/utils/labelToString.js +46 -0
- package/lib/utils/makeSorter.js +2 -2
- package/lib/utils/math.js +2 -2
- package/lib/utils/memoryParse.js +2 -2
- package/lib/utils/normalizeLink.js +2 -2
- package/lib/utils/normalizeOptions.js +2 -2
- package/lib/utils/object.js +2 -2
- package/lib/utils/offset.js +2 -2
- package/lib/utils/offsetParent.js +2 -2
- package/lib/utils/optionValueCompare.js +2 -2
- package/lib/utils/position.js +2 -2
- package/lib/utils/prettyBytes.js +2 -2
- package/lib/utils/renderer-event.js +2 -2
- package/lib/utils/replaceText.js +9 -15
- package/lib/utils/resize-sensor.js +2 -2
- package/lib/utils/resolveCondition.js +2 -2
- package/lib/utils/resolveVariable.js +2 -2
- package/lib/utils/resolveVariableAndFilter.js +2 -2
- package/lib/utils/resolveVariableAndFilterForAsync.js +2 -2
- package/lib/utils/scrollPosition.js +2 -2
- package/lib/utils/string2regExp.d.ts +1 -1
- package/lib/utils/string2regExp.js +5 -4
- package/lib/utils/stripNumber.js +2 -2
- package/lib/utils/style-helper.d.ts +24 -5
- package/lib/utils/style-helper.js +47 -17
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +2 -2
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +11 -3
- package/lib/utils/tpl-builtin.js +2 -2
- package/lib/utils/tpl-lodash.js +2 -2
- package/lib/utils/tpl.js +6 -8
- package/lib/utils/uncontrollable.js +2 -2
- package/lib/utils/validateId.d.ts +16 -0
- package/lib/utils/validateId.js +160 -0
- package/lib/utils/validations.js +17 -9
- package/package.json +3 -3
- package/LICENSE +0 -201
package/esm/Root.js
CHANGED
package/esm/RootRenderer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __extends, __assign, __awaiter, __generator, __spreadArray, __read, __rest, __decorate, __metadata } from 'tslib';
|
|
@@ -56,12 +56,13 @@ var RootRenderer = /** @class */ (function (_super) {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
RootRenderer.prototype.componentDidUpdate = function (prevProps) {
|
|
59
|
+
var _a;
|
|
59
60
|
var props = this.props;
|
|
60
61
|
if (props.data !== prevProps.data) {
|
|
61
62
|
this.store.initData(props.data);
|
|
62
63
|
}
|
|
63
64
|
if (props.location !== prevProps.location) {
|
|
64
|
-
this.store.updateLocation(props.location);
|
|
65
|
+
this.store.updateLocation(props.location, (_a = this.props.env) === null || _a === void 0 ? void 0 : _a.parseLocation);
|
|
65
66
|
}
|
|
66
67
|
if (props.context !== prevProps.context) {
|
|
67
68
|
this.store.updateContext(props.context);
|
package/esm/SchemaRenderer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __extends, __assign, __awaiter, __generator, __rest, __values, __decorate, __metadata } from 'tslib';
|
|
@@ -314,6 +314,9 @@ var SchemaRenderer = /** @class */ (function (_super) {
|
|
|
314
314
|
if (isStatic !== undefined) {
|
|
315
315
|
props.static = isStatic;
|
|
316
316
|
}
|
|
317
|
+
if (rest.env.enableTestid && props.id && !props.testid) {
|
|
318
|
+
props.testid = props.id;
|
|
319
|
+
}
|
|
317
320
|
// 自动解析变量模式,主要是方便直接引入第三方组件库,无需为了支持变量封装一层
|
|
318
321
|
if (renderer.autoVar) {
|
|
319
322
|
try {
|
package/esm/Scoped.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ import { ListenerAction } from './actions';
|
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
export declare function filterTarget(target: string, data: Record<string, any>): string;
|
|
17
|
+
/**
|
|
18
|
+
* 分割目标,如果里面有表达式,不要跟表达式里面的逗号冲突。
|
|
19
|
+
* @param target
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare function splitTarget(target: string): Array<string>;
|
|
17
23
|
export interface ScopedComponentType extends React.Component<RendererProps> {
|
|
18
24
|
focus?: () => void;
|
|
19
25
|
doAction?: (action: ActionObject, data: RendererData, throwErrors?: boolean) => void;
|
package/esm/Scoped.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __values, __assign, __awaiter, __generator, __extends, __rest, __decorate, __metadata } from 'tslib';
|
|
@@ -11,6 +11,7 @@ import hoistNonReactStatic from 'hoist-non-react-statics';
|
|
|
11
11
|
import { registerFunction } from 'amis-formula';
|
|
12
12
|
import 'moment';
|
|
13
13
|
import { createObject } from './utils/object.js';
|
|
14
|
+
import { memoParse } from './utils/tokenize.js';
|
|
14
15
|
import { isPureVariable } from './utils/isPureVariable.js';
|
|
15
16
|
import { getVariable } from './utils/getVariable.js';
|
|
16
17
|
import { dataMapping } from './utils/dataMapping.js';
|
|
@@ -33,12 +34,12 @@ import 'lodash/isBoolean';
|
|
|
33
34
|
import './utils/image.js';
|
|
34
35
|
import 'lodash/isEqual';
|
|
35
36
|
import { createRendererEvent } from './utils/renderer-event.js';
|
|
36
|
-
import 'lodash/cloneDeep';
|
|
37
37
|
import './utils/resize-sensor.js';
|
|
38
38
|
import 'react-overlays/useRootClose';
|
|
39
39
|
import './utils/SimpleMap.js';
|
|
40
40
|
import 'lodash/mapValues';
|
|
41
41
|
import 'lodash/camelCase';
|
|
42
|
+
import 'lodash/cloneDeep';
|
|
42
43
|
import 'lodash/map';
|
|
43
44
|
import 'lodash/isEmpty';
|
|
44
45
|
import 'lodash/kebabCase';
|
|
@@ -84,6 +85,43 @@ function filterTarget(target, data) {
|
|
|
84
85
|
}
|
|
85
86
|
return filter(target, data, '| raw');
|
|
86
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* 分割目标,如果里面有表达式,不要跟表达式里面的逗号冲突。
|
|
90
|
+
* @param target
|
|
91
|
+
* @returns
|
|
92
|
+
*/
|
|
93
|
+
function splitTarget(target) {
|
|
94
|
+
try {
|
|
95
|
+
var ast = memoParse(target);
|
|
96
|
+
var pos_1 = [];
|
|
97
|
+
ast.body.forEach(function (item) {
|
|
98
|
+
// 不要处理表达式里面的东西。
|
|
99
|
+
if (item.type === 'raw') {
|
|
100
|
+
var parts = item.value.split(',');
|
|
101
|
+
if (parts.length > 1) {
|
|
102
|
+
parts.pop();
|
|
103
|
+
var start_1 = item.start.index;
|
|
104
|
+
parts.forEach(function (part) {
|
|
105
|
+
pos_1.push(start_1 + part.length);
|
|
106
|
+
start_1 += part.length + 1;
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
if (pos_1.length) {
|
|
112
|
+
var parts = [];
|
|
113
|
+
pos_1.reduceRight(function (arr, index) {
|
|
114
|
+
arr.unshift(target.slice(index + 1));
|
|
115
|
+
target = target.slice(0, index);
|
|
116
|
+
return arr;
|
|
117
|
+
}, parts);
|
|
118
|
+
parts.unshift(target);
|
|
119
|
+
return parts;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (e) { }
|
|
123
|
+
return [target];
|
|
124
|
+
}
|
|
87
125
|
var rootScopedContext = createScopedTools('');
|
|
88
126
|
var ScopedContext = React.createContext(rootScopedContext);
|
|
89
127
|
function createScopedTools(path, parent, env, rendererType) {
|
|
@@ -228,7 +266,7 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
228
266
|
},
|
|
229
267
|
reload: function (target, ctx) {
|
|
230
268
|
var scoped = this;
|
|
231
|
-
var targets = typeof target === 'string' ? target
|
|
269
|
+
var targets = typeof target === 'string' ? splitTarget(target) : target;
|
|
232
270
|
targets.forEach(function (name) {
|
|
233
271
|
var idx2 = name.indexOf('?');
|
|
234
272
|
var query = null;
|
|
@@ -264,7 +302,7 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
264
302
|
},
|
|
265
303
|
send: function (receive, values) {
|
|
266
304
|
var scoped = this;
|
|
267
|
-
var receives = typeof receive === 'string' ? receive
|
|
305
|
+
var receives = typeof receive === 'string' ? splitTarget(receive) : receive;
|
|
268
306
|
// todo 没找到做提示!
|
|
269
307
|
receives.forEach(function (name) {
|
|
270
308
|
var askIdx = name.indexOf('?');
|
|
@@ -300,8 +338,7 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
300
338
|
var scoped = this;
|
|
301
339
|
if (typeof target === 'string') {
|
|
302
340
|
// 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
|
|
303
|
-
target
|
|
304
|
-
.split(/\s*,\s*/)
|
|
341
|
+
splitTarget(target)
|
|
305
342
|
.map(function (name) { return scoped.getComponentByName(name); })
|
|
306
343
|
.filter(function (component) { return component && component.props.show; })
|
|
307
344
|
.forEach(closeDialog);
|
|
@@ -427,4 +464,4 @@ function HocScoped(ComposedComponent, rendererType) {
|
|
|
427
464
|
return ScopedComponent;
|
|
428
465
|
}
|
|
429
466
|
|
|
430
|
-
export { HocScoped, ScopedContext, HocScoped as default, filterTarget };
|
|
467
|
+
export { HocScoped, ScopedContext, HocScoped as default, filterTarget, splitTarget };
|
package/esm/StatusScoped.js
CHANGED
package/esm/WithRootStore.js
CHANGED
package/esm/WithStore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __extends, __assign, __rest, __decorate, __metadata } from 'tslib';
|
|
@@ -96,9 +96,7 @@ function HocStoreFactory(renderer) {
|
|
|
96
96
|
isObjectShallowModified(state, this.state) && this.setState(state);
|
|
97
97
|
// 需要重新监听
|
|
98
98
|
(_a = this.unReaction) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
99
|
-
this.unReaction = reaction(function () { return
|
|
100
|
-
return _this.setState(__assign({}, getExprProperties(_this.props, store.data)));
|
|
101
|
-
});
|
|
99
|
+
this.unReaction = reaction(function () { return getExprProperties(_this.props, store.data); }, function (exprProps) { return _this.setState(exprProps); });
|
|
102
100
|
}
|
|
103
101
|
var shouldSync = (_b = renderer.shouldSyncSuperStore) === null || _b === void 0 ? void 0 : _b.call(renderer, store, props, prevProps);
|
|
104
102
|
if (shouldSync === false) {
|
|
@@ -143,7 +141,7 @@ function HocStoreFactory(renderer) {
|
|
|
143
141
|
// 目前主要的问题是,如果 combo 中表单项名字和 combo 本身的名字一样,会导致里面的值会被覆盖成数组
|
|
144
142
|
((_c = props.store) === null || _c === void 0 ? void 0 : _c.storeType) === 'ComboStore'
|
|
145
143
|
? undefined
|
|
146
|
-
: syncDataFromSuper(
|
|
144
|
+
: syncDataFromSuper(store.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
|
|
147
145
|
}
|
|
148
146
|
else {
|
|
149
147
|
store.initData(createObject(props.scope, props.data), props.updatePristineAfterStoreDataReInit === false);
|
package/esm/actions/Action.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __awaiter, __generator } from 'tslib';
|
|
@@ -27,12 +27,12 @@ import '../utils/image.js';
|
|
|
27
27
|
import 'lodash/isEqual';
|
|
28
28
|
import { registerAction, runActions } from './Action.js';
|
|
29
29
|
import 'lodash/debounce';
|
|
30
|
-
import 'lodash/cloneDeep';
|
|
31
30
|
import '../utils/resize-sensor.js';
|
|
32
31
|
import 'react-overlays/useRootClose';
|
|
33
32
|
import '../utils/SimpleMap.js';
|
|
34
33
|
import 'lodash/mapValues';
|
|
35
34
|
import 'lodash/camelCase';
|
|
35
|
+
import 'lodash/cloneDeep';
|
|
36
36
|
import 'lodash/map';
|
|
37
37
|
import 'lodash/isEmpty';
|
|
38
38
|
import 'lodash/kebabCase';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __awaiter, __generator, __assign } from 'tslib';
|
|
@@ -20,15 +20,20 @@ var LinkAction = /** @class */ (function () {
|
|
|
20
20
|
LinkAction.prototype.run = function (action, renderer, event) {
|
|
21
21
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
22
22
|
return __awaiter(this, void 0, void 0, function () {
|
|
23
|
-
var urlObj;
|
|
23
|
+
var apiParams, urlObj;
|
|
24
24
|
return __generator(this, function (_j) {
|
|
25
25
|
if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
|
|
26
26
|
throw new Error('env.jumpTo is required!');
|
|
27
27
|
}
|
|
28
|
+
apiParams = __assign(__assign({}, ((_c = (_b = action.args) === null || _b === void 0 ? void 0 : _b.params) !== null && _c !== void 0 ? _c : {})), ((_d = action.data) !== null && _d !== void 0 ? _d : {}));
|
|
29
|
+
if ((action === null || action === void 0 ? void 0 : action.actionType) === 'link' && (apiParams === null || apiParams === void 0 ? void 0 : apiParams.targetType)) {
|
|
30
|
+
// link动作新增打开方式targetType,buildApi不需要该参数
|
|
31
|
+
delete apiParams.targetType;
|
|
32
|
+
}
|
|
28
33
|
urlObj = buildApi({
|
|
29
|
-
url: (((
|
|
34
|
+
url: (((_e = action.args) === null || _e === void 0 ? void 0 : _e.url) || ((_f = action.args) === null || _f === void 0 ? void 0 : _f.link)),
|
|
30
35
|
method: 'get'
|
|
31
|
-
},
|
|
36
|
+
}, apiParams, {
|
|
32
37
|
autoAppend: true
|
|
33
38
|
});
|
|
34
39
|
(_g = event.context.env) === null || _g === void 0 ? void 0 : _g.jumpTo(urlObj.url, __assign({ actionType: action.actionType, type: 'button' }, action.args), (_h = action.data) !== null && _h !== void 0 ? _h : {});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { RendererEnv } from '../env';
|
|
2
1
|
import { type InsertCustomStyle } from '../utils/style-helper';
|
|
3
2
|
interface CustomStyleProps {
|
|
4
3
|
config: {
|
|
5
4
|
wrapperCustomStyle?: any;
|
|
6
5
|
componentId?: string;
|
|
7
6
|
} & InsertCustomStyle;
|
|
8
|
-
|
|
7
|
+
[propName: string]: any;
|
|
9
8
|
}
|
|
10
9
|
export declare const styleIdCount: Map<any, any>;
|
|
11
10
|
export default function (props: CustomStyleProps): null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { useEffect } from 'react';
|
|
@@ -8,7 +8,7 @@ import { insertCustomStyle, removeCustomStyle, insertEditCustomStyle } from '../
|
|
|
8
8
|
|
|
9
9
|
var styleIdCount = new Map();
|
|
10
10
|
function CustomStyle (props) {
|
|
11
|
-
var config = props.config, env = props.env;
|
|
11
|
+
var config = props.config, env = props.env, data = props.data;
|
|
12
12
|
var themeCss = config.themeCss, classNames = config.classNames, id = config.id, defaultData = config.defaultData, wrapperCustomStyle = config.wrapperCustomStyle;
|
|
13
13
|
if (!themeCss && !wrapperCustomStyle) {
|
|
14
14
|
return null;
|
|
@@ -32,24 +32,37 @@ function CustomStyle (props) {
|
|
|
32
32
|
useEffect(function () {
|
|
33
33
|
var _a, _b;
|
|
34
34
|
if (themeCss && id) {
|
|
35
|
-
insertCustomStyle(
|
|
35
|
+
insertCustomStyle({
|
|
36
|
+
themeCss: themeCss,
|
|
37
|
+
classNames: classNames,
|
|
38
|
+
id: id,
|
|
39
|
+
defaultData: defaultData,
|
|
40
|
+
customStyleClassPrefix: env === null || env === void 0 ? void 0 : env.customStyleClassPrefix,
|
|
41
|
+
doc: (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument,
|
|
42
|
+
data: data
|
|
43
|
+
});
|
|
36
44
|
}
|
|
37
45
|
return function () {
|
|
38
46
|
var _a, _b;
|
|
39
47
|
if (id && !styleIdCount.get(id)) {
|
|
40
|
-
removeCustomStyle('', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
48
|
+
removeCustomStyle('', id, (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument, data);
|
|
41
49
|
}
|
|
42
50
|
};
|
|
43
51
|
}, [themeCss, id]);
|
|
44
52
|
useEffect(function () {
|
|
45
53
|
var _a, _b;
|
|
46
54
|
if (wrapperCustomStyle && id) {
|
|
47
|
-
insertEditCustomStyle(
|
|
55
|
+
insertEditCustomStyle({
|
|
56
|
+
customStyle: wrapperCustomStyle,
|
|
57
|
+
id: id,
|
|
58
|
+
doc: (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument,
|
|
59
|
+
data: data
|
|
60
|
+
});
|
|
48
61
|
}
|
|
49
62
|
return function () {
|
|
50
63
|
var _a, _b;
|
|
51
64
|
if (id && !styleIdCount.get(id)) {
|
|
52
|
-
removeCustomStyle('wrapperCustomStyle', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
65
|
+
removeCustomStyle('wrapperCustomStyle', id, (_b = (_a = env === null || env === void 0 ? void 0 : env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument, data);
|
|
53
66
|
}
|
|
54
67
|
};
|
|
55
68
|
}, [wrapperCustomStyle, id]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
3
|
-
* Copyright 2018-
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __extends, __rest, __assign, __decorate, __metadata } from 'tslib';
|
|
@@ -21,7 +21,7 @@ import '../utils/debug.js';
|
|
|
21
21
|
import { getContainer, ownerDocument, calculatePosition } from '../utils/dom.js';
|
|
22
22
|
import '../utils/errors.js';
|
|
23
23
|
import '../utils/tpl.js';
|
|
24
|
-
import { noop, getScrollParent, autobind } from '../utils/helper.js';
|
|
24
|
+
import { uuid, noop, getScrollParent, autobind } from '../utils/helper.js';
|
|
25
25
|
import '../utils/filter.js';
|
|
26
26
|
import 'lodash/isObject';
|
|
27
27
|
import 'lodash/isString';
|
|
@@ -30,12 +30,12 @@ import '../utils/image.js';
|
|
|
30
30
|
import 'lodash/isEqual';
|
|
31
31
|
import '../actions/Action.js';
|
|
32
32
|
import 'lodash/debounce';
|
|
33
|
-
import 'lodash/cloneDeep';
|
|
34
33
|
import { getComputedStyle, resizeSensor } from '../utils/resize-sensor.js';
|
|
35
34
|
import { RootClose } from '../utils/RootClose.js';
|
|
36
35
|
import '../utils/SimpleMap.js';
|
|
37
36
|
import 'lodash/mapValues';
|
|
38
37
|
import 'lodash/camelCase';
|
|
38
|
+
import 'lodash/cloneDeep';
|
|
39
39
|
import 'lodash/map';
|
|
40
40
|
import 'lodash/isEmpty';
|
|
41
41
|
import 'lodash/kebabCase';
|
|
@@ -86,6 +86,7 @@ var Position = /** @class */ (function (_super) {
|
|
|
86
86
|
arrowOffsetTop: null
|
|
87
87
|
};
|
|
88
88
|
_this._lastTarget = null;
|
|
89
|
+
_this.componentId = uuid();
|
|
89
90
|
return _this;
|
|
90
91
|
}
|
|
91
92
|
Position.prototype.updatePosition = function (target) {
|
|
@@ -97,7 +98,7 @@ var Position = /** @class */ (function (_super) {
|
|
|
97
98
|
var parentPopover = (_a = target === null || target === void 0 ? void 0 : target.closest) === null || _a === void 0 ? void 0 : _a.call(target, '[role=popover]');
|
|
98
99
|
if (!this.parentPopover && parentPopover) {
|
|
99
100
|
this.parentPopover = parentPopover;
|
|
100
|
-
this.parentPopover.setAttribute(SubPopoverDisplayedID, true);
|
|
101
|
+
this.parentPopover.setAttribute(SubPopoverDisplayedID + '-' + this.componentId, true);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
if (!target) {
|
|
@@ -138,9 +139,11 @@ var Position = /** @class */ (function (_super) {
|
|
|
138
139
|
};
|
|
139
140
|
Position.prototype.componentWillUnmount = function () {
|
|
140
141
|
var _a;
|
|
142
|
+
// 一个 PopOver 关闭时,需把挂载父 PopOver 的标记去掉
|
|
143
|
+
// 这里可能会存在多个子 PopOver 的情况,所以需要加上 componentId
|
|
141
144
|
if (this.parentPopover &&
|
|
142
|
-
this.parentPopover.getAttribute(SubPopoverDisplayedID)) {
|
|
143
|
-
this.parentPopover.removeAttribute(SubPopoverDisplayedID);
|
|
145
|
+
this.parentPopover.getAttribute(SubPopoverDisplayedID + '-' + this.componentId)) {
|
|
146
|
+
this.parentPopover.removeAttribute(SubPopoverDisplayedID + '-' + this.componentId);
|
|
144
147
|
this.parentPopover = null;
|
|
145
148
|
}
|
|
146
149
|
(_a = this.resizeDispose) === null || _a === void 0 ? void 0 : _a.forEach(function (fn) { return fn(); });
|
|
@@ -157,9 +160,8 @@ var Position = /** @class */ (function (_super) {
|
|
|
157
160
|
return cloneElement(child, __assign(__assign(__assign(__assign({}, props), arrowPosition), (child.props.offset ? { offset: child.props.offset } : {})), {
|
|
158
161
|
// FIXME: Don't forward `positionLeft` and `positionTop` via both props
|
|
159
162
|
// and `props.style`.
|
|
160
|
-
positionLeft: positionLeft, positionTop: positionTop, className: cx(className, child.props.className), style: __assign(__assign({}, child.props.style), { left: positionLeft, top: positionTop }) }));
|
|
163
|
+
positionLeft: positionLeft, positionTop: positionTop, className: cx(className, child.props.className), style: __assign(__assign({}, child.props.style), { left: positionLeft, top: positionTop }), componentId: this.componentId }));
|
|
161
164
|
};
|
|
162
|
-
// setState: (state: any) => void;
|
|
163
165
|
Position.defaultProps = {
|
|
164
166
|
containerPadding: 0,
|
|
165
167
|
placement: 'right',
|