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/lib/utils/highlight.js
CHANGED
package/lib/utils/icon.js
CHANGED
package/lib/utils/image.js
CHANGED
package/lib/utils/keyToPath.js
CHANGED
package/lib/utils/makeSorter.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 v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -10,6 +10,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
10
10
|
var UNITS = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
|
|
11
11
|
var prettyBytes = function (num, step) {
|
|
12
12
|
if (step === void 0) { step = 1000; }
|
|
13
|
+
if (num && typeof num === 'string') {
|
|
14
|
+
// 说明已经转过了
|
|
15
|
+
if (num.endsWith('B')) {
|
|
16
|
+
return num;
|
|
17
|
+
}
|
|
18
|
+
num = parseFloat(num);
|
|
19
|
+
}
|
|
13
20
|
if (!Number.isFinite(num)) {
|
|
14
21
|
throw new TypeError("Expected a finite number, got ".concat(typeof num, ": ").concat(num));
|
|
15
22
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -41,7 +41,8 @@ function createRendererEvent(type, context) {
|
|
|
41
41
|
}
|
|
42
42
|
// 绑定事件
|
|
43
43
|
var bindEvent = function (renderer) {
|
|
44
|
-
var
|
|
44
|
+
var e_1, _a;
|
|
45
|
+
var _b, _c;
|
|
45
46
|
if (!renderer) {
|
|
46
47
|
return undefined;
|
|
47
48
|
}
|
|
@@ -52,7 +53,7 @@ var bindEvent = function (renderer) {
|
|
|
52
53
|
return item.renderer === renderer && item.type === key;
|
|
53
54
|
});
|
|
54
55
|
if (listener === null || listener === void 0 ? void 0 : listener.executing) {
|
|
55
|
-
(
|
|
56
|
+
(_c = (_b = listener === null || listener === void 0 ? void 0 : listener.debounceInstance) === null || _b === void 0 ? void 0 : _b.cancel) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
56
57
|
rendererEventListeners = rendererEventListeners.filter(function (item) {
|
|
57
58
|
return !(item.renderer === listener.renderer && item.type === listener.type);
|
|
58
59
|
});
|
|
@@ -74,10 +75,19 @@ var bindEvent = function (renderer) {
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
var
|
|
80
|
-
|
|
78
|
+
try {
|
|
79
|
+
// 暂存
|
|
80
|
+
for (var _d = tslib.__values(Object.keys(listeners)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
81
|
+
var key = _e.value;
|
|
82
|
+
_loop_1(key);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
86
|
+
finally {
|
|
87
|
+
try {
|
|
88
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
89
|
+
}
|
|
90
|
+
finally { if (e_1) throw e_1.error; }
|
|
81
91
|
}
|
|
82
92
|
return function () {
|
|
83
93
|
rendererEventListeners = rendererEventListeners.filter(function (item) { return item.renderer !== renderer; });
|
|
@@ -89,10 +99,11 @@ var bindEvent = function (renderer) {
|
|
|
89
99
|
function dispatchEvent(e, renderer, scoped, data, broadcast) {
|
|
90
100
|
var _a, _b, _c, _d, _e, _f;
|
|
91
101
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
92
|
-
var unbindEvent, eventName, eventConfig, rendererEvent, listeners, executedCount, checkExecuted, _loop_2,
|
|
102
|
+
var unbindEvent, eventName, eventConfig, rendererEvent, listeners, executedCount, checkExecuted, _loop_2, listeners_1, listeners_1_1, listener, state_1, e_2_1;
|
|
103
|
+
var e_2, _g;
|
|
93
104
|
var _this = this;
|
|
94
|
-
return tslib.__generator(this, function (
|
|
95
|
-
switch (
|
|
105
|
+
return tslib.__generator(this, function (_h) {
|
|
106
|
+
switch (_h.label) {
|
|
96
107
|
case 0:
|
|
97
108
|
unbindEvent = null;
|
|
98
109
|
eventName = typeof e === 'string' ? e : e.type;
|
|
@@ -132,11 +143,11 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
|
|
|
132
143
|
}
|
|
133
144
|
};
|
|
134
145
|
_loop_2 = function (listener) {
|
|
135
|
-
var
|
|
136
|
-
return tslib.__generator(this, function (
|
|
137
|
-
switch (
|
|
146
|
+
var _j, _k, wait, _l, trailing, _m, leading, _o, maxWait, debounced_1;
|
|
147
|
+
return tslib.__generator(this, function (_p) {
|
|
148
|
+
switch (_p.label) {
|
|
138
149
|
case 0:
|
|
139
|
-
|
|
150
|
+
_j = (listener === null || listener === void 0 ? void 0 : listener.debounce) || {}, _k = _j.wait, wait = _k === void 0 ? 100 : _k, _l = _j.trailing, trailing = _l === void 0 ? true : _l, _m = _j.leading, leading = _m === void 0 ? false : _m, _o = _j.maxWait, maxWait = _o === void 0 ? 10000 : _o;
|
|
140
151
|
if (!(listener === null || listener === void 0 ? void 0 : listener.debounce)) return [3 /*break*/, 1];
|
|
141
152
|
debounced_1 = debounce__default["default"](function () { return tslib.__awaiter(_this, void 0, void 0, function () {
|
|
142
153
|
return tslib.__generator(this, function (_a) {
|
|
@@ -165,9 +176,9 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
|
|
|
165
176
|
return [3 /*break*/, 3];
|
|
166
177
|
case 1: return [4 /*yield*/, Action.runActions(listener.actions, listener.renderer, rendererEvent)];
|
|
167
178
|
case 2:
|
|
168
|
-
|
|
179
|
+
_p.sent();
|
|
169
180
|
checkExecuted();
|
|
170
|
-
|
|
181
|
+
_p.label = 3;
|
|
171
182
|
case 3:
|
|
172
183
|
// 停止后续监听器执行
|
|
173
184
|
if (rendererEvent.stoped) {
|
|
@@ -177,21 +188,35 @@ function dispatchEvent(e, renderer, scoped, data, broadcast) {
|
|
|
177
188
|
}
|
|
178
189
|
});
|
|
179
190
|
};
|
|
180
|
-
|
|
181
|
-
_g.label = 1;
|
|
191
|
+
_h.label = 1;
|
|
182
192
|
case 1:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
193
|
+
_h.trys.push([1, 6, 7, 8]);
|
|
194
|
+
listeners_1 = tslib.__values(listeners), listeners_1_1 = listeners_1.next();
|
|
195
|
+
_h.label = 2;
|
|
186
196
|
case 2:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
_g.label = 3;
|
|
197
|
+
if (!!listeners_1_1.done) return [3 /*break*/, 5];
|
|
198
|
+
listener = listeners_1_1.value;
|
|
199
|
+
return [5 /*yield**/, _loop_2(listener)];
|
|
191
200
|
case 3:
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
201
|
+
state_1 = _h.sent();
|
|
202
|
+
if (state_1 === "break")
|
|
203
|
+
return [3 /*break*/, 5];
|
|
204
|
+
_h.label = 4;
|
|
205
|
+
case 4:
|
|
206
|
+
listeners_1_1 = listeners_1.next();
|
|
207
|
+
return [3 /*break*/, 2];
|
|
208
|
+
case 5: return [3 /*break*/, 8];
|
|
209
|
+
case 6:
|
|
210
|
+
e_2_1 = _h.sent();
|
|
211
|
+
e_2 = { error: e_2_1 };
|
|
212
|
+
return [3 /*break*/, 8];
|
|
213
|
+
case 7:
|
|
214
|
+
try {
|
|
215
|
+
if (listeners_1_1 && !listeners_1_1.done && (_g = listeners_1.return)) _g.call(listeners_1);
|
|
216
|
+
}
|
|
217
|
+
finally { if (e_2) throw e_2.error; }
|
|
218
|
+
return [7 /*endfinally*/];
|
|
219
|
+
case 8: return [2 /*return*/, Promise.resolve(rendererEvent)];
|
|
195
220
|
}
|
|
196
221
|
});
|
|
197
222
|
});
|
package/lib/utils/replaceText.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
+
var tslib = require('tslib');
|
|
10
11
|
var cloneDeep = require('lodash/cloneDeep');
|
|
11
12
|
var helper = require('./helper.js');
|
|
12
13
|
var object = require('./object.js');
|
|
@@ -15,9 +16,6 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
15
16
|
|
|
16
17
|
var cloneDeep__default = /*#__PURE__*/_interopDefaultLegacy(cloneDeep);
|
|
17
18
|
|
|
18
|
-
/**
|
|
19
|
-
* 对文本进行替换
|
|
20
|
-
*/
|
|
21
19
|
function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
|
|
22
20
|
// 进行文本替换
|
|
23
21
|
if (replaceText && object.isObject(replaceText)) {
|
|
@@ -26,15 +24,25 @@ function replaceText(schema, replaceText, replaceTextIgnoreKeys) {
|
|
|
26
24
|
replaceKeys_1.sort(function (a, b) { return b.length - a.length; }); // 避免用户将短的放前面
|
|
27
25
|
var IgnoreKeys_1 = new Set(replaceTextIgnoreKeys || []);
|
|
28
26
|
helper.JSONTraverse(replicaSchema, function (value, key, object) {
|
|
27
|
+
var e_1, _a;
|
|
29
28
|
var descriptor = Object.getOwnPropertyDescriptor(object, key);
|
|
30
29
|
if (typeof value === 'string' &&
|
|
31
30
|
!IgnoreKeys_1.has(key) &&
|
|
32
31
|
(descriptor === null || descriptor === void 0 ? void 0 : descriptor.writable)) {
|
|
33
|
-
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
try {
|
|
33
|
+
for (var replaceKeys_2 = tslib.__values(replaceKeys_1), replaceKeys_2_1 = replaceKeys_2.next(); !replaceKeys_2_1.done; replaceKeys_2_1 = replaceKeys_2.next()) {
|
|
34
|
+
var replaceKey = replaceKeys_2_1.value;
|
|
35
|
+
if (~value.indexOf(replaceKey)) {
|
|
36
|
+
value = object[key] = value.replaceAll(replaceKey, replaceText[replaceKey]);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
41
|
+
finally {
|
|
42
|
+
try {
|
|
43
|
+
if (replaceKeys_2_1 && !replaceKeys_2_1.done && (_a = replaceKeys_2.return)) _a.call(replaceKeys_2);
|
|
37
44
|
}
|
|
45
|
+
finally { if (e_1) throw e_1.error; }
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
+
var tslib = require('tslib');
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* @file resize-sensor.js.
|
|
12
14
|
* @author fex
|
|
@@ -24,7 +26,7 @@ var EventQueue = /** @class */ (function () {
|
|
|
24
26
|
args[_i] = arguments[_i];
|
|
25
27
|
}
|
|
26
28
|
this.q.forEach(function (fn) {
|
|
27
|
-
fn.apply(void 0, args);
|
|
29
|
+
fn.apply(void 0, tslib.__spreadArray([], tslib.__read(args), false));
|
|
28
30
|
});
|
|
29
31
|
};
|
|
30
32
|
return EventQueue;
|
package/lib/utils/stripNumber.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.8.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
+
var tslib = require('tslib');
|
|
10
11
|
var helper = require('./helper.js');
|
|
11
12
|
|
|
12
13
|
var valueMap = {
|
|
@@ -54,7 +55,8 @@ function addStyle(style, id) {
|
|
|
54
55
|
varStyleTag.innerHTML += style;
|
|
55
56
|
}
|
|
56
57
|
function formatStyle(css, classNames, id) {
|
|
57
|
-
var _a;
|
|
58
|
+
var e_1, _a;
|
|
59
|
+
var _b;
|
|
58
60
|
if (!css) {
|
|
59
61
|
return { value: '', origin: [] };
|
|
60
62
|
}
|
|
@@ -66,8 +68,9 @@ function formatStyle(css, classNames, id) {
|
|
|
66
68
|
disabled: '.is-disabled'
|
|
67
69
|
};
|
|
68
70
|
var _loop_1 = function (item) {
|
|
71
|
+
var e_2, _c;
|
|
69
72
|
var body = css[item.key];
|
|
70
|
-
var list = (
|
|
73
|
+
var list = (_b = item.value) === null || _b === void 0 ? void 0 : _b.split(' ');
|
|
71
74
|
var classNameList = [];
|
|
72
75
|
if (!body) {
|
|
73
76
|
return "continue";
|
|
@@ -79,94 +82,112 @@ function formatStyle(css, classNames, id) {
|
|
|
79
82
|
}
|
|
80
83
|
});
|
|
81
84
|
var weightsList = item.weights || {};
|
|
82
|
-
|
|
83
|
-
var
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
for (var key in body) {
|
|
92
|
-
if (key === '$$id') {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (!!~key.indexOf(':default')) {
|
|
96
|
-
statusMap.default[key.replace(':default', '')] = body[key];
|
|
97
|
-
}
|
|
98
|
-
else if (!!~key.indexOf(':hover')) {
|
|
99
|
-
statusMap.hover[key.replace(':hover', '')] = body[key];
|
|
100
|
-
}
|
|
101
|
-
else if (!!~key.indexOf(':active')) {
|
|
102
|
-
statusMap.active[key.replace(':active', '')] = body[key];
|
|
103
|
-
}
|
|
104
|
-
else if (!!~key.indexOf(':disabled')) {
|
|
105
|
-
statusMap.disabled[key.replace(':disabled', '')] = body[key];
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
statusMap.default[key] = body[key];
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
var _loop_2 = function (status_1) {
|
|
112
|
-
var weights = weightsList[status_1];
|
|
113
|
-
var styles = [];
|
|
114
|
-
var fn = function (key, value) {
|
|
115
|
-
key = valueMap[key] || key;
|
|
116
|
-
styles.push("".concat(key, ": ").concat(value, ";"));
|
|
85
|
+
try {
|
|
86
|
+
for (var classNameList_1 = (e_2 = void 0, tslib.__values(classNameList)), classNameList_1_1 = classNameList_1.next(); !classNameList_1_1.done; classNameList_1_1 = classNameList_1.next()) {
|
|
87
|
+
var className = classNameList_1_1.value;
|
|
88
|
+
// 没有具体的样式,或者没有对应的classname
|
|
89
|
+
var statusMap = {
|
|
90
|
+
default: {},
|
|
91
|
+
hover: {},
|
|
92
|
+
active: {},
|
|
93
|
+
disabled: {}
|
|
117
94
|
};
|
|
118
|
-
for (var key in
|
|
95
|
+
for (var key in body) {
|
|
119
96
|
if (key === '$$id') {
|
|
120
97
|
continue;
|
|
121
98
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
99
|
+
if (!!~key.indexOf(':default')) {
|
|
100
|
+
statusMap.default[key.replace(':default', '')] = body[key];
|
|
101
|
+
}
|
|
102
|
+
else if (!!~key.indexOf(':hover')) {
|
|
103
|
+
statusMap.hover[key.replace(':hover', '')] = body[key];
|
|
104
|
+
}
|
|
105
|
+
else if (!!~key.indexOf(':active')) {
|
|
106
|
+
statusMap.active[key.replace(':active', '')] = body[key];
|
|
107
|
+
}
|
|
108
|
+
else if (!!~key.indexOf(':disabled')) {
|
|
109
|
+
statusMap.disabled[key.replace(':disabled', '')] = body[key];
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
statusMap.default[key] = body[key];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
var _loop_2 = function (status_1) {
|
|
116
|
+
var weights = weightsList[status_1];
|
|
117
|
+
var styles = [];
|
|
118
|
+
var fn = function (key, value) {
|
|
119
|
+
key = valueMap[key] || key;
|
|
120
|
+
styles.push("".concat(key, ": ").concat(value, ";"));
|
|
121
|
+
};
|
|
122
|
+
for (var key in statusMap[status_1]) {
|
|
123
|
+
if (key === '$$id') {
|
|
124
|
+
continue;
|
|
132
125
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
126
|
+
var style = statusMap[status_1][key];
|
|
127
|
+
if (typeof style === 'object') {
|
|
128
|
+
// 圆角特殊处理
|
|
129
|
+
if (key === 'radius') {
|
|
130
|
+
fn('border-radius', [
|
|
131
|
+
style['top-left-border-radius'],
|
|
132
|
+
style['top-right-border-radius'],
|
|
133
|
+
style['bottom-right-border-radius'],
|
|
134
|
+
style['bottom-left-border-radius']
|
|
135
|
+
].join(' '));
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
for (var k in style) {
|
|
139
|
+
if (k === '$$id') {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
var value = style[k];
|
|
143
|
+
value && fn(k, value);
|
|
137
144
|
}
|
|
138
|
-
var value = style[k];
|
|
139
|
-
value && fn(k, value);
|
|
140
145
|
}
|
|
141
146
|
}
|
|
147
|
+
else {
|
|
148
|
+
var value = style;
|
|
149
|
+
value && fn(key, value);
|
|
150
|
+
}
|
|
142
151
|
}
|
|
143
|
-
|
|
144
|
-
var
|
|
145
|
-
value && fn(key, value);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
if (styles.length > 0) {
|
|
149
|
-
var cx = ((weights === null || weights === void 0 ? void 0 : weights.pre) || '') + className + ((weights === null || weights === void 0 ? void 0 : weights.suf) || '');
|
|
150
|
-
res.push({
|
|
151
|
-
className: cx + status2string[status_1],
|
|
152
|
-
content: ".".concat(cx + status2string[status_1], " {\n ").concat(styles.join('\n '), "\n}")
|
|
153
|
-
});
|
|
154
|
-
if (['hover', 'active', 'disabled'].includes(status_1)) {
|
|
152
|
+
if (styles.length > 0) {
|
|
153
|
+
var cx = ((weights === null || weights === void 0 ? void 0 : weights.pre) || '') + className + ((weights === null || weights === void 0 ? void 0 : weights.suf) || '');
|
|
155
154
|
res.push({
|
|
156
|
-
className: cx +
|
|
157
|
-
content: ".".concat(cx
|
|
155
|
+
className: cx + status2string[status_1],
|
|
156
|
+
content: ".".concat(cx + status2string[status_1], " {\n ").concat(styles.join('\n '), "\n}")
|
|
158
157
|
});
|
|
158
|
+
if (['hover', 'active', 'disabled'].includes(status_1)) {
|
|
159
|
+
res.push({
|
|
160
|
+
className: cx + '.' + status_1,
|
|
161
|
+
content: ".".concat(cx, ".").concat(status_1, " {\n ").concat(styles.join('\n '), "\n}")
|
|
162
|
+
});
|
|
163
|
+
}
|
|
159
164
|
}
|
|
165
|
+
};
|
|
166
|
+
for (var status_1 in statusMap) {
|
|
167
|
+
_loop_2(status_1);
|
|
160
168
|
}
|
|
161
|
-
};
|
|
162
|
-
for (var status_1 in statusMap) {
|
|
163
|
-
_loop_2(status_1);
|
|
164
169
|
}
|
|
165
170
|
}
|
|
171
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
172
|
+
finally {
|
|
173
|
+
try {
|
|
174
|
+
if (classNameList_1_1 && !classNameList_1_1.done && (_c = classNameList_1.return)) _c.call(classNameList_1);
|
|
175
|
+
}
|
|
176
|
+
finally { if (e_2) throw e_2.error; }
|
|
177
|
+
}
|
|
166
178
|
};
|
|
167
|
-
|
|
168
|
-
var
|
|
169
|
-
|
|
179
|
+
try {
|
|
180
|
+
for (var classNames_1 = tslib.__values(classNames), classNames_1_1 = classNames_1.next(); !classNames_1_1.done; classNames_1_1 = classNames_1.next()) {
|
|
181
|
+
var item = classNames_1_1.value;
|
|
182
|
+
_loop_1(item);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
186
|
+
finally {
|
|
187
|
+
try {
|
|
188
|
+
if (classNames_1_1 && !classNames_1_1.done && (_a = classNames_1.return)) _a.call(classNames_1);
|
|
189
|
+
}
|
|
190
|
+
finally { if (e_1) throw e_1.error; }
|
|
170
191
|
}
|
|
171
192
|
return {
|
|
172
193
|
value: res.map(function (n) { return n.content; }).join('\n'),
|
package/lib/utils/style.js
CHANGED
package/lib/utils/toNumber.js
CHANGED
package/lib/utils/tokenize.js
CHANGED
package/lib/utils/tpl-builtin.js
CHANGED