amis-core 3.6.4 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.js +3 -2
- package/esm/SchemaRenderer.js +4 -1
- package/esm/Scoped.d.ts +6 -0
- package/esm/Scoped.js +45 -7
- package/esm/StatusScoped.js +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +3 -5
- package/esm/actions/Action.js +31 -27
- 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 +65 -26
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +4 -3
- 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 +9 -4
- 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.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/CustomStyle.d.ts +1 -2
- package/esm/components/CustomStyle.js +19 -6
- package/esm/components/ErrorBoundary.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +12 -9
- package/esm/components/PopOver.js +8 -5
- package/esm/env.d.ts +4 -0
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +14 -1
- package/esm/index.d.ts +2 -2
- package/esm/index.js +14 -7
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +4 -3
- package/esm/renderers/Form.js +216 -150
- package/esm/renderers/Item.d.ts +1 -0
- package/esm/renderers/Item.js +17 -17
- package/esm/renderers/Options.d.ts +5 -0
- package/esm/renderers/Options.js +188 -57
- 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 +39 -30
- package/esm/store/app.d.ts +2 -2
- package/esm/store/app.js +4 -3
- package/esm/store/combo.d.ts +79 -55
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +3 -2
- package/esm/store/crud.js +18 -4
- package/esm/store/form.d.ts +33 -23
- package/esm/store/form.js +5 -5
- package/esm/store/formItem.d.ts +2 -1
- package/esm/store/formItem.js +3 -2
- package/esm/store/iRenderer.d.ts +1 -1
- package/esm/store/iRenderer.js +10 -3
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +1 -1
- package/esm/store/list.js +18 -13
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +2 -2
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +2 -1
- package/esm/store/pagination.js +3 -2
- package/esm/store/root.d.ts +2 -2
- package/esm/store/root.js +4 -3
- package/esm/store/service.d.ts +2 -2
- package/esm/store/service.js +11 -7
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +69 -47
- package/esm/store/table.js +54 -25
- package/esm/store/table2.d.ts +14 -3
- package/esm/store/table2.js +22 -9
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +7 -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 +1 -1
- package/esm/utils/arraySlice.js +1 -1
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/browser.d.ts +1 -0
- package/esm/utils/browser.js +11 -0
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/concatData.d.ts +8 -0
- package/esm/utils/concatData.js +39 -0
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.js +1 -1
- package/esm/utils/decodeEntity.js +1 -1
- package/esm/utils/dom.js +1 -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.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.d.ts +14 -2
- package/esm/utils/helper.js +49 -14
- package/esm/utils/highlight.js +3 -2
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +3 -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/labelToString.d.ts +1 -0
- package/esm/utils/labelToString.js +38 -0
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/math.js +1 -1
- package/esm/utils/memoryParse.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 +19 -3
- package/esm/utils/replaceText.js +9 -11
- 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.d.ts +1 -1
- package/esm/utils/string2regExp.js +4 -3
- package/esm/utils/stripNumber.js +1 -1
- package/esm/utils/style-helper.d.ts +24 -5
- package/esm/utils/style-helper.js +49 -21
- package/esm/utils/style.js +1 -1
- package/esm/utils/toNumber.js +1 -1
- package/esm/utils/tokenize.d.ts +1 -0
- package/esm/utils/tokenize.js +10 -3
- package/esm/utils/tpl-builtin.js +1 -1
- package/esm/utils/tpl-lodash.js +1 -1
- package/esm/utils/tpl.js +6 -8
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validateId.d.ts +16 -0
- package/esm/utils/validateId.js +154 -0
- package/esm/utils/validations.js +16 -8
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.js +3 -2
- package/lib/SchemaRenderer.js +4 -1
- package/lib/Scoped.d.ts +6 -0
- package/lib/Scoped.js +45 -6
- package/lib/StatusScoped.js +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +3 -5
- package/lib/actions/Action.js +31 -27
- 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 +65 -26
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +4 -3
- 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 +9 -4
- 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.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/CustomStyle.d.ts +1 -2
- package/lib/components/CustomStyle.js +19 -6
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +11 -8
- package/lib/components/PopOver.js +8 -5
- package/lib/env.d.ts +4 -0
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +14 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +19 -4
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +4 -3
- package/lib/renderers/Form.js +216 -150
- package/lib/renderers/Item.d.ts +1 -0
- package/lib/renderers/Item.js +17 -17
- package/lib/renderers/Options.d.ts +5 -0
- package/lib/renderers/Options.js +188 -57
- 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 +38 -29
- package/lib/store/app.d.ts +2 -2
- package/lib/store/app.js +4 -3
- package/lib/store/combo.d.ts +55 -31
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +3 -2
- package/lib/store/crud.js +18 -4
- package/lib/store/form.d.ts +23 -13
- package/lib/store/form.js +5 -5
- package/lib/store/formItem.d.ts +2 -1
- package/lib/store/formItem.js +3 -2
- package/lib/store/iRenderer.d.ts +1 -1
- package/lib/store/iRenderer.js +10 -3
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +1 -1
- package/lib/store/list.js +18 -14
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +2 -2
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +2 -1
- package/lib/store/pagination.js +3 -2
- package/lib/store/root.d.ts +2 -2
- package/lib/store/root.js +4 -3
- package/lib/store/service.d.ts +2 -2
- package/lib/store/service.js +11 -7
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +49 -27
- package/lib/store/table.js +54 -26
- package/lib/store/table2.d.ts +14 -3
- package/lib/store/table2.js +22 -9
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +7 -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 +1 -1
- package/lib/utils/arraySlice.js +1 -1
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/browser.d.ts +1 -0
- package/lib/utils/browser.js +15 -0
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/concatData.d.ts +8 -0
- package/lib/utils/concatData.js +43 -0
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.js +1 -1
- package/lib/utils/decodeEntity.js +1 -1
- package/lib/utils/dom.js +1 -1
- 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 +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.d.ts +14 -2
- package/lib/utils/helper.js +50 -12
- package/lib/utils/highlight.js +3 -2
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +3 -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/labelToString.d.ts +1 -0
- package/lib/utils/labelToString.js +46 -0
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/math.js +1 -1
- package/lib/utils/memoryParse.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 +19 -3
- package/lib/utils/replaceText.js +8 -14
- 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.d.ts +1 -1
- package/lib/utils/string2regExp.js +4 -3
- package/lib/utils/stripNumber.js +1 -1
- package/lib/utils/style-helper.d.ts +24 -5
- package/lib/utils/style-helper.js +49 -21
- package/lib/utils/style.js +1 -1
- package/lib/utils/toNumber.js +1 -1
- package/lib/utils/tokenize.d.ts +1 -0
- package/lib/utils/tokenize.js +10 -2
- package/lib/utils/tpl-builtin.js +1 -1
- package/lib/utils/tpl-lodash.js +1 -1
- package/lib/utils/tpl.js +5 -7
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validateId.d.ts +16 -0
- package/lib/utils/validateId.js +160 -0
- package/lib/utils/validations.js +16 -8
- package/package.json +4 -3
- package/LICENSE +0 -201
package/lib/utils/keyToPath.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function labelToString(label: any): string;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* amis-core v6.1.0
|
|
3
|
+
* Copyright 2018-2024 fex
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
|
+
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
var isPlainObject = require('lodash/isPlainObject');
|
|
12
|
+
|
|
13
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14
|
+
|
|
15
|
+
var isPlainObject__default = /*#__PURE__*/_interopDefaultLegacy(isPlainObject);
|
|
16
|
+
|
|
17
|
+
function labelToString(label) {
|
|
18
|
+
var e_1, _a;
|
|
19
|
+
var type = typeof label;
|
|
20
|
+
if (type === 'string') {
|
|
21
|
+
return label;
|
|
22
|
+
}
|
|
23
|
+
else if (type === 'number') {
|
|
24
|
+
return "".concat(label);
|
|
25
|
+
}
|
|
26
|
+
if (isPlainObject__default["default"](label)) {
|
|
27
|
+
try {
|
|
28
|
+
for (var _b = tslib.__values(['__title', 'label', Object.keys(label)[0]]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
29
|
+
var key = _c.value;
|
|
30
|
+
if (typeof label[key] === 'string') {
|
|
31
|
+
return label[key];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
36
|
+
finally {
|
|
37
|
+
try {
|
|
38
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
39
|
+
}
|
|
40
|
+
finally { if (e_1) throw e_1.error; }
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return 'invalid label';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
exports.labelToString = labelToString;
|
package/lib/utils/makeSorter.js
CHANGED
package/lib/utils/math.js
CHANGED
package/lib/utils/memoryParse.js
CHANGED
package/lib/utils/object.js
CHANGED
package/lib/utils/offset.js
CHANGED
package/lib/utils/position.js
CHANGED
package/lib/utils/prettyBytes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.1.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
|
19
19
|
var rendererEventListeners = [];
|
|
20
20
|
// 创建渲染器事件对象
|
|
21
21
|
function createRendererEvent(type, context) {
|
|
22
|
-
var rendererEvent = {
|
|
22
|
+
var rendererEvent = Object.defineProperties({
|
|
23
23
|
context: object.extendObject({ pristineData: context.data }, context),
|
|
24
24
|
type: type,
|
|
25
25
|
prevented: false,
|
|
@@ -39,7 +39,23 @@ function createRendererEvent(type, context) {
|
|
|
39
39
|
setData: function (data) {
|
|
40
40
|
rendererEvent.context.data = data;
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}, {
|
|
43
|
+
context: {
|
|
44
|
+
enumerable: false
|
|
45
|
+
},
|
|
46
|
+
pristineData: {
|
|
47
|
+
enumerable: false
|
|
48
|
+
},
|
|
49
|
+
preventDefault: {
|
|
50
|
+
enumerable: false
|
|
51
|
+
},
|
|
52
|
+
stopPropagation: {
|
|
53
|
+
enumerable: false
|
|
54
|
+
},
|
|
55
|
+
setData: {
|
|
56
|
+
enumerable: false
|
|
57
|
+
}
|
|
58
|
+
});
|
|
43
59
|
return rendererEvent;
|
|
44
60
|
}
|
|
45
61
|
// 绑定事件
|
package/lib/utils/replaceText.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.1.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -8,19 +8,16 @@
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
10
|
var tslib = require('tslib');
|
|
11
|
-
var cloneDeep = require('lodash/cloneDeep');
|
|
12
11
|
var helper = require('./helper.js');
|
|
13
12
|
var object = require('./object.js');
|
|
14
13
|
|
|
15
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
-
|
|
17
|
-
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
18
|
-
|
|
19
14
|
function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
|
|
20
15
|
// 进行文本替换
|
|
21
16
|
if (replaceText && object.isObject(replaceText)) {
|
|
22
|
-
var replicaSchema = cloneDeep__default["default"](schema);
|
|
23
17
|
var replaceKeys_1 = Object.keys(replaceText);
|
|
18
|
+
if (!replaceKeys_1.length) {
|
|
19
|
+
return schema;
|
|
20
|
+
}
|
|
24
21
|
replaceKeys_1.sort(function (a, b) { return b.length - a.length; }); // 避免用户将短的放前面
|
|
25
22
|
var IgnoreKeys_1 = new Set(Array.isArray(replaceTextIgnoreKeys) ? replaceTextIgnoreKeys : []);
|
|
26
23
|
var ignore_1 = typeof replaceTextIgnoreKeys === 'function'
|
|
@@ -28,17 +25,14 @@ function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
|
|
|
28
25
|
: function (key) {
|
|
29
26
|
return IgnoreKeys_1.has(key);
|
|
30
27
|
};
|
|
31
|
-
helper.
|
|
28
|
+
return helper.JSONValueMap(schema, function (value, key, object) {
|
|
32
29
|
var e_1, _a;
|
|
33
|
-
|
|
34
|
-
if (typeof value === 'string' &&
|
|
35
|
-
(descriptor === null || descriptor === void 0 ? void 0 : descriptor.writable) &&
|
|
36
|
-
!ignore_1(key, value, object)) {
|
|
30
|
+
if (typeof value === 'string' && !ignore_1(key, value, object)) {
|
|
37
31
|
try {
|
|
38
32
|
for (var replaceKeys_2 = tslib.__values(replaceKeys_1), replaceKeys_2_1 = replaceKeys_2.next(); !replaceKeys_2_1.done; replaceKeys_2_1 = replaceKeys_2.next()) {
|
|
39
33
|
var replaceKey = replaceKeys_2_1.value;
|
|
40
34
|
if (~value.indexOf(replaceKey)) {
|
|
41
|
-
|
|
35
|
+
return value.replaceAll(replaceKey, replaceText[replaceKey]);
|
|
42
36
|
}
|
|
43
37
|
}
|
|
44
38
|
}
|
|
@@ -50,8 +44,8 @@ function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
|
|
|
50
44
|
finally { if (e_1) throw e_1.error; }
|
|
51
45
|
}
|
|
52
46
|
}
|
|
47
|
+
return value;
|
|
53
48
|
});
|
|
54
|
-
return replicaSchema;
|
|
55
49
|
}
|
|
56
50
|
return schema;
|
|
57
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function string2regExp(value: string, caseSensitive?: boolean): RegExp;
|
|
1
|
+
export declare function string2regExp(value: string, caseSensitive?: boolean, globalSearch?: boolean): RegExp;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.1.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
function string2regExp(value, caseSensitive) {
|
|
10
|
+
function string2regExp(value, caseSensitive, globalSearch) {
|
|
11
11
|
if (caseSensitive === void 0) { caseSensitive = false; }
|
|
12
|
+
if (globalSearch === void 0) { globalSearch = false; }
|
|
12
13
|
if (typeof value !== 'string') {
|
|
13
14
|
throw new TypeError('Expected a string');
|
|
14
15
|
}
|
|
15
|
-
return new RegExp(value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'), !caseSensitive ? 'i' : '');
|
|
16
|
+
return new RegExp(value.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'), "".concat(!caseSensitive ? 'i' : '').concat(globalSearch ? 'g' : ''));
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
exports.string2regExp = string2regExp;
|
package/lib/utils/stripNumber.js
CHANGED
|
@@ -10,7 +10,7 @@ interface extra {
|
|
|
10
10
|
export declare function findOrCreateStyle(id: string, doc?: Document): HTMLElement;
|
|
11
11
|
export declare function insertStyle(style: string, id: string, doc?: Document): void;
|
|
12
12
|
export declare function addStyle(style: string, id: string): void;
|
|
13
|
-
export declare function formatStyle(themeCss: any, classNames?: CustomStyleClassName[], id?: string, defaultData?: any): {
|
|
13
|
+
export declare function formatStyle(themeCss: any, classNames?: CustomStyleClassName[], id?: string, defaultData?: any, data?: any): {
|
|
14
14
|
value: string;
|
|
15
15
|
origin: {
|
|
16
16
|
className: string;
|
|
@@ -26,7 +26,15 @@ export interface CustomStyleClassName {
|
|
|
26
26
|
disabled?: extra;
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
|
-
export declare function insertCustomStyle(
|
|
29
|
+
export declare function insertCustomStyle(prams: {
|
|
30
|
+
themeCss: any;
|
|
31
|
+
classNames: CustomStyleClassName[];
|
|
32
|
+
id: string;
|
|
33
|
+
defaultData?: any;
|
|
34
|
+
customStyleClassPrefix?: string;
|
|
35
|
+
doc?: Document;
|
|
36
|
+
[propName: string]: any;
|
|
37
|
+
}): void;
|
|
30
38
|
/**
|
|
31
39
|
* 根据路径获取默认值
|
|
32
40
|
*/
|
|
@@ -34,7 +42,12 @@ export declare function getValueByPath(path: string, data: any): any;
|
|
|
34
42
|
/**
|
|
35
43
|
* 设置源码编辑自定义样式
|
|
36
44
|
*/
|
|
37
|
-
export declare function insertEditCustomStyle(
|
|
45
|
+
export declare function insertEditCustomStyle(params: {
|
|
46
|
+
customStyle: any;
|
|
47
|
+
id?: string;
|
|
48
|
+
doc?: Document;
|
|
49
|
+
[propName: string]: any;
|
|
50
|
+
}): void;
|
|
38
51
|
export interface InsertCustomStyle {
|
|
39
52
|
themeCss: any;
|
|
40
53
|
classNames: CustomStyleClassName[];
|
|
@@ -46,7 +59,13 @@ export interface InsertCustomStyle {
|
|
|
46
59
|
/**
|
|
47
60
|
* 移除自定义样式
|
|
48
61
|
*/
|
|
49
|
-
export declare function removeCustomStyle(type: string, id: string, doc?: Document): void;
|
|
62
|
+
export declare function removeCustomStyle(type: string, id: string, doc?: Document, data?: any): void;
|
|
50
63
|
export declare function formatInputThemeCss(themeCss: any): any;
|
|
51
|
-
export declare function setThemeClassName(
|
|
64
|
+
export declare function setThemeClassName(params: {
|
|
65
|
+
name: string;
|
|
66
|
+
id?: string;
|
|
67
|
+
themeCss: any;
|
|
68
|
+
extra?: string;
|
|
69
|
+
[propName: string]: any;
|
|
70
|
+
}): string;
|
|
52
71
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.1.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -14,6 +14,7 @@ var isObject = require('lodash/isObject');
|
|
|
14
14
|
var map = require('lodash/map');
|
|
15
15
|
var isEmpty = require('lodash/isEmpty');
|
|
16
16
|
var kebabCase = require('lodash/kebabCase');
|
|
17
|
+
var resolveVariableAndFilter = require('./resolveVariableAndFilter.js');
|
|
17
18
|
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
20
|
|
|
@@ -112,7 +113,7 @@ function handleInheritData(statusMap, data) {
|
|
|
112
113
|
});
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
|
-
function formatStyle(themeCss, classNames, id, defaultData) {
|
|
116
|
+
function formatStyle(themeCss, classNames, id, defaultData, data) {
|
|
116
117
|
var e_1, _a;
|
|
117
118
|
// 没有具体的样式,或者没有对应的classname
|
|
118
119
|
if (!themeCss || !classNames) {
|
|
@@ -132,6 +133,9 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
132
133
|
}
|
|
133
134
|
var className = item.key + '-' + (id === null || id === void 0 ? void 0 : id.replace('u:', ''));
|
|
134
135
|
var weightsList = item.weights || {};
|
|
136
|
+
if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
|
|
137
|
+
className += "-".concat(data.index);
|
|
138
|
+
}
|
|
135
139
|
var statusMap = {
|
|
136
140
|
default: {},
|
|
137
141
|
hover: {},
|
|
@@ -163,7 +167,8 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
163
167
|
var styles = [];
|
|
164
168
|
var fn = function (key, value) {
|
|
165
169
|
key = valueMap[key] || key;
|
|
166
|
-
|
|
170
|
+
value = resolveVariableAndFilter.resolveVariableAndFilter(value, data, '| raw') || value;
|
|
171
|
+
styles.push("".concat(key.startsWith('--') ? key : kebabCase__default["default"](key), ": ").concat(value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''), ";"));
|
|
167
172
|
};
|
|
168
173
|
Object.keys(statusMap[status]).forEach(function (key) {
|
|
169
174
|
if (key !== '$$id') {
|
|
@@ -175,16 +180,14 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
175
180
|
style_1['top-left-border-radius'] || 0,
|
|
176
181
|
style_1['top-right-border-radius'] || 0,
|
|
177
182
|
style_1['bottom-right-border-radius'] || 0,
|
|
178
|
-
style_1['bottom-left-border-radius'] || 0
|
|
179
|
-
(weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''
|
|
183
|
+
style_1['bottom-left-border-radius'] || 0
|
|
180
184
|
].join(' '));
|
|
181
185
|
}
|
|
182
186
|
else {
|
|
183
187
|
Object.keys(style_1).forEach(function (k) {
|
|
184
188
|
if (k !== '$$id') {
|
|
185
189
|
var value = style_1[k];
|
|
186
|
-
value &&
|
|
187
|
-
fn(k, value + ((weights === null || weights === void 0 ? void 0 : weights.important) ? ' !important' : ''));
|
|
190
|
+
value && fn(k, value);
|
|
188
191
|
}
|
|
189
192
|
});
|
|
190
193
|
}
|
|
@@ -237,13 +240,18 @@ function formatStyle(themeCss, classNames, id, defaultData) {
|
|
|
237
240
|
origin: res
|
|
238
241
|
};
|
|
239
242
|
}
|
|
240
|
-
function insertCustomStyle(
|
|
243
|
+
function insertCustomStyle(prams) {
|
|
244
|
+
var themeCss = prams.themeCss, classNames = prams.classNames, id = prams.id, defaultData = prams.defaultData, customStyleClassPrefix = prams.customStyleClassPrefix, doc = prams.doc, data = prams.data;
|
|
241
245
|
if (!themeCss) {
|
|
242
246
|
return;
|
|
243
247
|
}
|
|
244
|
-
var value = formatStyle(themeCss, classNames, id, defaultData).value;
|
|
248
|
+
var value = formatStyle(themeCss, classNames, id, defaultData, data).value;
|
|
245
249
|
value = customStyleClassPrefix ? "".concat(customStyleClassPrefix, " ").concat(value) : value;
|
|
246
|
-
|
|
250
|
+
var classId = id.replace('u:', '');
|
|
251
|
+
if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
|
|
252
|
+
classId += "-".concat(data.index);
|
|
253
|
+
}
|
|
254
|
+
insertStyle(value, classId, doc);
|
|
247
255
|
}
|
|
248
256
|
/**
|
|
249
257
|
* 根据路径获取默认值
|
|
@@ -286,38 +294,53 @@ function traverseStyle(style, path, result) {
|
|
|
286
294
|
/**
|
|
287
295
|
* 设置源码编辑自定义样式
|
|
288
296
|
*/
|
|
289
|
-
function insertEditCustomStyle(
|
|
297
|
+
function insertEditCustomStyle(params) {
|
|
298
|
+
var customStyle = params.customStyle, id = params.id, doc = params.doc, data = params.data;
|
|
290
299
|
var styles = {};
|
|
291
300
|
traverseStyle(customStyle, '', styles);
|
|
292
301
|
var content = '';
|
|
302
|
+
var index = '';
|
|
303
|
+
if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
|
|
304
|
+
index = "-".concat(data.index);
|
|
305
|
+
}
|
|
293
306
|
if (!isEmpty__default["default"](styles)) {
|
|
294
|
-
var className_1 = "wrapperCustomStyle-".concat(id === null || id === void 0 ? void 0 : id.replace('u:', ''));
|
|
307
|
+
var className_1 = "wrapperCustomStyle-".concat(id === null || id === void 0 ? void 0 : id.replace('u:', '')).concat(index);
|
|
295
308
|
Object.keys(styles).forEach(function (key) {
|
|
296
309
|
if (!isObject__default["default"](styles[key])) {
|
|
297
|
-
content += "\n.".concat(className_1, " {\n ").concat(key, ": ").concat(styles[key], "\n}");
|
|
310
|
+
content += "\n.".concat(className_1, " {\n ").concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(styles[key].replace(/['|"]/g, ''), data, '| raw') || styles[key], "\n}");
|
|
298
311
|
}
|
|
299
312
|
else if (key === 'root') {
|
|
300
|
-
var res = map__default["default"](styles[key], function (value, key) {
|
|
313
|
+
var res = map__default["default"](styles[key], function (value, key) {
|
|
314
|
+
return "".concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(value.replace(/['|"]/g, ''), data, '| raw') || value, ";");
|
|
315
|
+
});
|
|
301
316
|
content += "\n.".concat(className_1, " {\n ").concat(res.join('\n '), "\n}");
|
|
302
317
|
}
|
|
303
318
|
else if (/^root:/.test(key)) {
|
|
304
|
-
var res = map__default["default"](styles[key], function (value, key) {
|
|
319
|
+
var res = map__default["default"](styles[key], function (value, key) {
|
|
320
|
+
return "".concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(value.replace(/['|"]/g, ''), data, '| raw') || value, ";");
|
|
321
|
+
});
|
|
305
322
|
var nowKey = key.replace('root', '');
|
|
306
323
|
content += "\n.".concat(className_1, " ").concat(nowKey, " {\n ").concat(res.join('\n '), "\n}");
|
|
307
324
|
}
|
|
308
325
|
else {
|
|
309
|
-
var res = map__default["default"](styles[key], function (value, key) {
|
|
326
|
+
var res = map__default["default"](styles[key], function (value, key) {
|
|
327
|
+
return "".concat(key, ": ").concat(resolveVariableAndFilter.resolveVariableAndFilter(value.replace(/['|"]/g, ''), data, '| raw') || value, ";");
|
|
328
|
+
});
|
|
310
329
|
content += "\n.".concat(className_1, " ").concat(key, " {\n ").concat(res.join('\n '), "\n}");
|
|
311
330
|
}
|
|
312
331
|
});
|
|
313
332
|
}
|
|
314
|
-
insertStyle(content, 'wrapperCustomStyle-' + ((id === null || id === void 0 ? void 0 : id.replace('u:', '')) || helper.uuid()), doc);
|
|
333
|
+
insertStyle(content, 'wrapperCustomStyle-' + ((id === null || id === void 0 ? void 0 : id.replace('u:', '')) || helper.uuid()) + index, doc);
|
|
315
334
|
}
|
|
316
335
|
/**
|
|
317
336
|
* 移除自定义样式
|
|
318
337
|
*/
|
|
319
|
-
function removeCustomStyle(type, id, doc) {
|
|
320
|
-
var
|
|
338
|
+
function removeCustomStyle(type, id, doc, data) {
|
|
339
|
+
var styleId = 'amis-' + (type ? type + '-' : '') + id.replace('u:', '');
|
|
340
|
+
if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
|
|
341
|
+
styleId += "-".concat(data.index);
|
|
342
|
+
}
|
|
343
|
+
var style = (doc || document).getElementById(styleId);
|
|
321
344
|
if (style) {
|
|
322
345
|
style.remove();
|
|
323
346
|
}
|
|
@@ -336,14 +359,19 @@ function formatInputThemeCss(themeCss) {
|
|
|
336
359
|
});
|
|
337
360
|
return inputFontThemeCss;
|
|
338
361
|
}
|
|
339
|
-
function setThemeClassName(
|
|
362
|
+
function setThemeClassName(params) {
|
|
363
|
+
var name = params.name, id = params.id, themeCss = params.themeCss, extra = params.extra, data = params.data;
|
|
340
364
|
if (!id || !themeCss) {
|
|
341
365
|
return '';
|
|
342
366
|
}
|
|
343
367
|
if (name !== 'wrapperCustomStyle' && !themeCss[name]) {
|
|
344
368
|
return '';
|
|
345
369
|
}
|
|
346
|
-
|
|
370
|
+
var index = '';
|
|
371
|
+
if (typeof (data === null || data === void 0 ? void 0 : data.index) === 'number') {
|
|
372
|
+
index = "-".concat(data.index);
|
|
373
|
+
}
|
|
374
|
+
return "".concat(name, "-").concat(id.replace('u:', '')) + (extra ? "-".concat(extra) : '') + index;
|
|
347
375
|
}
|
|
348
376
|
|
|
349
377
|
exports.addStyle = addStyle;
|
package/lib/utils/style.js
CHANGED
package/lib/utils/toNumber.js
CHANGED
package/lib/utils/tokenize.d.ts
CHANGED
package/lib/utils/tokenize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core
|
|
2
|
+
* amis-core v6.1.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -9,13 +9,20 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
9
9
|
|
|
10
10
|
var amisFormula = require('amis-formula');
|
|
11
11
|
|
|
12
|
+
var AST_CACHE = {};
|
|
13
|
+
function memoParse(str, options) {
|
|
14
|
+
var key = "".concat(str).concat((options === null || options === void 0 ? void 0 : options.evalMode) ? '-eval' : '').concat((options === null || options === void 0 ? void 0 : options.allowFilter) ? '-filter' : '').concat((options === null || options === void 0 ? void 0 : options.variableMode) ? '-variable' : '');
|
|
15
|
+
var ast = AST_CACHE[key] || amisFormula.parse(str, options);
|
|
16
|
+
AST_CACHE[key] = ast;
|
|
17
|
+
return ast;
|
|
18
|
+
}
|
|
12
19
|
var tokenize = function (str, data, defaultFilter) {
|
|
13
20
|
if (defaultFilter === void 0) { defaultFilter = '| html'; }
|
|
14
21
|
if (!str || typeof str !== 'string') {
|
|
15
22
|
return str;
|
|
16
23
|
}
|
|
17
24
|
try {
|
|
18
|
-
var ast =
|
|
25
|
+
var ast = memoParse(str, {
|
|
19
26
|
evalMode: false,
|
|
20
27
|
allowFilter: true
|
|
21
28
|
});
|
|
@@ -30,4 +37,5 @@ var tokenize = function (str, data, defaultFilter) {
|
|
|
30
37
|
}
|
|
31
38
|
};
|
|
32
39
|
|
|
40
|
+
exports.memoParse = memoParse;
|
|
33
41
|
exports.tokenize = tokenize;
|
package/lib/utils/tpl-builtin.js
CHANGED
package/lib/utils/tpl-lodash.js
CHANGED