amis-core 2.8.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.d.ts +1 -1
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +21 -4
- package/esm/SchemaRenderer.d.ts +3 -1
- package/esm/SchemaRenderer.js +7 -5
- package/esm/Scoped.js +30 -2
- package/esm/WithRootStore.d.ts +4 -8
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.d.ts +2 -1
- package/esm/actions/Action.js +40 -12
- 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 +2 -1
- package/esm/actions/DialogAction.d.ts +1 -1
- package/esm/actions/DialogAction.js +12 -3
- 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 +18 -15
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/LazyComponent.d.ts +3 -3
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +2 -2
- package/esm/components/Overlay.js +2 -1
- package/esm/components/PopOver.d.ts +2 -4
- package/esm/components/PopOver.js +2 -1
- package/esm/env.d.ts +3 -7
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +2 -1
- package/esm/factory.js +5 -3
- package/esm/index.d.ts +9 -5
- package/esm/index.js +12 -9
- package/esm/locale.d.ts +1 -3
- package/esm/locale.js +1 -1
- package/esm/renderers/Form.d.ts +1 -1
- package/esm/renderers/Form.js +17 -15
- package/esm/renderers/Item.d.ts +9 -15
- package/esm/renderers/Item.js +11 -7
- package/esm/renderers/Options.js +4 -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.d.ts +4 -8
- package/esm/renderers/wrapControl.js +21 -30
- package/esm/store/app.d.ts +4 -2
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +12 -6
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +5 -2
- package/esm/store/crud.js +46 -12
- package/esm/store/form.d.ts +4 -2
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.js +6 -5
- package/esm/store/iRenderer.d.ts +5 -2
- package/esm/store/iRenderer.js +15 -3
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +4 -2
- package/esm/store/list.js +5 -5
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +4 -2
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +4 -2
- package/esm/store/pagination.js +2 -2
- package/esm/store/root.d.ts +4 -2
- package/esm/store/root.js +1 -1
- package/esm/store/service.d.ts +4 -2
- package/esm/store/service.js +1 -1
- package/esm/store/table.d.ts +36 -29
- package/esm/store/table.js +28 -5
- package/esm/store/table2.d.ts +9 -7
- package/esm/store/table2.js +23 -19
- package/esm/theme.d.ts +2 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +45 -2
- 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 +11 -5
- 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.d.ts +1 -0
- 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.d.ts +1 -0
- package/esm/utils/formula.js +7 -3
- 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/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/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 +7 -3
- 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 +6 -0
- package/esm/utils/resolveCondition.js +321 -0
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
- package/esm/utils/resolveVariableAndFilterForAsync.js +63 -0
- 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 +9 -0
- package/esm/utils/tpl.js +45 -3
- 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.d.ts +1 -1
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +21 -4
- package/lib/SchemaRenderer.d.ts +3 -1
- package/lib/SchemaRenderer.js +7 -4
- package/lib/Scoped.js +30 -2
- package/lib/WithRootStore.d.ts +4 -8
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.d.ts +2 -1
- package/lib/actions/Action.js +39 -11
- 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 +2 -1
- package/lib/actions/DialogAction.d.ts +1 -1
- package/lib/actions/DialogAction.js +12 -3
- 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 +17 -14
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/LazyComponent.d.ts +3 -3
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +2 -2
- package/lib/components/Overlay.js +2 -1
- package/lib/components/PopOver.d.ts +2 -4
- package/lib/components/PopOver.js +2 -1
- package/lib/env.d.ts +3 -7
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +2 -1
- package/lib/factory.js +5 -3
- package/lib/index.d.ts +9 -5
- package/lib/index.js +30 -2
- package/lib/locale.d.ts +1 -3
- package/lib/locale.js +1 -1
- package/lib/renderers/Form.d.ts +1 -1
- package/lib/renderers/Form.js +16 -14
- package/lib/renderers/Item.d.ts +9 -15
- package/lib/renderers/Item.js +11 -7
- package/lib/renderers/Options.js +4 -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.d.ts +4 -8
- package/lib/renderers/wrapControl.js +20 -28
- package/lib/store/app.d.ts +4 -2
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +12 -6
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +5 -2
- package/lib/store/crud.js +45 -11
- package/lib/store/form.d.ts +4 -2
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.js +6 -5
- package/lib/store/iRenderer.d.ts +5 -2
- package/lib/store/iRenderer.js +15 -3
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +4 -2
- package/lib/store/list.js +5 -5
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +4 -2
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +4 -2
- package/lib/store/pagination.js +2 -2
- package/lib/store/root.d.ts +4 -2
- package/lib/store/root.js +1 -1
- package/lib/store/service.d.ts +4 -2
- package/lib/store/service.js +1 -1
- package/lib/store/table.d.ts +36 -29
- package/lib/store/table.js +28 -5
- package/lib/store/table2.d.ts +9 -7
- package/lib/store/table2.js +23 -19
- package/lib/theme.d.ts +2 -4
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +45 -2
- 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 +10 -4
- 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.d.ts +1 -0
- 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.d.ts +1 -0
- package/lib/utils/formula.js +7 -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/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/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 +7 -3
- 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 +6 -0
- package/lib/utils/resolveCondition.js +338 -0
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +6 -0
- package/lib/utils/resolveVariableAndFilterForAsync.js +68 -0
- 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 +9 -0
- package/lib/utils/tpl.js +45 -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 +5 -5
package/lib/utils/autobind.js
CHANGED
package/lib/utils/dataMapping.js
CHANGED
package/lib/utils/date.js
CHANGED
package/lib/utils/debug.d.ts
CHANGED
package/lib/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
|
|
|
@@ -361,12 +361,12 @@ var DebugWrapper = /** @class */ (function (_super) {
|
|
|
361
361
|
* @param ext 扩展信息
|
|
362
362
|
*/
|
|
363
363
|
function debug(cat, msg, ext) {
|
|
364
|
-
console.groupCollapsed('[amis debug]', msg);
|
|
365
|
-
console.debug(ext);
|
|
366
|
-
console.groupEnd();
|
|
367
364
|
if (!isEnabled) {
|
|
368
365
|
return;
|
|
369
366
|
}
|
|
367
|
+
console.groupCollapsed('[amis debug]', msg);
|
|
368
|
+
console.debug(ext);
|
|
369
|
+
console.groupEnd();
|
|
370
370
|
var log = {
|
|
371
371
|
cat: cat,
|
|
372
372
|
level: 'debug',
|
package/lib/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/lib/utils/dom.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
|
|
|
@@ -9,12 +9,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
9
9
|
|
|
10
10
|
var tslib = require('tslib');
|
|
11
11
|
var ReactDOM = require('react-dom');
|
|
12
|
+
var React = require('react');
|
|
12
13
|
var offset = require('./offset.js');
|
|
13
14
|
var position = require('./position.js');
|
|
14
15
|
|
|
15
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
17
|
|
|
17
18
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
19
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
20
|
|
|
19
21
|
function getContainer(container, defaultContainer) {
|
|
20
22
|
container = typeof container === 'function' ? container() : container;
|
|
@@ -86,16 +88,27 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
86
88
|
? clip2.height / overlayNode.offsetHeight
|
|
87
89
|
: 1;
|
|
88
90
|
// auto 尝试四个方向对齐。
|
|
89
|
-
placement
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
var isAuto = placement === 'auto';
|
|
92
|
+
// 兜底方向
|
|
93
|
+
var autoDefaultPlacement = 'left-bottom-left-top';
|
|
94
|
+
placement = isAuto
|
|
95
|
+
? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
|
|
96
|
+
: placement;
|
|
93
97
|
var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
|
|
94
98
|
if (~placement.indexOf('-')) {
|
|
95
99
|
var tests = placement.split(/\s+/);
|
|
100
|
+
// 收集可见方向
|
|
101
|
+
var visiblePlacement = {};
|
|
96
102
|
while (tests.length) {
|
|
97
103
|
var current = (activePlacement = tests.shift());
|
|
98
|
-
|
|
104
|
+
// 自动对齐模式下,当四个方向都无法完全可见时
|
|
105
|
+
// 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
|
|
106
|
+
if (isAuto && tests.length === 0) {
|
|
107
|
+
var _b = tslib.__read(autoDefaultPlacement.split('-'), 4), _atX = _b[0], _atY = _b[1], _myX = _b[2], _myY = _b[3];
|
|
108
|
+
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;
|
|
109
|
+
current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
|
|
110
|
+
}
|
|
111
|
+
var _g = tslib.__read(current.split('-'), 4), atX = _g[0], atY = _g[1], myX = _g[2], myY = _g[3];
|
|
99
112
|
myX = myX || atX;
|
|
100
113
|
myY = myY || atY;
|
|
101
114
|
positionLeft =
|
|
@@ -126,10 +139,21 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
126
139
|
width: overlayWidth,
|
|
127
140
|
height: overlayHeight
|
|
128
141
|
};
|
|
142
|
+
var visibleX = false;
|
|
143
|
+
var visibleY = false;
|
|
129
144
|
if (transformed.x > 0 &&
|
|
130
|
-
transformed.x + transformed.width < window.innerWidth
|
|
131
|
-
|
|
145
|
+
transformed.x + transformed.width < window.innerWidth) {
|
|
146
|
+
visibleX = true;
|
|
147
|
+
!visiblePlacement.atX && (visiblePlacement.atX = atX);
|
|
148
|
+
!visiblePlacement.myX && (visiblePlacement.myX = myX);
|
|
149
|
+
}
|
|
150
|
+
if (transformed.y > 0 &&
|
|
132
151
|
transformed.y + transformed.height < window.innerHeight) {
|
|
152
|
+
visibleY = true;
|
|
153
|
+
!visiblePlacement.atY && (visiblePlacement.atY = atY);
|
|
154
|
+
!visiblePlacement.myY && (visiblePlacement.myY = myY);
|
|
155
|
+
}
|
|
156
|
+
if (visibleX && visibleY) {
|
|
133
157
|
break;
|
|
134
158
|
}
|
|
135
159
|
}
|
|
@@ -175,7 +199,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
175
199
|
else {
|
|
176
200
|
throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
|
|
177
201
|
}
|
|
178
|
-
var
|
|
202
|
+
var _h = tslib.__read(customOffset, 2), _j = _h[0], offSetX = _j === void 0 ? 0 : _j, _k = _h[1], offSetY = _k === void 0 ? 0 : _k;
|
|
179
203
|
return {
|
|
180
204
|
positionLeft: (positionLeft + offSetX) / scaleX,
|
|
181
205
|
positionTop: (positionTop + offSetY) / scaleY,
|
|
@@ -193,8 +217,23 @@ function getStyleNumber(element, styleName) {
|
|
|
193
217
|
}
|
|
194
218
|
return (parseInt(getComputedStyle(element).getPropertyValue(styleName), 10) || 0);
|
|
195
219
|
}
|
|
220
|
+
/** 根据关键字高亮显示文本内容 */
|
|
221
|
+
function renderTextByKeyword(rendererText, curKeyword) {
|
|
222
|
+
if (curKeyword && ~rendererText.indexOf(curKeyword)) {
|
|
223
|
+
var keywordStartIndex = rendererText.indexOf(curKeyword);
|
|
224
|
+
var keywordEndIndex = keywordStartIndex + curKeyword.length;
|
|
225
|
+
return (React__default["default"].createElement("span", null,
|
|
226
|
+
rendererText.substring(0, keywordStartIndex),
|
|
227
|
+
React__default["default"].createElement("span", { className: "is-keyword" }, curKeyword),
|
|
228
|
+
rendererText.substring(keywordEndIndex)));
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
return rendererText;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
196
234
|
|
|
197
235
|
exports.calculatePosition = calculatePosition;
|
|
198
236
|
exports.getContainer = getContainer;
|
|
199
237
|
exports.getStyleNumber = getStyleNumber;
|
|
200
238
|
exports.ownerDocument = ownerDocument;
|
|
239
|
+
exports.renderTextByKeyword = renderTextByKeyword;
|
package/lib/utils/errors.js
CHANGED
package/lib/utils/escapeHtml.js
CHANGED
package/lib/utils/filter.js
CHANGED
package/lib/utils/formula.d.ts
CHANGED
package/lib/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
|
|
|
@@ -12,8 +12,8 @@ var isString = require('lodash/isString');
|
|
|
12
12
|
var isBoolean = require('lodash/isBoolean');
|
|
13
13
|
var amisFormula = require('amis-formula');
|
|
14
14
|
var tpl = require('./tpl.js');
|
|
15
|
-
require('moment');
|
|
16
15
|
require('tslib');
|
|
16
|
+
require('moment');
|
|
17
17
|
require('lodash/isPlainObject');
|
|
18
18
|
var getVariable = require('./getVariable.js');
|
|
19
19
|
var resolveVariableAndFilter = require('./resolveVariableAndFilter.js');
|
|
@@ -216,6 +216,10 @@ function isNeedFormula(expression, prevData, curData) {
|
|
|
216
216
|
return false;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
+
function isNowFormula(expression) {
|
|
220
|
+
var block = expression.split(/\${|\||}/).filter(function (item) { return item; });
|
|
221
|
+
return block[1] === 'now';
|
|
222
|
+
}
|
|
219
223
|
// 将 \${xx} 替换成 ${xx}
|
|
220
224
|
function replaceExpression(expression) {
|
|
221
225
|
if (expression &&
|
|
@@ -230,5 +234,6 @@ exports.FormulaExec = FormulaExec;
|
|
|
230
234
|
exports.formulaExec = formulaExec;
|
|
231
235
|
exports.isExpression = isExpression;
|
|
232
236
|
exports.isNeedFormula = isNeedFormula;
|
|
237
|
+
exports.isNowFormula = isNowFormula;
|
|
233
238
|
exports.registerFormulaExec = registerFormulaExec;
|
|
234
239
|
exports.replaceExpression = replaceExpression;
|
package/lib/utils/getVariable.js
CHANGED
package/lib/utils/grammar.js
CHANGED
package/lib/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/lib/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
|
|
|
@@ -609,6 +609,21 @@ function findTree(tree, iterator) {
|
|
|
609
609
|
});
|
|
610
610
|
return result;
|
|
611
611
|
}
|
|
612
|
+
/**
|
|
613
|
+
* 在树中查找节点。
|
|
614
|
+
* @param tree
|
|
615
|
+
* @param iterator
|
|
616
|
+
*/
|
|
617
|
+
function findTreeAll(tree, iterator) {
|
|
618
|
+
var result = [];
|
|
619
|
+
everyTree(tree, function (item, key, level, paths) {
|
|
620
|
+
if (iterator(item, key, level, paths)) {
|
|
621
|
+
result.push(item);
|
|
622
|
+
}
|
|
623
|
+
return true;
|
|
624
|
+
});
|
|
625
|
+
return result;
|
|
626
|
+
}
|
|
612
627
|
/**
|
|
613
628
|
* 在树中查找节点, 返回下标数组。
|
|
614
629
|
* @param tree
|
|
@@ -1015,6 +1030,16 @@ function loadScript(src) {
|
|
|
1015
1030
|
document.head.appendChild(script);
|
|
1016
1031
|
});
|
|
1017
1032
|
}
|
|
1033
|
+
function loadStyle(href) {
|
|
1034
|
+
return new Promise(function (ok, fail) {
|
|
1035
|
+
var link = document.createElement('link');
|
|
1036
|
+
link.rel = 'stylesheet';
|
|
1037
|
+
link.onerror = function (reason) { return fail(reason); };
|
|
1038
|
+
link.onload = function () { return ok(); };
|
|
1039
|
+
link.href = href;
|
|
1040
|
+
document.head.appendChild(link);
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1018
1043
|
var SkipOperation = /** @class */ (function (_super) {
|
|
1019
1044
|
tslib.__extends(SkipOperation, _super);
|
|
1020
1045
|
function SkipOperation() {
|
|
@@ -1189,7 +1214,7 @@ function isClickOnInput(e) {
|
|
|
1189
1214
|
var formItem;
|
|
1190
1215
|
if (!e.currentTarget.contains(target) ||
|
|
1191
1216
|
~['INPUT', 'TEXTAREA'].indexOf(target.tagName) ||
|
|
1192
|
-
((formItem = target.closest("button, a, [data-role=\"form-item\"]")) &&
|
|
1217
|
+
((formItem = target.closest("button, a, [data-role=\"form-item\"], label[data-role=\"checkbox\"]")) &&
|
|
1193
1218
|
e.currentTarget.contains(formItem))) {
|
|
1194
1219
|
return true;
|
|
1195
1220
|
}
|
|
@@ -1297,6 +1322,7 @@ exports.filterTree = filterTree;
|
|
|
1297
1322
|
exports.findIndex = findIndex;
|
|
1298
1323
|
exports.findObjectsWithKey = findObjectsWithKey;
|
|
1299
1324
|
exports.findTree = findTree;
|
|
1325
|
+
exports.findTreeAll = findTreeAll;
|
|
1300
1326
|
exports.findTreeIndex = findTreeIndex;
|
|
1301
1327
|
exports.flattenTree = flattenTree;
|
|
1302
1328
|
exports.flattenTreeWithLeafNodes = flattenTreeWithLeafNodes;
|
|
@@ -1331,6 +1357,7 @@ exports.isUnfolded = isUnfolded;
|
|
|
1331
1357
|
exports.isVisible = isVisible;
|
|
1332
1358
|
exports.lcFirst = lcFirst;
|
|
1333
1359
|
exports.loadScript = loadScript;
|
|
1360
|
+
exports.loadStyle = loadStyle;
|
|
1334
1361
|
exports.makeColumnClassBuild = makeColumnClassBuild;
|
|
1335
1362
|
exports.makeHorizontalDeeper = makeHorizontalDeeper;
|
|
1336
1363
|
exports.mapObject = mapObject;
|
package/lib/utils/highlight.js
CHANGED
package/lib/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/lib/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
|
|
|
@@ -24,6 +24,11 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
24
24
|
* @param classNameProp amis 配置里设置的 className
|
|
25
25
|
*/
|
|
26
26
|
var generateIcon = function (cx, icon, className, classNameProp) {
|
|
27
|
+
if (lodash.isObject(icon) &&
|
|
28
|
+
icon.type === 'icon' &&
|
|
29
|
+
icon.icon) {
|
|
30
|
+
icon = icon.icon;
|
|
31
|
+
}
|
|
27
32
|
if (React__default["default"].isValidElement(icon)) {
|
|
28
33
|
return icon;
|
|
29
34
|
}
|
package/lib/utils/image.js
CHANGED
package/lib/utils/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from './replaceText';
|
|
|
39
39
|
export * from './resize-sensor';
|
|
40
40
|
export * from './resolveVariable';
|
|
41
41
|
export * from './resolveVariableAndFilter';
|
|
42
|
+
export * from './resolveVariableAndFilterForAsync';
|
|
42
43
|
export * from './RootClose';
|
|
43
44
|
export * from './scrollPosition';
|
|
44
45
|
export * from './SimpleMap';
|
|
@@ -52,5 +53,6 @@ export * from './validations';
|
|
|
52
53
|
export * from './toNumber';
|
|
53
54
|
export * from './decodeEntity';
|
|
54
55
|
export * from './style-helper';
|
|
56
|
+
export * from './resolveCondition';
|
|
55
57
|
import animation from './Animation';
|
|
56
58
|
export { animation };
|
package/lib/utils/keyToPath.js
CHANGED
package/lib/utils/makeSorter.js
CHANGED
package/lib/utils/object.js
CHANGED
package/lib/utils/offset.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
|
|
|
@@ -17,9 +17,13 @@ function matchOptionValue(a, b, valueField) {
|
|
|
17
17
|
var aValue = object.isObject(a) && a && a.hasOwnProperty(valueField)
|
|
18
18
|
? a[valueField]
|
|
19
19
|
: a;
|
|
20
|
+
var bValue = b[valueField || 'value'];
|
|
20
21
|
return object.isObject(aValue)
|
|
21
|
-
? lodash.isEqual(aValue,
|
|
22
|
-
:
|
|
22
|
+
? lodash.isEqual(aValue, bValue)
|
|
23
|
+
: // 当值均为 undefined 时,不应该判定相等
|
|
24
|
+
aValue !== undefined &&
|
|
25
|
+
bValue !== undefined &&
|
|
26
|
+
String(bValue) === String(aValue);
|
|
23
27
|
}
|
|
24
28
|
function optionValueCompare(a, valueField) {
|
|
25
29
|
if (valueField === void 0) { valueField = 'value'; }
|
package/lib/utils/position.js
CHANGED
package/lib/utils/prettyBytes.js
CHANGED