@tachybase/schema 0.23.40 → 0.23.47
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/lib/core/effects/index.d.ts +2 -0
- package/lib/core/effects/index.js +23 -0
- package/lib/core/effects/onFieldEffects.d.ts +27 -0
- package/lib/core/effects/onFieldEffects.js +158 -0
- package/lib/core/effects/onFormEffects.d.ts +24 -0
- package/lib/core/effects/onFormEffects.js +117 -0
- package/lib/core/global.d.js +0 -0
- package/lib/core/index.d.ts +4 -0
- package/lib/core/index.js +27 -0
- package/lib/core/models/ArrayField.d.ts +17 -0
- package/lib/core/models/ArrayField.js +145 -0
- package/lib/core/models/BaseField.d.ts +72 -0
- package/lib/core/models/BaseField.js +285 -0
- package/lib/core/models/Field.d.ts +70 -0
- package/lib/core/models/Field.js +426 -0
- package/lib/core/models/Form.d.ts +102 -0
- package/lib/core/models/Form.js +483 -0
- package/lib/core/models/Graph.d.ts +8 -0
- package/lib/core/models/Graph.js +77 -0
- package/lib/core/models/Heart.d.ts +16 -0
- package/lib/core/models/Heart.js +91 -0
- package/lib/core/models/LifeCycle.d.ts +14 -0
- package/lib/core/models/LifeCycle.js +64 -0
- package/lib/core/models/ObjectField.d.ts +12 -0
- package/lib/core/models/ObjectField.js +64 -0
- package/lib/core/models/Query.d.ts +18 -0
- package/lib/core/models/Query.js +105 -0
- package/lib/core/models/VoidField.d.ts +14 -0
- package/lib/core/models/VoidField.js +117 -0
- package/lib/core/models/index.d.ts +9 -0
- package/lib/core/models/index.js +37 -0
- package/lib/core/models/types.d.ts +9 -0
- package/lib/core/models/types.js +15 -0
- package/lib/core/shared/checkers.d.ts +117 -0
- package/lib/core/shared/checkers.js +109 -0
- package/lib/core/shared/constants.d.ts +48 -0
- package/lib/core/shared/constants.js +86 -0
- package/lib/core/shared/effective.d.ts +9 -0
- package/lib/core/shared/effective.js +91 -0
- package/lib/core/shared/externals.d.ts +8 -0
- package/lib/core/shared/externals.js +87 -0
- package/lib/core/shared/internals.d.ts +54 -0
- package/lib/core/shared/internals.js +956 -0
- package/lib/core/types.d.ts +275 -0
- package/lib/core/types.js +76 -0
- package/lib/grid/index.d.ts +67 -0
- package/lib/grid/index.js +378 -0
- package/lib/grid/observer.d.ts +19 -0
- package/lib/grid/observer.js +107 -0
- package/lib/index.d.ts +12 -24
- package/lib/index.js +27 -244
- package/lib/json-schema/compiler.d.ts +8 -0
- package/lib/json-schema/compiler.js +129 -0
- package/lib/json-schema/global.d.js +0 -0
- package/lib/json-schema/index.d.ts +2 -0
- package/lib/json-schema/index.js +23 -0
- package/lib/json-schema/patches.d.ts +5 -0
- package/lib/json-schema/patches.js +68 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.d.ts +2 -0
- package/lib/json-schema/polyfills/SPECIFICATION_1_0.js +132 -0
- package/lib/json-schema/polyfills/index.d.ts +1 -0
- package/lib/json-schema/polyfills/index.js +21 -0
- package/lib/json-schema/schema.d.ts +88 -0
- package/lib/json-schema/schema.js +231 -0
- package/lib/json-schema/shared.d.ts +62 -0
- package/lib/json-schema/shared.js +232 -0
- package/lib/json-schema/transformer.d.ts +4 -0
- package/lib/json-schema/transformer.js +238 -0
- package/lib/json-schema/types.d.ts +119 -0
- package/lib/json-schema/types.js +15 -0
- package/lib/path/contexts.d.ts +10 -0
- package/lib/path/contexts.js +49 -0
- package/lib/path/destructor.d.ts +15 -0
- package/lib/path/destructor.js +151 -0
- package/lib/path/index.d.ts +51 -0
- package/lib/path/index.js +513 -0
- package/lib/path/matcher.d.ts +33 -0
- package/lib/path/matcher.js +197 -0
- package/lib/path/parser.d.ts +33 -0
- package/lib/path/parser.js +379 -0
- package/lib/path/shared.d.ts +13 -0
- package/lib/path/shared.js +121 -0
- package/lib/path/tokenizer.d.ts +27 -0
- package/lib/path/tokenizer.js +269 -0
- package/lib/path/tokens.d.ts +27 -0
- package/lib/path/tokens.js +216 -0
- package/lib/path/types.d.ts +88 -0
- package/lib/path/types.js +63 -0
- package/lib/react/components/ArrayField.d.ts +6 -0
- package/lib/react/components/ArrayField.js +44 -0
- package/lib/react/components/ExpressionScope.d.ts +2 -0
- package/lib/react/components/ExpressionScope.js +35 -0
- package/lib/react/components/Field.d.ts +5 -0
- package/lib/react/components/Field.js +45 -0
- package/lib/react/components/FormConsumer.d.ts +2 -0
- package/lib/react/components/FormConsumer.js +36 -0
- package/lib/react/components/FormProvider.d.ts +2 -0
- package/lib/react/components/FormProvider.js +35 -0
- package/lib/react/components/ObjectField.d.ts +6 -0
- package/lib/react/components/ObjectField.js +39 -0
- package/lib/react/components/ReactiveField.d.ts +11 -0
- package/lib/react/components/ReactiveField.js +115 -0
- package/lib/react/components/RecordScope.d.ts +2 -0
- package/lib/react/components/RecordScope.js +65 -0
- package/lib/react/components/RecordsScope.d.ts +2 -0
- package/lib/react/components/RecordsScope.js +43 -0
- package/lib/react/components/RecursionField.d.ts +2 -0
- package/lib/react/components/RecursionField.js +105 -0
- package/lib/react/components/SchemaField.d.ts +41 -0
- package/lib/react/components/SchemaField.js +154 -0
- package/lib/react/components/VoidField.d.ts +5 -0
- package/lib/react/components/VoidField.js +39 -0
- package/lib/react/components/index.d.ts +11 -0
- package/lib/react/components/index.js +41 -0
- package/lib/react/global.d.js +0 -0
- package/lib/react/hooks/index.d.ts +6 -0
- package/lib/react/hooks/index.js +31 -0
- package/lib/react/hooks/useAttach.d.ts +6 -0
- package/lib/react/hooks/useAttach.js +35 -0
- package/lib/react/hooks/useExpressionScope.d.ts +1 -0
- package/lib/react/hooks/useExpressionScope.js +30 -0
- package/lib/react/hooks/useField.d.ts +2 -0
- package/lib/react/hooks/useField.js +32 -0
- package/lib/react/hooks/useFieldSchema.d.ts +2 -0
- package/lib/react/hooks/useFieldSchema.js +32 -0
- package/lib/react/hooks/useForm.d.ts +2 -0
- package/lib/react/hooks/useForm.js +32 -0
- package/lib/react/hooks/useFormEffects.d.ts +2 -0
- package/lib/react/hooks/useFormEffects.js +42 -0
- package/lib/react/hooks/useParentForm.d.ts +2 -0
- package/lib/react/hooks/useParentForm.js +40 -0
- package/lib/react/index.d.ts +5 -0
- package/lib/react/index.js +29 -0
- package/lib/react/shared/connect.d.ts +9 -0
- package/lib/react/shared/connect.js +118 -0
- package/lib/react/shared/context.d.ts +14 -0
- package/lib/react/shared/context.js +74 -0
- package/lib/react/shared/index.d.ts +2 -0
- package/lib/react/shared/index.js +23 -0
- package/lib/react/shared/render.d.ts +2 -0
- package/lib/react/shared/render.js +69 -0
- package/lib/react/types.d.ts +84 -0
- package/lib/react/types.js +15 -0
- package/lib/reactive/action.d.ts +2 -0
- package/lib/reactive/action.js +48 -0
- package/lib/reactive/annotations/box.d.ts +7 -0
- package/lib/reactive/annotations/box.js +76 -0
- package/lib/reactive/annotations/computed.d.ts +12 -0
- package/lib/reactive/annotations/computed.js +154 -0
- package/lib/reactive/annotations/index.d.ts +5 -0
- package/lib/reactive/annotations/index.js +29 -0
- package/lib/reactive/annotations/observable.d.ts +4 -0
- package/lib/reactive/annotations/observable.js +67 -0
- package/lib/reactive/annotations/ref.d.ts +6 -0
- package/lib/reactive/annotations/ref.js +78 -0
- package/lib/reactive/annotations/shallow.d.ts +2 -0
- package/lib/reactive/annotations/shallow.js +67 -0
- package/lib/reactive/array.d.ts +12 -0
- package/lib/reactive/array.js +83 -0
- package/lib/reactive/autorun.d.ts +7 -0
- package/lib/reactive/autorun.js +155 -0
- package/lib/reactive/batch.d.ts +2 -0
- package/lib/reactive/batch.js +40 -0
- package/lib/reactive/checkers.d.ts +10 -0
- package/lib/reactive/checkers.js +60 -0
- package/lib/reactive/environment.d.ts +28 -0
- package/lib/reactive/environment.js +76 -0
- package/lib/reactive/externals.d.ts +10 -0
- package/lib/reactive/externals.js +156 -0
- package/lib/reactive/global.d.js +0 -0
- package/lib/reactive/handlers.d.ts +4 -0
- package/lib/reactive/handlers.js +246 -0
- package/lib/reactive/index.d.ts +10 -0
- package/lib/reactive/index.js +39 -0
- package/lib/reactive/internals.d.ts +17 -0
- package/lib/reactive/internals.js +139 -0
- package/lib/reactive/model.d.ts +3 -0
- package/lib/reactive/model.js +68 -0
- package/lib/reactive/observable.d.ts +9 -0
- package/lib/reactive/observable.js +50 -0
- package/lib/reactive/observe.d.ts +2 -0
- package/lib/reactive/observe.js +58 -0
- package/lib/reactive/reaction.d.ts +21 -0
- package/lib/reactive/reaction.js +278 -0
- package/lib/reactive/tracker.d.ts +7 -0
- package/lib/reactive/tracker.js +63 -0
- package/lib/reactive/tree.d.ts +25 -0
- package/lib/reactive/tree.js +106 -0
- package/lib/reactive/types.d.ts +79 -0
- package/lib/reactive/types.js +21 -0
- package/lib/reactive/untracked.d.ts +4 -0
- package/lib/reactive/untracked.js +29 -0
- package/lib/reactive-react/hooks/index.d.ts +9 -0
- package/lib/reactive-react/hooks/index.js +48 -0
- package/lib/reactive-react/hooks/useCompatEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useCompatEffect.js +60 -0
- package/lib/reactive-react/hooks/useCompatFactory.d.ts +3 -0
- package/lib/reactive-react/hooks/useCompatFactory.js +74 -0
- package/lib/reactive-react/hooks/useDidUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useDidUpdate.js +38 -0
- package/lib/reactive-react/hooks/useForceUpdate.d.ts +1 -0
- package/lib/reactive-react/hooks/useForceUpdate.js +76 -0
- package/lib/reactive-react/hooks/useLayoutEffect.d.ts +2 -0
- package/lib/reactive-react/hooks/useLayoutEffect.js +28 -0
- package/lib/reactive-react/hooks/useObserver.d.ts +2 -0
- package/lib/reactive-react/hooks/useObserver.js +43 -0
- package/lib/reactive-react/index.d.ts +3 -0
- package/lib/reactive-react/index.js +25 -0
- package/lib/reactive-react/observer.d.ts +8 -0
- package/lib/reactive-react/observer.js +64 -0
- package/lib/reactive-react/shared/gc.d.ts +8 -0
- package/lib/reactive-react/shared/gc.js +59 -0
- package/lib/reactive-react/shared/global.d.ts +1 -0
- package/lib/reactive-react/shared/global.js +50 -0
- package/lib/reactive-react/shared/immediate.d.ts +1 -0
- package/lib/reactive-react/shared/immediate.js +40 -0
- package/lib/reactive-react/shared/index.d.ts +2 -0
- package/lib/reactive-react/shared/index.js +23 -0
- package/lib/reactive-react/types.d.ts +14 -0
- package/lib/reactive-react/types.js +15 -0
- package/lib/shared/array.d.ts +35 -0
- package/lib/shared/array.js +189 -0
- package/lib/shared/case.d.ts +6 -0
- package/lib/shared/case.js +39 -0
- package/lib/shared/checkers.d.ts +21 -0
- package/lib/shared/checkers.js +77 -0
- package/lib/shared/clone.d.ts +2 -0
- package/lib/shared/clone.js +97 -0
- package/lib/shared/compare.d.ts +1 -0
- package/lib/shared/compare.js +129 -0
- package/lib/shared/defaults.d.ts +6 -0
- package/lib/shared/defaults.js +63 -0
- package/lib/shared/deprecate.d.ts +1 -0
- package/lib/shared/deprecate.js +42 -0
- package/lib/shared/global.d.ts +1 -0
- package/lib/shared/global.js +50 -0
- package/lib/shared/index.d.ts +16 -0
- package/lib/shared/index.js +51 -0
- package/lib/shared/instanceof.d.ts +1 -0
- package/lib/shared/instanceof.js +36 -0
- package/lib/shared/isEmpty.d.ts +3 -0
- package/lib/shared/isEmpty.js +94 -0
- package/lib/shared/merge.d.ts +12 -0
- package/lib/shared/merge.js +214 -0
- package/lib/shared/middleware.d.ts +4 -0
- package/lib/shared/middleware.js +41 -0
- package/lib/shared/path.d.ts +3 -0
- package/lib/shared/path.js +27 -0
- package/lib/shared/string.d.ts +1 -0
- package/lib/shared/string.js +38 -0
- package/lib/shared/subscribable.d.ts +11 -0
- package/lib/shared/subscribable.js +74 -0
- package/lib/shared/uid.d.ts +1 -0
- package/lib/shared/uid.js +35 -0
- package/lib/validator/formats.d.ts +16 -0
- package/lib/validator/formats.js +40 -0
- package/lib/validator/index.d.ts +4 -0
- package/lib/validator/index.js +27 -0
- package/lib/validator/locale.d.ts +219 -0
- package/lib/validator/locale.js +240 -0
- package/lib/validator/parser.d.ts +5 -0
- package/lib/validator/parser.js +153 -0
- package/lib/validator/registry.d.ts +15 -0
- package/lib/validator/registry.js +116 -0
- package/lib/validator/rules.d.ts +3 -0
- package/lib/validator/rules.js +154 -0
- package/lib/validator/template.d.ts +2 -0
- package/lib/validator/template.js +42 -0
- package/lib/validator/types.d.ts +62 -0
- package/lib/validator/types.js +28 -0
- package/lib/validator/validator.d.ts +2 -0
- package/lib/validator/validator.js +63 -0
- package/package.json +16 -10
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var shared_exports = {};
|
|
20
|
+
__export(shared_exports, {
|
|
21
|
+
SchemaNestedMap: () => SchemaNestedMap,
|
|
22
|
+
SchemaNormalKeys: () => SchemaNormalKeys,
|
|
23
|
+
SchemaStateMap: () => SchemaStateMap,
|
|
24
|
+
SchemaValidatorKeys: () => SchemaValidatorKeys,
|
|
25
|
+
SchemaValidatorMap: () => SchemaValidatorMap,
|
|
26
|
+
createDataSource: () => createDataSource,
|
|
27
|
+
hasOwnProperty: () => hasOwnProperty,
|
|
28
|
+
isNoNeedCompileObject: () => isNoNeedCompileObject,
|
|
29
|
+
patchStateFormSchema: () => patchStateFormSchema,
|
|
30
|
+
traverse: () => traverse,
|
|
31
|
+
traverseSchema: () => traverseSchema
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(shared_exports);
|
|
34
|
+
var import_reactive = require("../reactive");
|
|
35
|
+
var import_shared = require("../shared");
|
|
36
|
+
var import_schema = require("./schema");
|
|
37
|
+
const REVA_ACTIONS_KEY = Symbol.for("__REVA_ACTIONS");
|
|
38
|
+
const SchemaNestedMap = {
|
|
39
|
+
parent: true,
|
|
40
|
+
root: true,
|
|
41
|
+
properties: true,
|
|
42
|
+
patternProperties: true,
|
|
43
|
+
additionalProperties: true,
|
|
44
|
+
items: true,
|
|
45
|
+
additionalItems: true,
|
|
46
|
+
"x-linkages": true,
|
|
47
|
+
"x-reactions": true
|
|
48
|
+
};
|
|
49
|
+
const SchemaStateMap = {
|
|
50
|
+
title: "title",
|
|
51
|
+
description: "description",
|
|
52
|
+
default: "initialValue",
|
|
53
|
+
enum: "dataSource",
|
|
54
|
+
readOnly: "readOnly",
|
|
55
|
+
writeOnly: "editable",
|
|
56
|
+
"x-content": "content",
|
|
57
|
+
"x-data": "data",
|
|
58
|
+
"x-value": "value",
|
|
59
|
+
"x-editable": "editable",
|
|
60
|
+
"x-disabled": "disabled",
|
|
61
|
+
"x-read-pretty": "readPretty",
|
|
62
|
+
"x-read-only": "readOnly",
|
|
63
|
+
"x-visible": "visible",
|
|
64
|
+
"x-hidden": "hidden",
|
|
65
|
+
"x-display": "display",
|
|
66
|
+
"x-pattern": "pattern",
|
|
67
|
+
"x-validator": "validator",
|
|
68
|
+
"x-decorator": "decoratorType",
|
|
69
|
+
"x-component": "componentType",
|
|
70
|
+
"x-decorator-props": "decoratorProps",
|
|
71
|
+
"x-component-props": "componentProps"
|
|
72
|
+
};
|
|
73
|
+
const SchemaValidatorMap = {
|
|
74
|
+
required: true,
|
|
75
|
+
format: true,
|
|
76
|
+
maxItems: true,
|
|
77
|
+
minItems: true,
|
|
78
|
+
maxLength: true,
|
|
79
|
+
minLength: true,
|
|
80
|
+
maximum: true,
|
|
81
|
+
minimum: true,
|
|
82
|
+
exclusiveMaximum: true,
|
|
83
|
+
exclusiveMinimum: true,
|
|
84
|
+
pattern: true,
|
|
85
|
+
const: true,
|
|
86
|
+
multipleOf: true,
|
|
87
|
+
maxProperties: true,
|
|
88
|
+
minProperties: true,
|
|
89
|
+
uniqueItems: true
|
|
90
|
+
};
|
|
91
|
+
const SchemaNormalKeys = Object.keys(SchemaStateMap);
|
|
92
|
+
const SchemaValidatorKeys = Object.keys(SchemaValidatorMap);
|
|
93
|
+
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
94
|
+
const traverse = /* @__PURE__ */ __name((target, visitor) => {
|
|
95
|
+
const seenObjects = [];
|
|
96
|
+
const root = target;
|
|
97
|
+
const traverse2 = /* @__PURE__ */ __name((target2, path = []) => {
|
|
98
|
+
if ((0, import_shared.isPlainObj)(target2)) {
|
|
99
|
+
const seenIndex = seenObjects.indexOf(target2);
|
|
100
|
+
if (seenIndex > -1) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const addIndex = seenObjects.length;
|
|
104
|
+
seenObjects.push(target2);
|
|
105
|
+
if (isNoNeedCompileObject(target2) && root !== target2) {
|
|
106
|
+
visitor(target2, path);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
(0, import_shared.each)(target2, (value, key) => {
|
|
110
|
+
traverse2(value, path.concat(key));
|
|
111
|
+
});
|
|
112
|
+
seenObjects.splice(addIndex, 1);
|
|
113
|
+
} else {
|
|
114
|
+
visitor(target2, path);
|
|
115
|
+
}
|
|
116
|
+
}, "traverse");
|
|
117
|
+
traverse2(target);
|
|
118
|
+
}, "traverse");
|
|
119
|
+
const traverseSchema = /* @__PURE__ */ __name((schema, visitor) => {
|
|
120
|
+
var _a;
|
|
121
|
+
if (schema["x-validator"] !== void 0) {
|
|
122
|
+
visitor(schema["x-validator"], ["x-validator"], (_a = schema["x-compile-omitted"]) == null ? void 0 : _a.includes("x-validator"));
|
|
123
|
+
}
|
|
124
|
+
const seenObjects = [];
|
|
125
|
+
const root = schema;
|
|
126
|
+
const traverse2 = /* @__PURE__ */ __name((target, path = []) => {
|
|
127
|
+
var _a2;
|
|
128
|
+
if (path[0] === "x-compile-omitted" || path[0] === "x-validator" || path[0] === "version" || path[0] === "_isJSONSchemaObject")
|
|
129
|
+
return;
|
|
130
|
+
if (String(path[0]).indexOf("x-") === -1 && (0, import_shared.isFn)(target)) return;
|
|
131
|
+
if (SchemaNestedMap[path[0]]) return;
|
|
132
|
+
if (((_a2 = schema["x-compile-omitted"]) == null ? void 0 : _a2.indexOf(path[0])) > -1) {
|
|
133
|
+
visitor(target, path, true);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
if ((0, import_shared.isPlainObj)(target)) {
|
|
137
|
+
if (path[0] === "default" || path[0] === "x-value") {
|
|
138
|
+
visitor(target, path);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
const seenIndex = seenObjects.indexOf(target);
|
|
142
|
+
if (seenIndex > -1) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const addIndex = seenObjects.length;
|
|
146
|
+
seenObjects.push(target);
|
|
147
|
+
if (isNoNeedCompileObject(target) && root !== target) {
|
|
148
|
+
visitor(target, path);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
(0, import_shared.each)(target, (value, key) => {
|
|
152
|
+
traverse2(value, path.concat(key));
|
|
153
|
+
});
|
|
154
|
+
seenObjects.splice(addIndex, 1);
|
|
155
|
+
} else {
|
|
156
|
+
visitor(target, path);
|
|
157
|
+
}
|
|
158
|
+
}, "traverse");
|
|
159
|
+
traverse2(schema);
|
|
160
|
+
}, "traverseSchema");
|
|
161
|
+
const isNoNeedCompileObject = /* @__PURE__ */ __name((source) => {
|
|
162
|
+
if ("$$typeof" in source && "_owner" in source) {
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
if (source["_isAMomentObject"]) {
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
if (import_schema.Schema.isSchemaInstance(source)) {
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
if (source[REVA_ACTIONS_KEY]) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
if ((0, import_shared.isFn)(source["toJS"])) {
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
if ((0, import_shared.isFn)(source["toJSON"])) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
if ((0, import_reactive.isObservable)(source)) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
return false;
|
|
184
|
+
}, "isNoNeedCompileObject");
|
|
185
|
+
const createDataSource = /* @__PURE__ */ __name((source) => {
|
|
186
|
+
return (0, import_shared.toArr)(source).map((item) => {
|
|
187
|
+
if (typeof item === "object") {
|
|
188
|
+
return item;
|
|
189
|
+
} else {
|
|
190
|
+
return {
|
|
191
|
+
label: item,
|
|
192
|
+
value: item
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}, "createDataSource");
|
|
197
|
+
const patchStateFormSchema = /* @__PURE__ */ __name((targetState, pattern, compiled) => {
|
|
198
|
+
(0, import_reactive.untracked)(() => {
|
|
199
|
+
var _a;
|
|
200
|
+
const path = import_shared.FormPath.parse(pattern);
|
|
201
|
+
const segments = path.segments;
|
|
202
|
+
const key = segments[0];
|
|
203
|
+
const isEnum = key === "enum" && (0, import_shared.isArr)(compiled);
|
|
204
|
+
const schemaMapKey = SchemaStateMap[key];
|
|
205
|
+
if (schemaMapKey) {
|
|
206
|
+
import_shared.FormPath.setIn(
|
|
207
|
+
targetState,
|
|
208
|
+
[schemaMapKey].concat(segments.slice(1)),
|
|
209
|
+
isEnum ? createDataSource(compiled) : compiled
|
|
210
|
+
);
|
|
211
|
+
} else {
|
|
212
|
+
const isValidatorKey = SchemaValidatorMap[key];
|
|
213
|
+
if (isValidatorKey) {
|
|
214
|
+
(_a = targetState["setValidatorRule"]) == null ? void 0 : _a.call(targetState, key, compiled);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}, "patchStateFormSchema");
|
|
219
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
220
|
+
0 && (module.exports = {
|
|
221
|
+
SchemaNestedMap,
|
|
222
|
+
SchemaNormalKeys,
|
|
223
|
+
SchemaStateMap,
|
|
224
|
+
SchemaValidatorKeys,
|
|
225
|
+
SchemaValidatorMap,
|
|
226
|
+
createDataSource,
|
|
227
|
+
hasOwnProperty,
|
|
228
|
+
isNoNeedCompileObject,
|
|
229
|
+
patchStateFormSchema,
|
|
230
|
+
traverse,
|
|
231
|
+
traverseSchema
|
|
232
|
+
});
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var transformer_exports = {};
|
|
20
|
+
__export(transformer_exports, {
|
|
21
|
+
transformFieldProps: () => transformFieldProps
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(transformer_exports);
|
|
24
|
+
var import_core = require("../core");
|
|
25
|
+
var import_reactive = require("../reactive");
|
|
26
|
+
var import_shared = require("../shared");
|
|
27
|
+
var import_compiler = require("./compiler");
|
|
28
|
+
const FieldEffects = {
|
|
29
|
+
onFieldInit: import_core.onFieldInit,
|
|
30
|
+
onFieldMount: import_core.onFieldMount,
|
|
31
|
+
onFieldUnmount: import_core.onFieldUnmount,
|
|
32
|
+
onFieldValueChange: import_core.onFieldValueChange,
|
|
33
|
+
onFieldInputValueChange: import_core.onFieldInputValueChange,
|
|
34
|
+
onFieldInitialValueChange: import_core.onFieldInitialValueChange,
|
|
35
|
+
onFieldValidateStart: import_core.onFieldValidateStart,
|
|
36
|
+
onFieldValidateEnd: import_core.onFieldValidateEnd,
|
|
37
|
+
onFieldValidateFailed: import_core.onFieldValidateFailed,
|
|
38
|
+
onFieldValidateSuccess: import_core.onFieldValidateSuccess
|
|
39
|
+
};
|
|
40
|
+
const DefaultFieldEffects = ["onFieldInit", "onFieldValueChange"];
|
|
41
|
+
const getDependencyValue = /* @__PURE__ */ __name((field, pattern, property) => {
|
|
42
|
+
const [target, path] = String(pattern).split(/\s*#\s*/);
|
|
43
|
+
return field.query(target).getIn(path || property || "value");
|
|
44
|
+
}, "getDependencyValue");
|
|
45
|
+
const getDependencies = /* @__PURE__ */ __name((field, dependencies) => {
|
|
46
|
+
if ((0, import_shared.isArr)(dependencies)) {
|
|
47
|
+
const results = [];
|
|
48
|
+
dependencies.forEach((pattern) => {
|
|
49
|
+
if ((0, import_shared.isStr)(pattern)) {
|
|
50
|
+
results.push(getDependencyValue(field, pattern));
|
|
51
|
+
} else if ((0, import_shared.isPlainObj)(pattern)) {
|
|
52
|
+
if (pattern.name && pattern.source) {
|
|
53
|
+
results[pattern.name] = getDependencyValue(field, pattern.source, pattern.property);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return results;
|
|
58
|
+
} else if ((0, import_shared.isPlainObj)(dependencies)) {
|
|
59
|
+
return (0, import_shared.reduce)(
|
|
60
|
+
dependencies,
|
|
61
|
+
(buf, pattern, key) => {
|
|
62
|
+
buf[key] = getDependencyValue(field, pattern);
|
|
63
|
+
return buf;
|
|
64
|
+
},
|
|
65
|
+
{}
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
return [];
|
|
69
|
+
}, "getDependencies");
|
|
70
|
+
const setSchemaFieldState = /* @__PURE__ */ __name((options, demand = false) => {
|
|
71
|
+
const { request, target, runner, field, scope } = options || {};
|
|
72
|
+
if (!request) return;
|
|
73
|
+
if (target) {
|
|
74
|
+
if (request.state) {
|
|
75
|
+
field.form.setFieldState(
|
|
76
|
+
target,
|
|
77
|
+
(state) => (0, import_compiler.patchCompile)(
|
|
78
|
+
state,
|
|
79
|
+
request.state,
|
|
80
|
+
(0, import_shared.lazyMerge)(scope, {
|
|
81
|
+
$target: state
|
|
82
|
+
})
|
|
83
|
+
)
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
if (request.schema) {
|
|
87
|
+
field.form.setFieldState(
|
|
88
|
+
target,
|
|
89
|
+
(state) => (0, import_compiler.patchSchemaCompile)(
|
|
90
|
+
state,
|
|
91
|
+
request.schema,
|
|
92
|
+
(0, import_shared.lazyMerge)(scope, {
|
|
93
|
+
$target: state
|
|
94
|
+
}),
|
|
95
|
+
demand
|
|
96
|
+
)
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
if ((0, import_shared.isStr)(runner) && runner) {
|
|
100
|
+
field.form.setFieldState(target, (state) => {
|
|
101
|
+
(0, import_compiler.shallowCompile)(
|
|
102
|
+
`{{function(){${runner}}}}`,
|
|
103
|
+
(0, import_shared.lazyMerge)(scope, {
|
|
104
|
+
$target: state
|
|
105
|
+
})
|
|
106
|
+
)();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
} else {
|
|
110
|
+
if (request.state) {
|
|
111
|
+
field.setState((state) => (0, import_compiler.patchCompile)(state, request.state, scope));
|
|
112
|
+
}
|
|
113
|
+
if (request.schema) {
|
|
114
|
+
field.setState((state) => (0, import_compiler.patchSchemaCompile)(state, request.schema, scope, demand));
|
|
115
|
+
}
|
|
116
|
+
if ((0, import_shared.isStr)(runner) && runner) {
|
|
117
|
+
(0, import_compiler.shallowCompile)(`{{function(){${runner}}}}`, scope)();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}, "setSchemaFieldState");
|
|
121
|
+
const getBaseScope = /* @__PURE__ */ __name((field, options = {}) => {
|
|
122
|
+
const $observable = /* @__PURE__ */ __name((target, deps) => import_reactive.autorun.memo(() => (0, import_reactive.observable)(target), deps), "$observable");
|
|
123
|
+
const $props = /* @__PURE__ */ __name((props) => field.setComponentProps(props), "$props");
|
|
124
|
+
const $effect = import_reactive.autorun.effect;
|
|
125
|
+
const $memo = import_reactive.autorun.memo;
|
|
126
|
+
const $self = field;
|
|
127
|
+
const $form = field.form;
|
|
128
|
+
const $values = field.form.values;
|
|
129
|
+
return (0, import_shared.lazyMerge)(
|
|
130
|
+
{
|
|
131
|
+
get $lookup() {
|
|
132
|
+
var _a;
|
|
133
|
+
return ((_a = options == null ? void 0 : options.scope) == null ? void 0 : _a.$record) ?? $values;
|
|
134
|
+
},
|
|
135
|
+
get $records() {
|
|
136
|
+
return field.records;
|
|
137
|
+
},
|
|
138
|
+
get $record() {
|
|
139
|
+
const record = field.record;
|
|
140
|
+
if (typeof record === "object") {
|
|
141
|
+
return (0, import_shared.lazyMerge)(record, {
|
|
142
|
+
get $lookup() {
|
|
143
|
+
var _a;
|
|
144
|
+
return ((_a = options == null ? void 0 : options.scope) == null ? void 0 : _a.$record) ?? $values;
|
|
145
|
+
},
|
|
146
|
+
get $index() {
|
|
147
|
+
return field.index;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return record;
|
|
152
|
+
},
|
|
153
|
+
get $index() {
|
|
154
|
+
return field.index;
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
options.scope,
|
|
158
|
+
{
|
|
159
|
+
$form,
|
|
160
|
+
$self,
|
|
161
|
+
$observable,
|
|
162
|
+
$effect,
|
|
163
|
+
$memo,
|
|
164
|
+
$props,
|
|
165
|
+
$values
|
|
166
|
+
}
|
|
167
|
+
);
|
|
168
|
+
}, "getBaseScope");
|
|
169
|
+
const getBaseReactions = /* @__PURE__ */ __name((schema, options) => (field) => {
|
|
170
|
+
setSchemaFieldState(
|
|
171
|
+
{
|
|
172
|
+
field,
|
|
173
|
+
request: { schema },
|
|
174
|
+
scope: getBaseScope(field, options)
|
|
175
|
+
},
|
|
176
|
+
true
|
|
177
|
+
);
|
|
178
|
+
}, "getBaseReactions");
|
|
179
|
+
const getUserReactions = /* @__PURE__ */ __name((schema, options) => {
|
|
180
|
+
const reactions = (0, import_shared.toArr)(schema["x-reactions"]);
|
|
181
|
+
return reactions.map((unCompiled) => {
|
|
182
|
+
return (field) => {
|
|
183
|
+
const baseScope = getBaseScope(field, options);
|
|
184
|
+
const reaction = (0, import_compiler.shallowCompile)(unCompiled, baseScope);
|
|
185
|
+
if (!reaction) return;
|
|
186
|
+
if ((0, import_shared.isFn)(reaction)) {
|
|
187
|
+
return reaction(field, baseScope);
|
|
188
|
+
}
|
|
189
|
+
const { when, fulfill, otherwise, target, effects } = reaction;
|
|
190
|
+
const run = /* @__PURE__ */ __name(() => {
|
|
191
|
+
const $deps = getDependencies(field, reaction.dependencies);
|
|
192
|
+
const $dependencies = $deps;
|
|
193
|
+
const scope = (0, import_shared.lazyMerge)(baseScope, {
|
|
194
|
+
$target: null,
|
|
195
|
+
$deps,
|
|
196
|
+
$dependencies
|
|
197
|
+
});
|
|
198
|
+
const compiledWhen = (0, import_compiler.shallowCompile)(when, scope);
|
|
199
|
+
const condition = when ? compiledWhen : true;
|
|
200
|
+
const request = condition ? fulfill : otherwise;
|
|
201
|
+
const runner = request == null ? void 0 : request.run;
|
|
202
|
+
setSchemaFieldState({
|
|
203
|
+
field,
|
|
204
|
+
target,
|
|
205
|
+
request,
|
|
206
|
+
runner,
|
|
207
|
+
scope
|
|
208
|
+
});
|
|
209
|
+
}, "run");
|
|
210
|
+
if (target) {
|
|
211
|
+
reaction.effects = (effects == null ? void 0 : effects.length) ? effects : DefaultFieldEffects;
|
|
212
|
+
}
|
|
213
|
+
if (reaction.effects) {
|
|
214
|
+
import_reactive.autorun.memo(() => {
|
|
215
|
+
(0, import_reactive.untracked)(() => {
|
|
216
|
+
(0, import_shared.each)(reaction.effects, (type) => {
|
|
217
|
+
if (FieldEffects[type]) {
|
|
218
|
+
FieldEffects[type](field.address, run);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
}, []);
|
|
223
|
+
} else {
|
|
224
|
+
run();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
}, "getUserReactions");
|
|
229
|
+
const transformFieldProps = /* @__PURE__ */ __name((schema, options) => {
|
|
230
|
+
return {
|
|
231
|
+
name: schema.name,
|
|
232
|
+
reactions: [getBaseReactions(schema, options)].concat(getUserReactions(schema, options))
|
|
233
|
+
};
|
|
234
|
+
}, "transformFieldProps");
|
|
235
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
236
|
+
0 && (module.exports = {
|
|
237
|
+
transformFieldProps
|
|
238
|
+
});
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { FormPathPattern, GeneralField, IGeneralFieldState } from '../core';
|
|
2
|
+
export type SchemaEnum<Message> = Array<string | number | boolean | {
|
|
3
|
+
label?: Message;
|
|
4
|
+
value?: any;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
} | {
|
|
7
|
+
key?: any;
|
|
8
|
+
title?: Message;
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
}>;
|
|
11
|
+
export type SchemaTypes = 'string' | 'object' | 'array' | 'number' | 'boolean' | 'void' | 'date' | 'datetime' | (string & {});
|
|
12
|
+
export type SchemaProperties<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message> = Record<string, ISchema<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>>;
|
|
13
|
+
export type SchemaPatch = (schema: ISchema) => ISchema;
|
|
14
|
+
export type SchemaKey = string | number;
|
|
15
|
+
export type SchemaEffectTypes = 'onFieldInit' | 'onFieldMount' | 'onFieldUnmount' | 'onFieldValueChange' | 'onFieldInputValueChange' | 'onFieldInitialValueChange' | 'onFieldValidateStart' | 'onFieldValidateEnd' | 'onFieldValidateFailed' | 'onFieldValidateSuccess';
|
|
16
|
+
export type SchemaReaction<Field = any> = {
|
|
17
|
+
dependencies?: Array<string | {
|
|
18
|
+
name?: string;
|
|
19
|
+
type?: string;
|
|
20
|
+
source?: string;
|
|
21
|
+
property?: string;
|
|
22
|
+
}> | Record<string, string>;
|
|
23
|
+
when?: string | boolean;
|
|
24
|
+
target?: string;
|
|
25
|
+
effects?: (SchemaEffectTypes | (string & {}))[];
|
|
26
|
+
fulfill?: {
|
|
27
|
+
state?: Stringify<IGeneralFieldState>;
|
|
28
|
+
schema?: ISchema;
|
|
29
|
+
run?: string;
|
|
30
|
+
};
|
|
31
|
+
otherwise?: {
|
|
32
|
+
state?: Stringify<IGeneralFieldState>;
|
|
33
|
+
schema?: ISchema;
|
|
34
|
+
run?: string;
|
|
35
|
+
};
|
|
36
|
+
[key: string]: any;
|
|
37
|
+
} | ((field: Field, scope: IScopeContext) => void);
|
|
38
|
+
export type SchemaReactions<Field = any> = SchemaReaction<Field> | SchemaReaction<Field>[];
|
|
39
|
+
export type SchemaItems<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message> = ISchema<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message> | ISchema<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>[];
|
|
40
|
+
export type SchemaComponents = Record<string, any>;
|
|
41
|
+
export interface ISchemaFieldUpdateRequest {
|
|
42
|
+
state?: Stringify<IGeneralFieldState>;
|
|
43
|
+
schema?: ISchema;
|
|
44
|
+
run?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface IScopeContext {
|
|
47
|
+
[key: string]: any;
|
|
48
|
+
}
|
|
49
|
+
export interface IFieldStateSetterOptions {
|
|
50
|
+
field: GeneralField;
|
|
51
|
+
target?: FormPathPattern;
|
|
52
|
+
request: ISchemaFieldUpdateRequest;
|
|
53
|
+
runner?: string;
|
|
54
|
+
scope?: IScopeContext;
|
|
55
|
+
}
|
|
56
|
+
export interface ISchemaTransformerOptions {
|
|
57
|
+
scope?: IScopeContext;
|
|
58
|
+
}
|
|
59
|
+
export type Stringify<P extends {
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}> = {
|
|
62
|
+
[key in keyof P]?: P[key] | (string & {});
|
|
63
|
+
};
|
|
64
|
+
export type ISchema<Decorator = any, Component = any, DecoratorProps = any, ComponentProps = any, Pattern = any, Display = any, Validator = any, Message = any, ReactionField = any> = Stringify<{
|
|
65
|
+
version?: string;
|
|
66
|
+
name?: SchemaKey;
|
|
67
|
+
title?: Message;
|
|
68
|
+
description?: Message;
|
|
69
|
+
default?: any;
|
|
70
|
+
readOnly?: boolean;
|
|
71
|
+
writeOnly?: boolean;
|
|
72
|
+
type?: SchemaTypes;
|
|
73
|
+
enum?: SchemaEnum<Message>;
|
|
74
|
+
const?: any;
|
|
75
|
+
multipleOf?: number;
|
|
76
|
+
maximum?: number;
|
|
77
|
+
exclusiveMaximum?: number;
|
|
78
|
+
minimum?: number;
|
|
79
|
+
exclusiveMinimum?: number;
|
|
80
|
+
maxLength?: number;
|
|
81
|
+
minLength?: number;
|
|
82
|
+
pattern?: string | RegExp;
|
|
83
|
+
maxItems?: number;
|
|
84
|
+
minItems?: number;
|
|
85
|
+
uniqueItems?: boolean;
|
|
86
|
+
maxProperties?: number;
|
|
87
|
+
minProperties?: number;
|
|
88
|
+
required?: string[] | boolean | string;
|
|
89
|
+
format?: string;
|
|
90
|
+
$ref?: string;
|
|
91
|
+
$namespace?: string;
|
|
92
|
+
/** nested json schema spec **/
|
|
93
|
+
definitions?: SchemaProperties<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>;
|
|
94
|
+
properties?: SchemaProperties<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>;
|
|
95
|
+
items?: SchemaItems<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>;
|
|
96
|
+
additionalItems?: ISchema<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>;
|
|
97
|
+
patternProperties?: SchemaProperties<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>;
|
|
98
|
+
additionalProperties?: ISchema<Decorator, Component, DecoratorProps, ComponentProps, Pattern, Display, Validator, Message>;
|
|
99
|
+
['x-value']?: any;
|
|
100
|
+
['x-index']?: number;
|
|
101
|
+
['x-pattern']?: Pattern;
|
|
102
|
+
['x-display']?: Display;
|
|
103
|
+
['x-validator']?: Validator;
|
|
104
|
+
['x-decorator']?: Decorator | (string & {}) | ((...args: any[]) => any);
|
|
105
|
+
['x-decorator-props']?: DecoratorProps;
|
|
106
|
+
['x-component']?: Component | (string & {}) | ((...args: any[]) => any);
|
|
107
|
+
['x-component-props']?: ComponentProps;
|
|
108
|
+
['x-reactions']?: SchemaReactions<ReactionField>;
|
|
109
|
+
['x-content']?: any;
|
|
110
|
+
['x-data']?: any;
|
|
111
|
+
['x-visible']?: boolean;
|
|
112
|
+
['x-hidden']?: boolean;
|
|
113
|
+
['x-disabled']?: boolean;
|
|
114
|
+
['x-editable']?: boolean;
|
|
115
|
+
['x-read-only']?: boolean;
|
|
116
|
+
['x-read-pretty']?: boolean;
|
|
117
|
+
['x-compile-omitted']?: string[];
|
|
118
|
+
[key: `x-${string | number}` | symbol]: any;
|
|
119
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
14
|
+
var types_exports = {};
|
|
15
|
+
module.exports = __toCommonJS(types_exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type Context = {
|
|
2
|
+
flag: string;
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
5
|
+
export declare const bracketContext: Context;
|
|
6
|
+
export declare const bracketArrayContext: Context;
|
|
7
|
+
export declare const bracketDContext: Context;
|
|
8
|
+
export declare const parenContext: Context;
|
|
9
|
+
export declare const braceContext: Context;
|
|
10
|
+
export declare const destructorContext: Context;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var contexts_exports = {};
|
|
20
|
+
__export(contexts_exports, {
|
|
21
|
+
braceContext: () => braceContext,
|
|
22
|
+
bracketArrayContext: () => bracketArrayContext,
|
|
23
|
+
bracketContext: () => bracketContext,
|
|
24
|
+
bracketDContext: () => bracketDContext,
|
|
25
|
+
destructorContext: () => destructorContext,
|
|
26
|
+
parenContext: () => parenContext
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(contexts_exports);
|
|
29
|
+
const ContextType = /* @__PURE__ */ __name((flag, props) => {
|
|
30
|
+
return {
|
|
31
|
+
flag,
|
|
32
|
+
...props
|
|
33
|
+
};
|
|
34
|
+
}, "ContextType");
|
|
35
|
+
const bracketContext = ContextType("[]");
|
|
36
|
+
const bracketArrayContext = ContextType("[\\d]");
|
|
37
|
+
const bracketDContext = ContextType("[[]]");
|
|
38
|
+
const parenContext = ContextType("()");
|
|
39
|
+
const braceContext = ContextType("{}");
|
|
40
|
+
const destructorContext = ContextType("{x}");
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
braceContext,
|
|
44
|
+
bracketArrayContext,
|
|
45
|
+
bracketContext,
|
|
46
|
+
bracketDContext,
|
|
47
|
+
destructorContext,
|
|
48
|
+
parenContext
|
|
49
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DestructorRules, Node, Segments } from './types';
|
|
2
|
+
type Mutators = {
|
|
3
|
+
getIn: (segments: Segments, source: any) => any;
|
|
4
|
+
setIn: (segments: Segments, source: any, value: any) => void;
|
|
5
|
+
deleteIn?: (segments: Segments, source: any) => any;
|
|
6
|
+
existIn?: (segments: Segments, source: any, start: number) => boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const getDestructor: (source: string) => any;
|
|
9
|
+
export declare const setDestructor: (source: string, rules: DestructorRules) => void;
|
|
10
|
+
export declare const parseDestructorRules: (node: Node) => DestructorRules;
|
|
11
|
+
export declare const setInByDestructor: (source: any, rules: DestructorRules, value: any, mutators: Mutators) => void;
|
|
12
|
+
export declare const getInByDestructor: (source: any, rules: DestructorRules, mutators: Mutators) => {};
|
|
13
|
+
export declare const deleteInByDestructor: (source: any, rules: DestructorRules, mutators: Mutators) => void;
|
|
14
|
+
export declare const existInByDestructor: (source: any, rules: DestructorRules, start: number, mutators: Mutators) => boolean;
|
|
15
|
+
export {};
|