amis-core 6.11.0-beta.0 → 6.11.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/Root.d.ts +3 -0
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.js +14 -8
- package/esm/SchemaRenderer.d.ts +2 -13
- package/esm/SchemaRenderer.js +36 -72
- package/esm/Scoped.js +1 -1
- package/esm/StatusScoped.js +1 -1
- package/esm/StyleManager.js +1 -1
- package/esm/WithRootStore.d.ts +1 -1
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.js +1 -1
- 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 +6 -2
- 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/EventAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/PrintAction.js +1 -1
- package/esm/actions/StatusAction.js +1 -1
- package/esm/actions/SwitchAction.js +1 -1
- package/esm/actions/ToastAction.js +1 -1
- package/esm/actions/WaitAction.js +1 -1
- package/esm/components/Animations.d.ts +8 -0
- package/esm/components/Animations.js +158 -0
- package/esm/components/CustomStyle.js +1 -1
- package/esm/components/ErrorBoundary.js +1 -1
- package/esm/components/LazyComponent.d.ts +1 -1
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.js +1 -1
- package/esm/components/PopOver.d.ts +1 -1
- package/esm/components/PopOver.js +1 -1
- package/esm/env.d.ts +1 -1
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.d.ts +1 -0
- package/esm/factory.js +1 -1
- package/esm/globalVar.d.ts +173 -0
- package/esm/globalVar.js +122 -0
- package/esm/globalVarClientHandler.d.ts +1 -0
- package/esm/globalVarClientHandler.js +65 -0
- package/esm/globalVarDefaultValueHandler.d.ts +1 -0
- package/esm/globalVarDefaultValueHandler.js +28 -0
- package/esm/index.d.ts +3 -0
- package/esm/index.js +8 -5
- package/esm/locale.d.ts +1 -1
- package/esm/locale.js +1 -1
- package/esm/polyfills.js +1 -1
- package/esm/renderers/Form.d.ts +3 -1
- package/esm/renderers/Form.js +39 -24
- package/esm/renderers/Item.d.ts +11 -17
- package/esm/renderers/Item.js +17 -2
- package/esm/renderers/Options.js +1 -1
- 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 +1 -1
- package/esm/renderers/wrapControl.js +1 -1
- package/esm/store/app.js +1 -1
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +8 -0
- package/esm/store/crud.js +24 -17
- package/esm/store/form.js +14 -5
- package/esm/store/formItem.js +1 -1
- package/esm/store/iRenderer.js +1 -1
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +14 -1
- package/esm/store/list.js +45 -17
- 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.d.ts +14 -0
- package/esm/store/root.js +483 -12
- package/esm/store/service.js +1 -1
- package/esm/store/status.js +1 -1
- package/esm/store/table.d.ts +16 -2
- package/esm/store/table.js +83 -26
- package/esm/store/table2.js +1 -1
- package/esm/theme.d.ts +1 -1
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +3 -2
- package/esm/utils/Animation.js +1 -1
- package/esm/utils/ColorScale.js +1 -1
- package/esm/utils/DataSchema.js +1 -1
- package/esm/utils/DataScope.js +1 -1
- package/esm/utils/RootClose.js +1 -1
- package/esm/utils/SimpleMap.js +1 -1
- package/esm/utils/animations.d.ts +4 -0
- package/esm/utils/animations.js +1 -1
- package/esm/utils/api.d.ts +1 -0
- package/esm/utils/api.js +18 -6
- 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.js +1 -1
- package/esm/utils/errors.js +1 -1
- package/esm/utils/escapeHtml.js +1 -1
- package/esm/utils/filter-schema.js +1 -1
- package/esm/utils/filter.js +1 -1
- package/esm/utils/formatDuration.js +1 -1
- package/esm/utils/formula.js +1 -1
- package/esm/utils/getVariable.js +1 -1
- package/esm/utils/grammar.js +1 -1
- package/esm/utils/handleAction.js +1 -1
- package/esm/utils/helper.d.ts +5 -0
- package/esm/utils/helper.js +6 -2
- 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/loopTooMuch.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.js +1 -1
- 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.js +1 -1
- package/esm/utils/style-helper.js +1 -1
- 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 +1 -1
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validateId.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/esm/utils/visitedCache.js +1 -1
- package/lib/Root.d.ts +3 -0
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +13 -7
- package/lib/SchemaRenderer.d.ts +2 -13
- package/lib/SchemaRenderer.js +35 -71
- package/lib/Scoped.js +1 -1
- package/lib/StatusScoped.js +1 -1
- package/lib/StyleManager.js +1 -1
- package/lib/WithRootStore.d.ts +1 -1
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.js +1 -1
- 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 +6 -2
- 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/EventAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/PrintAction.js +1 -1
- package/lib/actions/StatusAction.js +1 -1
- package/lib/actions/SwitchAction.js +1 -1
- package/lib/actions/ToastAction.js +1 -1
- package/lib/actions/WaitAction.js +1 -1
- package/lib/components/Animations.d.ts +8 -0
- package/lib/components/Animations.js +172 -0
- package/lib/components/CustomStyle.js +1 -1
- package/lib/components/ErrorBoundary.js +1 -1
- package/lib/components/LazyComponent.d.ts +1 -1
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.js +1 -1
- package/lib/components/PopOver.d.ts +1 -1
- package/lib/components/PopOver.js +1 -1
- package/lib/env.d.ts +1 -1
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.d.ts +1 -0
- package/lib/factory.js +1 -1
- package/lib/globalVar.d.ts +173 -0
- package/lib/globalVar.js +130 -0
- package/lib/globalVarClientHandler.d.ts +1 -0
- package/lib/globalVarClientHandler.js +67 -0
- package/lib/globalVarDefaultValueHandler.d.ts +1 -0
- package/lib/globalVarDefaultValueHandler.js +30 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +13 -4
- package/lib/locale.d.ts +1 -1
- package/lib/locale.js +1 -1
- package/lib/polyfills.js +1 -1
- package/lib/renderers/Form.d.ts +3 -1
- package/lib/renderers/Form.js +37 -21
- package/lib/renderers/Item.d.ts +11 -17
- package/lib/renderers/Item.js +17 -2
- package/lib/renderers/Options.js +1 -1
- 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 +1 -1
- package/lib/renderers/wrapControl.js +1 -1
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +24 -25
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +8 -0
- package/lib/store/crud.js +23 -16
- package/lib/store/form.d.ts +10 -11
- package/lib/store/form.js +14 -5
- package/lib/store/formItem.js +1 -1
- package/lib/store/iRenderer.js +1 -1
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +14 -1
- package/lib/store/list.js +44 -16
- 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.d.ts +13 -0
- package/lib/store/root.js +487 -11
- package/lib/store/service.js +1 -1
- package/lib/store/status.js +1 -1
- package/lib/store/table.d.ts +36 -23
- package/lib/store/table.js +82 -25
- package/lib/store/table2.js +1 -1
- package/lib/theme.d.ts +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +3 -2
- package/lib/utils/Animation.js +1 -1
- package/lib/utils/ColorScale.js +1 -1
- package/lib/utils/DataSchema.js +1 -1
- package/lib/utils/DataScope.js +1 -1
- package/lib/utils/RootClose.js +1 -1
- package/lib/utils/SimpleMap.js +1 -1
- package/lib/utils/animations.d.ts +4 -0
- package/lib/utils/animations.js +1 -1
- package/lib/utils/api.d.ts +1 -0
- package/lib/utils/api.js +18 -5
- 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.js +1 -1
- package/lib/utils/errors.js +1 -1
- package/lib/utils/escapeHtml.js +1 -1
- package/lib/utils/filter-schema.js +1 -1
- package/lib/utils/filter.js +1 -1
- package/lib/utils/formatDuration.js +1 -1
- package/lib/utils/formula.js +1 -1
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.d.ts +5 -0
- package/lib/utils/helper.js +6 -2
- 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/loopTooMuch.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.js +1 -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.js +1 -1
- package/lib/utils/style-helper.js +1 -1
- 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 +1 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validateId.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/lib/utils/visitedCache.js +1 -1
- package/package.json +2 -2
package/esm/store/table.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.11.0-beta.
|
|
2
|
+
* amis-core v6.11.0-beta.2
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -17,7 +17,7 @@ import 'lodash/isPlainObject';
|
|
|
17
17
|
import '../utils/filter.js';
|
|
18
18
|
import isEqual from 'lodash/isEqual';
|
|
19
19
|
import sortBy from 'lodash/sortBy';
|
|
20
|
-
import { immutableExtends, flattenTree, findTree, eachTree, guid, isVisible, hasVisibleExpression, isBreakpoint, difference, sortArray } from '../utils/helper.js';
|
|
20
|
+
import { immutableExtends, flattenTree, findTree, eachTree, findTreeIndex, guid, isVisible, hasVisibleExpression, isBreakpoint, difference, sortArray } from '../utils/helper.js';
|
|
21
21
|
import { evalExpression } from '../utils/tpl.js';
|
|
22
22
|
import { getStoreById } from './manager.js';
|
|
23
23
|
|
|
@@ -230,14 +230,9 @@ var Row = types
|
|
|
230
230
|
}
|
|
231
231
|
var table = getParent(self, self.depth * 2);
|
|
232
232
|
var parent = getParent(self, 2);
|
|
233
|
-
return createObject(extendObject(getParent(self, self.depth * 2).data, {
|
|
234
|
-
index: self.index,
|
|
233
|
+
return createObject(extendObject(getParent(self, self.depth * 2).data, __assign({ index: self.index, path: self.path,
|
|
235
234
|
// todo 以后再支持多层,目前先一层
|
|
236
|
-
parent: parent.storeType === Row.name ? parent.data : undefined,
|
|
237
|
-
// 只有table时,也可以获取选中行
|
|
238
|
-
selectedItems: table.selectedRows.map(function (item) { return item.data; }),
|
|
239
|
-
unSelectedItems: table.unSelectedRows.map(function (item) { return item.data; })
|
|
240
|
-
}), children
|
|
235
|
+
parent: parent.storeType === Row.name ? parent.data : undefined }, table.eventContext)), children
|
|
241
236
|
? __assign(__assign({}, self.data), { children: children }) : self.data);
|
|
242
237
|
},
|
|
243
238
|
get checkable() {
|
|
@@ -287,8 +282,12 @@ var Row = types
|
|
|
287
282
|
var table = self.table;
|
|
288
283
|
var row = self;
|
|
289
284
|
table.toggle(row, checked);
|
|
290
|
-
|
|
291
|
-
|
|
285
|
+
// 多选才需要处理祖先和后代
|
|
286
|
+
// 单选只处理自己就行了
|
|
287
|
+
if (table.multiple) {
|
|
288
|
+
table.toggleAncestors(row);
|
|
289
|
+
table.toggleDescendants(row, checked);
|
|
290
|
+
}
|
|
292
291
|
},
|
|
293
292
|
toggleExpanded: function () {
|
|
294
293
|
getParent(self, self.depth * 2).toggleExpanded(self);
|
|
@@ -297,8 +296,16 @@ var Row = types
|
|
|
297
296
|
getParent(self, self.depth * 2).setExpanded(self, expanded);
|
|
298
297
|
},
|
|
299
298
|
change: function (values, savePristine) {
|
|
300
|
-
|
|
301
|
-
|
|
299
|
+
var data = immutableExtends(self.data, values);
|
|
300
|
+
Object.isExtensible(data) &&
|
|
301
|
+
Object.defineProperty(data, '__pristine', {
|
|
302
|
+
value: savePristine ? data : self.pristine,
|
|
303
|
+
enumerable: false,
|
|
304
|
+
configurable: false,
|
|
305
|
+
writable: false
|
|
306
|
+
});
|
|
307
|
+
self.data = data;
|
|
308
|
+
savePristine && (self.pristine = data);
|
|
302
309
|
},
|
|
303
310
|
reset: function () {
|
|
304
311
|
self.newIndex = self.index;
|
|
@@ -360,9 +367,17 @@ var Row = types
|
|
|
360
367
|
},
|
|
361
368
|
updateData: function (_a) {
|
|
362
369
|
var children = _a.children, rest = __rest(_a, ["children"]);
|
|
363
|
-
|
|
370
|
+
var data = __assign(__assign({}, self.data), rest);
|
|
371
|
+
Object.isExtensible(data) &&
|
|
372
|
+
Object.defineProperty(data, '__pristine', {
|
|
373
|
+
value: self.data.__pristine || self.pristine,
|
|
374
|
+
enumerable: false,
|
|
375
|
+
configurable: false,
|
|
376
|
+
writable: false
|
|
377
|
+
});
|
|
378
|
+
self.data = data;
|
|
364
379
|
if (Array.isArray(children)) {
|
|
365
|
-
this.replaceChildren(initChildren(children, self.depth, self.index, self.id, self.path));
|
|
380
|
+
this.replaceChildren(initChildren(children, self.depth, self.index, self.id, "".concat(self.path, ".")));
|
|
366
381
|
}
|
|
367
382
|
}
|
|
368
383
|
}); });
|
|
@@ -371,6 +386,11 @@ var TableStore = iRendererStore
|
|
|
371
386
|
.props({
|
|
372
387
|
columns: types.array(Column),
|
|
373
388
|
rows: types.array(Row),
|
|
389
|
+
// 记录原始列表和原始选中的列表
|
|
390
|
+
// 因为如果是前端分页,上层 crud 或者 input-table 下发到这层的
|
|
391
|
+
// 是某个页区间的数据,这个时候 items 和 selectedItems 会少很多条
|
|
392
|
+
fullItems: types.optional(types.array(types.frozen()), []),
|
|
393
|
+
fullSelectedItems: types.optional(types.array(types.frozen()), []),
|
|
374
394
|
selectedRows: types.array(types.reference(Row)),
|
|
375
395
|
expandedRows: types.array(types.string),
|
|
376
396
|
primaryField: 'id',
|
|
@@ -381,6 +401,7 @@ var TableStore = iRendererStore
|
|
|
381
401
|
draggable: false,
|
|
382
402
|
dragging: false,
|
|
383
403
|
selectable: false,
|
|
404
|
+
showIndex: false,
|
|
384
405
|
multiple: true,
|
|
385
406
|
footable: types.frozen(),
|
|
386
407
|
expandConfig: types.frozen(),
|
|
@@ -504,13 +525,6 @@ var TableStore = iRendererStore
|
|
|
504
525
|
function getUnSelectedRows() {
|
|
505
526
|
return flattenTree(self.rows).filter(function (item) { return !item.checked; });
|
|
506
527
|
}
|
|
507
|
-
function getData(superData) {
|
|
508
|
-
return createObject(superData, {
|
|
509
|
-
items: self.rows.map(function (item) { return item.data; }),
|
|
510
|
-
selectedItems: self.selectedRows.map(function (item) { return item.data; }),
|
|
511
|
-
unSelectedItems: getUnSelectedRows().map(function (item) { return item.data; })
|
|
512
|
-
});
|
|
513
|
-
}
|
|
514
528
|
function hasColumnHidden() {
|
|
515
529
|
return self.columns.findIndex(function (column) { return !column.toggled; }) !== -1;
|
|
516
530
|
}
|
|
@@ -684,7 +698,9 @@ var TableStore = iRendererStore
|
|
|
684
698
|
get firstToggledColumnIndex() {
|
|
685
699
|
return getFirstToggledColumnIndex();
|
|
686
700
|
},
|
|
687
|
-
getData:
|
|
701
|
+
getData: function (superData) {
|
|
702
|
+
return createObject(superData, this.eventContext);
|
|
703
|
+
},
|
|
688
704
|
get columnGroup() {
|
|
689
705
|
return getColumnGroup();
|
|
690
706
|
},
|
|
@@ -777,6 +793,37 @@ var TableStore = iRendererStore
|
|
|
777
793
|
column.realWidth + 'px';
|
|
778
794
|
});
|
|
779
795
|
return style;
|
|
796
|
+
},
|
|
797
|
+
/**
|
|
798
|
+
* 构建事件的上下文数据
|
|
799
|
+
* @param buildChain
|
|
800
|
+
* @returns
|
|
801
|
+
*/
|
|
802
|
+
get eventContext() {
|
|
803
|
+
var context = {
|
|
804
|
+
selectedItems: self.selectedRows.map(function (item) { return item.data; }),
|
|
805
|
+
selectedIndexes: self.selectedRows.map(function (item) { return item.path; }),
|
|
806
|
+
items: self.rows.map(function (item) { return item.data; }),
|
|
807
|
+
unSelectedItems: this.unSelectedRows.map(function (item) { return item.data; })
|
|
808
|
+
};
|
|
809
|
+
// 如果是前端分页情况,需要根据全量数据计算
|
|
810
|
+
// 如果不是前端分页,数据都没有返回,那种就没办法支持全量数据信息了
|
|
811
|
+
if (self.fullItems.length > self.rows.length) {
|
|
812
|
+
// todo 这里的选择顺序会一直变,这个有影响吗?
|
|
813
|
+
var selectedItems_1 = self.fullSelectedItems
|
|
814
|
+
.filter(function (item) {
|
|
815
|
+
return !self.rows.find(function (row) { return row.pristine === (item.__pristine || item); });
|
|
816
|
+
})
|
|
817
|
+
.concat(context.selectedItems);
|
|
818
|
+
context.selectedItems = selectedItems_1;
|
|
819
|
+
context.items = self.fullItems.concat();
|
|
820
|
+
context.unSelectedItems = self.fullItems.filter(function (item) { return !selectedItems_1.includes(item); });
|
|
821
|
+
context.selectedIndexes = selectedItems_1.map(function (item) {
|
|
822
|
+
var _a;
|
|
823
|
+
return ((_a = findTreeIndex(self.fullItems, function (i) { return (item.__pristine || item) === (i.__pristine || i); })) === null || _a === void 0 ? void 0 : _a.join('.')) || '-1';
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
return context;
|
|
780
827
|
}
|
|
781
828
|
};
|
|
782
829
|
})
|
|
@@ -835,6 +882,7 @@ var TableStore = iRendererStore
|
|
|
835
882
|
(self.lazyRenderAfter = config.lazyRenderAfter);
|
|
836
883
|
typeof config.tableLayout === 'string' &&
|
|
837
884
|
(self.tableLayout = config.tableLayout);
|
|
885
|
+
config.showIndex !== undefined && (self.showIndex = config.showIndex);
|
|
838
886
|
if (config.columns && Array.isArray(config.columns)) {
|
|
839
887
|
var columns = config.columns
|
|
840
888
|
.map(function (column) {
|
|
@@ -876,6 +924,12 @@ var TableStore = iRendererStore
|
|
|
876
924
|
label: '空'
|
|
877
925
|
});
|
|
878
926
|
}
|
|
927
|
+
if (self.showIndex) {
|
|
928
|
+
columns.unshift({
|
|
929
|
+
type: '__index',
|
|
930
|
+
width: 50
|
|
931
|
+
});
|
|
932
|
+
}
|
|
879
933
|
columns.unshift({
|
|
880
934
|
type: '__expandme',
|
|
881
935
|
toggable: false,
|
|
@@ -1052,7 +1106,7 @@ var TableStore = iRendererStore
|
|
|
1052
1106
|
}
|
|
1053
1107
|
return combineCell(arr, keys);
|
|
1054
1108
|
}
|
|
1055
|
-
function initRows(rows, getEntryId, reUseRow) {
|
|
1109
|
+
function initRows(rows, getEntryId, reUseRow, fullItems, fullSelectedItems) {
|
|
1056
1110
|
self.selectedRows.clear();
|
|
1057
1111
|
// self.expandedRows.clear();
|
|
1058
1112
|
/* 避免输入内容为非数组挂掉 */
|
|
@@ -1072,7 +1126,7 @@ var TableStore = iRendererStore
|
|
|
1072
1126
|
depth: 1,
|
|
1073
1127
|
index: index,
|
|
1074
1128
|
newIndex: index,
|
|
1075
|
-
pristine: item,
|
|
1129
|
+
pristine: item.__pristine || item,
|
|
1076
1130
|
path: "".concat(index),
|
|
1077
1131
|
data: item,
|
|
1078
1132
|
rowSpans: {},
|
|
@@ -1111,6 +1165,9 @@ var TableStore = iRendererStore
|
|
|
1111
1165
|
}
|
|
1112
1166
|
}
|
|
1113
1167
|
self.dragging = false;
|
|
1168
|
+
Array.isArray(fullItems) && self.fullItems.replace(fullItems);
|
|
1169
|
+
Array.isArray(fullSelectedItems) &&
|
|
1170
|
+
self.fullSelectedItems.replace(fullSelectedItems);
|
|
1114
1171
|
}
|
|
1115
1172
|
// 获取所有层级的子节点id
|
|
1116
1173
|
function getExpandAllRows(arr) {
|
|
@@ -1306,7 +1363,7 @@ var TableStore = iRendererStore
|
|
|
1306
1363
|
return;
|
|
1307
1364
|
}
|
|
1308
1365
|
var maxLength = self.getSelectionUpperLimit();
|
|
1309
|
-
var selectedItems = self.data
|
|
1366
|
+
var selectedItems = self.selectedRows.map(function (item) { return item.data; });
|
|
1310
1367
|
self.selectedRows.map(function (item) { return item.setCheckdisable(false); });
|
|
1311
1368
|
if (maxLength !== Infinity && maxLength <= selectedItems.length) {
|
|
1312
1369
|
self.unSelectedRows.map(function (item) { return !item.checked && item.setCheckdisable(true); });
|
package/esm/store/table2.js
CHANGED
package/esm/theme.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export declare function themeable<T extends React.ComponentType<React.ComponentP
|
|
|
67
67
|
componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
68
68
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof ThemeProps>> & ThemeOuterProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
69
69
|
};
|
|
70
|
-
displayName:
|
|
70
|
+
displayName: string;
|
|
71
71
|
contextType: React.Context<string>;
|
|
72
72
|
ComposedComponent: React.ComponentType<T>;
|
|
73
73
|
} & hoistNonReactStatic.NonReactStatics<T, {}> & {
|
package/esm/theme.js
CHANGED
package/esm/types.d.ts
CHANGED
|
@@ -2,7 +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
|
+
import type { TestIdBuilder, ValidateError } from './utils/helper';
|
|
6
6
|
import { AnimationsProps } from './utils/animations';
|
|
7
7
|
export interface Option {
|
|
8
8
|
/**
|
|
@@ -281,7 +281,7 @@ export interface Definitions {
|
|
|
281
281
|
[propName: string]: SchemaNode;
|
|
282
282
|
}
|
|
283
283
|
export interface ActionObject extends ButtonObject {
|
|
284
|
-
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';
|
|
284
|
+
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' | 'clearError';
|
|
285
285
|
api?: BaseApiObject | string;
|
|
286
286
|
asyncApi?: BaseApiObject | string;
|
|
287
287
|
payload?: any;
|
|
@@ -390,6 +390,7 @@ export type ToastConf = {
|
|
|
390
390
|
className?: string;
|
|
391
391
|
items?: Array<any>;
|
|
392
392
|
useMobileUI?: boolean;
|
|
393
|
+
validateError?: ValidateError;
|
|
393
394
|
};
|
|
394
395
|
export interface OptionProps {
|
|
395
396
|
className?: 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
|
@@ -3,6 +3,8 @@ export interface AnimationsProps {
|
|
|
3
3
|
type: string;
|
|
4
4
|
duration?: number;
|
|
5
5
|
delay?: number;
|
|
6
|
+
repeat?: boolean;
|
|
7
|
+
inView?: boolean;
|
|
6
8
|
};
|
|
7
9
|
attention?: {
|
|
8
10
|
type: string;
|
|
@@ -14,6 +16,8 @@ export interface AnimationsProps {
|
|
|
14
16
|
type: string;
|
|
15
17
|
duration?: number;
|
|
16
18
|
delay?: number;
|
|
19
|
+
repeat?: boolean;
|
|
20
|
+
outView?: boolean;
|
|
17
21
|
};
|
|
18
22
|
}
|
|
19
23
|
export declare function createAnimationStyle(id: string, animationsConfig: AnimationsProps): void;
|
package/esm/utils/animations.js
CHANGED
package/esm/utils/api.d.ts
CHANGED
|
@@ -48,6 +48,7 @@ export declare function isApiOutdatedWithData(prevApi: Api | undefined, nextApi:
|
|
|
48
48
|
export declare function isApiOutdated(prevApi: Api | undefined, nextApi: Api | undefined, prevData: any, nextData: any): nextApi is Api;
|
|
49
49
|
export declare function isValidApi(api: string): boolean;
|
|
50
50
|
export declare function isEffectiveApi(api?: Api, data?: any, initFetch?: boolean, initFetchOn?: string): api is Api;
|
|
51
|
+
export declare function shouldBlockedBySendOnApi(api?: Api, data?: any): boolean;
|
|
51
52
|
export declare function isSameApi(apiA: ApiObject | ApiCacheConfig, apiB: ApiObject | ApiCacheConfig): boolean;
|
|
52
53
|
export declare function getApiCache(api: ApiObject): ApiCacheConfig | undefined;
|
|
53
54
|
export declare function setApiCache(api: ApiObject, promise: Promise<any>): Promise<any>;
|
package/esm/utils/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.11.0-beta.
|
|
2
|
+
* amis-core v6.11.0-beta.2
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -158,9 +158,13 @@ function buildApi(api, data, options) {
|
|
|
158
158
|
}
|
|
159
159
|
return apiObject;
|
|
160
160
|
};
|
|
161
|
+
var queryMapped = false;
|
|
161
162
|
if (~idx) {
|
|
162
163
|
var hashIdx = url.indexOf('#');
|
|
163
164
|
var params = qsparse(url.substring(idx + 1, ~hashIdx && hashIdx > idx ? hashIdx : undefined));
|
|
165
|
+
// 合并 api.query 的配置
|
|
166
|
+
params = dataMapping(Object.assign(params, api.query), data, undefined, api.convertKeyToPath);
|
|
167
|
+
queryMapped = true;
|
|
164
168
|
// 将里面的表达式运算完
|
|
165
169
|
JSONTraverse(params, function (value, key, host) {
|
|
166
170
|
var _a;
|
|
@@ -172,13 +176,12 @@ function buildApi(api, data, options) {
|
|
|
172
176
|
host[key] = replaceExpression(host[key], 'raw', '');
|
|
173
177
|
}
|
|
174
178
|
});
|
|
179
|
+
api.query = params;
|
|
175
180
|
var left = replaceExpression(url.substring(0, idx), 'raw', '');
|
|
176
|
-
// 追加
|
|
177
|
-
Object.assign(params, api.query);
|
|
178
181
|
api.url =
|
|
179
182
|
left +
|
|
180
183
|
(~left.indexOf('?') ? '&' : '?') +
|
|
181
|
-
queryStringify(
|
|
184
|
+
queryStringify(api.query) +
|
|
182
185
|
(~hashIdx && hashIdx > idx
|
|
183
186
|
? replaceExpression(url.substring(hashIdx))
|
|
184
187
|
: '');
|
|
@@ -199,7 +202,7 @@ function buildApi(api, data, options) {
|
|
|
199
202
|
api.body = api.data = data;
|
|
200
203
|
}
|
|
201
204
|
// 给 query 做数据映射
|
|
202
|
-
if (api.query) {
|
|
205
|
+
if (api.query && !queryMapped) {
|
|
203
206
|
api.query = dataMapping(api.query, data, undefined, api.convertKeyToPath);
|
|
204
207
|
}
|
|
205
208
|
// get 类请求,把 data 附带到 url 上。
|
|
@@ -767,6 +770,15 @@ function isEffectiveApi(api, data, initFetch, initFetchOn) {
|
|
|
767
770
|
}
|
|
768
771
|
return false;
|
|
769
772
|
}
|
|
773
|
+
// 判断api是否存在,且SendOn为不发送
|
|
774
|
+
function shouldBlockedBySendOnApi(api, data) {
|
|
775
|
+
if (isObject(api) && api.url) {
|
|
776
|
+
if (api.sendOn && data) {
|
|
777
|
+
return !evalExpression(api.sendOn, data);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
770
782
|
function isSameApi(apiA, apiB) {
|
|
771
783
|
return (apiA.method === apiB.method &&
|
|
772
784
|
apiA.url === apiB.url &&
|
|
@@ -812,4 +824,4 @@ function normalizeApiResponseData(data) {
|
|
|
812
824
|
}
|
|
813
825
|
// window.apiCaches = apiCaches;
|
|
814
826
|
|
|
815
|
-
export { addApiRequestAdaptor, addApiResponseAdaptor, addApiResponseAdator, buildApi, callStrFunction, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, removeApiRequestAdaptor, removeApiResponseAdaptor, responseAdaptor, setApiCache, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher };
|
|
827
|
+
export { addApiRequestAdaptor, addApiResponseAdaptor, addApiResponseAdator, buildApi, callStrFunction, clearApiCache, getApiCache, isApiOutdated, isApiOutdatedWithData, isEffectiveApi, isSameApi, isValidApi, jsFetcher, jsonpFetcher, normalizeApi, normalizeApiResponseData, removeApiRequestAdaptor, removeApiResponseAdaptor, responseAdaptor, setApiCache, shouldBlockedBySendOnApi, str2AsyncFunction, str2function, wrapAdaptor, wrapFetcher };
|
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.js
CHANGED
package/esm/utils/errors.js
CHANGED
package/esm/utils/escapeHtml.js
CHANGED
package/esm/utils/filter.js
CHANGED
package/esm/utils/formula.js
CHANGED
package/esm/utils/getVariable.js
CHANGED
package/esm/utils/grammar.js
CHANGED
package/esm/utils/helper.d.ts
CHANGED
|
@@ -293,8 +293,13 @@ export declare class ValidateError extends Error {
|
|
|
293
293
|
detail: {
|
|
294
294
|
[propName: string]: Array<string> | string;
|
|
295
295
|
};
|
|
296
|
+
rawError?: {
|
|
297
|
+
[propName: string]: any;
|
|
298
|
+
};
|
|
296
299
|
constructor(message: string, error: {
|
|
297
300
|
[propName: string]: Array<string> | string;
|
|
301
|
+
}, rawError?: {
|
|
302
|
+
[propName: string]: any;
|
|
298
303
|
});
|
|
299
304
|
}
|
|
300
305
|
/**
|
package/esm/utils/helper.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v6.11.0-beta.
|
|
2
|
+
* amis-core v6.11.0-beta.2
|
|
3
3
|
* Copyright 2018-2024 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -1218,11 +1218,12 @@ var SkipOperation = /** @class */ (function (_super) {
|
|
|
1218
1218
|
}(Error));
|
|
1219
1219
|
var ValidateError = /** @class */ (function (_super) {
|
|
1220
1220
|
__extends(ValidateError, _super);
|
|
1221
|
-
function ValidateError(message, error) {
|
|
1221
|
+
function ValidateError(message, error, rawError) {
|
|
1222
1222
|
var _this = _super.call(this) || this;
|
|
1223
1223
|
_this.name = 'ValidateError';
|
|
1224
1224
|
_this.message = message;
|
|
1225
1225
|
_this.detail = error;
|
|
1226
|
+
_this.rawError = rawError;
|
|
1226
1227
|
return _this;
|
|
1227
1228
|
}
|
|
1228
1229
|
return ValidateError;
|
|
@@ -1731,6 +1732,9 @@ function supportsMjs() {
|
|
|
1731
1732
|
}
|
|
1732
1733
|
}
|
|
1733
1734
|
function formateId(id) {
|
|
1735
|
+
if (!id) {
|
|
1736
|
+
return guid();
|
|
1737
|
+
}
|
|
1734
1738
|
// 将className非法字符替换为短横线
|
|
1735
1739
|
id = id.replace(/[^a-zA-Z0-9-]/g, '-');
|
|
1736
1740
|
// 将连续的-替换为单个-
|
package/esm/utils/highlight.js
CHANGED
package/esm/utils/icon.js
CHANGED