amis-core 2.8.0 → 2.9.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.d.ts +1 -1
- package/esm/Root.js +1 -1
- package/esm/RootRenderer.d.ts +1 -1
- package/esm/RootRenderer.js +21 -4
- package/esm/SchemaRenderer.d.ts +2 -1
- package/esm/SchemaRenderer.js +1 -1
- package/esm/Scoped.js +30 -2
- package/esm/WithRootStore.d.ts +4 -8
- package/esm/WithRootStore.js +1 -1
- package/esm/WithStore.js +1 -1
- package/esm/actions/Action.d.ts +2 -1
- package/esm/actions/Action.js +33 -11
- package/esm/actions/AjaxAction.js +1 -1
- package/esm/actions/BreakAction.js +1 -1
- package/esm/actions/BroadcastAction.js +1 -1
- package/esm/actions/CmptAction.js +1 -1
- package/esm/actions/ContinueAction.js +1 -1
- package/esm/actions/CopyAction.js +1 -1
- package/esm/actions/CustomAction.js +2 -1
- package/esm/actions/DialogAction.d.ts +1 -1
- package/esm/actions/DialogAction.js +8 -3
- package/esm/actions/DrawerAction.js +1 -1
- package/esm/actions/EmailAction.js +1 -1
- package/esm/actions/LinkAction.js +1 -1
- package/esm/actions/LoopAction.js +1 -1
- package/esm/actions/PageAction.js +1 -1
- package/esm/actions/ParallelAction.js +1 -1
- package/esm/actions/SwitchAction.js +18 -15
- package/esm/actions/ToastAction.js +1 -1
- package/esm/components/LazyComponent.d.ts +3 -3
- package/esm/components/LazyComponent.js +1 -1
- package/esm/components/Overlay.d.ts +1 -1
- package/esm/components/Overlay.js +2 -1
- package/esm/components/PopOver.d.ts +2 -4
- package/esm/components/PopOver.js +2 -1
- package/esm/env.d.ts +3 -7
- package/esm/env.js +1 -1
- package/esm/envOverwrite.js +1 -1
- package/esm/factory.js +3 -1
- package/esm/index.d.ts +2 -3
- package/esm/index.js +7 -5
- package/esm/locale.d.ts +1 -3
- package/esm/locale.js +1 -1
- package/esm/renderers/Form.js +17 -15
- package/esm/renderers/Item.d.ts +9 -15
- package/esm/renderers/Item.js +2 -1
- package/esm/renderers/Options.js +2 -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 +4 -8
- package/esm/renderers/wrapControl.js +21 -30
- package/esm/store/app.d.ts +4 -2
- package/esm/store/app.js +1 -1
- package/esm/store/combo.d.ts +12 -6
- package/esm/store/combo.js +1 -1
- package/esm/store/crud.d.ts +5 -2
- package/esm/store/crud.js +32 -12
- package/esm/store/form.d.ts +4 -2
- package/esm/store/form.js +1 -1
- package/esm/store/formItem.js +5 -4
- package/esm/store/iRenderer.d.ts +5 -2
- package/esm/store/iRenderer.js +15 -3
- package/esm/store/index.js +1 -1
- package/esm/store/list.d.ts +4 -2
- package/esm/store/list.js +5 -5
- package/esm/store/manager.js +1 -1
- package/esm/store/modal.d.ts +4 -2
- package/esm/store/modal.js +1 -1
- package/esm/store/node.js +1 -1
- package/esm/store/pagination.d.ts +4 -2
- package/esm/store/pagination.js +1 -1
- package/esm/store/root.d.ts +4 -2
- package/esm/store/root.js +1 -1
- package/esm/store/service.d.ts +4 -2
- package/esm/store/service.js +1 -1
- package/esm/store/table.d.ts +12 -6
- package/esm/store/table.js +12 -2
- package/esm/store/table2.d.ts +4 -2
- package/esm/store/table2.js +1 -1
- package/esm/theme.d.ts +2 -4
- package/esm/theme.js +1 -1
- package/esm/types.d.ts +39 -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/api.js +3 -4
- package/esm/utils/attachmentAdpator.js +1 -1
- package/esm/utils/autobind.js +1 -1
- package/esm/utils/columnsSplit.js +1 -1
- package/esm/utils/dataMapping.js +1 -1
- package/esm/utils/date.js +1 -1
- package/esm/utils/debug.d.ts +1 -0
- 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.d.ts +1 -0
- package/esm/utils/formula.js +6 -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.js +1 -1
- package/esm/utils/highlight.js +1 -1
- package/esm/utils/icon.js +1 -1
- package/esm/utils/image.js +1 -1
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/isPureVariable.js +1 -1
- package/esm/utils/json-schema-2-amis-schema.js +1 -1
- package/esm/utils/keyToPath.js +1 -1
- package/esm/utils/makeSorter.js +1 -1
- package/esm/utils/normalizeLink.js +1 -1
- package/esm/utils/normalizeOptions.js +1 -1
- package/esm/utils/object.js +1 -1
- package/esm/utils/offset.js +1 -1
- package/esm/utils/offsetParent.js +1 -1
- package/esm/utils/optionValueCompare.js +7 -3
- package/esm/utils/position.js +1 -1
- package/esm/utils/prettyBytes.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.d.ts +5 -0
- package/esm/utils/resolveCondition.js +306 -0
- package/esm/utils/resolveVariable.js +1 -1
- package/esm/utils/resolveVariableAndFilter.js +1 -1
- package/esm/utils/resolveVariableAndFilterForAsync.d.ts +1 -0
- package/esm/utils/resolveVariableAndFilterForAsync.js +46 -0
- 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.d.ts +7 -0
- package/esm/utils/tpl.js +23 -3
- package/esm/utils/uncontrollable.js +1 -1
- package/esm/utils/validations.js +1 -1
- package/lib/Root.d.ts +1 -1
- package/lib/Root.js +1 -1
- package/lib/RootRenderer.d.ts +1 -1
- package/lib/RootRenderer.js +21 -4
- package/lib/SchemaRenderer.d.ts +2 -1
- package/lib/SchemaRenderer.js +1 -1
- package/lib/Scoped.js +30 -2
- package/lib/WithRootStore.d.ts +4 -8
- package/lib/WithRootStore.js +1 -1
- package/lib/WithStore.js +1 -1
- package/lib/actions/Action.d.ts +2 -1
- package/lib/actions/Action.js +32 -10
- package/lib/actions/AjaxAction.js +1 -1
- package/lib/actions/BreakAction.js +1 -1
- package/lib/actions/BroadcastAction.js +1 -1
- package/lib/actions/CmptAction.js +1 -1
- package/lib/actions/ContinueAction.js +1 -1
- package/lib/actions/CopyAction.js +1 -1
- package/lib/actions/CustomAction.js +2 -1
- package/lib/actions/DialogAction.d.ts +1 -1
- package/lib/actions/DialogAction.js +8 -3
- package/lib/actions/DrawerAction.js +1 -1
- package/lib/actions/EmailAction.js +1 -1
- package/lib/actions/LinkAction.js +1 -1
- package/lib/actions/LoopAction.js +1 -1
- package/lib/actions/PageAction.js +1 -1
- package/lib/actions/ParallelAction.js +1 -1
- package/lib/actions/SwitchAction.js +17 -14
- package/lib/actions/ToastAction.js +1 -1
- package/lib/components/LazyComponent.d.ts +3 -3
- package/lib/components/LazyComponent.js +1 -1
- package/lib/components/Overlay.d.ts +1 -1
- package/lib/components/Overlay.js +2 -1
- package/lib/components/PopOver.d.ts +2 -4
- package/lib/components/PopOver.js +2 -1
- package/lib/env.d.ts +3 -7
- package/lib/env.js +1 -1
- package/lib/envOverwrite.js +1 -1
- package/lib/factory.js +3 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +18 -2
- package/lib/locale.d.ts +1 -3
- package/lib/locale.js +1 -1
- package/lib/renderers/Form.js +16 -14
- package/lib/renderers/Item.d.ts +9 -15
- package/lib/renderers/Item.js +2 -1
- package/lib/renderers/Options.js +2 -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 +4 -8
- package/lib/renderers/wrapControl.js +20 -28
- package/lib/store/app.d.ts +4 -2
- package/lib/store/app.js +1 -1
- package/lib/store/combo.d.ts +12 -6
- package/lib/store/combo.js +1 -1
- package/lib/store/crud.d.ts +5 -2
- package/lib/store/crud.js +31 -11
- package/lib/store/form.d.ts +4 -2
- package/lib/store/form.js +1 -1
- package/lib/store/formItem.js +5 -4
- package/lib/store/iRenderer.d.ts +5 -2
- package/lib/store/iRenderer.js +15 -3
- package/lib/store/index.js +1 -1
- package/lib/store/list.d.ts +4 -2
- package/lib/store/list.js +5 -5
- package/lib/store/manager.js +1 -1
- package/lib/store/modal.d.ts +4 -2
- package/lib/store/modal.js +1 -1
- package/lib/store/node.js +1 -1
- package/lib/store/pagination.d.ts +4 -2
- package/lib/store/pagination.js +1 -1
- package/lib/store/root.d.ts +4 -2
- package/lib/store/root.js +1 -1
- package/lib/store/service.d.ts +4 -2
- package/lib/store/service.js +1 -1
- package/lib/store/table.d.ts +12 -6
- package/lib/store/table.js +12 -2
- package/lib/store/table2.d.ts +4 -2
- package/lib/store/table2.js +1 -1
- package/lib/theme.d.ts +2 -4
- package/lib/theme.js +1 -1
- package/lib/types.d.ts +39 -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/api.js +2 -3
- package/lib/utils/attachmentAdpator.js +1 -1
- package/lib/utils/autobind.js +1 -1
- package/lib/utils/columnsSplit.js +1 -1
- package/lib/utils/dataMapping.js +1 -1
- package/lib/utils/date.js +1 -1
- package/lib/utils/debug.d.ts +1 -0
- 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.d.ts +1 -0
- package/lib/utils/formula.js +6 -1
- package/lib/utils/getVariable.js +1 -1
- package/lib/utils/grammar.js +1 -1
- package/lib/utils/handleAction.js +1 -1
- package/lib/utils/helper.js +1 -1
- package/lib/utils/highlight.js +1 -1
- package/lib/utils/icon.js +1 -1
- package/lib/utils/image.js +1 -1
- package/lib/utils/index.d.ts +2 -0
- package/lib/utils/isPureVariable.js +1 -1
- package/lib/utils/json-schema-2-amis-schema.js +1 -1
- package/lib/utils/keyToPath.js +1 -1
- package/lib/utils/makeSorter.js +1 -1
- package/lib/utils/normalizeLink.js +1 -1
- package/lib/utils/normalizeOptions.js +1 -1
- package/lib/utils/object.js +1 -1
- package/lib/utils/offset.js +1 -1
- package/lib/utils/offsetParent.js +1 -1
- package/lib/utils/optionValueCompare.js +7 -3
- package/lib/utils/position.js +1 -1
- package/lib/utils/prettyBytes.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.d.ts +5 -0
- package/lib/utils/resolveCondition.js +322 -0
- package/lib/utils/resolveVariable.js +1 -1
- package/lib/utils/resolveVariableAndFilter.js +1 -1
- package/lib/utils/resolveVariableAndFilterForAsync.d.ts +1 -0
- package/lib/utils/resolveVariableAndFilterForAsync.js +50 -0
- 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.d.ts +7 -0
- package/lib/utils/tpl.js +22 -1
- package/lib/utils/uncontrollable.js +1 -1
- package/lib/utils/validations.js +1 -1
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -52,6 +52,7 @@ var replaceText = require('./utils/replaceText.js');
|
|
|
52
52
|
var resizeSensor = require('./utils/resize-sensor.js');
|
|
53
53
|
var resolveVariable = require('./utils/resolveVariable.js');
|
|
54
54
|
var resolveVariableAndFilter = require('./utils/resolveVariableAndFilter.js');
|
|
55
|
+
var resolveVariableAndFilterForAsync = require('./utils/resolveVariableAndFilterForAsync.js');
|
|
55
56
|
var RootClose = require('./utils/RootClose.js');
|
|
56
57
|
var scrollPosition = require('./utils/scrollPosition.js');
|
|
57
58
|
var SimpleMap = require('./utils/SimpleMap.js');
|
|
@@ -65,6 +66,7 @@ var validations = require('./utils/validations.js');
|
|
|
65
66
|
var toNumber = require('./utils/toNumber.js');
|
|
66
67
|
var decodeEntity = require('./utils/decodeEntity.js');
|
|
67
68
|
var styleHelper = require('./utils/style-helper.js');
|
|
69
|
+
var resolveCondition = require('./utils/resolveCondition.js');
|
|
68
70
|
var Animation = require('./utils/Animation.js');
|
|
69
71
|
var index = require('./store/index.js');
|
|
70
72
|
var mobxStateTree = require('mobx-state-tree');
|
|
@@ -127,7 +129,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
127
129
|
*/
|
|
128
130
|
var classPrefix = theme.getClassPrefix();
|
|
129
131
|
// @ts-ignore
|
|
130
|
-
var version = '2.
|
|
132
|
+
var version = '2.9.0';
|
|
131
133
|
function render(schema, props, options, pathPrefix) {
|
|
132
134
|
if (props === void 0) { props = {}; }
|
|
133
135
|
if (options === void 0) { options = {}; }
|
|
@@ -233,6 +235,7 @@ exports.FormulaExec = formula.FormulaExec;
|
|
|
233
235
|
exports.formulaExec = formula.formulaExec;
|
|
234
236
|
exports.isExpression = formula.isExpression;
|
|
235
237
|
exports.isNeedFormula = formula.isNeedFormula;
|
|
238
|
+
exports.isNowFormula = formula.isNowFormula;
|
|
236
239
|
exports.registerFormulaExec = formula.registerFormulaExec;
|
|
237
240
|
exports.replaceExpression = formula.replaceExpression;
|
|
238
241
|
exports.getVariable = getVariable.getVariable;
|
|
@@ -352,6 +355,7 @@ exports.getComputedStyle = resizeSensor.getComputedStyle;
|
|
|
352
355
|
exports.resizeSensor = resizeSensor.resizeSensor;
|
|
353
356
|
exports.resolveVariable = resolveVariable.resolveVariable;
|
|
354
357
|
exports.resolveVariableAndFilter = resolveVariableAndFilter.resolveVariableAndFilter;
|
|
358
|
+
exports.resolveVariableAndFilterForAsync = resolveVariableAndFilterForAsync.resolveVariableAndFilterForAsync;
|
|
355
359
|
exports.RootClose = RootClose.RootClose;
|
|
356
360
|
exports.scrollPosition = scrollPosition.scrollPosition;
|
|
357
361
|
exports.SimpleMap = SimpleMap.SimpleMap;
|
|
@@ -360,6 +364,7 @@ exports.buildStyle = style.buildStyle;
|
|
|
360
364
|
exports.tokenize = tokenize.tokenize;
|
|
361
365
|
exports.register = tplBuiltin.register;
|
|
362
366
|
exports.evalExpression = tpl.evalExpression;
|
|
367
|
+
exports.evalExpressionWithConditionBuilder = tpl.evalExpressionWithConditionBuilder;
|
|
363
368
|
exports.evalJS = tpl.evalJS;
|
|
364
369
|
exports.filter = tpl.filter;
|
|
365
370
|
exports.registerTplEnginer = tpl.registerTplEnginer;
|
|
@@ -380,6 +385,9 @@ exports.formatStyle = styleHelper.formatStyle;
|
|
|
380
385
|
exports.insertCustomStyle = styleHelper.insertCustomStyle;
|
|
381
386
|
exports.insertStyle = styleHelper.insertStyle;
|
|
382
387
|
exports.valueMap = styleHelper.valueMap;
|
|
388
|
+
exports.getConditionComputers = resolveCondition.getConditionComputers;
|
|
389
|
+
exports.registerConditionComputer = resolveCondition.registerConditionComputer;
|
|
390
|
+
exports.resolveCondition = resolveCondition.resolveCondition;
|
|
383
391
|
exports.animation = Animation["default"];
|
|
384
392
|
exports.RegisterStore = index.RegisterStore;
|
|
385
393
|
exports.RendererStore = index.RendererStore;
|
|
@@ -415,6 +423,10 @@ exports.OptionsControl = Options.OptionsControl;
|
|
|
415
423
|
exports.registerOptionsControl = Options.registerOptionsControl;
|
|
416
424
|
exports.addRootWrapper = Root.addRootWrapper;
|
|
417
425
|
exports.EnvContext = env.EnvContext;
|
|
426
|
+
Object.defineProperty(exports, 'AsyncEvaluator', {
|
|
427
|
+
enumerable: true,
|
|
428
|
+
get: function () { return amisFormula.AsyncEvaluator; }
|
|
429
|
+
});
|
|
418
430
|
Object.defineProperty(exports, 'Evaluator', {
|
|
419
431
|
enumerable: true,
|
|
420
432
|
get: function () { return amisFormula.Evaluator; }
|
|
@@ -423,6 +435,10 @@ Object.defineProperty(exports, 'evaluate', {
|
|
|
423
435
|
enumerable: true,
|
|
424
436
|
get: function () { return amisFormula.evaluate; }
|
|
425
437
|
});
|
|
438
|
+
Object.defineProperty(exports, 'evaluateForAsync', {
|
|
439
|
+
enumerable: true,
|
|
440
|
+
get: function () { return amisFormula.evaluateForAsync; }
|
|
441
|
+
});
|
|
426
442
|
Object.defineProperty(exports, 'extendsFilters', {
|
|
427
443
|
enumerable: true,
|
|
428
444
|
get: function () { return amisFormula.extendsFilters; }
|
package/lib/locale.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export declare function localeable<T extends React.ComponentType<React.Component
|
|
|
25
25
|
childRef(ref: any): void;
|
|
26
26
|
getWrappedInstance(): any;
|
|
27
27
|
render(): JSX.Element;
|
|
28
|
-
context:
|
|
28
|
+
context: unknown;
|
|
29
29
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof LocaleProps>> & {
|
|
30
30
|
locale?: string | undefined;
|
|
31
31
|
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
|
@@ -34,8 +34,6 @@ export declare function localeable<T extends React.ComponentType<React.Component
|
|
|
34
34
|
readonly props: Readonly<JSX.LibraryManagedAttributes<T, Omit<React.ComponentProps<T>, keyof LocaleProps>> & {
|
|
35
35
|
locale?: string | undefined;
|
|
36
36
|
translate?: ((str: string, ...args: any[]) => string) | undefined;
|
|
37
|
-
}> & Readonly<{
|
|
38
|
-
children?: React.ReactNode;
|
|
39
37
|
}>;
|
|
40
38
|
state: Readonly<{}>;
|
|
41
39
|
refs: {
|
package/lib/locale.js
CHANGED
package/lib/renderers/Form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -391,7 +391,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
391
391
|
};
|
|
392
392
|
Form.prototype.emitChange = function (submit) {
|
|
393
393
|
return tslib.__awaiter(this, void 0, void 0, function () {
|
|
394
|
-
var _a, onChange, store, submitOnChange, dispatchEvent, data, dispatcher;
|
|
394
|
+
var _a, onChange, store, submitOnChange, dispatchEvent, data, changeProps, dispatcher;
|
|
395
395
|
return tslib.__generator(this, function (_b) {
|
|
396
396
|
switch (_b.label) {
|
|
397
397
|
case 0:
|
|
@@ -399,12 +399,16 @@ var Form = /** @class */ (function (_super) {
|
|
|
399
399
|
if (!mobxStateTree.isAlive(store)) {
|
|
400
400
|
return [2 /*return*/];
|
|
401
401
|
}
|
|
402
|
+
changeProps = [
|
|
403
|
+
store.data,
|
|
404
|
+
helper.difference(store.data, store.pristine),
|
|
405
|
+
this.props
|
|
406
|
+
];
|
|
402
407
|
return [4 /*yield*/, dispatchEvent('change', object.createObject(data, store.data))];
|
|
403
408
|
case 1:
|
|
404
409
|
dispatcher = _b.sent();
|
|
405
410
|
if (!(dispatcher === null || dispatcher === void 0 ? void 0 : dispatcher.prevented)) {
|
|
406
|
-
onChange &&
|
|
407
|
-
onChange(store.data, helper.difference(store.data, store.pristine), this.props);
|
|
411
|
+
onChange && onChange.apply(null, changeProps);
|
|
408
412
|
}
|
|
409
413
|
store.clearRestError();
|
|
410
414
|
(submit || (submitOnChange && store.inited)) &&
|
|
@@ -512,11 +516,12 @@ var Form = /** @class */ (function (_super) {
|
|
|
512
516
|
// 走到这里代表校验成功了
|
|
513
517
|
dispatchEvent('validateSucc', _this.props.data);
|
|
514
518
|
if (target) {
|
|
515
|
-
_this.submitToTarget(target, values);
|
|
519
|
+
_this.submitToTarget(tpl.filter(target, values), values);
|
|
516
520
|
dispatchEvent('submitSucc', object.createObject(_this.props.data, values));
|
|
517
521
|
}
|
|
518
522
|
else if (action.actionType === 'reload') {
|
|
519
|
-
action.target &&
|
|
523
|
+
action.target &&
|
|
524
|
+
_this.reloadTarget(tpl.filter(action.target, values), values);
|
|
520
525
|
}
|
|
521
526
|
else if (action.actionType === 'dialog') {
|
|
522
527
|
store.openDialog(data);
|
|
@@ -617,15 +622,12 @@ var Form = /** @class */ (function (_super) {
|
|
|
617
622
|
finalRedirect && env.jumpTo(finalRedirect, action);
|
|
618
623
|
}
|
|
619
624
|
else if (action.reload || reload) {
|
|
620
|
-
_this.reloadTarget(action.reload || reload, store.data);
|
|
625
|
+
_this.reloadTarget(tpl.filter(action.reload || reload, store.data), store.data);
|
|
621
626
|
}
|
|
622
627
|
action.close && _this.closeTarget(action.close);
|
|
623
628
|
return values;
|
|
624
629
|
})
|
|
625
630
|
.catch(function (reason) {
|
|
626
|
-
if (reason instanceof helper.SkipOperation) {
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
631
|
onFailed && onFailed(reason, store.errors);
|
|
630
632
|
if (throwErrors) {
|
|
631
633
|
throw reason;
|
|
@@ -684,7 +686,8 @@ var Form = /** @class */ (function (_super) {
|
|
|
684
686
|
case 4:
|
|
685
687
|
redirect = action.redirect && tpl.filter(action.redirect, store.data);
|
|
686
688
|
redirect && env.jumpTo(redirect, action);
|
|
687
|
-
action.reload &&
|
|
689
|
+
action.reload &&
|
|
690
|
+
this.reloadTarget(tpl.filter(action.reload, store.data), store.data);
|
|
688
691
|
action.close && this.closeTarget(action.close);
|
|
689
692
|
return [2 /*return*/];
|
|
690
693
|
}
|
|
@@ -700,7 +703,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
700
703
|
else if (action.actionType === 'reload') {
|
|
701
704
|
store.setCurrentAction(action);
|
|
702
705
|
if (action.target) {
|
|
703
|
-
this.reloadTarget(action.target, data);
|
|
706
|
+
this.reloadTarget(tpl.filter(action.target, data), data);
|
|
704
707
|
}
|
|
705
708
|
else {
|
|
706
709
|
this.receive(data);
|
|
@@ -880,8 +883,7 @@ var Form = /** @class */ (function (_super) {
|
|
|
880
883
|
*/
|
|
881
884
|
disabled: disabled ||
|
|
882
885
|
control.disabled ||
|
|
883
|
-
(form.loading ? true : undefined) }, control.static || isStatic
|
|
884
|
-
? { static: true } : {}), { btnDisabled: disabled || form.loading || form.validating, onAction: this.handleAction, onQuery: this.handleQuery, onChange: this.handleChange, onBulkChange: this.handleBulkChange, addHook: this.addHook, removeHook: this.removeHook, renderFormItems: this.renderFormItems, formItemDispatchEvent: this.formItemDispatchEvent(dispatchEvent), formPristine: form.pristine });
|
|
886
|
+
(form.loading ? true : undefined) }, (control.static || isStatic ? { static: true } : {})), { btnDisabled: disabled || form.loading || form.validating, onAction: this.handleAction, onQuery: this.handleQuery, onChange: this.handleChange, onBulkChange: this.handleBulkChange, addHook: this.addHook, removeHook: this.removeHook, renderFormItems: this.renderFormItems, formItemDispatchEvent: this.formItemDispatchEvent(dispatchEvent), formPristine: form.pristine });
|
|
885
887
|
var subSchema = tslib.__assign({}, control);
|
|
886
888
|
if (subSchema.$ref) {
|
|
887
889
|
subSchema = tslib.__assign(tslib.__assign({}, resolveDefinitions(subSchema.$ref)), subSchema);
|
package/lib/renderers/Item.d.ts
CHANGED
|
@@ -461,15 +461,11 @@ export declare class FormItemWrap extends React.Component<FormItemProps> {
|
|
|
461
461
|
export declare const detectProps: string[];
|
|
462
462
|
export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (Control: FormControlComponent) => {
|
|
463
463
|
new (props: Omit<any, "rootStore"> | Readonly<Omit<any, "rootStore">>): {
|
|
464
|
-
render(): JSX.Element;
|
|
465
|
-
|
|
466
|
-
*/
|
|
467
|
-
context: any;
|
|
464
|
+
render(): JSX.Element;
|
|
465
|
+
context: unknown;
|
|
468
466
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
469
467
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
470
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
471
|
-
children?: React.ReactNode;
|
|
472
|
-
}>;
|
|
468
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
473
469
|
state: Readonly<{}>;
|
|
474
470
|
refs: {
|
|
475
471
|
[key: string]: React.ReactInstance;
|
|
@@ -488,15 +484,11 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
488
484
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<Omit<any, "rootStore">>, nextState: Readonly<{}>, nextContext: any): void;
|
|
489
485
|
};
|
|
490
486
|
new (props: Omit<any, "rootStore">, context: any): {
|
|
491
|
-
render(): JSX.Element;
|
|
492
|
-
|
|
493
|
-
*/
|
|
494
|
-
context: any;
|
|
487
|
+
render(): JSX.Element;
|
|
488
|
+
context: unknown;
|
|
495
489
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
496
490
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
497
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
498
|
-
children?: React.ReactNode;
|
|
499
|
-
}>;
|
|
491
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
500
492
|
state: Readonly<{}>;
|
|
501
493
|
refs: {
|
|
502
494
|
[key: string]: React.ReactInstance;
|
|
@@ -862,7 +854,9 @@ export declare function asFormItem(config: Omit<FormItemConfig, 'component'>): (
|
|
|
862
854
|
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>>;
|
|
863
855
|
ComposedComponent: React.ComponentType<any>;
|
|
864
856
|
} & hoistNonReactStatic.NonReactStatics<any, {}> & {
|
|
865
|
-
ComposedComponent: any;
|
|
857
|
+
ComposedComponent: any; /**
|
|
858
|
+
* 配置 label className
|
|
859
|
+
*/
|
|
866
860
|
} & {
|
|
867
861
|
ComposedComponent: any;
|
|
868
862
|
};
|
package/lib/renderers/Item.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -49,6 +49,7 @@ require('lodash/camelCase');
|
|
|
49
49
|
var styleHelper = require('../utils/style-helper.js');
|
|
50
50
|
require('uncontrollable');
|
|
51
51
|
require('../utils/validations.js');
|
|
52
|
+
require('../utils/resolveCondition.js');
|
|
52
53
|
require('../utils/Animation.js');
|
|
53
54
|
var Overlay = require('../components/Overlay.js');
|
|
54
55
|
var PopOver = require('../components/PopOver.js');
|
package/lib/renderers/Options.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -51,6 +51,7 @@ require('lodash/camelCase');
|
|
|
51
51
|
require('uncontrollable');
|
|
52
52
|
require('hoist-non-react-statics');
|
|
53
53
|
require('../utils/validations.js');
|
|
54
|
+
require('../utils/resolveCondition.js');
|
|
54
55
|
require('../utils/Animation.js');
|
|
55
56
|
|
|
56
57
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
package/lib/renderers/builtin.js
CHANGED
|
@@ -51,12 +51,10 @@ export interface ControlProps {
|
|
|
51
51
|
export declare function wrapControl<T extends React.ComponentType<React.ComponentProps<T> & ControlProps>>(ComposedComponent: T): {
|
|
52
52
|
new (props: Omit<any, "rootStore"> | Readonly<Omit<any, "rootStore">>): {
|
|
53
53
|
render(): JSX.Element;
|
|
54
|
-
context:
|
|
54
|
+
context: unknown;
|
|
55
55
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
56
56
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
57
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
58
|
-
children?: React.ReactNode;
|
|
59
|
-
}>;
|
|
57
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
60
58
|
state: Readonly<{}>;
|
|
61
59
|
refs: {
|
|
62
60
|
[key: string]: React.ReactInstance;
|
|
@@ -76,12 +74,10 @@ export declare function wrapControl<T extends React.ComponentType<React.Componen
|
|
|
76
74
|
};
|
|
77
75
|
new (props: Omit<any, "rootStore">, context: any): {
|
|
78
76
|
render(): JSX.Element;
|
|
79
|
-
context:
|
|
77
|
+
context: unknown;
|
|
80
78
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<Omit<any, "rootStore">>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
81
79
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
82
|
-
readonly props: Readonly<Omit<any, "rootStore"
|
|
83
|
-
children?: React.ReactNode;
|
|
84
|
-
}>;
|
|
80
|
+
readonly props: Readonly<Omit<any, "rootStore">>;
|
|
85
81
|
state: Readonly<{}>;
|
|
86
82
|
refs: {
|
|
87
83
|
[key: string]: React.ReactInstance;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -21,6 +21,7 @@ var mobxReact = require('mobx-react');
|
|
|
21
21
|
var hoistNonReactStatic = require('hoist-non-react-statics');
|
|
22
22
|
var WithRootStore = require('../WithRootStore.js');
|
|
23
23
|
var table = require('../store/table.js');
|
|
24
|
+
var pick = require('lodash/pick');
|
|
24
25
|
var getVariable = require('../utils/getVariable.js');
|
|
25
26
|
|
|
26
27
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -29,6 +30,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
29
30
|
var debounce__default = /*#__PURE__*/_interopDefaultLegacy(debounce);
|
|
30
31
|
var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
|
|
31
32
|
var hoistNonReactStatic__default = /*#__PURE__*/_interopDefaultLegacy(hoistNonReactStatic);
|
|
33
|
+
var pick__default = /*#__PURE__*/_interopDefaultLegacy(pick);
|
|
32
34
|
|
|
33
35
|
function wrapControl(ComposedComponent) {
|
|
34
36
|
var _a;
|
|
@@ -43,7 +45,7 @@ function wrapControl(ComposedComponent) {
|
|
|
43
45
|
trailing: true,
|
|
44
46
|
leading: false
|
|
45
47
|
});
|
|
46
|
-
var _c = _this.props, form = _c.formStore, formItem$1 = _c.formItem, rootStore = _c.rootStore, store = _c.store, onChange = _c.onChange, data = _c.data, inputGroupControl = _c.inputGroupControl, _d = _c.$schema, name = _d.name, id = _d.id, type = _d.type, required = _d.required, validations = _d.validations, validationErrors = _d.validationErrors, unique = _d.unique, value = _d.value
|
|
48
|
+
var _c = _this.props, form = _c.formStore, formItem$1 = _c.formItem, rootStore = _c.rootStore, store = _c.store, onChange = _c.onChange, data = _c.data, inputGroupControl = _c.inputGroupControl, _d = _c.$schema, name = _d.name, id = _d.id, type = _d.type, required = _d.required, validations = _d.validations, validationErrors = _d.validationErrors, unique = _d.unique, value = _d.value; _d.multiple; var delimiter = _d.delimiter, valueField = _d.valueField, labelField = _d.labelField, joinValues = _d.joinValues, extractValue = _d.extractValue, selectFirst = _d.selectFirst, autoFill = _d.autoFill, clearValueOnHidden = _d.clearValueOnHidden, validateApi = _d.validateApi, minLength = _d.minLength, maxLength = _d.maxLength, validateOnChange = _d.validateOnChange, label = _d.label;
|
|
47
49
|
_this.getValue = _this.getValue.bind(_this);
|
|
48
50
|
_this.setValue = _this.setValue.bind(_this);
|
|
49
51
|
_this.handleChange = _this.handleChange.bind(_this);
|
|
@@ -74,31 +76,7 @@ function wrapControl(ComposedComponent) {
|
|
|
74
76
|
_this.model = model;
|
|
75
77
|
// @issue 打算干掉这个
|
|
76
78
|
formItem$1 === null || formItem$1 === void 0 ? void 0 : formItem$1.addSubFormItem(model);
|
|
77
|
-
model.config({
|
|
78
|
-
id: id,
|
|
79
|
-
type: type,
|
|
80
|
-
required: required,
|
|
81
|
-
unique: unique,
|
|
82
|
-
value: value,
|
|
83
|
-
isValueSchemaExp: formula.isExpression(value),
|
|
84
|
-
rules: validations,
|
|
85
|
-
messages: validationErrors,
|
|
86
|
-
multiple: multiple,
|
|
87
|
-
delimiter: delimiter,
|
|
88
|
-
valueField: valueField,
|
|
89
|
-
labelField: labelField,
|
|
90
|
-
joinValues: joinValues,
|
|
91
|
-
extractValue: extractValue,
|
|
92
|
-
selectFirst: selectFirst,
|
|
93
|
-
autoFill: autoFill,
|
|
94
|
-
clearValueOnHidden: clearValueOnHidden,
|
|
95
|
-
validateApi: validateApi,
|
|
96
|
-
minLength: minLength,
|
|
97
|
-
maxLength: maxLength,
|
|
98
|
-
validateOnChange: validateOnChange,
|
|
99
|
-
label: label,
|
|
100
|
-
inputGroupControl: inputGroupControl
|
|
101
|
-
});
|
|
79
|
+
model.config(tslib.__assign(tslib.__assign({}, pick__default["default"](tslib.__assign(tslib.__assign({}, ComposedComponent.defaultProps), _this.props.$schema), ['multiple'])), { id: id, type: type, required: required, unique: unique, value: value, isValueSchemaExp: formula.isExpression(value), rules: validations, messages: validationErrors, delimiter: delimiter, valueField: valueField, labelField: labelField, joinValues: joinValues, extractValue: extractValue, selectFirst: selectFirst, autoFill: autoFill, clearValueOnHidden: clearValueOnHidden, validateApi: validateApi, minLength: minLength, maxLength: maxLength, validateOnChange: validateOnChange, label: label, inputGroupControl: inputGroupControl }));
|
|
102
80
|
// issue 这个逻辑应该在 combo 里面自己实现。
|
|
103
81
|
if (_this.model.unique &&
|
|
104
82
|
((_a = form === null || form === void 0 ? void 0 : form.parentStore) === null || _a === void 0 ? void 0 : _a.storeType) === combo.ComboStore.name) {
|
|
@@ -220,10 +198,12 @@ function wrapControl(ComposedComponent) {
|
|
|
220
198
|
else if (model &&
|
|
221
199
|
typeof props.defaultValue !== 'undefined' &&
|
|
222
200
|
formula.isExpression(props.defaultValue)) {
|
|
201
|
+
var nowFormulaChecked = formula.isNowFormula(props.defaultValue);
|
|
223
202
|
// 渲染器中的 defaultValue 优先(备注: SchemaRenderer中会将 value 改成 defaultValue)
|
|
224
203
|
if (!isEqual__default["default"](props.defaultValue, prevProps.defaultValue) ||
|
|
225
204
|
(props.data !== prevProps.data &&
|
|
226
|
-
formula.isNeedFormula(props.defaultValue, props.data, prevProps.data)
|
|
205
|
+
(formula.isNeedFormula(props.defaultValue, props.data, prevProps.data) ||
|
|
206
|
+
nowFormulaChecked))) {
|
|
227
207
|
var curResult = formula.FormulaExec['formula'](props.defaultValue, props.data);
|
|
228
208
|
var prevResult = formula.FormulaExec['formula'](prevProps.defaultValue, prevProps.data);
|
|
229
209
|
if (!isEqual__default["default"](curResult, prevResult) &&
|
|
@@ -234,6 +214,14 @@ function wrapControl(ComposedComponent) {
|
|
|
234
214
|
props.onChange(curResult, model.name, false);
|
|
235
215
|
}
|
|
236
216
|
}
|
|
217
|
+
else if (nowFormulaChecked) {
|
|
218
|
+
var nowData = props.data[model.name];
|
|
219
|
+
// now 表达式,计算后的值永远相同
|
|
220
|
+
model.changeTmpValue(nowData);
|
|
221
|
+
if (props.onChange) {
|
|
222
|
+
props.onChange(nowData, model.name, false);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
237
225
|
}
|
|
238
226
|
}
|
|
239
227
|
else if (model) {
|
|
@@ -431,6 +419,10 @@ function wrapControl(ComposedComponent) {
|
|
|
431
419
|
if ((onFormItemChange === null || onFormItemChange === void 0 ? void 0 : onFormItemChange(value, oldValue, this.model, form)) === false) {
|
|
432
420
|
return;
|
|
433
421
|
}
|
|
422
|
+
// onFormItemChange 可能会触发组件销毁,再次读取 this.model 为 undefined
|
|
423
|
+
if (!this.model) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
434
426
|
var validated = this.model.validated;
|
|
435
427
|
onChange === null || onChange === void 0 ? void 0 : onChange(value, name, submitOnChange === true);
|
|
436
428
|
if (
|
package/lib/store/app.d.ts
CHANGED
|
@@ -54,10 +54,12 @@ export declare const AppStore: import("mobx-state-tree").IModelType<{
|
|
|
54
54
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
55
55
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
56
56
|
setCurrentAction(action: object): void;
|
|
57
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
57
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
58
58
|
closeDialog(result?: any): void;
|
|
59
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
59
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
60
60
|
closeDrawer(result?: any): void;
|
|
61
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
62
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
61
63
|
} & {
|
|
62
64
|
readonly loading: boolean;
|
|
63
65
|
} & {
|
package/lib/store/app.js
CHANGED
package/lib/store/combo.d.ts
CHANGED
|
@@ -1775,10 +1775,12 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
1775
1775
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
1776
1776
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
1777
1777
|
setCurrentAction(action: object): void;
|
|
1778
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1778
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1779
1779
|
closeDialog(result?: any): void;
|
|
1780
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1780
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1781
1781
|
closeDrawer(result?: any): void;
|
|
1782
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
1783
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
1782
1784
|
} & {
|
|
1783
1785
|
readonly forms: ({
|
|
1784
1786
|
id: string;
|
|
@@ -1834,10 +1836,12 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
1834
1836
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
1835
1837
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
1836
1838
|
setCurrentAction(action: object): void;
|
|
1837
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1839
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1838
1840
|
closeDialog(result?: any): void;
|
|
1839
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
1841
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
1840
1842
|
closeDrawer(result?: any): void;
|
|
1843
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
1844
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
1841
1845
|
} & {
|
|
1842
1846
|
readonly loading: boolean;
|
|
1843
1847
|
} & {
|
|
@@ -7091,10 +7095,12 @@ export declare const ComboStore: import("mobx-state-tree").IModelType<{
|
|
|
7091
7095
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
7092
7096
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
7093
7097
|
setCurrentAction(action: object): void;
|
|
7094
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
7098
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
7095
7099
|
closeDialog(result?: any): void;
|
|
7096
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
7100
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
7097
7101
|
closeDrawer(result?: any): void;
|
|
7102
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
7103
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
7098
7104
|
} & {
|
|
7099
7105
|
readonly loading: boolean;
|
|
7100
7106
|
} & {
|
package/lib/store/combo.js
CHANGED
package/lib/store/crud.d.ts
CHANGED
|
@@ -65,10 +65,12 @@ export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
|
65
65
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
66
66
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
67
67
|
setCurrentAction(action: object): void;
|
|
68
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
68
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
69
69
|
closeDialog(result?: any): void;
|
|
70
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
70
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
71
71
|
closeDrawer(result?: any): void;
|
|
72
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
73
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
72
74
|
} & {
|
|
73
75
|
readonly loading: boolean;
|
|
74
76
|
} & {
|
|
@@ -110,6 +112,7 @@ export declare const CRUDStore: import("mobx-state-tree").IModelType<{
|
|
|
110
112
|
isTable2?: Boolean;
|
|
111
113
|
}) => Promise<any>;
|
|
112
114
|
changePage: (page: number, perPage?: number | string) => void;
|
|
115
|
+
changePerPage: (perPage: number | string) => void;
|
|
113
116
|
selectAction: (action: ActionObject) => void;
|
|
114
117
|
saveRemote: (api: Api, data?: object, options?: fetchOptions) => Promise<any>;
|
|
115
118
|
setFilterTogglable: (toggable: boolean, filterVisible?: boolean) => void;
|
package/lib/store/crud.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* amis-core v2.
|
|
2
|
+
* amis-core v2.9.0
|
|
3
3
|
* Copyright 2018-2023 fex
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -118,12 +118,14 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
118
118
|
options.columns.forEach(function (column) {
|
|
119
119
|
var value;
|
|
120
120
|
var key = column.name;
|
|
121
|
-
if (column.searchable &&
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
if ((column.searchable || column.filterable) && key) {
|
|
122
|
+
// value可能为null、undefined、''、0
|
|
123
|
+
value = getVariable.getVariable(self.query, key);
|
|
124
|
+
if (value != null) {
|
|
125
|
+
items_1 = matchSorter.matchSorter(items_1, value, {
|
|
126
|
+
keys: [key]
|
|
127
|
+
});
|
|
128
|
+
}
|
|
127
129
|
}
|
|
128
130
|
});
|
|
129
131
|
}
|
|
@@ -222,9 +224,23 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
222
224
|
if (column.searchable &&
|
|
223
225
|
key &&
|
|
224
226
|
(value = getVariable.getVariable(self.query, key))) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
if (Array.isArray(value)) {
|
|
228
|
+
if (value.length > 0) {
|
|
229
|
+
var arr_1 = tslib.__spreadArray([], tslib.__read(filteredItems_1), false);
|
|
230
|
+
var arrItems_1 = [];
|
|
231
|
+
value.forEach(function (item) {
|
|
232
|
+
arrItems_1 = tslib.__spreadArray(tslib.__spreadArray([], tslib.__read(arrItems_1), false), tslib.__read(matchSorter.matchSorter(arr_1, item, {
|
|
233
|
+
keys: [key]
|
|
234
|
+
})), false);
|
|
235
|
+
});
|
|
236
|
+
filteredItems_1 = filteredItems_1.filter(function (item) { return arrItems_1.find(function (a) { return a === item; }); });
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else {
|
|
240
|
+
filteredItems_1 = matchSorter.matchSorter(filteredItems_1, value, {
|
|
241
|
+
keys: [key]
|
|
242
|
+
});
|
|
243
|
+
}
|
|
228
244
|
}
|
|
229
245
|
});
|
|
230
246
|
}
|
|
@@ -280,7 +296,10 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
280
296
|
});
|
|
281
297
|
function changePage(page, perPage) {
|
|
282
298
|
self.page = page;
|
|
283
|
-
perPage && (
|
|
299
|
+
perPage && changePerPage(perPage);
|
|
300
|
+
}
|
|
301
|
+
function changePerPage(perPage) {
|
|
302
|
+
self.perPage = parseInt(perPage, 10);
|
|
284
303
|
}
|
|
285
304
|
function selectAction(action) {
|
|
286
305
|
self.selectedAction = action;
|
|
@@ -458,6 +477,7 @@ var CRUDStore = service.ServiceStore.named('CRUDStore')
|
|
|
458
477
|
updateQuery: updateQuery,
|
|
459
478
|
fetchInitData: fetchInitData,
|
|
460
479
|
changePage: changePage,
|
|
480
|
+
changePerPage: changePerPage,
|
|
461
481
|
selectAction: selectAction,
|
|
462
482
|
saveRemote: saveRemote,
|
|
463
483
|
setFilterTogglable: setFilterTogglable,
|
package/lib/store/form.d.ts
CHANGED
|
@@ -59,10 +59,12 @@ export declare const FormStore: import("mobx-state-tree").IModelType<{
|
|
|
59
59
|
updateData(data?: object, tag?: object | undefined, replace?: boolean | undefined): void;
|
|
60
60
|
changeValue(name: string, value: any, changePristine?: boolean | undefined, force?: boolean | undefined, otherModifier?: ((data: Object) => void) | undefined): void;
|
|
61
61
|
setCurrentAction(action: object): void;
|
|
62
|
-
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
62
|
+
openDialog(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
63
63
|
closeDialog(result?: any): void;
|
|
64
|
-
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined): void;
|
|
64
|
+
openDrawer(ctx: any, additonal?: object | undefined, callback?: ((ret: any) => void) | undefined, scoped?: import("..").IScopedContext | undefined): void;
|
|
65
65
|
closeDrawer(result?: any): void;
|
|
66
|
+
getDialogScoped(): import("..").IScopedContext | null;
|
|
67
|
+
getDrawerScoped(): import("..").IScopedContext | null;
|
|
66
68
|
} & {
|
|
67
69
|
readonly loading: boolean;
|
|
68
70
|
} & {
|