amis-core 2.7.2 → 2.8.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.js +4 -4
- package/esm/SchemaRenderer.js +23 -12
- package/esm/Scoped.js +49 -30
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.js +32 -17
- package/esm/actions/AjaxAction.js +1 -1
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +1 -1
- package/esm/actions/DialogAction.js +1 -1
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +63 -34
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/SwitchAction.js +25 -12
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.js +1 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +29 -9
- package/esm/factory.js +1 -1
- package/esm/index.js +2 -2
- package/esm/locale.js +3 -3
- package/esm/renderers/Form.js +5 -36
- package/esm/renderers/Item.js +4 -4
- package/esm/renderers/Options.js +4 -4
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/register.js +3 -6
- package/esm/renderers/wrapControl.js +8 -4
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +2335 -239
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +54 -35
- package/esm/store/form.d.ts +1033 -16
- package/esm/store/form.js +27 -7
- package/esm/store/formItem.d.ts +9 -1
- package/esm/store/formItem.js +83 -45
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.js +1 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.js +1 -1
- package/esm/store/service.js +1 -1
- package/esm/store/table.d.ts +2180 -148
- package/esm/store/table.js +27 -17
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +3 -3
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +4 -3
- package/esm/utils/DataSchema.js +4 -3
- package/esm/utils/DataScope.js +36 -16
- package/esm/utils/RootClose.js +3 -3
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +4 -4
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +3 -5
- package/esm/utils/dataMapping.js +16 -6
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +28 -18
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +4 -3
- 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 +5 -7
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.js +1 -1
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.js +7 -7
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.js +1 -1
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +1 -1
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.js +8 -1
- package/esm/utils/renderer-event.js +54 -29
- package/esm/utils/replaceText.js +16 -8
- package/esm/utils/resize-sensor.js +4 -2
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.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 +96 -75
- 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 +3 -3
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +4 -4
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.js +3 -3
- package/lib/SchemaRenderer.js +22 -11
- package/lib/Scoped.js +48 -29
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.js +31 -16
- package/lib/actions/AjaxAction.js +1 -1
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +1 -1
- package/lib/actions/DialogAction.js +1 -1
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +62 -33
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/SwitchAction.js +24 -11
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.js +1 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +29 -9
- package/lib/factory.js +1 -1
- package/lib/index.js +2 -2
- package/lib/locale.js +2 -2
- package/lib/renderers/Form.js +5 -36
- package/lib/renderers/Item.js +3 -3
- package/lib/renderers/Options.js +3 -3
- package/lib/renderers/Placeholder.js +1 -1
- package/lib/renderers/builtin.js +1 -1
- package/lib/renderers/register.js +3 -6
- package/lib/renderers/wrapControl.js +8 -4
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +2335 -239
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +53 -34
- package/lib/store/form.d.ts +1033 -16
- package/lib/store/form.js +26 -6
- package/lib/store/formItem.d.ts +9 -1
- package/lib/store/formItem.js +81 -43
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.js +1 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.js +1 -1
- package/lib/store/service.js +1 -1
- package/lib/store/table.d.ts +2180 -148
- package/lib/store/table.js +26 -16
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +2 -2
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +4 -3
- package/lib/utils/DataSchema.js +4 -3
- package/lib/utils/DataScope.js +35 -15
- package/lib/utils/RootClose.js +2 -2
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +3 -3
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +3 -5
- package/lib/utils/dataMapping.js +15 -5
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +27 -17
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +4 -3
- 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 +4 -6
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.js +1 -1
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.js +6 -6
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.js +1 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +1 -1
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.js +8 -1
- package/lib/utils/renderer-event.js +53 -28
- package/lib/utils/replaceText.js +16 -8
- package/lib/utils/resize-sensor.js +4 -2
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.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 +96 -75
- 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 +2 -2
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +3 -3
- package/package.json +3 -3
package/esm/store/table.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __assign, __spreadArray } from 'tslib';
|
|
6
|
+
import { __assign, __spreadArray, __read, __values } from 'tslib';
|
|
7
7
|
import { types, getParent, isAlive } from 'mobx-state-tree';
|
|
8
8
|
import { iRendererStore } from './iRenderer.js';
|
|
9
9
|
import 'amis-formula';
|
|
@@ -871,7 +871,7 @@ var TableStore = iRendererStore
|
|
|
871
871
|
maxLength >= selectedItems.length) {
|
|
872
872
|
var restCheckableRows = self.checkableRows.filter(function (item) { return !item.checked; });
|
|
873
873
|
var checkableRows = restCheckableRows.filter(function (item, i) { return i < maxLength - selectedItems.length; });
|
|
874
|
-
return __spreadArray(__spreadArray([], self.selectedRows,
|
|
874
|
+
return __spreadArray(__spreadArray([], __read(self.selectedRows), false), __read(checkableRows), false);
|
|
875
875
|
}
|
|
876
876
|
else {
|
|
877
877
|
return self.checkableRows;
|
|
@@ -904,6 +904,7 @@ var TableStore = iRendererStore
|
|
|
904
904
|
}
|
|
905
905
|
// 按住 shift 的时候点击选项
|
|
906
906
|
function toggleShift(row) {
|
|
907
|
+
var e_1, _a;
|
|
907
908
|
// 如果是同一个或非 multiple 模式下就和不用 shift 一样
|
|
908
909
|
if (!lastCheckedRow || row === lastCheckedRow || !self.multiple) {
|
|
909
910
|
toggle(row);
|
|
@@ -917,27 +918,36 @@ var TableStore = iRendererStore
|
|
|
917
918
|
var maxIndex = lastCheckedRowIndex > rowIndex ? lastCheckedRowIndex : rowIndex;
|
|
918
919
|
var rows = checkableRows.slice(minIndex, maxIndex);
|
|
919
920
|
rows.push(row); // 将当前行也加入进行判断
|
|
920
|
-
|
|
921
|
-
var
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
if (
|
|
927
|
-
if (
|
|
921
|
+
try {
|
|
922
|
+
for (var rows_1 = __values(rows), rows_1_1 = rows_1.next(); !rows_1_1.done; rows_1_1 = rows_1.next()) {
|
|
923
|
+
var rowItem = rows_1_1.value;
|
|
924
|
+
var idx = self.selectedRows.indexOf(rowItem);
|
|
925
|
+
if (idx === -1) {
|
|
926
|
+
// 如果上一个是选中状态,则将之间的所有 check 都变成可选
|
|
927
|
+
if (lastCheckedRow.checked) {
|
|
928
|
+
if (maxLength) {
|
|
929
|
+
if (self.selectedRows.length < maxLength) {
|
|
930
|
+
self.selectedRows.push(rowItem);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
else {
|
|
928
934
|
self.selectedRows.push(rowItem);
|
|
929
935
|
}
|
|
930
936
|
}
|
|
931
|
-
|
|
932
|
-
|
|
937
|
+
}
|
|
938
|
+
else {
|
|
939
|
+
if (!lastCheckedRow.checked) {
|
|
940
|
+
self.selectedRows.splice(idx, 1);
|
|
933
941
|
}
|
|
934
942
|
}
|
|
935
943
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
944
|
+
}
|
|
945
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
946
|
+
finally {
|
|
947
|
+
try {
|
|
948
|
+
if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
|
|
940
949
|
}
|
|
950
|
+
finally { if (e_1) throw e_1.error; }
|
|
941
951
|
}
|
|
942
952
|
lastCheckedRow = row;
|
|
943
953
|
}
|
package/esm/store/table2.js
CHANGED
package/esm/theme.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __assign, __extends } from 'tslib';
|
|
6
|
+
import { __assign, __extends, __spreadArray, __read } from 'tslib';
|
|
7
7
|
import cx from 'classnames';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import hoistNonReactStatic from 'hoist-non-react-statics';
|
|
@@ -27,7 +27,7 @@ function makeClassnames(ns) {
|
|
|
27
27
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
28
28
|
classes[_i] = arguments[_i];
|
|
29
29
|
}
|
|
30
|
-
var str = cx.apply(void 0, classes);
|
|
30
|
+
var str = cx.apply(void 0, __spreadArray([], __read(classes), false));
|
|
31
31
|
return str && ns
|
|
32
32
|
? str
|
|
33
33
|
.replace(/(^|\s)([A-Z])/g, '$1' + ns + '$2')
|
package/esm/utils/Animation.js
CHANGED
package/esm/utils/ColorScale.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { __read } from 'tslib';
|
|
7
|
+
|
|
6
8
|
// 代码修改自 https://github.com/dalisc/color-scales-js
|
|
7
|
-
// 主要是将校验功能改成修正而不是报错,比如 min 和 max 相等的时候自动给 max + 1
|
|
8
9
|
var Color = /** @class */ (function () {
|
|
9
10
|
function Color(r, g, b, a) {
|
|
10
11
|
if (a === void 0) { a = 1; }
|
|
@@ -69,7 +70,7 @@ var ColorScale = /** @class */ (function () {
|
|
|
69
70
|
this.max = this.min + 1;
|
|
70
71
|
}
|
|
71
72
|
if (this.max < this.min) {
|
|
72
|
-
_a = [this.min, this.max], this.max = _a[0], this.min = _a[1];
|
|
73
|
+
_a = __read([this.min, this.max], 2), this.max = _a[0], this.min = _a[1];
|
|
73
74
|
}
|
|
74
75
|
if (colorStops.length < 2) {
|
|
75
76
|
colorStops = ['#FFEF9C', '#FF7127'];
|
package/esm/utils/DataSchema.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { __spreadArray, __read } from 'tslib';
|
|
6
7
|
import { DataScope } from './DataScope.js';
|
|
7
8
|
import { guid } from './helper.js';
|
|
8
9
|
|
|
@@ -33,7 +34,7 @@ var DataSchema = /** @class */ (function () {
|
|
|
33
34
|
var schemas = [];
|
|
34
35
|
var current = this.current;
|
|
35
36
|
while (current) {
|
|
36
|
-
schemas.push.apply(schemas, current.schemas);
|
|
37
|
+
schemas.push.apply(schemas, __spreadArray([], __read(current.schemas), false));
|
|
37
38
|
current = current.parent;
|
|
38
39
|
}
|
|
39
40
|
return schemas;
|
|
@@ -89,7 +90,7 @@ var DataSchema = /** @class */ (function () {
|
|
|
89
90
|
});
|
|
90
91
|
}
|
|
91
92
|
else {
|
|
92
|
-
variables.push.apply(variables, current.getDataPropsAsOptions());
|
|
93
|
+
variables.push.apply(variables, __spreadArray([], __read(current.getDataPropsAsOptions()), false));
|
|
93
94
|
}
|
|
94
95
|
current = current.parent;
|
|
95
96
|
}
|
package/esm/utils/DataScope.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __assign } from 'tslib';
|
|
6
|
+
import { __values, __assign } from 'tslib';
|
|
7
7
|
import { guid } from './helper.js';
|
|
8
8
|
import { keyToPath } from './keyToPath.js';
|
|
9
9
|
|
|
@@ -34,13 +34,23 @@ var DataScope = /** @class */ (function () {
|
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
DataScope.prototype.setSchemas = function (schemas) {
|
|
37
|
+
var e_1, _a;
|
|
37
38
|
this.schemas.splice(0, this.schemas.length);
|
|
38
|
-
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
try {
|
|
40
|
+
for (var schemas_1 = __values(schemas), schemas_1_1 = schemas_1.next(); !schemas_1_1.done; schemas_1_1 = schemas_1.next()) {
|
|
41
|
+
var schema = schemas_1_1.value;
|
|
42
|
+
if (schema.type !== 'object') {
|
|
43
|
+
throw new TypeError('data scope accept only object');
|
|
44
|
+
}
|
|
45
|
+
this.schemas.push(__assign({ $id: guid() }, schema));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
49
|
+
finally {
|
|
50
|
+
try {
|
|
51
|
+
if (schemas_1_1 && !schemas_1_1.done && (_a = schemas_1.return)) _a.call(schemas_1);
|
|
42
52
|
}
|
|
43
|
-
|
|
53
|
+
finally { if (e_1) throw e_1.error; }
|
|
44
54
|
}
|
|
45
55
|
return this;
|
|
46
56
|
};
|
|
@@ -137,19 +147,29 @@ var DataScope = /** @class */ (function () {
|
|
|
137
147
|
return variables[0].children;
|
|
138
148
|
};
|
|
139
149
|
DataScope.prototype.getSchemaByPath = function (path) {
|
|
150
|
+
var e_2, _a;
|
|
140
151
|
var parts = keyToPath(path);
|
|
141
|
-
|
|
142
|
-
var
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
152
|
+
try {
|
|
153
|
+
for (var _b = __values(this.schemas), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
154
|
+
var schema = _c.value;
|
|
155
|
+
var result = parts.reduce(function (schema, key) {
|
|
156
|
+
if (schema && schema.type === 'object' && schema.properties) {
|
|
157
|
+
return schema.properties[key];
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}, schema);
|
|
161
|
+
if (result) {
|
|
162
|
+
return result;
|
|
146
163
|
}
|
|
147
|
-
return null;
|
|
148
|
-
}, schema);
|
|
149
|
-
if (result) {
|
|
150
|
-
return result;
|
|
151
164
|
}
|
|
152
165
|
}
|
|
166
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
167
|
+
finally {
|
|
168
|
+
try {
|
|
169
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
170
|
+
}
|
|
171
|
+
finally { if (e_2) throw e_2.error; }
|
|
172
|
+
}
|
|
153
173
|
return null;
|
|
154
174
|
};
|
|
155
175
|
return DataScope;
|
package/esm/utils/RootClose.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __rest } from 'tslib';
|
|
6
|
+
import { __rest, __read } from 'tslib';
|
|
7
7
|
import { useState } from 'react';
|
|
8
8
|
import useRootClose from 'react-overlays/useRootClose';
|
|
9
9
|
import { findDOMNode } from 'react-dom';
|
|
@@ -13,7 +13,7 @@ import { findDOMNode } from 'react-dom';
|
|
|
13
13
|
*/
|
|
14
14
|
var RootClose = function (_a) {
|
|
15
15
|
var children = _a.children, onRootClose = _a.onRootClose, props = __rest(_a, ["children", "onRootClose"]);
|
|
16
|
-
var _b = useState(null), rootComponent = _b[0], attachRef = _b[1];
|
|
16
|
+
var _b = __read(useState(null), 2), rootComponent = _b[0], attachRef = _b[1];
|
|
17
17
|
var rootElement = findDOMNode(rootComponent);
|
|
18
18
|
useRootClose(rootElement, onRootClose, props);
|
|
19
19
|
return typeof children === 'function' ? children(attachRef) : children;
|
package/esm/utils/SimpleMap.js
CHANGED
package/esm/utils/api.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __awaiter, __generator, __assign, __rest, __spreadArray } from 'tslib';
|
|
6
|
+
import { __awaiter, __generator, __assign, __rest, __spreadArray, __read } from 'tslib';
|
|
7
7
|
import omit from 'lodash/omit';
|
|
8
8
|
import { parse, evaluate } from 'amis-formula';
|
|
9
9
|
import { escapeHtml } from './escapeHtml.js';
|
|
@@ -218,7 +218,7 @@ function str2function(contents) {
|
|
|
218
218
|
args[_i - 1] = arguments[_i];
|
|
219
219
|
}
|
|
220
220
|
try {
|
|
221
|
-
var fn = new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], args, false), [contents], false)))();
|
|
221
|
+
var fn = new (Function.bind.apply(Function, __spreadArray(__spreadArray([void 0], __read(args), false), [contents], false)))();
|
|
222
222
|
return fn;
|
|
223
223
|
}
|
|
224
224
|
catch (e) {
|
|
@@ -237,7 +237,7 @@ function str2AsyncFunction(contents) {
|
|
|
237
237
|
args[_i - 1] = arguments[_i];
|
|
238
238
|
}
|
|
239
239
|
try {
|
|
240
|
-
var fn = new (AsyncFunction.bind.apply(AsyncFunction, __spreadArray(__spreadArray([void 0], args, false), [contents], false)))();
|
|
240
|
+
var fn = new (AsyncFunction.bind.apply(AsyncFunction, __spreadArray(__spreadArray([void 0], __read(args), false), [contents], false)))();
|
|
241
241
|
return fn;
|
|
242
242
|
}
|
|
243
243
|
catch (e) {
|
package/esm/utils/autobind.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { __spreadArray, __read } from 'tslib';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import chunk from 'lodash/chunk';
|
|
8
9
|
|
|
9
|
-
/**
|
|
10
|
-
* columnsCount 支持数字和数组两种格式
|
|
11
|
-
*/
|
|
12
10
|
function columnsSplit(body, cx, columnsCount) {
|
|
13
11
|
if (Array.isArray(columnsCount) && columnsCount.length) {
|
|
14
12
|
var bodyIndex_1 = 0;
|
|
15
13
|
var bodyList_1 = [];
|
|
16
|
-
var maxSize = Math.max(Math.round(12 / Math.max.apply(Math, columnsCount)), 1);
|
|
14
|
+
var maxSize = Math.max(Math.round(12 / Math.max.apply(Math, __spreadArray([], __read(columnsCount), false))), 1);
|
|
17
15
|
var cellClassName_1 = "Grid-col--sm".concat(maxSize);
|
|
18
16
|
columnsCount.forEach(function (columnSize, groupIndex) {
|
|
19
17
|
if (columnSize) {
|
package/esm/utils/dataMapping.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __assign } from 'tslib';
|
|
6
|
+
import { __values, __assign } from 'tslib';
|
|
7
7
|
import { isPureVariable } from './isPureVariable.js';
|
|
8
8
|
import { resolveVariableAndFilter } from './resolveVariableAndFilter.js';
|
|
9
9
|
import { tokenize } from './tokenize.js';
|
|
@@ -29,11 +29,21 @@ function resolveMapping(value, data, defaultFilter, ignoreIfNotMatch) {
|
|
|
29
29
|
* @param data 数据上下文
|
|
30
30
|
*/
|
|
31
31
|
function resolveMappingObject(value, data) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
var e_1, _a;
|
|
33
|
+
try {
|
|
34
|
+
for (var _b = __values(Object.keys(value)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
35
|
+
var key = _c.value;
|
|
36
|
+
if (typeof value[key] === 'string') {
|
|
37
|
+
value[key] = resolveMapping(value[key], data);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
42
|
+
finally {
|
|
43
|
+
try {
|
|
44
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
36
45
|
}
|
|
46
|
+
finally { if (e_1) throw e_1.error; }
|
|
37
47
|
}
|
|
38
48
|
return value;
|
|
39
49
|
}
|
package/esm/utils/date.js
CHANGED
package/esm/utils/debug.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __decorate, __metadata, __extends } from 'tslib';
|
|
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
9
|
import { findDOMNode, render } from 'react-dom';
|
|
@@ -117,12 +117,13 @@ var LogView = observer(function (_a) {
|
|
|
117
117
|
})));
|
|
118
118
|
});
|
|
119
119
|
var AMISDebug = observer(function (_a) {
|
|
120
|
-
var
|
|
120
|
+
var e_1, _b;
|
|
121
|
+
var _c, _d;
|
|
121
122
|
var store = _a.store;
|
|
122
123
|
var activeId = store.activeId;
|
|
123
124
|
var activeComponentInspect = ComponentInfo[activeId];
|
|
124
125
|
// 收集数据域里的数据
|
|
125
|
-
var start = ((
|
|
126
|
+
var start = ((_d = (_c = activeComponentInspect === null || activeComponentInspect === void 0 ? void 0 : activeComponentInspect.component) === null || _c === void 0 ? void 0 : _c.props) === null || _d === void 0 ? void 0 : _d.data) || {};
|
|
126
127
|
var stacks = [start];
|
|
127
128
|
while (Object.getPrototypeOf(start) !== Object.prototype) {
|
|
128
129
|
var superData = Object.getPrototypeOf(start);
|
|
@@ -135,20 +136,29 @@ var AMISDebug = observer(function (_a) {
|
|
|
135
136
|
var stackDataView = [];
|
|
136
137
|
if (Object.keys(stacks[0]).length || stacks.length > 1) {
|
|
137
138
|
var level = 0;
|
|
138
|
-
|
|
139
|
-
var
|
|
140
|
-
|
|
141
|
-
React.createElement("
|
|
142
|
-
"
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
139
|
+
try {
|
|
140
|
+
for (var stacks_1 = __values(stacks), stacks_1_1 = stacks_1.next(); !stacks_1_1.done; stacks_1_1 = stacks_1.next()) {
|
|
141
|
+
var stack = stacks_1_1.value;
|
|
142
|
+
stackDataView.push(React.createElement("div", { key: "data-".concat(level) },
|
|
143
|
+
React.createElement("h3", null,
|
|
144
|
+
"Data Level-",
|
|
145
|
+
level),
|
|
146
|
+
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
|
+
level += 1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
151
|
+
finally {
|
|
152
|
+
try {
|
|
153
|
+
if (stacks_1_1 && !stacks_1_1.done && (_b = stacks_1.return)) _b.call(stacks_1);
|
|
154
|
+
}
|
|
155
|
+
finally { if (e_1) throw e_1.error; }
|
|
146
156
|
}
|
|
147
157
|
}
|
|
148
158
|
var panelRef = useRef(null);
|
|
149
|
-
var
|
|
150
|
-
var
|
|
151
|
-
var
|
|
159
|
+
var _e = __read(useState(false), 2), isResizing = _e[0], setResizing = _e[1];
|
|
160
|
+
var _f = __read(useState(0), 2), startX = _f[0], setStartX = _f[1];
|
|
161
|
+
var _g = __read(useState(0), 2), panelWidth = _g[0], setPanelWidth = _g[1];
|
|
152
162
|
useEffect(function () {
|
|
153
163
|
var handleMouseUp = function () {
|
|
154
164
|
setResizing(false);
|
|
@@ -341,6 +351,9 @@ var DebugWrapper = /** @class */ (function (_super) {
|
|
|
341
351
|
* @param ext 扩展信息
|
|
342
352
|
*/
|
|
343
353
|
function debug(cat, msg, ext) {
|
|
354
|
+
console.groupCollapsed('[amis debug]', msg);
|
|
355
|
+
console.debug(ext);
|
|
356
|
+
console.groupEnd();
|
|
344
357
|
if (!isEnabled) {
|
|
345
358
|
return;
|
|
346
359
|
}
|
|
@@ -350,9 +363,6 @@ function debug(cat, msg, ext) {
|
|
|
350
363
|
msg: msg,
|
|
351
364
|
ext: JSON.stringify(ext)
|
|
352
365
|
};
|
|
353
|
-
console.groupCollapsed('amis debug', msg);
|
|
354
|
-
console.trace(log);
|
|
355
|
-
console.groupEnd();
|
|
356
366
|
store.logs.push(log);
|
|
357
367
|
}
|
|
358
368
|
/**
|
package/esm/utils/dom.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { __read } from 'tslib';
|
|
6
7
|
import ReactDOM from 'react-dom';
|
|
7
8
|
import { offset } from './offset.js';
|
|
8
9
|
import { position } from './position.js';
|
|
@@ -86,7 +87,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
86
87
|
var tests = placement.split(/\s+/);
|
|
87
88
|
while (tests.length) {
|
|
88
89
|
var current = (activePlacement = tests.shift());
|
|
89
|
-
var _b = current.split('-'), atX = _b[0], atY = _b[1], myX = _b[2], myY = _b[3];
|
|
90
|
+
var _b = __read(current.split('-'), 4), atX = _b[0], atY = _b[1], myX = _b[2], myY = _b[3];
|
|
90
91
|
myX = myX || atX;
|
|
91
92
|
myY = myY || atY;
|
|
92
93
|
positionLeft =
|
|
@@ -166,7 +167,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
166
167
|
else {
|
|
167
168
|
throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
|
|
168
169
|
}
|
|
169
|
-
var _c = customOffset[0], offSetX =
|
|
170
|
+
var _c = __read(customOffset, 2), _d = _c[0], offSetX = _d === void 0 ? 0 : _d, _e = _c[1], offSetY = _e === void 0 ? 0 : _e;
|
|
170
171
|
return {
|
|
171
172
|
positionLeft: (positionLeft + offSetX) / scaleX,
|
|
172
173
|
positionTop: (positionTop + offSetY) / scaleY,
|
package/esm/utils/errors.js
CHANGED
package/esm/utils/escapeHtml.js
CHANGED
package/esm/utils/filter.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { __spreadArray } from 'tslib';
|
|
6
|
+
import { __spreadArray, __read } from 'tslib';
|
|
7
7
|
import { extendsFilters, filters } from 'amis-formula';
|
|
8
8
|
import moment from 'moment';
|
|
9
9
|
import { makeSorter } from './makeSorter.js';
|
|
@@ -88,7 +88,7 @@ extendsFilters({
|
|
|
88
88
|
return Array.isArray(input) && filters[fn]
|
|
89
89
|
? input.map(function (item) {
|
|
90
90
|
var _a;
|
|
91
|
-
return (_a = filters[fn]).call.apply(_a, __spreadArray([_this, item], arg, false));
|
|
91
|
+
return (_a = filters[fn]).call.apply(_a, __spreadArray([_this, item], __read(arg), false));
|
|
92
92
|
})
|
|
93
93
|
: input;
|
|
94
94
|
},
|
|
@@ -169,9 +169,7 @@ extendsFilters({
|
|
|
169
169
|
bytes: function (input, step) {
|
|
170
170
|
var _a;
|
|
171
171
|
if (step === void 0) { step = 1000; }
|
|
172
|
-
return input
|
|
173
|
-
? prettyBytes(parseFloat(input), (_a = parseInt(step, 10)) !== null && _a !== void 0 ? _a : 1000)
|
|
174
|
-
: input;
|
|
172
|
+
return input ? prettyBytes(input, (_a = parseInt(step, 10)) !== null && _a !== void 0 ? _a : 1000) : input;
|
|
175
173
|
},
|
|
176
174
|
round: function (input, decimals) {
|
|
177
175
|
var _a;
|
|
@@ -365,7 +363,7 @@ extendsFilters({
|
|
|
365
363
|
args[_i - 1] = arguments[_i];
|
|
366
364
|
}
|
|
367
365
|
return Array.isArray(input)
|
|
368
|
-
? input.concat.apply(input, args.map(function (arg, index) { var _a; return getStrOrVariable(arg, _this.data, (_a = _this.filter) === null || _a === void 0 ? void 0 : _a.args[index]); })) : input;
|
|
366
|
+
? input.concat.apply(input, __spreadArray([], __read(args.map(function (arg, index) { var _a; return getStrOrVariable(arg, _this.data, (_a = _this.filter) === null || _a === void 0 ? void 0 : _a.args[index]); })), false)) : input;
|
|
369
367
|
},
|
|
370
368
|
filter: function (input, keys, expOrDirective, arg1) {
|
|
371
369
|
var _a, _b, _c, _d;
|
package/esm/utils/formula.js
CHANGED
package/esm/utils/getVariable.js
CHANGED
package/esm/utils/grammar.js
CHANGED