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/esm/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
|
|
|
@@ -23,7 +23,7 @@ import { getStoreById } from './manager.js';
|
|
|
23
23
|
* 内部列的数量 '__checkme' | '__dragme' | '__expandme'
|
|
24
24
|
*/
|
|
25
25
|
var PARTITION_INDEX = 3;
|
|
26
|
-
function initChildren(children, depth, pindex, parentId, path) {
|
|
26
|
+
function initChildren(children, depth, pindex, parentId, path, getEntryId) {
|
|
27
27
|
if (path === void 0) { path = ''; }
|
|
28
28
|
depth += 1;
|
|
29
29
|
return children.map(function (item, index) {
|
|
@@ -33,7 +33,7 @@ function initChildren(children, depth, pindex, parentId, path) {
|
|
|
33
33
|
: {
|
|
34
34
|
item: item
|
|
35
35
|
};
|
|
36
|
-
var id = (_a = item.__id) !== null && _a !== void 0 ? _a : guid();
|
|
36
|
+
var id = String(getEntryId ? getEntryId(item, index) : (_a = item.__id) !== null && _a !== void 0 ? _a : guid());
|
|
37
37
|
return {
|
|
38
38
|
// id: String(item && (item as any)[self.primaryField] || `${pindex}-${depth}-${key}`),
|
|
39
39
|
id: String(id),
|
|
@@ -50,7 +50,7 @@ function initChildren(children, depth, pindex, parentId, path) {
|
|
|
50
50
|
loading: false,
|
|
51
51
|
rowSpans: {},
|
|
52
52
|
children: item && Array.isArray(item.children)
|
|
53
|
-
? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."))
|
|
53
|
+
? initChildren(item.children, depth, index, id, "".concat(path).concat(index, "."), getEntryId)
|
|
54
54
|
: []
|
|
55
55
|
};
|
|
56
56
|
});
|
|
@@ -189,11 +189,9 @@ var Row = types
|
|
|
189
189
|
return Object.keys(self.data).some(function (key) { return !isEqual(self.data[key], self.pristine[key]); });
|
|
190
190
|
},
|
|
191
191
|
getDataWithModifiedChilden: function () {
|
|
192
|
-
var data =
|
|
192
|
+
var data = self.data;
|
|
193
193
|
if (data.children && self.children) {
|
|
194
|
-
data
|
|
195
|
-
return item.getDataWithModifiedChilden();
|
|
196
|
-
});
|
|
194
|
+
data = __assign(__assign({}, data), { children: self.children.map(function (item) { return item.getDataWithModifiedChilden(); }) });
|
|
197
195
|
}
|
|
198
196
|
return data;
|
|
199
197
|
},
|
|
@@ -287,6 +285,9 @@ var Row = types
|
|
|
287
285
|
toggleExpanded: function () {
|
|
288
286
|
getParent(self, self.depth * 2).toggleExpanded(self);
|
|
289
287
|
},
|
|
288
|
+
setExpanded: function (expanded) {
|
|
289
|
+
getParent(self, self.depth * 2).setExpanded(self, expanded);
|
|
290
|
+
},
|
|
290
291
|
change: function (values, savePristine) {
|
|
291
292
|
self.data = immutableExtends(self.data, values);
|
|
292
293
|
savePristine && (self.pristine = self.data);
|
|
@@ -1067,7 +1068,7 @@ var TableStore = iRendererStore
|
|
|
1067
1068
|
loaded: false,
|
|
1068
1069
|
loading: false,
|
|
1069
1070
|
children: item && Array.isArray(item.children)
|
|
1070
|
-
? initChildren(item.children, 1, index, id, "".concat(index, "."))
|
|
1071
|
+
? initChildren(item.children, 1, index, id, "".concat(index, "."), getEntryId)
|
|
1071
1072
|
: []
|
|
1072
1073
|
};
|
|
1073
1074
|
});
|
|
@@ -1315,6 +1316,18 @@ var TableStore = iRendererStore
|
|
|
1315
1316
|
self.expandedRows.push(row.id);
|
|
1316
1317
|
}
|
|
1317
1318
|
}
|
|
1319
|
+
function setExpanded(row, expanded) {
|
|
1320
|
+
var id = typeof row === 'string' ? row : row.id;
|
|
1321
|
+
var idx = self.expandedRows.indexOf(id);
|
|
1322
|
+
if (expanded) {
|
|
1323
|
+
if (!~idx) {
|
|
1324
|
+
self.expandedRows.push(id);
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
else {
|
|
1328
|
+
~idx && self.expandedRows.splice(idx, 1);
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1318
1331
|
function collapseAllAtDepth(depth) {
|
|
1319
1332
|
var rows = self.getExpandedRows().filter(function (item) { return item.depth !== depth; });
|
|
1320
1333
|
self.expandedRows.replace(rows.map(function (item) { return item.id; }));
|
|
@@ -1346,6 +1359,9 @@ var TableStore = iRendererStore
|
|
|
1346
1359
|
function toggleDragging() {
|
|
1347
1360
|
self.dragging = !self.dragging;
|
|
1348
1361
|
}
|
|
1362
|
+
function startDragging() {
|
|
1363
|
+
self.dragging = true;
|
|
1364
|
+
}
|
|
1349
1365
|
function stopDragging() {
|
|
1350
1366
|
self.dragging = false;
|
|
1351
1367
|
}
|
|
@@ -1447,12 +1463,14 @@ var TableStore = iRendererStore
|
|
|
1447
1463
|
getToggleShiftRows: getToggleShiftRows,
|
|
1448
1464
|
toggleExpandAll: toggleExpandAll,
|
|
1449
1465
|
toggleExpanded: toggleExpanded,
|
|
1466
|
+
setExpanded: setExpanded,
|
|
1450
1467
|
collapseAllAtDepth: collapseAllAtDepth,
|
|
1451
1468
|
clear: clear,
|
|
1452
1469
|
setOrderByInfo: setOrderByInfo,
|
|
1453
1470
|
changeOrder: changeOrder,
|
|
1454
1471
|
reset: reset,
|
|
1455
1472
|
toggleDragging: toggleDragging,
|
|
1473
|
+
startDragging: startDragging,
|
|
1456
1474
|
stopDragging: stopDragging,
|
|
1457
1475
|
exchange: exchange,
|
|
1458
1476
|
addForm: addForm,
|
package/esm/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/esm/store/table2.js
CHANGED
package/esm/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
|
|
|
@@ -109,7 +109,9 @@ function themeable(ComposedComponent) {
|
|
|
109
109
|
classnames: config.classnames,
|
|
110
110
|
theme: theme
|
|
111
111
|
};
|
|
112
|
-
var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent)
|
|
112
|
+
var refConfig = ((_a = ComposedComponent.prototype) === null || _a === void 0 ? void 0 : _a.isReactComponent) ||
|
|
113
|
+
ComposedComponent.$$typeof ===
|
|
114
|
+
Symbol.for('react.forward_ref')
|
|
113
115
|
? { ref: this.childRef }
|
|
114
116
|
: { forwardedRef: this.childRef };
|
|
115
117
|
var body = (React.createElement(ComposedComponent, __assign({}, config.getComponentConfig(ComposedComponent.themeKey), this.props, injectedProps, refConfig)));
|
package/esm/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/esm/utils/Animation.js
CHANGED
package/esm/utils/ColorScale.js
CHANGED
package/esm/utils/DataSchema.js
CHANGED
package/esm/utils/DataScope.js
CHANGED
package/esm/utils/RootClose.js
CHANGED
package/esm/utils/SimpleMap.js
CHANGED
package/esm/utils/api.js
CHANGED
package/esm/utils/arraySlice.js
CHANGED
package/esm/utils/autobind.js
CHANGED
package/esm/utils/browser.js
CHANGED
package/esm/utils/concatData.js
CHANGED
package/esm/utils/dataMapping.js
CHANGED
package/esm/utils/date.js
CHANGED
package/esm/utils/debug.js
CHANGED
package/esm/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/esm/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
|
|
|
@@ -8,6 +8,7 @@ import ReactDOM from 'react-dom';
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { offset } from './offset.js';
|
|
10
10
|
import { position } from './position.js';
|
|
11
|
+
import { getScrollParent } from './helper.js';
|
|
11
12
|
|
|
12
13
|
function getContainer(container, defaultContainer) {
|
|
13
14
|
container = typeof container === 'function' ? container() : container;
|
|
@@ -64,12 +65,14 @@ function getLeftDelta(left, overlayWidth, container, padding) {
|
|
|
64
65
|
return 0;
|
|
65
66
|
}
|
|
66
67
|
function calculatePosition(placement, overlayNode, target, container, padding, customOffset) {
|
|
68
|
+
var _a;
|
|
67
69
|
if (padding === void 0) { padding = 0; }
|
|
68
70
|
if (customOffset === void 0) { customOffset = [0, 0]; }
|
|
71
|
+
var scrollParent = getScrollParent(container);
|
|
69
72
|
var childOffset = container.tagName === 'BODY'
|
|
70
73
|
? offset(target)
|
|
71
74
|
: position(target, container);
|
|
72
|
-
var
|
|
75
|
+
var _b = offset(overlayNode), overlayHeight = _b.height, overlayWidth = _b.width;
|
|
73
76
|
var clip = container.getBoundingClientRect();
|
|
74
77
|
var clip2 = overlayNode.getBoundingClientRect();
|
|
75
78
|
var scaleX = overlayNode.offsetWidth
|
|
@@ -86,6 +89,40 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
86
89
|
? "left-bottom-left-top right-bottom-right-top left-top-left-bottom right-top-right-bottom ".concat(autoDefaultPlacement)
|
|
87
90
|
: placement;
|
|
88
91
|
var positionLeft = 0, positionTop = 0, arrowOffsetLeft = '', arrowOffsetTop = '', activePlacement = placement;
|
|
92
|
+
// 如果是作为菜单浮层,不再基于四个方向对齐,而是模拟原生右键菜单定位:
|
|
93
|
+
// 1.计算放右边,还是左边
|
|
94
|
+
// 2.计算能否放在下面,如果不能则贴底
|
|
95
|
+
// 3.由于是基于一个点此时不考虑 arrow
|
|
96
|
+
if (placement === 'asContextMenu') {
|
|
97
|
+
if (childOffset.left + 1 + overlayWidth <= clip.width) {
|
|
98
|
+
// 放右边
|
|
99
|
+
positionLeft = childOffset.left + 1;
|
|
100
|
+
}
|
|
101
|
+
else if (childOffset.left - overlayWidth >= 0) {
|
|
102
|
+
// 放左边
|
|
103
|
+
positionLeft = childOffset.left - overlayWidth;
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
// 兜底贴右边
|
|
107
|
+
positionLeft = Math.max(clip.width - overlayWidth, 10);
|
|
108
|
+
}
|
|
109
|
+
if (childOffset.top + 1 + overlayHeight <= clip.height) {
|
|
110
|
+
// 放下面
|
|
111
|
+
positionTop = childOffset.top + 1;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// 贴底边,预留5px避免完全贴底
|
|
115
|
+
positionTop = Math.max(clip.height - overlayHeight - 5, 10);
|
|
116
|
+
}
|
|
117
|
+
var _c = __read(customOffset, 2), _d = _c[0], offSetX_1 = _d === void 0 ? 0 : _d, _e = _c[1], offSetY_1 = _e === void 0 ? 0 : _e;
|
|
118
|
+
return {
|
|
119
|
+
positionLeft: (positionLeft + offSetX_1) / scaleX,
|
|
120
|
+
positionTop: (positionTop + offSetY_1) / scaleY,
|
|
121
|
+
arrowOffsetLeft: arrowOffsetLeft,
|
|
122
|
+
arrowOffsetTop: arrowOffsetTop,
|
|
123
|
+
activePlacement: activePlacement
|
|
124
|
+
};
|
|
125
|
+
}
|
|
89
126
|
if (~placement.indexOf('-')) {
|
|
90
127
|
var tests = placement.split(/\s+/);
|
|
91
128
|
// 收集可见方向
|
|
@@ -95,11 +132,11 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
95
132
|
// 自动对齐模式下,当四个方向都无法完全可见时
|
|
96
133
|
// 根据之前的计算结果,使用收集的可见方向作为兜底,避免完全不可见
|
|
97
134
|
if (isAuto && tests.length === 0) {
|
|
98
|
-
var
|
|
99
|
-
var
|
|
135
|
+
var _f = __read(autoDefaultPlacement.split('-'), 4), _atX = _f[0], _atY = _f[1], _myX = _f[2], _myY = _f[3];
|
|
136
|
+
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;
|
|
100
137
|
current = activePlacement = [atX_1, atY_1, myX_1, myY_1].join('-');
|
|
101
138
|
}
|
|
102
|
-
var
|
|
139
|
+
var _l = __read(current.split('-'), 4), atX = _l[0], atY = _l[1], myX = _l[2], myY = _l[3];
|
|
103
140
|
myX = myX || atX;
|
|
104
141
|
myY = myY || atY;
|
|
105
142
|
positionLeft =
|
|
@@ -132,14 +169,16 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
132
169
|
};
|
|
133
170
|
var visibleX = false;
|
|
134
171
|
var visibleY = false;
|
|
135
|
-
if (transformed.x
|
|
136
|
-
transformed.x + transformed.width <
|
|
172
|
+
if (transformed.x >= 0 &&
|
|
173
|
+
transformed.x + transformed.width <
|
|
174
|
+
window.innerWidth + scrollParent.scrollLeft) {
|
|
137
175
|
visibleX = true;
|
|
138
176
|
!visiblePlacement.atX && (visiblePlacement.atX = atX);
|
|
139
177
|
!visiblePlacement.myX && (visiblePlacement.myX = myX);
|
|
140
178
|
}
|
|
141
|
-
if (transformed.y
|
|
142
|
-
transformed.y + transformed.height <
|
|
179
|
+
if (transformed.y >= 0 &&
|
|
180
|
+
transformed.y + transformed.height <
|
|
181
|
+
window.innerHeight + scrollParent.scrollTop) {
|
|
143
182
|
visibleY = true;
|
|
144
183
|
!visiblePlacement.atY && (visiblePlacement.atY = atY);
|
|
145
184
|
!visiblePlacement.myY && (visiblePlacement.myY = myY);
|
|
@@ -148,9 +187,29 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
148
187
|
break;
|
|
149
188
|
}
|
|
150
189
|
else if (isAuto && tests.length === 0) {
|
|
151
|
-
//
|
|
152
|
-
|
|
153
|
-
|
|
190
|
+
// 获取相对定位的父元素位置
|
|
191
|
+
var offsetParent = overlayNode.offsetParent;
|
|
192
|
+
while (offsetParent &&
|
|
193
|
+
window.getComputedStyle(offsetParent).position === 'static') {
|
|
194
|
+
offsetParent = offsetParent.offsetParent;
|
|
195
|
+
}
|
|
196
|
+
var parentRect = (_a = offsetParent === null || offsetParent === void 0 ? void 0 : offsetParent.getBoundingClientRect) === null || _a === void 0 ? void 0 : _a.call(offsetParent);
|
|
197
|
+
var parentTransformed = {
|
|
198
|
+
x: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.x) || 0,
|
|
199
|
+
y: (parentRect === null || parentRect === void 0 ? void 0 : parentRect.y) || 0
|
|
200
|
+
};
|
|
201
|
+
// 如果是 auto 模式,且最后一个方向都不可见,则直接平移到可见区域,考虑相对定位的父元素位置,保留10px的边距
|
|
202
|
+
visibleY ||
|
|
203
|
+
(positionTop =
|
|
204
|
+
Math.max(10, window.innerHeight - transformed.height) +
|
|
205
|
+
scrollParent.scrollTop -
|
|
206
|
+
parentTransformed.y -
|
|
207
|
+
10);
|
|
208
|
+
visibleX ||
|
|
209
|
+
(positionLeft =
|
|
210
|
+
Math.max(10, window.innerWidth - transformed.width) +
|
|
211
|
+
scrollParent.scrollLeft -
|
|
212
|
+
parentTransformed.x);
|
|
154
213
|
}
|
|
155
214
|
}
|
|
156
215
|
}
|
|
@@ -195,7 +254,7 @@ function calculatePosition(placement, overlayNode, target, container, padding, c
|
|
|
195
254
|
else {
|
|
196
255
|
throw new Error("calcOverlayPosition(): No such placement of \"".concat(placement, "\" found."));
|
|
197
256
|
}
|
|
198
|
-
var
|
|
257
|
+
var _m = __read(customOffset, 2), _o = _m[0], offSetX = _o === void 0 ? 0 : _o, _p = _m[1], offSetY = _p === void 0 ? 0 : _p;
|
|
199
258
|
return {
|
|
200
259
|
positionLeft: (positionLeft + offSetX) / scaleX,
|
|
201
260
|
positionTop: (positionTop + offSetY) / scaleY,
|
package/esm/utils/errors.js
CHANGED
package/esm/utils/escapeHtml.js
CHANGED
package/esm/utils/filter.js
CHANGED
package/esm/utils/formula.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.
|
|
2
|
+
* amis-core v6.4.0
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -191,7 +191,7 @@ function isExpression(expression) {
|
|
|
191
191
|
}
|
|
192
192
|
// 备注1: "\\${xxx}"不作为表达式,至少含一个${xxx}才算是表达式
|
|
193
193
|
// 备注2: safari 不支持 /(?<!\\)(\${).+(\})/.test(expression)
|
|
194
|
-
return /(^|[^\\])\$\{
|
|
194
|
+
return /(^|[^\\])\$\{[\s\S]+\}/.test(expression);
|
|
195
195
|
}
|
|
196
196
|
// 用于判断是否需要执行表达式:
|
|
197
197
|
function isNeedFormula(expression, prevData, curData) {
|
package/esm/utils/getVariable.js
CHANGED
package/esm/utils/grammar.js
CHANGED
package/esm/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
|
+
}
|