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/lib/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
|
'use strict';
|
|
@@ -15,6 +15,7 @@ var hoistNonReactStatic = require('hoist-non-react-statics');
|
|
|
15
15
|
var amisFormula = require('amis-formula');
|
|
16
16
|
require('moment');
|
|
17
17
|
var object = require('./utils/object.js');
|
|
18
|
+
var tokenize = require('./utils/tokenize.js');
|
|
18
19
|
var isPureVariable = require('./utils/isPureVariable.js');
|
|
19
20
|
var getVariable = require('./utils/getVariable.js');
|
|
20
21
|
var dataMapping = require('./utils/dataMapping.js');
|
|
@@ -39,13 +40,13 @@ require('./utils/icon.js');
|
|
|
39
40
|
require('./utils/image.js');
|
|
40
41
|
require('lodash/isEqual');
|
|
41
42
|
var rendererEvent = require('./utils/renderer-event.js');
|
|
42
|
-
require('lodash/cloneDeep');
|
|
43
43
|
require('./utils/resize-sensor.js');
|
|
44
44
|
require('react-overlays/useRootClose');
|
|
45
45
|
require('react-dom');
|
|
46
46
|
require('./utils/SimpleMap.js');
|
|
47
47
|
require('lodash/mapValues');
|
|
48
48
|
require('lodash/camelCase');
|
|
49
|
+
require('lodash/cloneDeep');
|
|
49
50
|
require('lodash/map');
|
|
50
51
|
require('lodash/isEmpty');
|
|
51
52
|
require('lodash/kebabCase');
|
|
@@ -97,6 +98,43 @@ function filterTarget(target, data) {
|
|
|
97
98
|
}
|
|
98
99
|
return tpl.filter(target, data, '| raw');
|
|
99
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* 分割目标,如果里面有表达式,不要跟表达式里面的逗号冲突。
|
|
103
|
+
* @param target
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
function splitTarget(target) {
|
|
107
|
+
try {
|
|
108
|
+
var ast = tokenize.memoParse(target);
|
|
109
|
+
var pos_1 = [];
|
|
110
|
+
ast.body.forEach(function (item) {
|
|
111
|
+
// 不要处理表达式里面的东西。
|
|
112
|
+
if (item.type === 'raw') {
|
|
113
|
+
var parts = item.value.split(',');
|
|
114
|
+
if (parts.length > 1) {
|
|
115
|
+
parts.pop();
|
|
116
|
+
var start_1 = item.start.index;
|
|
117
|
+
parts.forEach(function (part) {
|
|
118
|
+
pos_1.push(start_1 + part.length);
|
|
119
|
+
start_1 += part.length + 1;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
if (pos_1.length) {
|
|
125
|
+
var parts = [];
|
|
126
|
+
pos_1.reduceRight(function (arr, index) {
|
|
127
|
+
arr.unshift(target.slice(index + 1));
|
|
128
|
+
target = target.slice(0, index);
|
|
129
|
+
return arr;
|
|
130
|
+
}, parts);
|
|
131
|
+
parts.unshift(target);
|
|
132
|
+
return parts;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch (e) { }
|
|
136
|
+
return [target];
|
|
137
|
+
}
|
|
100
138
|
var rootScopedContext = createScopedTools('');
|
|
101
139
|
var ScopedContext = React__default["default"].createContext(rootScopedContext);
|
|
102
140
|
function createScopedTools(path, parent, env, rendererType) {
|
|
@@ -241,7 +279,7 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
241
279
|
},
|
|
242
280
|
reload: function (target, ctx) {
|
|
243
281
|
var scoped = this;
|
|
244
|
-
var targets = typeof target === 'string' ? target
|
|
282
|
+
var targets = typeof target === 'string' ? splitTarget(target) : target;
|
|
245
283
|
targets.forEach(function (name) {
|
|
246
284
|
var idx2 = name.indexOf('?');
|
|
247
285
|
var query = null;
|
|
@@ -277,7 +315,7 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
277
315
|
},
|
|
278
316
|
send: function (receive, values) {
|
|
279
317
|
var scoped = this;
|
|
280
|
-
var receives = typeof receive === 'string' ? receive
|
|
318
|
+
var receives = typeof receive === 'string' ? splitTarget(receive) : receive;
|
|
281
319
|
// todo 没找到做提示!
|
|
282
320
|
receives.forEach(function (name) {
|
|
283
321
|
var askIdx = name.indexOf('?');
|
|
@@ -313,8 +351,7 @@ function createScopedTools(path, parent, env, rendererType) {
|
|
|
313
351
|
var scoped = this;
|
|
314
352
|
if (typeof target === 'string') {
|
|
315
353
|
// 过滤已经关掉的,当用户 close 配置多个弹框 name 时会出现这种情况
|
|
316
|
-
target
|
|
317
|
-
.split(/\s*,\s*/)
|
|
354
|
+
splitTarget(target)
|
|
318
355
|
.map(function (name) { return scoped.getComponentByName(name); })
|
|
319
356
|
.filter(function (component) { return component && component.props.show; })
|
|
320
357
|
.forEach(closeDialog);
|
|
@@ -444,3 +481,4 @@ exports.HocScoped = HocScoped;
|
|
|
444
481
|
exports.ScopedContext = ScopedContext;
|
|
445
482
|
exports["default"] = HocScoped;
|
|
446
483
|
exports.filterTarget = filterTarget;
|
|
484
|
+
exports.splitTarget = splitTarget;
|
package/lib/StatusScoped.js
CHANGED
package/lib/WithRootStore.js
CHANGED
package/lib/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
|
'use strict';
|
|
@@ -108,9 +108,7 @@ function HocStoreFactory(renderer) {
|
|
|
108
108
|
helper.isObjectShallowModified(state, this.state) && this.setState(state);
|
|
109
109
|
// 需要重新监听
|
|
110
110
|
(_a = this.unReaction) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
111
|
-
this.unReaction = mobx.reaction(function () { return
|
|
112
|
-
return _this.setState(tslib.__assign({}, filterSchema.getExprProperties(_this.props, store.data)));
|
|
113
|
-
});
|
|
111
|
+
this.unReaction = mobx.reaction(function () { return filterSchema.getExprProperties(_this.props, store.data); }, function (exprProps) { return _this.setState(exprProps); });
|
|
114
112
|
}
|
|
115
113
|
var shouldSync = (_b = renderer.shouldSyncSuperStore) === null || _b === void 0 ? void 0 : _b.call(renderer, store, props, prevProps);
|
|
116
114
|
if (shouldSync === false) {
|
|
@@ -155,7 +153,7 @@ function HocStoreFactory(renderer) {
|
|
|
155
153
|
// 目前主要的问题是,如果 combo 中表单项名字和 combo 本身的名字一样,会导致里面的值会被覆盖成数组
|
|
156
154
|
((_c = props.store) === null || _c === void 0 ? void 0 : _c.storeType) === 'ComboStore'
|
|
157
155
|
? undefined
|
|
158
|
-
: helper.syncDataFromSuper(
|
|
156
|
+
: helper.syncDataFromSuper(store.data, props.data.__super, prevProps.data.__super, store, false)), props.updatePristineAfterStoreDataReInit === false);
|
|
159
157
|
}
|
|
160
158
|
else {
|
|
161
159
|
store.initData(object.createObject(props.scope, props.data), props.updatePristineAfterStoreDataReInit === false);
|
package/lib/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
|
'use strict';
|
|
@@ -32,7 +32,6 @@ require('../utils/image.js');
|
|
|
32
32
|
require('lodash/isEqual');
|
|
33
33
|
var Action = require('./Action.js');
|
|
34
34
|
require('lodash/debounce');
|
|
35
|
-
require('lodash/cloneDeep');
|
|
36
35
|
require('../utils/resize-sensor.js');
|
|
37
36
|
require('react');
|
|
38
37
|
require('react-overlays/useRootClose');
|
|
@@ -40,6 +39,7 @@ require('react-dom');
|
|
|
40
39
|
require('../utils/SimpleMap.js');
|
|
41
40
|
require('lodash/mapValues');
|
|
42
41
|
require('lodash/camelCase');
|
|
42
|
+
require('lodash/cloneDeep');
|
|
43
43
|
require('lodash/map');
|
|
44
44
|
require('lodash/isEmpty');
|
|
45
45
|
require('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
|
'use strict';
|
|
@@ -24,15 +24,20 @@ var LinkAction = /** @class */ (function () {
|
|
|
24
24
|
LinkAction.prototype.run = function (action, renderer, event) {
|
|
25
25
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
26
26
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
27
|
-
var urlObj;
|
|
27
|
+
var apiParams, urlObj;
|
|
28
28
|
return tslib.__generator(this, function (_j) {
|
|
29
29
|
if (!((_a = event.context.env) === null || _a === void 0 ? void 0 : _a.jumpTo)) {
|
|
30
30
|
throw new Error('env.jumpTo is required!');
|
|
31
31
|
}
|
|
32
|
+
apiParams = tslib.__assign(tslib.__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 : {}));
|
|
33
|
+
if ((action === null || action === void 0 ? void 0 : action.actionType) === 'link' && (apiParams === null || apiParams === void 0 ? void 0 : apiParams.targetType)) {
|
|
34
|
+
// link动作新增打开方式targetType,buildApi不需要该参数
|
|
35
|
+
delete apiParams.targetType;
|
|
36
|
+
}
|
|
32
37
|
urlObj = api.buildApi({
|
|
33
|
-
url: (((
|
|
38
|
+
url: (((_e = action.args) === null || _e === void 0 ? void 0 : _e.url) || ((_f = action.args) === null || _f === void 0 ? void 0 : _f.link)),
|
|
34
39
|
method: 'get'
|
|
35
|
-
},
|
|
40
|
+
}, apiParams, {
|
|
36
41
|
autoAppend: true
|
|
37
42
|
});
|
|
38
43
|
(_g = event.context.env) === null || _g === void 0 ? void 0 : _g.jumpTo(urlObj.url, tslib.__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
|
'use strict';
|
|
@@ -12,7 +12,7 @@ var styleHelper = require('../utils/style-helper.js');
|
|
|
12
12
|
|
|
13
13
|
var styleIdCount = new Map();
|
|
14
14
|
function CustomStyle (props) {
|
|
15
|
-
var config = props.config, env = props.env;
|
|
15
|
+
var config = props.config, env = props.env, data = props.data;
|
|
16
16
|
var themeCss = config.themeCss, classNames = config.classNames, id = config.id, defaultData = config.defaultData, wrapperCustomStyle = config.wrapperCustomStyle;
|
|
17
17
|
if (!themeCss && !wrapperCustomStyle) {
|
|
18
18
|
return null;
|
|
@@ -36,24 +36,37 @@ function CustomStyle (props) {
|
|
|
36
36
|
React.useEffect(function () {
|
|
37
37
|
var _a, _b;
|
|
38
38
|
if (themeCss && id) {
|
|
39
|
-
styleHelper.insertCustomStyle(
|
|
39
|
+
styleHelper.insertCustomStyle({
|
|
40
|
+
themeCss: themeCss,
|
|
41
|
+
classNames: classNames,
|
|
42
|
+
id: id,
|
|
43
|
+
defaultData: defaultData,
|
|
44
|
+
customStyleClassPrefix: env === null || env === void 0 ? void 0 : env.customStyleClassPrefix,
|
|
45
|
+
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,
|
|
46
|
+
data: data
|
|
47
|
+
});
|
|
40
48
|
}
|
|
41
49
|
return function () {
|
|
42
50
|
var _a, _b;
|
|
43
51
|
if (id && !styleIdCount.get(id)) {
|
|
44
|
-
styleHelper.removeCustomStyle('', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
52
|
+
styleHelper.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);
|
|
45
53
|
}
|
|
46
54
|
};
|
|
47
55
|
}, [themeCss, id]);
|
|
48
56
|
React.useEffect(function () {
|
|
49
57
|
var _a, _b;
|
|
50
58
|
if (wrapperCustomStyle && id) {
|
|
51
|
-
styleHelper.insertEditCustomStyle(
|
|
59
|
+
styleHelper.insertEditCustomStyle({
|
|
60
|
+
customStyle: wrapperCustomStyle,
|
|
61
|
+
id: id,
|
|
62
|
+
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,
|
|
63
|
+
data: data
|
|
64
|
+
});
|
|
52
65
|
}
|
|
53
66
|
return function () {
|
|
54
67
|
var _a, _b;
|
|
55
68
|
if (id && !styleIdCount.get(id)) {
|
|
56
|
-
styleHelper.removeCustomStyle('wrapperCustomStyle', id, (_b = (_a = env.getModalContainer) === null || _a === void 0 ? void 0 : _a.call(env)) === null || _b === void 0 ? void 0 : _b.ownerDocument);
|
|
69
|
+
styleHelper.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);
|
|
57
70
|
}
|
|
58
71
|
};
|
|
59
72
|
}, [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
|
'use strict';
|
|
@@ -36,12 +36,12 @@ require('../utils/image.js');
|
|
|
36
36
|
require('lodash/isEqual');
|
|
37
37
|
require('../actions/Action.js');
|
|
38
38
|
require('lodash/debounce');
|
|
39
|
-
require('lodash/cloneDeep');
|
|
40
39
|
var resizeSensor = require('../utils/resize-sensor.js');
|
|
41
40
|
var RootClose = require('../utils/RootClose.js');
|
|
42
41
|
require('../utils/SimpleMap.js');
|
|
43
42
|
require('lodash/mapValues');
|
|
44
43
|
require('lodash/camelCase');
|
|
44
|
+
require('lodash/cloneDeep');
|
|
45
45
|
require('lodash/map');
|
|
46
46
|
require('lodash/isEmpty');
|
|
47
47
|
require('lodash/kebabCase');
|
|
@@ -97,6 +97,7 @@ var Position = /** @class */ (function (_super) {
|
|
|
97
97
|
arrowOffsetTop: null
|
|
98
98
|
};
|
|
99
99
|
_this._lastTarget = null;
|
|
100
|
+
_this.componentId = helper.uuid();
|
|
100
101
|
return _this;
|
|
101
102
|
}
|
|
102
103
|
Position.prototype.updatePosition = function (target) {
|
|
@@ -108,7 +109,7 @@ var Position = /** @class */ (function (_super) {
|
|
|
108
109
|
var parentPopover = (_a = target === null || target === void 0 ? void 0 : target.closest) === null || _a === void 0 ? void 0 : _a.call(target, '[role=popover]');
|
|
109
110
|
if (!this.parentPopover && parentPopover) {
|
|
110
111
|
this.parentPopover = parentPopover;
|
|
111
|
-
this.parentPopover.setAttribute(SubPopoverDisplayedID, true);
|
|
112
|
+
this.parentPopover.setAttribute(SubPopoverDisplayedID + '-' + this.componentId, true);
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
if (!target) {
|
|
@@ -149,9 +150,11 @@ var Position = /** @class */ (function (_super) {
|
|
|
149
150
|
};
|
|
150
151
|
Position.prototype.componentWillUnmount = function () {
|
|
151
152
|
var _a;
|
|
153
|
+
// 一个 PopOver 关闭时,需把挂载父 PopOver 的标记去掉
|
|
154
|
+
// 这里可能会存在多个子 PopOver 的情况,所以需要加上 componentId
|
|
152
155
|
if (this.parentPopover &&
|
|
153
|
-
this.parentPopover.getAttribute(SubPopoverDisplayedID)) {
|
|
154
|
-
this.parentPopover.removeAttribute(SubPopoverDisplayedID);
|
|
156
|
+
this.parentPopover.getAttribute(SubPopoverDisplayedID + '-' + this.componentId)) {
|
|
157
|
+
this.parentPopover.removeAttribute(SubPopoverDisplayedID + '-' + this.componentId);
|
|
155
158
|
this.parentPopover = null;
|
|
156
159
|
}
|
|
157
160
|
(_a = this.resizeDispose) === null || _a === void 0 ? void 0 : _a.forEach(function (fn) { return fn(); });
|
|
@@ -168,9 +171,8 @@ var Position = /** @class */ (function (_super) {
|
|
|
168
171
|
return React.cloneElement(child, tslib.__assign(tslib.__assign(tslib.__assign(tslib.__assign({}, props), arrowPosition), (child.props.offset ? { offset: child.props.offset } : {})), {
|
|
169
172
|
// FIXME: Don't forward `positionLeft` and `positionTop` via both props
|
|
170
173
|
// and `props.style`.
|
|
171
|
-
positionLeft: positionLeft, positionTop: positionTop, className: cx__default["default"](className, child.props.className), style: tslib.__assign(tslib.__assign({}, child.props.style), { left: positionLeft, top: positionTop }) }));
|
|
174
|
+
positionLeft: positionLeft, positionTop: positionTop, className: cx__default["default"](className, child.props.className), style: tslib.__assign(tslib.__assign({}, child.props.style), { left: positionLeft, top: positionTop }), componentId: this.componentId }));
|
|
172
175
|
};
|
|
173
|
-
// setState: (state: any) => void;
|
|
174
176
|
Position.defaultProps = {
|
|
175
177
|
containerPadding: 0,
|
|
176
178
|
placement: 'right',
|
|
@@ -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
|
'use strict';
|
|
@@ -35,12 +35,12 @@ require('../utils/image.js');
|
|
|
35
35
|
require('lodash/isEqual');
|
|
36
36
|
require('../actions/Action.js');
|
|
37
37
|
require('lodash/debounce');
|
|
38
|
-
require('lodash/cloneDeep');
|
|
39
38
|
require('../utils/resize-sensor.js');
|
|
40
39
|
require('react-overlays/useRootClose');
|
|
41
40
|
require('../utils/SimpleMap.js');
|
|
42
41
|
require('lodash/mapValues');
|
|
43
42
|
require('lodash/camelCase');
|
|
43
|
+
require('lodash/cloneDeep');
|
|
44
44
|
require('lodash/map');
|
|
45
45
|
require('lodash/isEmpty');
|
|
46
46
|
require('lodash/kebabCase');
|
|
@@ -112,7 +112,9 @@ var PopOver = /** @class */ (function (_super) {
|
|
|
112
112
|
closeOnOutside &&
|
|
113
113
|
target &&
|
|
114
114
|
this.wrapperRef.current &&
|
|
115
|
-
!this.wrapperRef.current
|
|
115
|
+
!this.wrapperRef.current
|
|
116
|
+
.getAttributeNames()
|
|
117
|
+
.find(function (n) { return n.startsWith(Overlay.SubPopoverDisplayedID); }) &&
|
|
116
118
|
((!this.wrapperRef.current.contains(target) &&
|
|
117
119
|
!target.closest('[role=dialog]')) ||
|
|
118
120
|
(target.matches(".".concat(ns, "Modal")) && target === this.wrapperRef.current))); // 干脆过滤掉来自弹框里面的点击
|
|
@@ -158,7 +160,7 @@ var PopOver = /** @class */ (function (_super) {
|
|
|
158
160
|
});
|
|
159
161
|
};
|
|
160
162
|
PopOver.prototype.render = function () {
|
|
161
|
-
var _a = this.props; _a.placement; var activePlacement = _a.activePlacement, positionTop = _a.positionTop, positionLeft = _a.positionLeft; _a.arrowOffsetLeft; _a.arrowOffsetTop; var style = _a.style, children = _a.children; _a.offset; var overlay = _a.overlay, onHide = _a.onHide, ns = _a.classPrefix, cx = _a.classnames, className = _a.className
|
|
163
|
+
var _a = this.props; _a.placement; var activePlacement = _a.activePlacement, positionTop = _a.positionTop, positionLeft = _a.positionLeft; _a.arrowOffsetLeft; _a.arrowOffsetTop; var style = _a.style, children = _a.children; _a.offset; var overlay = _a.overlay, onHide = _a.onHide, ns = _a.classPrefix, cx = _a.classnames, className = _a.className; _a.componentId; var rest = tslib.__rest(_a, ["placement", "activePlacement", "positionTop", "positionLeft", "arrowOffsetLeft", "arrowOffsetTop", "style", "children", "offset", "overlay", "onHide", "classPrefix", "classnames", "className", "componentId"]);
|
|
162
164
|
var _b = this.state, xOffset = _b.xOffset, yOffset = _b.yOffset;
|
|
163
165
|
var outerStyle = tslib.__assign(tslib.__assign({ display: 'block' }, style), { top: positionTop + yOffset, left: positionLeft + xOffset });
|
|
164
166
|
var placements = typeof activePlacement === 'string' ? activePlacement.split('-') : [];
|
package/lib/env.d.ts
CHANGED
package/lib/env.js
CHANGED
package/lib/envOverwrite.js
CHANGED
package/lib/factory.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
|
'use strict';
|
|
@@ -162,6 +162,19 @@ var defaultOptions = {
|
|
|
162
162
|
action.blank === false ? (window.location.href = to) : window.open(to);
|
|
163
163
|
return;
|
|
164
164
|
}
|
|
165
|
+
// link动作新增了targetType属性,默认是内容区打开(page),在新窗口打开(blank);在当前页签打开(self)
|
|
166
|
+
if ((action === null || action === void 0 ? void 0 : action.actionType) === 'link' &&
|
|
167
|
+
['blank', 'self'].includes(action === null || action === void 0 ? void 0 : action.targetType)) {
|
|
168
|
+
if (action.targetType === 'self') {
|
|
169
|
+
// 当前页签打开,需要刷新页面
|
|
170
|
+
window.history.pushState(null, '', to);
|
|
171
|
+
location.reload();
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
window.open(to);
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
165
178
|
if (/^https?:\/\//.test(to)) {
|
|
166
179
|
window.location.replace(to);
|
|
167
180
|
}
|