amis-core 2.9.0 → 3.0.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 +1 -1
- package/esm/SchemaRenderer.d.ts +1 -0
- package/esm/SchemaRenderer.js +7 -5
- package/esm/Scoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.js +8 -2
- 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 +5 -1
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +2 -2
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.js +1 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +2 -1
- package/esm/factory.js +3 -3
- package/esm/index.d.ts +8 -3
- package/esm/index.js +10 -9
- package/esm/locale.js +1 -1
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +1 -1
- package/esm/renderers/Item.js +10 -7
- package/esm/renderers/Options.js +3 -3
- package/esm/renderers/Placeholder.js +1 -1
- package/esm/renderers/builtin.js +1 -1
- package/esm/renderers/register.js +1 -1
- package/esm/renderers/wrapControl.js +1 -1
- package/esm/store/app.js +1 -1
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.js +22 -8
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.js +2 -2
- 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 +2 -2
- package/esm/store/root.js +1 -1
- package/esm/store/service.js +1 -1
- package/esm/store/table.d.ts +24 -23
- package/esm/store/table.js +17 -4
- package/esm/store/table2.d.ts +5 -5
- package/esm/store/table2.js +23 -19
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +6 -0
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.js +1 -1
- package/esm/utils/DataScope.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/api.js +9 -2
- 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 +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +4 -4
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.d.ts +2 -0
- package/esm/utils/dom.js +47 -10
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.js +2 -2
- 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 +7 -0
- package/esm/utils/helper.js +28 -3
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.d.ts +6 -1
- package/esm/utils/icon.js +6 -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 +1 -1
- package/esm/utils/renderer-event.js +35 -32
- package/esm/utils/replaceText.js +1 -1
- package/esm/utils/resize-sensor.js +1 -1
- package/esm/utils/resolveCondition.d.ts +1 -0
- package/esm/utils/resolveCondition.js +19 -4
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/esm/utils/resolveVariableAndFilterForAsync.js +20 -3
- package/esm/utils/scrollPosition.js +1 -1
- package/esm/utils/string2regExp.js +1 -1
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style-helper.d.ts +9 -4
- package/esm/utils/style-helper.js +81 -16
- package/esm/utils/style.js +2 -2
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +34 -3
- package/esm/utils/tpl-builtin.d.ts +2 -1
- package/esm/utils/tpl-builtin.js +18 -3
- package/esm/utils/tpl-lodash.js +3 -2
- package/esm/utils/tpl.d.ts +2 -0
- package/esm/utils/tpl.js +24 -2
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.d.ts +4 -1
- package/esm/utils/validations.js +27 -12
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.js +1 -1
- package/lib/SchemaRenderer.d.ts +1 -0
- package/lib/SchemaRenderer.js +7 -4
- package/lib/Scoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.js +8 -2
- 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 +5 -1
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +2 -2
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.js +1 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +2 -1
- package/lib/factory.js +3 -3
- package/lib/index.d.ts +8 -3
- package/lib/index.js +14 -2
- package/lib/locale.js +1 -1
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +1 -1
- package/lib/renderers/Item.js +10 -7
- 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 +1 -1
- package/lib/renderers/wrapControl.js +1 -1
- package/lib/store/app.js +1 -1
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.js +22 -8
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.js +2 -2
- 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 +2 -2
- package/lib/store/root.js +1 -1
- package/lib/store/service.js +1 -1
- package/lib/store/table.d.ts +24 -23
- package/lib/store/table.js +17 -4
- package/lib/store/table2.d.ts +5 -5
- package/lib/store/table2.js +23 -19
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +6 -0
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.js +1 -1
- package/lib/utils/DataScope.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/api.js +9 -2
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +4 -4
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.d.ts +2 -0
- package/lib/utils/dom.js +48 -9
- package/lib/utils/errors.js +1 -1
- package/lib/utils/escapeHtml.js +1 -1
- package/lib/utils/filter-schema.js +1 -1
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.js +2 -2
- 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 +7 -0
- package/lib/utils/helper.js +29 -2
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.d.ts +6 -1
- package/lib/utils/icon.js +6 -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 +1 -1
- package/lib/utils/renderer-event.js +35 -32
- package/lib/utils/replaceText.js +1 -1
- package/lib/utils/resize-sensor.js +1 -1
- package/lib/utils/resolveCondition.d.ts +1 -0
- package/lib/utils/resolveCondition.js +19 -3
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -1
- package/lib/utils/resolveVariableAndFilterForAsync.js +20 -2
- package/lib/utils/scrollPosition.js +1 -1
- package/lib/utils/string2regExp.js +1 -1
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style-helper.d.ts +9 -4
- package/lib/utils/style-helper.js +86 -15
- package/lib/utils/style.js +2 -2
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +33 -1
- package/lib/utils/tpl-builtin.d.ts +2 -1
- package/lib/utils/tpl-builtin.js +17 -2
- package/lib/utils/tpl-lodash.js +3 -2
- package/lib/utils/tpl.d.ts +2 -0
- package/lib/utils/tpl.js +24 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.d.ts +4 -1
- package/lib/utils/validations.js +27 -12
- package/package.json +3 -3
package/esm/utils/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -350,7 +350,10 @@ function wrapFetcher(fn, tracker) {
|
|
|
350
350
|
api = api.requestAdaptor(api) || api;
|
|
351
351
|
debug('api', 'after requestAdaptor', api);
|
|
352
352
|
}
|
|
353
|
-
if (api.data &&
|
|
353
|
+
if (api.data &&
|
|
354
|
+
(api.data instanceof FormData ||
|
|
355
|
+
hasFile(api.data) ||
|
|
356
|
+
api.dataType === 'form-data')) {
|
|
354
357
|
api.data =
|
|
355
358
|
api.data instanceof FormData
|
|
356
359
|
? api.data
|
|
@@ -522,6 +525,10 @@ function isApiOutdated(prevApi, nextApi, prevData, nextData) {
|
|
|
522
525
|
if (!nextApi) {
|
|
523
526
|
return false;
|
|
524
527
|
}
|
|
528
|
+
// 通常是编辑器里加了属性,一开始没值,后来有了
|
|
529
|
+
if (prevApi === undefined && !nextApi !== undefined) {
|
|
530
|
+
return true;
|
|
531
|
+
}
|
|
525
532
|
nextApi = normalizeApi(nextApi);
|
|
526
533
|
if (nextApi.autoRefresh === false) {
|
|
527
534
|
return false;
|
package/esm/utils/autobind.js
CHANGED
package/esm/utils/dataMapping.js
CHANGED
package/esm/utils/date.js
CHANGED
package/esm/utils/debug.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -351,12 +351,12 @@ var DebugWrapper = /** @class */ (function (_super) {
|
|
|
351
351
|
* @param ext 扩展信息
|
|
352
352
|
*/
|
|
353
353
|
function debug(cat, msg, ext) {
|
|
354
|
-
console.groupCollapsed('[amis debug]', msg);
|
|
355
|
-
console.debug(ext);
|
|
356
|
-
console.groupEnd();
|
|
357
354
|
if (!isEnabled) {
|
|
358
355
|
return;
|
|
359
356
|
}
|
|
357
|
+
console.groupCollapsed('[amis debug]', msg);
|
|
358
|
+
console.debug(ext);
|
|
359
|
+
console.groupEnd();
|
|
360
360
|
var log = {
|
|
361
361
|
cat: cat,
|
|
362
362
|
level: 'debug',
|
package/esm/utils/dom.d.ts
CHANGED
|
@@ -11,3 +11,5 @@ export declare function calculatePosition(placement: any, overlayNode: any, targ
|
|
|
11
11
|
* 专门用来获取样式的像素值,默认返回 0
|
|
12
12
|
*/
|
|
13
13
|
export declare function getStyleNumber(element: HTMLElement, styleName: string): number;
|
|
14
|
+
/** 根据关键字高亮显示文本内容 */
|
|
15
|
+
export declare function renderTextByKeyword(rendererText: string, curKeyword: string): string | JSX.Element;
|
package/esm/utils/dom.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { __read } from 'tslib';
|
|
7
7
|
import ReactDOM from 'react-dom';
|
|
8
|
+
import React from 'react';
|
|
8
9
|
import { offset } from './offset.js';
|
|
9
10
|
import { position } from './position.js';
|
|
10
11
|
|
|
@@ -78,16 +79,27 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
78
79
|
? clip2.height / overlayNode.offsetHeight
|
|
79
80
|
: 1;
|
|
80
81
|
// auto 尝试四个方向对齐。
|
|
81
|
-
placement
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
var isAuto = placement === 'auto';
|
|
83
|
+
// 兜底方向
|
|
84
|
+
var autoDefaultPlacement = 'left-bottom-left-top';
|
|
85
|
+
placement = isAuto
|
|
86
|
+
? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
|
|
87
|
+
: placement;
|
|
85
88
|
var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
|
|
86
89
|
if (~placement.indexOf('-')) {
|
|
87
90
|
var tests = placement.split(/\s+/);
|
|
91
|
+
// 收集可见方向
|
|
92
|
+
var visiblePlacement = {};
|
|
88
93
|
while (tests.length) {
|
|
89
94
|
var current = (activePlacement = tests.shift());
|
|
90
|
-
|
|
95
|
+
// 自动对齐模式下,当四个方向都无法完全可见时
|
|
96
|
+
// 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
|
|
97
|
+
if (isAuto && tests.length === 0) {
|
|
98
|
+
var _b = __read(autoDefaultPlacement.split('-'), 4), _atX = _b[0], _atY = _b[1], _myX = _b[2], _myY = _b[3];
|
|
99
|
+
var _c = visiblePlacement.atX, atX_1 = _c === void 0 ? _atX : _c, _d = visiblePlacement.atY, atY_1 = _d === void 0 ? _atY : _d, _e = visiblePlacement.myX, myX_1 = _e === void 0 ? _myX : _e, _f = visiblePlacement.myY, myY_1 = _f === void 0 ? _myY : _f;
|
|
100
|
+
current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
|
|
101
|
+
}
|
|
102
|
+
var _g = __read(current.split('-'), 4), atX = _g[0], atY = _g[1], myX = _g[2], myY = _g[3];
|
|
91
103
|
myX = myX || atX;
|
|
92
104
|
myY = myY || atY;
|
|
93
105
|
positionLeft =
|
|
@@ -118,10 +130,21 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
118
130
|
width: overlayWidth,
|
|
119
131
|
height: overlayHeight
|
|
120
132
|
};
|
|
133
|
+
var visibleX = false;
|
|
134
|
+
var visibleY = false;
|
|
121
135
|
if (transformed.x > 0 &&
|
|
122
|
-
transformed.x + transformed.width < window.innerWidth
|
|
123
|
-
|
|
136
|
+
transformed.x + transformed.width < window.innerWidth) {
|
|
137
|
+
visibleX = true;
|
|
138
|
+
!visiblePlacement.atX && (visiblePlacement.atX = atX);
|
|
139
|
+
!visiblePlacement.myX && (visiblePlacement.myX = myX);
|
|
140
|
+
}
|
|
141
|
+
if (transformed.y > 0 &&
|
|
124
142
|
transformed.y + transformed.height < window.innerHeight) {
|
|
143
|
+
visibleY = true;
|
|
144
|
+
!visiblePlacement.atY && (visiblePlacement.atY = atY);
|
|
145
|
+
!visiblePlacement.myY && (visiblePlacement.myY = myY);
|
|
146
|
+
}
|
|
147
|
+
if (visibleX && visibleY) {
|
|
125
148
|
break;
|
|
126
149
|
}
|
|
127
150
|
}
|
|
@@ -167,7 +190,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
167
190
|
else {
|
|
168
191
|
throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
|
|
169
192
|
}
|
|
170
|
-
var
|
|
193
|
+
var _h = __read(customOffset, 2), _j = _h[0], offSetX = _j === void 0 ? 0 : _j, _k = _h[1], offSetY = _k === void 0 ? 0 : _k;
|
|
171
194
|
return {
|
|
172
195
|
positionLeft: (positionLeft + offSetX) / scaleX,
|
|
173
196
|
positionTop: (positionTop + offSetY) / scaleY,
|
|
@@ -185,5 +208,19 @@ function getStyleNumber(element, styleName) {
|
|
|
185
208
|
}
|
|
186
209
|
return (parseInt(getComputedStyle(element).getPropertyValue(styleName), 10) || 0);
|
|
187
210
|
}
|
|
211
|
+
/** 根据关键字高亮显示文本内容 */
|
|
212
|
+
function renderTextByKeyword(rendererText, curKeyword) {
|
|
213
|
+
if (curKeyword && ~rendererText.indexOf(curKeyword)) {
|
|
214
|
+
var keywordStartIndex = rendererText.indexOf(curKeyword);
|
|
215
|
+
var keywordEndIndex = keywordStartIndex + curKeyword.length;
|
|
216
|
+
return (React.createElement("span", null,
|
|
217
|
+
rendererText.substring(0, keywordStartIndex),
|
|
218
|
+
React.createElement("span", { className: "is-keyword" }, curKeyword),
|
|
219
|
+
rendererText.substring(keywordEndIndex)));
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
return rendererText;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
188
225
|
|
|
189
|
-
export { calculatePosition, getContainer, getStyleNumber, ownerDocument };
|
|
226
|
+
export { calculatePosition, getContainer, getStyleNumber, ownerDocument, renderTextByKeyword };
|
package/esm/utils/errors.js
CHANGED
package/esm/utils/escapeHtml.js
CHANGED
package/esm/utils/filter.js
CHANGED
package/esm/utils/formula.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,8 +8,8 @@ import isString from 'lodash/isString';
|
|
|
8
8
|
import isBoolean from 'lodash/isBoolean';
|
|
9
9
|
import { evaluate, getFilters } from 'amis-formula';
|
|
10
10
|
import { filter } from './tpl.js';
|
|
11
|
-
import 'moment';
|
|
12
11
|
import 'tslib';
|
|
12
|
+
import 'moment';
|
|
13
13
|
import 'lodash/isPlainObject';
|
|
14
14
|
import { getVariable } from './getVariable.js';
|
|
15
15
|
import { resolveVariableAndFilter } from './resolveVariableAndFilter.js';
|
package/esm/utils/getVariable.js
CHANGED
package/esm/utils/grammar.js
CHANGED
package/esm/utils/helper.d.ts
CHANGED
|
@@ -144,6 +144,12 @@ export declare function eachTree<T extends TreeItem>(tree: Array<T>, iterator: (
|
|
|
144
144
|
* @param iterator
|
|
145
145
|
*/
|
|
146
146
|
export declare function findTree<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => any): T | null;
|
|
147
|
+
/**
|
|
148
|
+
* 在树中查找节点。
|
|
149
|
+
* @param tree
|
|
150
|
+
* @param iterator
|
|
151
|
+
*/
|
|
152
|
+
export declare function findTreeAll<T extends TreeItem>(tree: Array<T>, iterator: (item: T, key: number, level: number, paths: Array<T>) => any): Array<T>;
|
|
147
153
|
/**
|
|
148
154
|
* 在树中查找节点, 返回下标数组。
|
|
149
155
|
* @param tree
|
|
@@ -259,6 +265,7 @@ export declare function chainFunctions(...fns: Array<(...args: Array<any>) => vo
|
|
|
259
265
|
export declare function chainEvents(props: any, schema: any): any;
|
|
260
266
|
export declare function mapObject(value: any, fn: Function, skipFn?: (value: any) => boolean): any;
|
|
261
267
|
export declare function loadScript(src: string): Promise<void>;
|
|
268
|
+
export declare function loadStyle(href: string): Promise<void>;
|
|
262
269
|
export declare class SkipOperation extends Error {
|
|
263
270
|
}
|
|
264
271
|
/**
|
package/esm/utils/helper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -597,6 +597,21 @@ function findTree(tree, iterator) {
|
|
|
597
597
|
});
|
|
598
598
|
return result;
|
|
599
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* 在树中查找节点。
|
|
602
|
+
* @param tree
|
|
603
|
+
* @param iterator
|
|
604
|
+
*/
|
|
605
|
+
function findTreeAll(tree, iterator) {
|
|
606
|
+
var result = [];
|
|
607
|
+
everyTree(tree, function (item, key, level, paths) {
|
|
608
|
+
if (iterator(item, key, level, paths)) {
|
|
609
|
+
result.push(item);
|
|
610
|
+
}
|
|
611
|
+
return true;
|
|
612
|
+
});
|
|
613
|
+
return result;
|
|
614
|
+
}
|
|
600
615
|
/**
|
|
601
616
|
* 在树中查找节点, 返回下标数组。
|
|
602
617
|
* @param tree
|
|
@@ -1003,6 +1018,16 @@ function loadScript(src) {
|
|
|
1003
1018
|
document.head.appendChild(script);
|
|
1004
1019
|
});
|
|
1005
1020
|
}
|
|
1021
|
+
function loadStyle(href) {
|
|
1022
|
+
return new Promise(function (ok, fail) {
|
|
1023
|
+
var link = document.createElement('link');
|
|
1024
|
+
link.rel = 'stylesheet';
|
|
1025
|
+
link.onerror = function (reason) { return fail(reason); };
|
|
1026
|
+
link.onload = function () { return ok(); };
|
|
1027
|
+
link.href = href;
|
|
1028
|
+
document.head.appendChild(link);
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1006
1031
|
var SkipOperation = /** @class */ (function (_super) {
|
|
1007
1032
|
__extends(SkipOperation, _super);
|
|
1008
1033
|
function SkipOperation() {
|
|
@@ -1177,7 +1202,7 @@ function isClickOnInput(e) {
|
|
|
1177
1202
|
var formItem;
|
|
1178
1203
|
if (!e.currentTarget.contains(target) ||
|
|
1179
1204
|
~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
|
|
1180
|
-
((formItem = target.closest("button, a, [data-role=\"form-item\"]")) &&
|
|
1205
|
+
((formItem = target.closest("button, a, [data-role=\"form-item\"], label[data-role=\"checkbox\"]")) &&
|
|
1181
1206
|
e.currentTarget.contains(formItem))) {
|
|
1182
1207
|
return true;
|
|
1183
1208
|
}
|
|
@@ -1258,4 +1283,4 @@ function parseQuery(location) {
|
|
|
1258
1283
|
return merge(normalizedQuery, hashQuery);
|
|
1259
1284
|
}
|
|
1260
1285
|
|
|
1261
|
-
export { JSONTraverse, SkipOperation, __uri, anyChanged, autobind, bulkBindFunctions, camel, chainEvents, chainFunctions, convertArrayValueToMoment, detectPropValueChanged, difference, eachTree, everyTree, filterTree, findIndex, findObjectsWithKey, findTree, 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, 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 };
|
|
1286
|
+
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 };
|
package/esm/utils/highlight.js
CHANGED
package/esm/utils/icon.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ import { ClassNamesFn } from '../theme';
|
|
|
6
6
|
export interface IconCheckedSchema {
|
|
7
7
|
id: string;
|
|
8
8
|
name?: string;
|
|
9
|
+
svg?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface IconCheckedSchemaNew {
|
|
12
|
+
type: 'icon';
|
|
13
|
+
icon: IconCheckedSchema;
|
|
9
14
|
}
|
|
10
15
|
/**
|
|
11
16
|
* 判断字符串来生成 i 或 img
|
|
@@ -13,4 +18,4 @@ export interface IconCheckedSchema {
|
|
|
13
18
|
* @param className 内部用的 className
|
|
14
19
|
* @param classNameProp amis 配置里设置的 className
|
|
15
20
|
*/
|
|
16
|
-
export declare const generateIcon: (cx: ClassNamesFn, icon?: string | IconCheckedSchema | React.ReactNode, className?: string, classNameProp?: string) => JSX.Element | null | undefined;
|
|
21
|
+
export declare const generateIcon: (cx: ClassNamesFn, icon?: string | IconCheckedSchema | React.ReactNode | IconCheckedSchemaNew, className?: string, classNameProp?: string) => JSX.Element | null | undefined;
|
package/esm/utils/icon.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v3.0.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -16,6 +16,11 @@ import { isObject } from 'lodash';
|
|
|
16
16
|
* @param classNameProp amis 配置里设置的 className
|
|
17
17
|
*/
|
|
18
18
|
var generateIcon = function (cx, icon, className, classNameProp) {
|
|
19
|
+
if (isObject(icon) &&
|
|
20
|
+
icon.type === 'icon' &&
|
|
21
|
+
icon.icon) {
|
|
22
|
+
icon = icon.icon;
|
|
23
|
+
}
|
|
19
24
|
if (React.isValidElement(icon)) {
|
|
20
25
|
return icon;
|
|
21
26
|
}
|
package/esm/utils/image.js
CHANGED
package/esm/utils/keyToPath.js
CHANGED
package/esm/utils/makeSorter.js
CHANGED
package/esm/utils/object.js
CHANGED
package/esm/utils/offset.js
CHANGED
package/esm/utils/position.js
CHANGED
package/esm/utils/prettyBytes.js
CHANGED