amis-core 3.1.1 → 3.3.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 +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +3 -3
- package/esm/SchemaRenderer.js +6 -2
- package/esm/Scoped.d.ts +4 -1
- package/esm/Scoped.js +9 -5
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.d.ts +4 -24
- package/esm/WithRootStore.js +12 -4
- package/esm/WithStore.js +23 -16
- package/esm/actions/Action.d.ts +1 -0
- package/esm/actions/Action.js +70 -45
- package/esm/actions/AjaxAction.d.ts +6 -8
- package/esm/actions/AjaxAction.js +20 -18
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.d.ts +1 -2
- package/esm/actions/CmptAction.js +47 -32
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +3 -2
- package/esm/actions/DialogAction.d.ts +2 -0
- package/esm/actions/DialogAction.js +39 -23
- package/esm/actions/DrawerAction.js +4 -4
- 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.d.ts +15 -0
- package/esm/actions/StatusAction.js +49 -0
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/actions/index.d.ts +1 -0
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +3 -2
- package/esm/components/PopOver.js +3 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +2 -2
- package/esm/index.d.ts +3 -1
- package/esm/index.js +16 -14
- package/esm/locale.js +1 -1
- package/esm/polyfills.d.ts +3 -0
- package/esm/polyfills.js +18 -0
- package/esm/renderers/Form.d.ts +7 -7
- package/esm/renderers/Form.js +182 -128
- package/esm/renderers/Item.d.ts +82 -77
- package/esm/renderers/Item.js +90 -74
- package/esm/renderers/Options.js +1 -2
- 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.d.ts +4 -24
- package/esm/renderers/wrapControl.js +140 -88
- package/esm/store/app.js +42 -4
- package/esm/store/combo.d.ts +564 -1892
- package/esm/store/combo.js +9 -2
- package/esm/store/crud.d.ts +4 -2
- package/esm/store/crud.js +17 -4
- package/esm/store/form.d.ts +182 -882
- package/esm/store/form.js +83 -81
- package/esm/store/formItem.d.ts +6 -2
- package/esm/store/formItem.js +19 -3
- package/esm/store/iRenderer.js +3 -2
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -0
- package/esm/store/list.js +8 -2
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +3 -2
- package/esm/store/service.js +17 -12
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +604 -2020
- package/esm/store/table.js +86 -56
- package/esm/store/table2.d.ts +49 -0
- package/esm/store/table2.js +37 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +22 -5
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.d.ts +3 -2
- package/esm/utils/DataSchema.js +27 -7
- package/esm/utils/DataScope.d.ts +10 -3
- package/esm/utils/DataScope.js +50 -12
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.d.ts +2 -2
- package/esm/utils/api.js +152 -112
- package/esm/utils/arraySlice.d.ts +1 -0
- package/esm/utils/arraySlice.js +76 -0
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +29 -19
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.d.ts +2 -0
- package/esm/utils/debug.js +34 -7
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +4 -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.d.ts +0 -1
- package/esm/utils/formula.js +6 -9
- 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 +19 -2
- package/esm/utils/helper.js +69 -10
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +4 -2
- package/esm/utils/icon.js +3 -2
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.d.ts +3 -0
- package/esm/utils/math.js +52 -0
- package/esm/utils/memoryParse.js +1 -1
- package/esm/utils/normalizeLink.js +18 -9
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.d.ts +7 -0
- package/esm/utils/object.js +13 -2
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +2 -2
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +1 -1
- package/esm/utils/renderer-event.d.ts +1 -1
- package/esm/utils/renderer-event.js +14 -6
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- 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.js +1 -1
- 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 +10 -7
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +11 -8
- package/lib/SchemaRenderer.js +13 -6
- package/lib/Scoped.d.ts +4 -1
- package/lib/Scoped.js +19 -13
- package/lib/StatusScoped.js +5 -2
- package/lib/WithRootStore.d.ts +4 -24
- package/lib/WithRootStore.js +15 -4
- package/lib/WithStore.js +27 -17
- package/lib/actions/Action.d.ts +1 -0
- package/lib/actions/Action.js +70 -45
- package/lib/actions/AjaxAction.d.ts +6 -8
- package/lib/actions/AjaxAction.js +20 -18
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.d.ts +1 -2
- package/lib/actions/CmptAction.js +47 -32
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +9 -5
- package/lib/actions/DialogAction.d.ts +2 -0
- package/lib/actions/DialogAction.js +39 -23
- package/lib/actions/DrawerAction.js +4 -4
- 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.d.ts +15 -0
- package/lib/actions/StatusAction.js +53 -0
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/actions/index.d.ts +1 -0
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/LazyComponent.js +12 -14
- package/lib/components/Overlay.js +15 -14
- package/lib/components/PopOver.js +12 -10
- package/lib/env.js +4 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +11 -9
- package/lib/index.d.ts +3 -1
- package/lib/index.js +26 -19
- package/lib/locale.js +6 -3
- package/lib/polyfills.d.ts +3 -0
- package/lib/polyfills.js +20 -0
- package/lib/renderers/Form.d.ts +7 -7
- package/lib/renderers/Form.js +194 -135
- package/lib/renderers/Item.d.ts +82 -77
- package/lib/renderers/Item.js +126 -104
- package/lib/renderers/Options.js +10 -5
- 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.d.ts +4 -24
- package/lib/renderers/wrapControl.js +143 -88
- package/lib/store/app.js +44 -3
- package/lib/store/combo.d.ts +564 -1892
- package/lib/store/combo.js +9 -2
- package/lib/store/crud.d.ts +4 -2
- package/lib/store/crud.js +17 -4
- package/lib/store/form.d.ts +182 -882
- package/lib/store/form.js +81 -79
- package/lib/store/formItem.d.ts +6 -2
- package/lib/store/formItem.js +19 -3
- package/lib/store/iRenderer.js +9 -5
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -0
- package/lib/store/list.js +8 -2
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +9 -5
- package/lib/store/service.js +17 -12
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +604 -2020
- package/lib/store/table.js +85 -55
- package/lib/store/table2.d.ts +49 -0
- package/lib/store/table2.js +36 -3
- package/lib/theme.js +6 -3
- package/lib/types.d.ts +22 -5
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.d.ts +3 -2
- package/lib/utils/DataSchema.js +27 -7
- package/lib/utils/DataScope.d.ts +10 -3
- package/lib/utils/DataScope.js +50 -11
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.d.ts +2 -2
- package/lib/utils/api.js +151 -111
- package/lib/utils/arraySlice.d.ts +1 -0
- package/lib/utils/arraySlice.js +80 -0
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +8 -6
- package/lib/utils/dataMapping.js +29 -19
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.d.ts +2 -0
- package/lib/utils/debug.js +61 -33
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +10 -5
- 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.d.ts +0 -1
- package/lib/utils/formula.js +6 -10
- 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 +19 -2
- package/lib/utils/helper.js +70 -9
- package/lib/utils/highlight.js +8 -9
- package/lib/utils/icon.d.ts +4 -2
- package/lib/utils/icon.js +12 -10
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.d.ts +3 -0
- package/lib/utils/math.js +58 -0
- package/lib/utils/memoryParse.js +1 -1
- package/lib/utils/normalizeLink.js +18 -9
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.d.ts +7 -0
- package/lib/utils/object.js +13 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +7 -3
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +1 -1
- package/lib/utils/renderer-event.d.ts +1 -1
- package/lib/utils/renderer-event.js +13 -5
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- 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.js +1 -1
- 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 +9 -4
package/esm/utils/dataMapping.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -90,26 +90,27 @@ function dataMapping(to, from, ignoreFunction, convertKeyToPath, ignoreIfNotMatc
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
Object.keys(to)
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
var objectKeys = Object.keys(to);
|
|
94
|
+
// 如果存在 '&' 作为 key,则特殊处理
|
|
95
|
+
// 就是无论这个 key 的位置在什么地方始终都是当放在最前面
|
|
96
|
+
var idx = objectKeys.indexOf('&');
|
|
97
|
+
if (~idx) {
|
|
98
|
+
var value_1 = to['&'];
|
|
99
|
+
objectKeys.splice(idx, 1);
|
|
100
|
+
if (value_1 === '$$') {
|
|
101
101
|
ret = __assign(__assign({}, ret), from);
|
|
102
102
|
}
|
|
103
|
-
else
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
else {
|
|
104
|
+
var keys_1;
|
|
105
|
+
var v = isPlainObject(value_1) &&
|
|
106
|
+
(keys_1 = Object.keys(value_1)) &&
|
|
107
|
+
keys_1.length === 1 &&
|
|
108
|
+
from[keys_1[0].substring(1)] &&
|
|
109
|
+
Array.isArray(from[keys_1[0].substring(1)])
|
|
110
|
+
? from[keys_1[0].substring(1)].map(function (raw) {
|
|
111
|
+
return dataMapping(value_1[keys_1[0]], createObject(from, raw), ignoreFunction, convertKeyToPath, ignoreIfNotMatch);
|
|
111
112
|
})
|
|
112
|
-
: resolveMapping(
|
|
113
|
+
: resolveMapping(value_1, from, undefined, ignoreIfNotMatch);
|
|
113
114
|
if (Array.isArray(v) || typeof v === 'string') {
|
|
114
115
|
ret = v;
|
|
115
116
|
}
|
|
@@ -120,10 +121,19 @@ function dataMapping(to, from, ignoreFunction, convertKeyToPath, ignoreIfNotMatc
|
|
|
120
121
|
ret = __assign(__assign({}, ret), v);
|
|
121
122
|
}
|
|
122
123
|
}
|
|
124
|
+
}
|
|
125
|
+
objectKeys.forEach(function (key) {
|
|
126
|
+
var value = to[key];
|
|
127
|
+
if (typeof ignoreFunction === 'function' && ignoreFunction(key, value)) {
|
|
128
|
+
// 如果被ignore,不做数据映射处理。
|
|
129
|
+
setVariable(ret, key, value, convertKeyToPath);
|
|
130
|
+
}
|
|
123
131
|
else if (value === '$$') {
|
|
124
132
|
setVariable(ret, key, from, convertKeyToPath);
|
|
125
133
|
}
|
|
126
|
-
else if (
|
|
134
|
+
else if (typeof value === 'string' &&
|
|
135
|
+
value.length > 0 &&
|
|
136
|
+
value[0] === '$') {
|
|
127
137
|
var v = resolveMapping(value, from, undefined, ignoreIfNotMatch);
|
|
128
138
|
setVariable(ret, key, v, convertKeyToPath);
|
|
129
139
|
if (v === '__undefined') {
|
package/esm/utils/date.js
CHANGED
package/esm/utils/debug.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* amis 运行时调试功能,为了避免循环引用,这个组件不要依赖 amis 里的组件
|
|
3
3
|
*/
|
|
4
4
|
import React, { Component } from 'react';
|
|
5
|
+
export declare const JsonView: React.LazyExoticComponent<React.ComponentType<import("react-json-view").ReactJsonViewProps>>;
|
|
5
6
|
export declare function enableDebug(): void;
|
|
7
|
+
export declare function disableDebug(): void;
|
|
6
8
|
interface DebugWrapperProps {
|
|
7
9
|
renderer: any;
|
|
8
10
|
children?: React.ReactNode;
|
package/esm/utils/debug.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __decorate, __metadata, __values, __read, __extends } from 'tslib';
|
|
7
7
|
import React, { useRef, useState, useEffect, Component } from 'react';
|
|
8
8
|
import cx from 'classnames';
|
|
9
|
-
import { findDOMNode, render } from 'react-dom';
|
|
10
|
-
import JsonView from 'react-json-view';
|
|
9
|
+
import { findDOMNode, render, unmountComponentAtNode } from 'react-dom';
|
|
11
10
|
import { observable, autorun } from 'mobx';
|
|
12
11
|
import { observer } from 'mobx-react';
|
|
13
12
|
import { uuidv4 } from './helper.js';
|
|
@@ -16,6 +15,7 @@ import { position } from './position.js';
|
|
|
16
15
|
/**
|
|
17
16
|
* amis 运行时调试功能,为了避免循环引用,这个组件不要依赖 amis 里的组件
|
|
18
17
|
*/
|
|
18
|
+
var JsonView = React.lazy(function () { return import('react-json-view'); });
|
|
19
19
|
/** @class */ ((function () {
|
|
20
20
|
function Log() {
|
|
21
21
|
this.cat = '';
|
|
@@ -113,7 +113,8 @@ var LogView = observer(function (_a) {
|
|
|
113
113
|
log.cat,
|
|
114
114
|
"] ",
|
|
115
115
|
log.msg),
|
|
116
|
-
log.ext ? (React.createElement(
|
|
116
|
+
log.ext ? (React.createElement(React.Suspense, { fallback: React.createElement("div", null, "Loading...") },
|
|
117
|
+
React.createElement(JsonView, { name: null, theme: "monokai", src: JSON.parse(log.ext), collapsed: true, enableClipboard: false, displayDataTypes: false, collapseStringsAfterLength: ellipsisThreshold, iconStyle: "square" }))) : null));
|
|
117
118
|
})));
|
|
118
119
|
});
|
|
119
120
|
var AMISDebug = observer(function (_a) {
|
|
@@ -143,7 +144,8 @@ var AMISDebug = observer(function (_a) {
|
|
|
143
144
|
React.createElement("h3", null,
|
|
144
145
|
"Data Level-",
|
|
145
146
|
level),
|
|
146
|
-
React.createElement(
|
|
147
|
+
React.createElement(React.Suspense, { fallback: React.createElement("div", null, "Loading...") },
|
|
148
|
+
React.createElement(JsonView, { key: "dataview-".concat(stack), name: null, theme: "monokai", src: stack, collapsed: level === 0 ? false : true, enableClipboard: false, displayDataTypes: false, iconStyle: "square" }))));
|
|
147
149
|
level += 1;
|
|
148
150
|
}
|
|
149
151
|
}
|
|
@@ -254,7 +256,7 @@ function handleMouseclick(e) {
|
|
|
254
256
|
}
|
|
255
257
|
var dom = e.target;
|
|
256
258
|
var target = dom.closest("[data-debug-id]");
|
|
257
|
-
if (target) {
|
|
259
|
+
if (target && !target.closest('.AMISDebug')) {
|
|
258
260
|
store.activeId = target.getAttribute('data-debug-id');
|
|
259
261
|
store.tab = 'inspect';
|
|
260
262
|
}
|
|
@@ -294,6 +296,7 @@ autorun(function () {
|
|
|
294
296
|
});
|
|
295
297
|
// 页面中只能有一个实例
|
|
296
298
|
var isEnabled = false;
|
|
299
|
+
var unmount;
|
|
297
300
|
function enableDebug() {
|
|
298
301
|
if (isEnabled) {
|
|
299
302
|
return;
|
|
@@ -302,12 +305,36 @@ function enableDebug() {
|
|
|
302
305
|
var amisDebugElement = document.createElement('div');
|
|
303
306
|
document.body.appendChild(amisDebugElement);
|
|
304
307
|
var element = React.createElement(AMISDebug, { store: store });
|
|
308
|
+
// if (parseInt(version.split('.')[0], 10) >= 18) {
|
|
309
|
+
// const root = createRoot(amisDebugElement);
|
|
310
|
+
// root.render(element);
|
|
311
|
+
// unmount = () => {
|
|
312
|
+
// root.unmount();
|
|
313
|
+
// document.body.removeChild(amisDebugElement);
|
|
314
|
+
// };
|
|
315
|
+
// } else {
|
|
305
316
|
render(element, amisDebugElement);
|
|
317
|
+
unmount = function () {
|
|
318
|
+
unmountComponentAtNode(amisDebugElement);
|
|
319
|
+
document.body.removeChild(amisDebugElement);
|
|
320
|
+
};
|
|
321
|
+
// }
|
|
306
322
|
document.body.appendChild(amisHoverBox);
|
|
307
323
|
document.body.appendChild(amisActiveBox);
|
|
308
324
|
document.addEventListener('mousemove', handleMouseMove);
|
|
309
325
|
document.addEventListener('click', handleMouseclick);
|
|
310
326
|
}
|
|
327
|
+
function disableDebug() {
|
|
328
|
+
if (!isEnabled) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
isEnabled = false;
|
|
332
|
+
unmount === null || unmount === void 0 ? void 0 : unmount();
|
|
333
|
+
document.body.removeChild(amisHoverBox);
|
|
334
|
+
document.body.removeChild(amisActiveBox);
|
|
335
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
336
|
+
document.removeEventListener('click', handleMouseclick);
|
|
337
|
+
}
|
|
311
338
|
var DebugWrapper = /** @class */ (function (_super) {
|
|
312
339
|
__extends(DebugWrapper, _super);
|
|
313
340
|
function DebugWrapper() {
|
|
@@ -386,4 +413,4 @@ function warning(cat, msg, ext) {
|
|
|
386
413
|
store.logs.push(log);
|
|
387
414
|
}
|
|
388
415
|
|
|
389
|
-
export { DebugWrapper, debug, enableDebug, warning };
|
|
416
|
+
export { DebugWrapper, JsonView, debug, disableDebug, enableDebug, warning };
|
package/esm/utils/dom.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -210,6 +210,9 @@ function getStyleNumber(element, styleName) {
|
|
|
210
210
|
}
|
|
211
211
|
/** 根据关键字高亮显示文本内容 */
|
|
212
212
|
function renderTextByKeyword(rendererText, curKeyword) {
|
|
213
|
+
if (!rendererText || typeof rendererText !== 'string') {
|
|
214
|
+
return rendererText;
|
|
215
|
+
}
|
|
213
216
|
if (curKeyword && ~rendererText.indexOf(curKeyword)) {
|
|
214
217
|
var keywordStartIndex = rendererText.indexOf(curKeyword);
|
|
215
218
|
var keywordEndIndex = keywordStartIndex + curKeyword.length;
|
package/esm/utils/errors.js
CHANGED
package/esm/utils/escapeHtml.js
CHANGED
package/esm/utils/filter.js
CHANGED
package/esm/utils/formula.d.ts
CHANGED
package/esm/utils/formula.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import isObject from 'lodash/isObject';
|
|
7
7
|
import isString from 'lodash/isString';
|
|
8
8
|
import isBoolean from 'lodash/isBoolean';
|
|
9
9
|
import { evaluate, getFilters } from 'amis-formula';
|
|
@@ -114,7 +114,7 @@ var FormulaExec = {
|
|
|
114
114
|
},
|
|
115
115
|
collect: function (expression) {
|
|
116
116
|
var variables = [];
|
|
117
|
-
if (
|
|
117
|
+
if (isObject(expression) || isString(expression)) {
|
|
118
118
|
// 仅对 Object类型 和 String类型 进行变量提取
|
|
119
119
|
variables = collectVariables(expression);
|
|
120
120
|
}
|
|
@@ -198,7 +198,8 @@ function isNeedFormula(expression, prevData, curData) {
|
|
|
198
198
|
try {
|
|
199
199
|
var variables = FormulaExec.collect(expression);
|
|
200
200
|
return variables.some(function (variable) {
|
|
201
|
-
return FormulaExec.var(variable, prevData) !==
|
|
201
|
+
return FormulaExec.var(variable, prevData) !==
|
|
202
|
+
FormulaExec.var(variable, curData);
|
|
202
203
|
});
|
|
203
204
|
}
|
|
204
205
|
catch (e) {
|
|
@@ -206,10 +207,6 @@ function isNeedFormula(expression, prevData, curData) {
|
|
|
206
207
|
return false;
|
|
207
208
|
}
|
|
208
209
|
}
|
|
209
|
-
function isNowFormula(expression) {
|
|
210
|
-
var block = expression.split(/\${|\||}/).filter(function (item) { return item; });
|
|
211
|
-
return block[1] === 'now';
|
|
212
|
-
}
|
|
213
210
|
// 将 \${xx} 替换成 ${xx}
|
|
214
211
|
function replaceExpression(expression) {
|
|
215
212
|
if (expression &&
|
|
@@ -220,4 +217,4 @@ function replaceExpression(expression) {
|
|
|
220
217
|
return expression;
|
|
221
218
|
}
|
|
222
219
|
|
|
223
|
-
export { FormulaExec, formulaExec, isExpression, isNeedFormula,
|
|
220
|
+
export { FormulaExec, formulaExec, isExpression, isNeedFormula, registerFormulaExec, replaceExpression };
|
package/esm/utils/getVariable.js
CHANGED
package/esm/utils/grammar.js
CHANGED
package/esm/utils/helper.d.ts
CHANGED
|
@@ -256,7 +256,7 @@ export declare const autobind: typeof autobindMethod;
|
|
|
256
256
|
export declare const bulkBindFunctions: <T extends {
|
|
257
257
|
[propName: string]: any;
|
|
258
258
|
}>(context: T, funNames: FunctionPropertyNames<T>[]) => void;
|
|
259
|
-
export declare function sortArray<T extends any>(items: Array<T>, field: string, dir: -1 | 1): Array<T>;
|
|
259
|
+
export declare function sortArray<T extends any>(items: Array<T>, field: string, dir: -1 | 1, fieldGetter?: (item: T, field: string) => any): Array<T>;
|
|
260
260
|
export declare function hasFile(object: any): boolean;
|
|
261
261
|
export declare function qsstringify(data: any, options?: any, keepEmptyArray?: boolean): string;
|
|
262
262
|
export declare function qsparse(data: string, options?: any): qs.ParsedQs;
|
|
@@ -268,6 +268,15 @@ export declare function loadScript(src: string): Promise<void>;
|
|
|
268
268
|
export declare function loadStyle(href: string): Promise<void>;
|
|
269
269
|
export declare class SkipOperation extends Error {
|
|
270
270
|
}
|
|
271
|
+
export declare class ValidateError extends Error {
|
|
272
|
+
name: 'ValidateError';
|
|
273
|
+
detail: {
|
|
274
|
+
[propName: string]: Array<string> | string;
|
|
275
|
+
};
|
|
276
|
+
constructor(message: string, error: {
|
|
277
|
+
[propName: string]: Array<string> | string;
|
|
278
|
+
});
|
|
279
|
+
}
|
|
271
280
|
/**
|
|
272
281
|
* 深度查找具有某个 key 名字段的对象,实际实现是 internalFindObjectsWithKey,这里包一层是为了做循环引用检测
|
|
273
282
|
* @param obj
|
|
@@ -283,7 +292,8 @@ export declare function getPropValue<T extends {
|
|
|
283
292
|
name?: string;
|
|
284
293
|
data?: any;
|
|
285
294
|
defaultValue?: any;
|
|
286
|
-
|
|
295
|
+
canAccessSuperData?: boolean;
|
|
296
|
+
}>(props: T, getter?: (props: T) => any, canAccessSuper?: boolean | undefined): any;
|
|
287
297
|
export declare function detectPropValueChanged<T extends {
|
|
288
298
|
value?: any;
|
|
289
299
|
name?: string;
|
|
@@ -314,6 +324,13 @@ export declare function hashCode(s: string): number;
|
|
|
314
324
|
* @param mapper
|
|
315
325
|
*/
|
|
316
326
|
export declare function JSONTraverse(json: any, mapper: (value: any, key: string | number, host: Object) => any): void;
|
|
327
|
+
/**
|
|
328
|
+
* 每层都会执行,返回新的对象,新对象不会递归下去
|
|
329
|
+
* @param json
|
|
330
|
+
* @param mapper
|
|
331
|
+
* @returns
|
|
332
|
+
*/
|
|
333
|
+
export declare function JSONValueMap(json: any, mapper: (value: any, key: string | number, host: Object, stack: Array<Object>) => any, stack?: Array<Object>): any;
|
|
317
334
|
export declare function convertArrayValueToMoment(value: number[], types: string[], mom: moment.Moment): moment.Moment;
|
|
318
335
|
export declare function getRange(min: number, max: number, step?: number): number[];
|
|
319
336
|
export declare function repeatCount(count: number, iterator: (index: number) => any): any[];
|
package/esm/utils/helper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -858,11 +858,11 @@ var autobind = autobindMethod;
|
|
|
858
858
|
var bulkBindFunctions = function (context, funNames) {
|
|
859
859
|
funNames.forEach(function (key) { return (context[key] = context[key].bind(context)); });
|
|
860
860
|
};
|
|
861
|
-
function sortArray(items, field, dir) {
|
|
861
|
+
function sortArray(items, field, dir, fieldGetter) {
|
|
862
862
|
return items.sort(function (a, b) {
|
|
863
863
|
var ret;
|
|
864
|
-
var a1 = a[field];
|
|
865
|
-
var b1 = b[field];
|
|
864
|
+
var a1 = fieldGetter ? fieldGetter(a, field) : a[field];
|
|
865
|
+
var b1 = fieldGetter ? fieldGetter(b, field) : b[field];
|
|
866
866
|
if (typeof a1 === 'number' && typeof b1 === 'number') {
|
|
867
867
|
ret = a1 < b1 ? -1 : a1 === b1 ? 0 : 1;
|
|
868
868
|
}
|
|
@@ -885,11 +885,12 @@ function qsstringify(data, options, keepEmptyArray) {
|
|
|
885
885
|
arrayFormat: 'indices',
|
|
886
886
|
encodeValuesOnly: true
|
|
887
887
|
}; }
|
|
888
|
-
// qs会保留空字符串。fix: Combo
|
|
889
|
-
keepEmptyArray
|
|
890
|
-
|
|
891
|
-
Array.isArray(
|
|
888
|
+
// qs会保留空字符串。fix: Combo模式的空数组,无法清空。改为存为空字符串;
|
|
889
|
+
if (keepEmptyArray) {
|
|
890
|
+
data = JSONValueMap(data, function (value) {
|
|
891
|
+
return Array.isArray(value) && !value.length ? '' : value;
|
|
892
892
|
});
|
|
893
|
+
}
|
|
893
894
|
return qs.stringify(data, options);
|
|
894
895
|
}
|
|
895
896
|
function qsparse(data, options) {
|
|
@@ -958,6 +959,7 @@ function chainFunctions() {
|
|
|
958
959
|
function chainEvents(props, schema) {
|
|
959
960
|
var ret = {};
|
|
960
961
|
Object.keys(props).forEach(function (key) {
|
|
962
|
+
var _a;
|
|
961
963
|
if (key.substr(0, 2) === 'on' &&
|
|
962
964
|
typeof props[key] === 'function' &&
|
|
963
965
|
typeof schema[key] === 'function' &&
|
|
@@ -971,7 +973,7 @@ function chainEvents(props, schema) {
|
|
|
971
973
|
}
|
|
972
974
|
}
|
|
973
975
|
else {
|
|
974
|
-
ret[key] = props[key];
|
|
976
|
+
ret[key] = (_a = props[key]) !== null && _a !== void 0 ? _a : schema[key];
|
|
975
977
|
}
|
|
976
978
|
});
|
|
977
979
|
return ret;
|
|
@@ -1039,6 +1041,17 @@ var SkipOperation = /** @class */ (function (_super) {
|
|
|
1039
1041
|
}
|
|
1040
1042
|
return SkipOperation;
|
|
1041
1043
|
}(Error));
|
|
1044
|
+
var ValidateError = /** @class */ (function (_super) {
|
|
1045
|
+
__extends(ValidateError, _super);
|
|
1046
|
+
function ValidateError(message, error) {
|
|
1047
|
+
var _this = _super.call(this) || this;
|
|
1048
|
+
_this.name = 'ValidateError';
|
|
1049
|
+
_this.message = message;
|
|
1050
|
+
_this.detail = error;
|
|
1051
|
+
return _this;
|
|
1052
|
+
}
|
|
1053
|
+
return ValidateError;
|
|
1054
|
+
}(Error));
|
|
1042
1055
|
/**
|
|
1043
1056
|
* 检查对象是否有循环引用,来自 https://stackoverflow.com/a/34909127
|
|
1044
1057
|
* @param obj
|
|
@@ -1121,6 +1134,7 @@ function resolveValueByName(data, name, canAccessSuper) {
|
|
|
1121
1134
|
// 统一的获取 value 值方法
|
|
1122
1135
|
function getPropValue(props, getter, canAccessSuper) {
|
|
1123
1136
|
var _a, _b;
|
|
1137
|
+
if (canAccessSuper === void 0) { canAccessSuper = props.canAccessSuperData; }
|
|
1124
1138
|
var name = props.name, value = props.value, data = props.data, defaultValue = props.defaultValue;
|
|
1125
1139
|
return ((_b = (_a = value !== null && value !== void 0 ? value : getter === null || getter === void 0 ? void 0 : getter(props)) !== null && _a !== void 0 ? _a : resolveValueByName(data, name, canAccessSuper)) !== null && _b !== void 0 ? _b : defaultValue);
|
|
1126
1140
|
}
|
|
@@ -1237,6 +1251,51 @@ function JSONTraverse(json, mapper) {
|
|
|
1237
1251
|
}
|
|
1238
1252
|
});
|
|
1239
1253
|
}
|
|
1254
|
+
/**
|
|
1255
|
+
* 每层都会执行,返回新的对象,新对象不会递归下去
|
|
1256
|
+
* @param json
|
|
1257
|
+
* @param mapper
|
|
1258
|
+
* @returns
|
|
1259
|
+
*/
|
|
1260
|
+
function JSONValueMap(json, mapper, stack) {
|
|
1261
|
+
if (stack === void 0) { stack = []; }
|
|
1262
|
+
if (!isPlainObject(json) && !Array.isArray(json)) {
|
|
1263
|
+
return json;
|
|
1264
|
+
}
|
|
1265
|
+
var iterator = function (origin, key, host, stack) {
|
|
1266
|
+
if (stack === void 0) { stack = []; }
|
|
1267
|
+
var maped = mapper(origin, key, host, stack);
|
|
1268
|
+
if (maped === origin && (isPlainObject(origin) || Array.isArray(origin))) {
|
|
1269
|
+
return JSONValueMap(origin, mapper, stack);
|
|
1270
|
+
}
|
|
1271
|
+
return maped;
|
|
1272
|
+
};
|
|
1273
|
+
if (Array.isArray(json)) {
|
|
1274
|
+
var flag_1 = false;
|
|
1275
|
+
var mapped = json.map(function (value, index) {
|
|
1276
|
+
var result = iterator(value, index, json, [json].concat(stack));
|
|
1277
|
+
if (result !== value) {
|
|
1278
|
+
flag_1 = true;
|
|
1279
|
+
return result;
|
|
1280
|
+
}
|
|
1281
|
+
return value;
|
|
1282
|
+
});
|
|
1283
|
+
return flag_1 ? mapped : json;
|
|
1284
|
+
}
|
|
1285
|
+
var flag = false;
|
|
1286
|
+
var toUpdate = {};
|
|
1287
|
+
Object.keys(json).forEach(function (key) {
|
|
1288
|
+
var value = json[key];
|
|
1289
|
+
var result = iterator(value, key, json, [json].concat(stack));
|
|
1290
|
+
if (result !== value) {
|
|
1291
|
+
flag = true;
|
|
1292
|
+
toUpdate[key] = result;
|
|
1293
|
+
return;
|
|
1294
|
+
}
|
|
1295
|
+
});
|
|
1296
|
+
return flag
|
|
1297
|
+
? __assign(__assign({}, json), toUpdate) : json;
|
|
1298
|
+
}
|
|
1240
1299
|
function convertArrayValueToMoment(value, types, mom) {
|
|
1241
1300
|
if (value.length === 0)
|
|
1242
1301
|
return mom;
|
|
@@ -1290,4 +1349,4 @@ function parseQuery(location) {
|
|
|
1290
1349
|
return merge(normalizedQuery, hashQuery);
|
|
1291
1350
|
}
|
|
1292
1351
|
|
|
1293
|
-
export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeAll, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, loadStyle, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter };
|
|
1352
|
+
export { JSONTraverse, JSONValueMap, SkipOperation, ValidateError, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, findTreeAll, findTreeIndex, flattenTree, flattenTreeWithLeafNodes, getLevelFromClassName, getPropValue, getRange, getScrollParent, getScrollbarWidth, getTree, getTreeAncestors, getTreeDepth, getTreeParent, getWidthRate, guid, hasAbility, hasFile, hasOwnPropertyInPath, hasVisibleExpression, hashCode, immutableExtends, injectPropsToObject, isArrayChildrenModified, isBreakpoint, isClickOnInput, isDisabled, isEmpty, isMobile, isNumeric, isObjectShallowModified, isSuperDataModified, isUnfolded, isVisible, lcFirst, loadScript, loadStyle, makeColumnClassBuild, makeHorizontalDeeper, mapObject, mapTree, noop, normalizeNodePath, object2formData, omitControls, padArr, parseQuery, pickEventsProps, preventDefault, promisify, qsparse, qsstringify, range, removeHTMLTag, repeatCount, rmUndefined, someTree, sortArray, spliceTree, syncDataFromSuper, ucFirst, until, uuid, uuidv4, visibilityFilter };
|
package/esm/utils/highlight.js
CHANGED
package/esm/utils/icon.d.ts
CHANGED
|
@@ -3,19 +3,21 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { ClassNamesFn } from '../theme';
|
|
6
|
-
|
|
6
|
+
interface IconCheckedSchema {
|
|
7
7
|
id: string;
|
|
8
8
|
name?: string;
|
|
9
9
|
svg?: string;
|
|
10
10
|
}
|
|
11
|
-
|
|
11
|
+
interface IconCheckedSchemaNew {
|
|
12
12
|
type: 'icon';
|
|
13
13
|
icon: IconCheckedSchema;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
+
* 废弃,不建议使用
|
|
16
17
|
* 判断字符串来生成 i 或 img
|
|
17
18
|
* @param icon icon 设置
|
|
18
19
|
* @param className 内部用的 className
|
|
19
20
|
* @param classNameProp amis 配置里设置的 className
|
|
20
21
|
*/
|
|
21
22
|
export declare const generateIcon: (cx: ClassNamesFn, icon?: string | IconCheckedSchema | React.ReactNode | IconCheckedSchemaNew, className?: string, classNameProp?: string) => React.JSX.Element | null | undefined;
|
|
23
|
+
export {};
|
package/esm/utils/icon.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v3.
|
|
2
|
+
* amis-core v3.3.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
|
-
import
|
|
7
|
+
import isObject from 'lodash/isObject';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @file 图标支持的公共方法,主要是支持自动识别地址和 icon-font
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
13
|
+
* 废弃,不建议使用
|
|
13
14
|
* 判断字符串来生成 i 或 img
|
|
14
15
|
* @param icon icon 设置
|
|
15
16
|
* @param className 内部用的 className
|
package/esm/utils/image.js
CHANGED
package/esm/utils/index.d.ts
CHANGED
package/esm/utils/keyToPath.js
CHANGED
package/esm/utils/makeSorter.js
CHANGED