amis-core 6.2.2 → 6.4.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.d.ts +1 -1
- package/esm/RootRenderer.js +28 -10
- package/esm/SchemaRenderer.js +17 -7
- package/esm/Scoped.d.ts +2 -1
- package/esm/Scoped.js +30 -14
- package/esm/StatusScoped.js +4 -2
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +28 -17
- package/esm/actions/Action.js +5 -3
- package/esm/actions/AjaxAction.js +29 -19
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +3 -3
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -2
- package/esm/actions/DialogAction.d.ts +8 -0
- package/esm/actions/DialogAction.js +116 -40
- package/esm/actions/DrawerAction.d.ts +5 -0
- package/esm/actions/DrawerAction.js +74 -11
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/EventAction.d.ts +20 -0
- package/esm/actions/EventAction.js +102 -0
- 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/PrintAction.d.ts +2 -2
- package/esm/actions/PrintAction.js +6 -6
- package/esm/actions/StatusAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/actions/WaitAction.d.ts +18 -0
- package/esm/actions/WaitAction.js +41 -0
- package/esm/actions/index.d.ts +2 -0
- package/esm/components/CustomStyle.js +1 -4
- package/esm/components/ErrorBoundary.js +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +3 -0
- package/esm/components/Overlay.js +7 -4
- package/esm/components/PopOver.js +2 -2
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +3 -0
- package/esm/factory.js +1 -1
- package/esm/index.js +6 -4
- package/esm/locale.js +4 -2
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +6 -4
- package/esm/renderers/Form.js +134 -66
- package/esm/renderers/Item.d.ts +123 -79
- package/esm/renderers/Item.js +159 -60
- package/esm/renderers/Options.d.ts +0 -11
- package/esm/renderers/Options.js +20 -84
- 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 +2 -1
- package/esm/renderers/wrapControl.js +34 -28
- package/esm/store/app.d.ts +5 -5
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +255 -63
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +5 -5
- package/esm/store/crud.js +12 -6
- package/esm/store/form.d.ts +105 -25
- package/esm/store/form.js +33 -15
- package/esm/store/formItem.d.ts +6 -2
- package/esm/store/formItem.js +68 -5
- package/esm/store/iRenderer.d.ts +5 -5
- package/esm/store/iRenderer.js +28 -12
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +18 -5
- package/esm/store/list.js +14 -1
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +5 -5
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +5 -5
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.d.ts +5 -5
- package/esm/store/root.js +1 -1
- package/esm/store/service.d.ts +5 -5
- package/esm/store/service.js +2 -2
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +244 -55
- package/esm/store/table.js +27 -9
- package/esm/store/table2.d.ts +5 -5
- package/esm/store/table2.js +1 -1
- package/esm/theme.js +4 -2
- package/esm/types.d.ts +7 -1
- 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.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/concatData.js +1 -1
- 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.d.ts +2 -2
- package/esm/utils/dom.js +72 -13
- 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 +12 -6
- package/esm/utils/helper.js +41 -18
- 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/labelToString.js +1 -1
- 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/printElement.js +1 -1
- package/esm/utils/renderer-event.d.ts +13 -0
- package/esm/utils/renderer-event.js +111 -2
- package/esm/utils/replaceText.js +1 -1
- 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.js +1 -1
- package/esm/utils/stripNumber.d.ts +1 -1
- package/esm/utils/stripNumber.js +4 -3
- package/esm/utils/style-helper.d.ts +21 -2
- package/esm/utils/style-helper.js +55 -10
- 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 +4 -4
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validateId.js +5 -2
- package/esm/utils/validations.js +1 -1
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.d.ts +2 -2
- package/lib/RootRenderer.js +28 -10
- package/lib/SchemaRenderer.js +16 -6
- package/lib/Scoped.d.ts +2 -1
- package/lib/Scoped.js +30 -14
- package/lib/StatusScoped.js +4 -2
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +28 -17
- package/lib/actions/Action.js +5 -3
- package/lib/actions/AjaxAction.js +29 -19
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +3 -3
- 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.d.ts +8 -0
- package/lib/actions/DialogAction.js +119 -40
- package/lib/actions/DrawerAction.d.ts +5 -0
- package/lib/actions/DrawerAction.js +77 -11
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/EventAction.d.ts +20 -0
- package/lib/actions/EventAction.js +109 -0
- 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/PrintAction.d.ts +2 -2
- package/lib/actions/PrintAction.js +6 -6
- package/lib/actions/StatusAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/actions/WaitAction.d.ts +18 -0
- package/lib/actions/WaitAction.js +45 -0
- package/lib/actions/index.d.ts +2 -0
- package/lib/components/CustomStyle.js +1 -4
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +3 -0
- package/lib/components/Overlay.js +7 -4
- package/lib/components/PopOver.js +1 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +3 -0
- package/lib/factory.js +1 -1
- package/lib/index.js +6 -4
- package/lib/locale.js +4 -2
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +6 -4
- package/lib/renderers/Form.js +135 -65
- package/lib/renderers/Item.d.ts +123 -79
- package/lib/renderers/Item.js +158 -58
- package/lib/renderers/Options.d.ts +0 -11
- package/lib/renderers/Options.js +19 -84
- 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 +2 -1
- package/lib/renderers/wrapControl.js +34 -28
- package/lib/store/app.d.ts +5 -5
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +279 -88
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +5 -5
- package/lib/store/crud.js +12 -6
- package/lib/store/form.d.ts +115 -36
- package/lib/store/form.js +33 -15
- package/lib/store/formItem.d.ts +6 -2
- package/lib/store/formItem.js +67 -4
- package/lib/store/iRenderer.d.ts +5 -5
- package/lib/store/iRenderer.js +27 -11
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +18 -5
- package/lib/store/list.js +14 -1
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +5 -5
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +5 -5
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.d.ts +5 -5
- package/lib/store/root.js +1 -1
- package/lib/store/service.d.ts +5 -5
- package/lib/store/service.js +2 -2
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +264 -76
- package/lib/store/table.js +27 -9
- package/lib/store/table2.d.ts +5 -5
- package/lib/store/table2.js +1 -1
- package/lib/theme.js +4 -2
- package/lib/types.d.ts +7 -1
- 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.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/concatData.js +1 -1
- 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.d.ts +2 -2
- package/lib/utils/dom.js +72 -13
- 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 +12 -6
- package/lib/utils/helper.js +41 -20
- 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/labelToString.js +1 -1
- 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/printElement.js +1 -1
- package/lib/utils/renderer-event.d.ts +13 -0
- package/lib/utils/renderer-event.js +111 -1
- package/lib/utils/replaceText.js +1 -1
- 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.js +1 -1
- package/lib/utils/stripNumber.d.ts +1 -1
- package/lib/utils/stripNumber.js +4 -3
- package/lib/utils/style-helper.d.ts +21 -2
- package/lib/utils/style-helper.js +55 -10
- 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 +4 -4
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validateId.js +9 -2
- package/lib/utils/validations.js +1 -1
- package/package.json +5 -3
package/lib/store/table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
2
|
+
* amis-core v6.4.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -32,7 +32,7 @@ var sortBy__default = /*#__PURE__*/_interopDefaultLegacy(sortBy);
|
|
|
32
32
|
* 内部列的数量 '__checkme' | '__dragme' | '__expandme'
|
|
33
33
|
*/
|
|
34
34
|
var PARTITION_INDEX = 3;
|
|
35
|
-
function initChildren(children, depth, pindex, parentId, path) {
|
|
35
|
+
function initChildren(children, depth, pindex, parentId, path, getEntryId) {
|
|
36
36
|
if (path === void 0) { path = ''; }
|
|
37
37
|
depth += 1;
|
|
38
38
|
return children.map(function (item, index) {
|
|
@@ -42,7 +42,7 @@ function initChildren(children, depth, pindex, parentId, path) {
|
|
|
42
42
|
: {
|
|
43
43
|
item: item
|
|
44
44
|
};
|
|
45
|
-
var id = (_a = item.__id) !== null && _a !== void 0 ? _a : helper.guid();
|
|
45
|
+
var id = String(getEntryId ? getEntryId(item, index) : (_a = item.__id) !== null && _a !== void 0 ? _a : helper.guid());
|
|
46
46
|
return {
|
|
47
47
|
// id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`),
|
|
48
48
|
id: String(id),
|
|
@@ -59,7 +59,7 @@ function initChildren(children, depth, pindex, parentId, path) {
|
|
|
59
59
|
loading: false,
|
|
60
60
|
rowSpans: {},
|
|
61
61
|
children: item && Array.isArray(item.children)
|
|
62
|
-
? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."))
|
|
62
|
+
? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."), getEntryId)
|
|
63
63
|
: []
|
|
64
64
|
};
|
|
65
65
|
});
|
|
@@ -198,11 +198,9 @@ var Row = mobxStateTree.types
|
|
|
198
198
|
return Object.keys(self.data).some(function (key) { return !isEqual__default["default"](self.data[key], self.pristine[key]); });
|
|
199
199
|
},
|
|
200
200
|
getDataWithModifiedChilden: function () {
|
|
201
|
-
var data =
|
|
201
|
+
var data = self.data;
|
|
202
202
|
if (data.children && self.children) {
|
|
203
|
-
data.children
|
|
204
|
-
return item.getDataWithModifiedChilden();
|
|
205
|
-
});
|
|
203
|
+
data = tslib.__assign(tslib.__assign({}, data), { children: self.children.map(function (item) { return item.getDataWithModifiedChilden(); }) });
|
|
206
204
|
}
|
|
207
205
|
return data;
|
|
208
206
|
},
|
|
@@ -296,6 +294,9 @@ var Row = mobxStateTree.types
|
|
|
296
294
|
toggleExpanded: function () {
|
|
297
295
|
mobxStateTree.getParent(self, self.depth * 2).toggleExpanded(self);
|
|
298
296
|
},
|
|
297
|
+
setExpanded: function (expanded) {
|
|
298
|
+
mobxStateTree.getParent(self, self.depth * 2).setExpanded(self, expanded);
|
|
299
|
+
},
|
|
299
300
|
change: function (values, savePristine) {
|
|
300
301
|
self.data = helper.immutableExtends(self.data, values);
|
|
301
302
|
savePristine && (self.pristine = self.data);
|
|
@@ -1076,7 +1077,7 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1076
1077
|
loaded: false,
|
|
1077
1078
|
loading: false,
|
|
1078
1079
|
children: item && Array.isArray(item.children)
|
|
1079
|
-
? initChildren(item.children, 1, index, id, "".concat(index, "."))
|
|
1080
|
+
? initChildren(item.children, 1, index, id, "".concat(index, "."), getEntryId)
|
|
1080
1081
|
: []
|
|
1081
1082
|
};
|
|
1082
1083
|
});
|
|
@@ -1324,6 +1325,18 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1324
1325
|
self.expandedRows.push(row.id);
|
|
1325
1326
|
}
|
|
1326
1327
|
}
|
|
1328
|
+
function setExpanded(row, expanded) {
|
|
1329
|
+
var id = typeof row === 'string' ? row : row.id;
|
|
1330
|
+
var idx = self.expandedRows.indexOf(id);
|
|
1331
|
+
if (expanded) {
|
|
1332
|
+
if (!~idx) {
|
|
1333
|
+
self.expandedRows.push(id);
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
else {
|
|
1337
|
+
~idx && self.expandedRows.splice(idx, 1);
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1327
1340
|
function collapseAllAtDepth(depth) {
|
|
1328
1341
|
var rows = self.getExpandedRows().filter(function (item) { return item.depth !== depth; });
|
|
1329
1342
|
self.expandedRows.replace(rows.map(function (item) { return item.id; }));
|
|
@@ -1355,6 +1368,9 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1355
1368
|
function toggleDragging() {
|
|
1356
1369
|
self.dragging = !self.dragging;
|
|
1357
1370
|
}
|
|
1371
|
+
function startDragging() {
|
|
1372
|
+
self.dragging = true;
|
|
1373
|
+
}
|
|
1358
1374
|
function stopDragging() {
|
|
1359
1375
|
self.dragging = false;
|
|
1360
1376
|
}
|
|
@@ -1456,12 +1472,14 @@ var TableStore = iRenderer.iRendererStore
|
|
|
1456
1472
|
getToggleShiftRows: getToggleShiftRows,
|
|
1457
1473
|
toggleExpandAll: toggleExpandAll,
|
|
1458
1474
|
toggleExpanded: toggleExpanded,
|
|
1475
|
+
setExpanded: setExpanded,
|
|
1459
1476
|
collapseAllAtDepth: collapseAllAtDepth,
|
|
1460
1477
|
clear: clear,
|
|
1461
1478
|
setOrderByInfo: setOrderByInfo,
|
|
1462
1479
|
changeOrder: changeOrder,
|
|
1463
1480
|
reset: reset,
|
|
1464
1481
|
toggleDragging: toggleDragging,
|
|
1482
|
+
startDragging: startDragging,
|
|
1465
1483
|
stopDragging: stopDragging,
|
|
1466
1484
|
exchange: exchange,
|
|
1467
1485
|
addForm: addForm,
|
package/lib/store/table2.d.ts
CHANGED
|
@@ -165,11 +165,11 @@ export declare const TableStore2: import("mobx-state-tree").IModelType<{
|
|
|
165
165
|
reset(): void;
|
|
166
166
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined, concatFields?: string | string[] | undefined): void;
|
|
167
167
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
168
|
-
setCurrentAction(action:
|
|
169
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((
|
|
170
|
-
closeDialog(
|
|
171
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
172
|
-
closeDrawer(
|
|
168
|
+
setCurrentAction(action: any, resolveDefinitions?: ((schema: any) => any) | undefined): void;
|
|
169
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((confirmed: boolean, values: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
170
|
+
closeDialog(confirmed?: any, data?: any): void;
|
|
171
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((confirmed: boolean, ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
172
|
+
closeDrawer(confirmed?: any, data?: any): void;
|
|
173
173
|
getDialogScoped(): import("..").IScopedContext | null;
|
|
174
174
|
getDrawerScoped(): import("..").IScopedContext | null;
|
|
175
175
|
} & {
|
package/lib/store/table2.js
CHANGED
package/lib/theme.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
2
|
+
* amis-core v6.4.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -122,7 +122,9 @@ function themeable(ComposedComponent) {
|
|
|
122
122
|
classnames: config.classnames,
|
|
123
123
|
theme: theme
|
|
124
124
|
};
|
|
125
|
-
var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent)
|
|
125
|
+
var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent) ||
|
|
126
|
+
ComposedComponent.$$typeof ===
|
|
127
|
+
Symbol.for('react.forward_ref')
|
|
126
128
|
? { ref: this.childRef }
|
|
127
129
|
: { forwardedRef: this.childRef };
|
|
128
130
|
var body = (_J$X_(ComposedComponent, tslib.__assign({}, config.getComponentConfig(ComposedComponent.themeKey), this.props, injectedProps, refConfig)));
|
package/lib/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import type { JSONSchema7 } from 'json-schema';
|
|
3
3
|
import { ListenerAction } from './actions/Action';
|
|
4
4
|
import { debounceConfig, trackConfig } from './utils/renderer-event';
|
|
5
|
+
import type { TestIdBuilder } from './utils/helper';
|
|
5
6
|
export interface Option {
|
|
6
7
|
/**
|
|
7
8
|
* 用来显示的文字
|
|
@@ -271,7 +272,7 @@ export interface Definitions {
|
|
|
271
272
|
[propName: string]: SchemaNode;
|
|
272
273
|
}
|
|
273
274
|
export interface ActionObject extends ButtonObject {
|
|
274
|
-
actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'confirmDialog' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'selectAll' | 'changeTabKey' | 'clearSearch';
|
|
275
|
+
actionType?: 'submit' | 'copy' | 'reload' | 'ajax' | 'saveAs' | 'dialog' | 'drawer' | 'confirmDialog' | 'jump' | 'link' | 'url' | 'email' | 'close' | 'confirm' | 'add' | 'remove' | 'delete' | 'edit' | 'cancel' | 'next' | 'prev' | 'reset' | 'validate' | 'reset-and-submit' | 'clear' | 'clear-and-submit' | 'toast' | 'goto-step' | 'goto-image' | 'expand' | 'collapse' | 'step-submit' | 'select' | 'selectAll' | 'clearAll' | 'changeTabKey' | 'clearSearch' | 'submitQuickEdit' | 'initDrag' | 'cancelDrag' | 'toggleExpanded' | 'setExpanded';
|
|
275
276
|
api?: BaseApiObject | string;
|
|
276
277
|
asyncApi?: BaseApiObject | string;
|
|
277
278
|
payload?: any;
|
|
@@ -432,6 +433,10 @@ export type SchemaClassName = string | {
|
|
|
432
433
|
[propName: string]: boolean | undefined | null | SchemaExpression;
|
|
433
434
|
};
|
|
434
435
|
export interface BaseSchemaWithoutType {
|
|
436
|
+
/**
|
|
437
|
+
* 组件唯一 id,主要用于页面设计器中定位 json 节点
|
|
438
|
+
*/
|
|
439
|
+
$$id?: string;
|
|
435
440
|
/**
|
|
436
441
|
* 容器 css 类名
|
|
437
442
|
*/
|
|
@@ -534,6 +539,7 @@ export interface BaseSchemaWithoutType {
|
|
|
534
539
|
* 可以组件级别用来关闭移动端样式
|
|
535
540
|
*/
|
|
536
541
|
useMobileUI?: boolean;
|
|
542
|
+
testIdBuilder?: TestIdBuilder;
|
|
537
543
|
}
|
|
538
544
|
export type OperatorType = 'equal' | 'not_equal' | 'is_empty' | 'is_not_empty' | 'like' | 'not_like' | 'starts_with' | 'ends_with' | 'less' | 'less_or_equal' | 'greater' | 'greater_or_equal' | 'between' | 'not_between' | 'select_equals' | 'select_not_equals' | 'select_any_in' | 'select_not_any_in' | {
|
|
539
545
|
label: string;
|
package/lib/utils/Animation.js
CHANGED
package/lib/utils/ColorScale.js
CHANGED
package/lib/utils/DataSchema.js
CHANGED
package/lib/utils/DataScope.js
CHANGED
package/lib/utils/RootClose.js
CHANGED
package/lib/utils/SimpleMap.js
CHANGED
package/lib/utils/api.js
CHANGED
package/lib/utils/arraySlice.js
CHANGED
package/lib/utils/autobind.js
CHANGED
package/lib/utils/browser.js
CHANGED
package/lib/utils/concatData.js
CHANGED
package/lib/utils/dataMapping.js
CHANGED
package/lib/utils/date.js
CHANGED
package/lib/utils/debug.js
CHANGED
package/lib/utils/dom.d.ts
CHANGED
|
@@ -4,8 +4,8 @@ export declare function ownerDocument(componentOrElement: any): Document;
|
|
|
4
4
|
export declare function calculatePosition(placement: any, overlayNode: any, target: HTMLElement, container: any, padding?: any, customOffset?: [number, number]): {
|
|
5
5
|
positionLeft: number;
|
|
6
6
|
positionTop: number;
|
|
7
|
-
arrowOffsetLeft:
|
|
8
|
-
arrowOffsetTop:
|
|
7
|
+
arrowOffsetLeft: any;
|
|
8
|
+
arrowOffsetTop: any;
|
|
9
9
|
activePlacement: string;
|
|
10
10
|
};
|
|
11
11
|
/**
|
package/lib/utils/dom.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
2
|
+
* amis-core v6.4.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -12,6 +12,7 @@ var ReactDOM = require('react-dom');
|
|
|
12
12
|
require('react');
|
|
13
13
|
var offset = require('./offset.js');
|
|
14
14
|
var position = require('./position.js');
|
|
15
|
+
var helper = require('./helper.js');
|
|
15
16
|
|
|
16
17
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
17
18
|
|
|
@@ -75,12 +76,14 @@ function getLeftDelta(left, overlayWidth, container, padding) {
|
|
|
75
76
|
return 0;
|
|
76
77
|
}
|
|
77
78
|
function calculatePosition(placement, overlayNode, target, container, padding, customOffset) {
|
|
79
|
+
var _a;
|
|
78
80
|
if (padding === void 0) { padding = 0; }
|
|
79
81
|
if (customOffset === void 0) { customOffset = [0, 0]; }
|
|
82
|
+
var scrollParent = helper.getScrollParent(container);
|
|
80
83
|
var childOffset = container.tagName === 'BODY'
|
|
81
84
|
? offset.offset(target)
|
|
82
85
|
: position.position(target, container);
|
|
83
|
-
var
|
|
86
|
+
var _b = offset.offset(overlayNode), overlayHeight = _b.height, overlayWidth = _b.width;
|
|
84
87
|
var clip = container.getBoundingClientRect();
|
|
85
88
|
var clip2 = overlayNode.getBoundingClientRect();
|
|
86
89
|
var scaleX = overlayNode.offsetWidth
|
|
@@ -97,6 +100,40 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
97
100
|
? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
|
|
98
101
|
: placement;
|
|
99
102
|
var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
|
|
103
|
+
// 如果是作为菜单浮层,不再基于四个方向对齐,而是模拟原生右键菜单定位:
|
|
104
|
+
// 1.计算放右边,还是左边
|
|
105
|
+
// 2.计算能否放在下面,如果不能则贴底
|
|
106
|
+
// 3.由于是基于一个点此时不考虑 arrow
|
|
107
|
+
if (placement === 'asContextMenu') {
|
|
108
|
+
if (childOffset.left + 1 + overlayWidth <= clip.width) {
|
|
109
|
+
// 放右边
|
|
110
|
+
positionLeft = childOffset.left + 1;
|
|
111
|
+
}
|
|
112
|
+
else if (childOffset.left - overlayWidth >= 0) {
|
|
113
|
+
// 放左边
|
|
114
|
+
positionLeft = childOffset.left - overlayWidth;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// 兜底贴右边
|
|
118
|
+
positionLeft = Math.max(clip.width - overlayWidth, 10);
|
|
119
|
+
}
|
|
120
|
+
if (childOffset.top + 1 + overlayHeight <= clip.height) {
|
|
121
|
+
// 放下面
|
|
122
|
+
positionTop = childOffset.top + 1;
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
// 贴底边,预留5px避免完全贴底
|
|
126
|
+
positionTop = Math.max(clip.height - overlayHeight - 5, 10);
|
|
127
|
+
}
|
|
128
|
+
var _c = tslib.__read(customOffset, 2), _d = _c[0], offSetX_1 = _d === void 0 ? 0 : _d, _e = _c[1], offSetY_1 = _e === void 0 ? 0 : _e;
|
|
129
|
+
return {
|
|
130
|
+
positionLeft: (positionLeft + offSetX_1) / scaleX,
|
|
131
|
+
positionTop: (positionTop + offSetY_1) / scaleY,
|
|
132
|
+
arrowOffsetLeft: arrowOffsetLeft,
|
|
133
|
+
arrowOffsetTop: arrowOffsetTop,
|
|
134
|
+
activePlacement: activePlacement
|
|
135
|
+
};
|
|
136
|
+
}
|
|
100
137
|
if (~placement.indexOf('-')) {
|
|
101
138
|
var tests = placement.split(/\s+/);
|
|
102
139
|
// 收集可见方向
|
|
@@ -106,11 +143,11 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
106
143
|
// 自动对齐模式下,当四个方向都无法完全可见时
|
|
107
144
|
// 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
|
|
108
145
|
if (isAuto && tests.length === 0) {
|
|
109
|
-
var
|
|
110
|
-
var
|
|
146
|
+
var _f = tslib.__read(autoDefaultPlacement.split('-'), 4), _atX = _f[0], _atY = _f[1], _myX = _f[2], _myY = _f[3];
|
|
147
|
+
var _g = visiblePlacement.atX, atX_1 = _g === void 0 ? _atX : _g, _h = visiblePlacement.atY, atY_1 = _h === void 0 ? _atY : _h, _j = visiblePlacement.myX, myX_1 = _j === void 0 ? _myX : _j, _k = visiblePlacement.myY, myY_1 = _k === void 0 ? _myY : _k;
|
|
111
148
|
current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
|
|
112
149
|
}
|
|
113
|
-
var
|
|
150
|
+
var _l = tslib.__read(current.split('-'), 4), atX = _l[0], atY = _l[1], myX = _l[2], myY = _l[3];
|
|
114
151
|
myX = myX || atX;
|
|
115
152
|
myY = myY || atY;
|
|
116
153
|
positionLeft =
|
|
@@ -143,14 +180,16 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
143
180
|
};
|
|
144
181
|
var visibleX = false;
|
|
145
182
|
var visibleY = false;
|
|
146
|
-
if (transformed.x
|
|
147
|
-
transformed.x + transformed.width <
|
|
183
|
+
if (transformed.x >= 0 &&
|
|
184
|
+
transformed.x + transformed.width <
|
|
185
|
+
window.innerWidth + scrollParent.scrollLeft) {
|
|
148
186
|
visibleX = true;
|
|
149
187
|
!visiblePlacement.atX && (visiblePlacement.atX = atX);
|
|
150
188
|
!visiblePlacement.myX && (visiblePlacement.myX = myX);
|
|
151
189
|
}
|
|
152
|
-
if (transformed.y
|
|
153
|
-
transformed.y + transformed.height <
|
|
190
|
+
if (transformed.y >= 0 &&
|
|
191
|
+
transformed.y + transformed.height <
|
|
192
|
+
window.innerHeight + scrollParent.scrollTop) {
|
|
154
193
|
visibleY = true;
|
|
155
194
|
!visiblePlacement.atY && (visiblePlacement.atY = atY);
|
|
156
195
|
!visiblePlacement.myY && (visiblePlacement.myY = myY);
|
|
@@ -159,9 +198,29 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
159
198
|
break;
|
|
160
199
|
}
|
|
161
200
|
else if (isAuto && tests.length === 0) {
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
|
|
201
|
+
// 获取相对定位的父元素位置
|
|
202
|
+
var offsetParent = overlayNode.offsetParent;
|
|
203
|
+
while (offsetParent &&
|
|
204
|
+
window.getComputedStyle(offsetParent).position === 'static') {
|
|
205
|
+
offsetParent = offsetParent.offsetParent;
|
|
206
|
+
}
|
|
207
|
+
var parentRect = (_a = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(offsetParent);
|
|
208
|
+
var parentTransformed = {
|
|
209
|
+
x: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.x) || 0,
|
|
210
|
+
y: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.y) || 0
|
|
211
|
+
};
|
|
212
|
+
// 如果是 auto 模式,且最后一个方向都不可见,则直接平移到可见区域,考虑相对定位的父元素位置,保留10px的边距
|
|
213
|
+
visibleY ||
|
|
214
|
+
(positionTop =
|
|
215
|
+
Math.max(10, window.innerHeight - transformed.height) +
|
|
216
|
+
scrollParent.scrollTop -
|
|
217
|
+
parentTransformed.y -
|
|
218
|
+
10);
|
|
219
|
+
visibleX ||
|
|
220
|
+
(positionLeft =
|
|
221
|
+
Math.max(10, window.innerWidth - transformed.width) +
|
|
222
|
+
scrollParent.scrollLeft -
|
|
223
|
+
parentTransformed.x);
|
|
165
224
|
}
|
|
166
225
|
}
|
|
167
226
|
}
|
|
@@ -206,7 +265,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
206
265
|
else {
|
|
207
266
|
throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
|
|
208
267
|
}
|
|
209
|
-
var
|
|
268
|
+
var _m = tslib.__read(customOffset, 2), _o = _m[0], offSetX = _o === void 0 ? 0 : _o, _p = _m[1], offSetY = _p === void 0 ? 0 : _p;
|
|
210
269
|
return {
|
|
211
270
|
positionLeft: (positionLeft + offSetX) / scaleX,
|
|
212
271
|
positionTop: (positionTop + offSetY) / scaleY,
|
package/lib/utils/errors.js
CHANGED
package/lib/utils/escapeHtml.js
CHANGED
package/lib/utils/filter.js
CHANGED
package/lib/utils/formula.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
2
|
+
* amis-core v6.4.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -201,7 +201,7 @@ function isExpression(expression) {
|
|
|
201
201
|
}
|
|
202
202
|
// 备注1: "\\${xxx}"不作为表达式,至少含一个${xxx}才算是表达式
|
|
203
203
|
// 备注2: safari 不支持 /(?<!\\)(\${).+(\})/.test(expression)
|
|
204
|
-
return /(^|[^\\])\$\{
|
|
204
|
+
return /(^|[^\\])\$\{[\s\S]+\}/.test(expression);
|
|
205
205
|
}
|
|
206
206
|
// 用于判断是否需要执行表达式:
|
|
207
207
|
function isNeedFormula(expression, prevData, curData) {
|
package/lib/utils/getVariable.js
CHANGED
package/lib/utils/grammar.js
CHANGED
package/lib/utils/helper.d.ts
CHANGED
|
@@ -384,9 +384,15 @@ export declare function evalTrackExpression(expression: string, data: Record<str
|
|
|
384
384
|
export declare function importLazyComponent(mod: any): any;
|
|
385
385
|
export declare function replaceUrlParams(path: string, params: Record<string, any>): string;
|
|
386
386
|
export declare const TEST_ID_KEY: 'data-testid';
|
|
387
|
-
export declare
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
};
|
|
392
|
-
|
|
387
|
+
export declare class TestIdBuilder {
|
|
388
|
+
testId?: string;
|
|
389
|
+
static fast(testId: string): {
|
|
390
|
+
"data-testid": string;
|
|
391
|
+
};
|
|
392
|
+
constructor(testId?: string);
|
|
393
|
+
getChild(childPath: string | number, data?: object): TestIdBuilder;
|
|
394
|
+
getTestId(data?: object): {
|
|
395
|
+
"data-testid": string;
|
|
396
|
+
} | undefined;
|
|
397
|
+
getTestIdValue(data?: object): string | undefined;
|
|
398
|
+
}
|