@tachybase/client 1.6.21 → 1.6.22
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/es/api-client/APIClient.d.ts +2 -1
- package/es/api-client/APIClient.mjs +6 -3
- package/es/application/Plugin.d.ts +2 -2
- package/es/application/hoc/withDynamicSchemaProps.mjs +1 -1
- package/es/application/schema-initializer/hooks/index.mjs +4 -1
- package/es/application/schema-settings/components/SchemaSettingsChildren.mjs +14 -14
- package/es/application/utils/clientModuleRegistry.d.ts +2 -0
- package/es/application/utils/clientModuleRegistry.mjs +9 -0
- package/es/application/utils/globalDeps.mjs +3 -3
- package/es/block-provider/BlockProvider.d.ts +1 -27
- package/es/block-provider/BlockProvider.mjs +1 -3
- package/es/block-provider/BlockRequestContext.d.ts +27 -0
- package/es/block-provider/BlockRequestContext.mjs +5 -0
- package/es/block-provider/FormBlockContext.d.ts +32 -0
- package/es/block-provider/FormBlockContext.mjs +5 -0
- package/es/block-provider/FormBlockProvider.d.ts +1 -33
- package/es/block-provider/FormBlockProvider.mjs +4 -5
- package/es/built-in/acl/ACLCollectionFieldProvider.d.ts +1 -0
- package/es/built-in/acl/ACLCollectionFieldProvider.mjs +42 -0
- package/es/built-in/acl/ACLContext.d.ts +9 -0
- package/es/built-in/acl/ACLContext.mjs +24 -0
- package/es/built-in/acl/ACLPlugin.mjs +2 -1
- package/es/built-in/acl/ACLProvider.d.ts +0 -11
- package/es/built-in/acl/ACLProvider.mjs +6 -51
- package/es/built-in/acl/index.d.ts +2 -0
- package/es/built-in/acl/index.mjs +2 -0
- package/es/collection-manager/hooks/useCollectionManager_deprecated.mjs +2 -1
- package/es/collection-manager/sub-table.d.ts +1 -1
- package/es/data-source/data-source/DataSourceManager.d.ts +1 -2
- package/es/data-source/data-source/DataSourceManager.mjs +1 -2
- package/es/data-source/data-source/constants.d.ts +2 -0
- package/es/data-source/data-source/constants.mjs +3 -0
- package/es/data-source/utils.d.ts +2 -2
- package/es/data-source/utils.mjs +1 -1
- package/es/exports.d.ts +46 -0
- package/es/exports.mjs +46 -0
- package/es/filter-provider/utils.d.ts +2 -14
- package/es/filter-provider/utils.mjs +2 -57
- package/es/index.d.ts +1 -46
- package/es/index.mjs +4 -46
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +2 -86
- package/es/record-provider/index.mjs +3 -3
- package/es/schema-component/antd/action/Action.mjs +7 -6
- package/es/schema-component/antd/action/hooks.mjs +3 -2
- package/es/schema-component/antd/association-field/AssociationSelect.mjs +4 -3
- package/es/schema-component/antd/association-field/hooks.mjs +18 -1
- package/es/schema-component/antd/cron/CronSet.mjs +9 -3
- package/es/schema-component/antd/filter/conditionUtils.d.ts +2 -0
- package/es/schema-component/antd/filter/conditionUtils.mjs +133 -0
- package/es/schema-component/antd/filter/dateValueUtils.d.ts +13 -0
- package/es/schema-component/antd/filter/dateValueUtils.mjs +66 -0
- package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -4
- package/es/schema-component/antd/filter/useFilterActionProps.mjs +3 -181
- package/es/schema-component/antd/filter/useGetFilterOptions.d.ts +2 -0
- package/es/schema-component/antd/filter/useGetFilterOptions.mjs +54 -0
- package/es/schema-component/antd/form/Form.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.FilterFormDesigner.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.d.ts +1 -1
- package/es/schema-component/antd/form-item/FormItem.mjs +14 -12
- package/es/schema-component/antd/form-item/SchemaSettingOptions.d.ts +1 -14
- package/es/schema-component/antd/form-item/SchemaSettingOptions.mjs +1 -33
- package/es/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.mjs +4 -3
- package/es/schema-component/antd/form-item/hooks/useParseDefaultValue.mjs +5 -3
- package/es/schema-component/antd/form-item/operatorUtils.d.ts +14 -0
- package/es/schema-component/antd/form-item/operatorUtils.mjs +36 -0
- package/es/schema-component/antd/form-v2/Form.mjs +26 -167
- package/es/schema-component/antd/form-v2/FormLinkageRules.d.ts +9 -0
- package/es/schema-component/antd/form-v2/FormLinkageRules.mjs +191 -0
- package/es/schema-component/antd/form-v2/Templates.mjs +1 -1
- package/es/schema-component/antd/grid/Grid.mjs +6 -4
- package/es/schema-component/antd/grid-card/GridCard.Item.mjs +2 -2
- package/es/schema-component/antd/icon-picker/IconFilterInput.mjs +12 -4
- package/es/schema-component/antd/icon-picker/IconPicker.mjs +1 -1
- package/es/schema-component/antd/input/Json.d.ts +1 -4
- package/es/schema-component/antd/input/ReadPretty.mjs +2 -2
- package/es/schema-component/antd/input-number/ReadPretty.mjs +1 -1
- package/es/schema-component/antd/markdown/Markdown.Void.Designer.mjs +2 -1
- package/es/schema-component/antd/markdown/Markdown.Void.mjs +10 -2
- package/es/schema-component/antd/markdown/Markdown.mjs +1 -1
- package/es/schema-component/antd/markdown/util.mjs +5 -0
- package/es/schema-component/antd/rich-text/RichText.mjs +1 -1
- package/es/schema-component/antd/select/FormulaSelect.mjs +1 -2
- package/es/schema-component/antd/select/ReadPretty.mjs +2 -2
- package/es/schema-component/antd/select/Select.mjs +1 -2
- package/es/schema-component/antd/select/utils.d.ts +2 -1
- package/es/schema-component/antd/select/utils.mjs +2 -2
- package/es/schema-component/antd/time-picker/ReadPretty.mjs +1 -1
- package/es/schema-component/antd/upload/ReadPretty.mjs +5 -5
- package/es/schema-component/antd/upload/Upload.mjs +6 -5
- package/es/schema-component/antd/variable/Input.mjs +1 -1
- package/es/schema-component/antd/variable/TextArea.mjs +1 -1
- package/es/schema-component/hooks/useDesigner.mjs +9 -3
- package/es/schema-component/hooks/useOptionalNavigate.d.ts +1 -0
- package/es/schema-component/hooks/useOptionalNavigate.mjs +2 -0
- package/es/schema-settings/DataTemplates/components/Designer.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useBaseVariable.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useBlockCollection.mjs +1 -1
- package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.mjs +2 -1
- package/es/schema-settings/VariableInput/hooks/useFormVariable.mjs +1 -1
- package/es/schema-settings/VariableInput/hooks/useRecordVariable.mjs +1 -1
- package/es/style/theme/AntdAppProvider.mjs +2 -2
- package/es/user/ChangePassword.d.ts +4 -1
- package/es/user/CurrentUserContext.d.ts +2 -0
- package/es/user/CurrentUserContext.mjs +5 -0
- package/es/user/CurrentUserProvider.d.ts +0 -3
- package/es/user/CurrentUserProvider.mjs +3 -5
- package/es/user/EditProfile.d.ts +4 -1
- package/es/user/LanguageSettings.d.ts +4 -1
- package/es/user/SwitchRole.d.ts +4 -1
- package/es/user/index.d.ts +1 -0
- package/es/user/index.mjs +1 -0
- package/es/variables/VariablesProvider.mjs +1 -1
- package/lib/api-client/APIClient.js +8 -5
- package/lib/application/hoc/withDynamicSchemaProps.js +3 -3
- package/lib/application/schema-initializer/hooks/index.js +4 -1
- package/lib/application/schema-settings/components/SchemaSettingsChildren.js +14 -14
- package/lib/application/utils/clientModuleRegistry.js +46 -0
- package/lib/application/utils/globalDeps.js +2 -2
- package/lib/block-provider/BlockProvider.js +6 -8
- package/lib/block-provider/BlockRequestContext.js +42 -0
- package/lib/block-provider/FormBlockContext.js +42 -0
- package/lib/block-provider/FormBlockProvider.js +13 -14
- package/lib/built-in/acl/ACLCollectionFieldProvider.js +76 -0
- package/lib/built-in/acl/ACLContext.js +70 -0
- package/lib/built-in/acl/ACLPlugin.js +2 -1
- package/lib/built-in/acl/ACLProvider.js +13 -76
- package/lib/built-in/acl/index.js +27 -9
- package/lib/collection-manager/hooks/useCollectionManager_deprecated.js +4 -3
- package/lib/data-source/data-source/DataSourceManager.js +6 -7
- package/lib/data-source/data-source/constants.js +40 -0
- package/lib/data-source/utils.js +2 -2
- package/lib/exports.js +769 -0
- package/lib/filter-provider/utils.js +7 -63
- package/lib/index.js +10 -714
- package/lib/record-provider/index.js +6 -6
- package/lib/schema-component/antd/action/Action.js +9 -8
- package/lib/schema-component/antd/action/hooks.js +3 -2
- package/lib/schema-component/antd/association-field/AssociationSelect.js +3 -2
- package/lib/schema-component/antd/association-field/hooks.js +18 -1
- package/lib/schema-component/antd/cron/CronSet.js +8 -2
- package/lib/schema-component/antd/filter/conditionUtils.js +180 -0
- package/lib/schema-component/antd/filter/dateValueUtils.js +116 -0
- package/lib/schema-component/antd/filter/useFilterActionProps.js +7 -186
- package/lib/schema-component/antd/filter/useGetFilterOptions.js +91 -0
- package/lib/schema-component/antd/form/Form.js +4 -4
- package/lib/schema-component/antd/form-item/FormItem.FilterFormDesigner.js +2 -2
- package/lib/schema-component/antd/form-item/FormItem.js +23 -20
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +6 -38
- package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js +9 -7
- package/lib/schema-component/antd/form-item/hooks/useParseDefaultValue.js +12 -8
- package/lib/schema-component/antd/form-item/operatorUtils.js +76 -0
- package/lib/schema-component/antd/form-v2/Form.js +204 -317
- package/lib/schema-component/antd/form-v2/FormLinkageRules.js +236 -0
- package/lib/schema-component/antd/form-v2/Templates.js +2 -2
- package/lib/schema-component/antd/grid/Grid.js +11 -9
- package/lib/schema-component/antd/grid-card/GridCard.Item.js +2 -2
- package/lib/schema-component/antd/icon-picker/IconFilterInput.js +12 -4
- package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -1
- package/lib/schema-component/antd/input/ReadPretty.js +10 -10
- package/lib/schema-component/antd/input-number/ReadPretty.js +1 -1
- package/lib/schema-component/antd/markdown/Markdown.Void.Designer.js +6 -5
- package/lib/schema-component/antd/markdown/Markdown.Void.js +138 -111
- package/lib/schema-component/antd/markdown/Markdown.js +2 -2
- package/lib/schema-component/antd/markdown/util.js +5 -0
- package/lib/schema-component/antd/rich-text/RichText.js +2 -2
- package/lib/schema-component/antd/select/FormulaSelect.js +1 -2
- package/lib/schema-component/antd/select/ReadPretty.js +2 -2
- package/lib/schema-component/antd/select/Select.js +1 -2
- package/lib/schema-component/antd/select/utils.js +6 -3
- package/lib/schema-component/antd/time-picker/ReadPretty.js +2 -2
- package/lib/schema-component/antd/upload/ReadPretty.js +5 -5
- package/lib/schema-component/antd/upload/Upload.js +6 -5
- package/lib/schema-component/antd/variable/Input.js +1 -1
- package/lib/schema-component/antd/variable/TextArea.js +1 -1
- package/lib/schema-component/hooks/useDesigner.js +57 -23
- package/lib/schema-component/hooks/useOptionalNavigate.js +36 -0
- package/lib/schema-settings/DataTemplates/components/Designer.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useBaseVariable.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useBlockCollection.js +2 -2
- package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +4 -3
- package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +2 -2
- package/lib/schema-settings/VariableInput/hooks/useRecordVariable.js +2 -2
- package/lib/style/theme/AntdAppProvider.js +4 -4
- package/lib/user/CurrentUserContext.js +42 -0
- package/lib/user/CurrentUserProvider.js +6 -14
- package/lib/user/index.js +24 -12
- package/lib/variables/VariablesProvider.js +2 -2
- package/package.json +5 -4
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
findFilterOperators: ()=>findFilterOperators,
|
|
28
|
+
getDefaultFilterOperatorValue: ()=>getDefaultFilterOperatorValue,
|
|
29
|
+
useEnsureOperatorsValid: ()=>useEnsureOperatorsValid
|
|
30
|
+
});
|
|
31
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
32
|
+
const useOperators_js_namespaceObject = require("../filter/useOperators.js");
|
|
33
|
+
const findFilterOperators = (schema)=>{
|
|
34
|
+
while(schema){
|
|
35
|
+
if (schema['x-filter-operators']) return {
|
|
36
|
+
operators: schema['x-filter-operators'],
|
|
37
|
+
uid: schema['x-uid']
|
|
38
|
+
};
|
|
39
|
+
schema = schema.parent;
|
|
40
|
+
}
|
|
41
|
+
return {};
|
|
42
|
+
};
|
|
43
|
+
const getSchemaFilterComponent = (schema)=>{
|
|
44
|
+
var _schema_xcomponentprops;
|
|
45
|
+
return (null == schema ? void 0 : null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : _schema_xcomponentprops.component) || (null == schema ? void 0 : schema['x-component']);
|
|
46
|
+
};
|
|
47
|
+
const getDefaultFilterOperatorValue = function(schema) {
|
|
48
|
+
let operatorList = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [];
|
|
49
|
+
var _operatorList_find, _operatorList_;
|
|
50
|
+
const component = getSchemaFilterComponent(schema);
|
|
51
|
+
if (component) {
|
|
52
|
+
const matched = operatorList.find((item)=>{
|
|
53
|
+
var _item_schema;
|
|
54
|
+
return (null == item ? void 0 : null == (_item_schema = item.schema) ? void 0 : _item_schema['x-component']) === component;
|
|
55
|
+
});
|
|
56
|
+
if (null == matched ? void 0 : matched.value) return matched.value;
|
|
57
|
+
}
|
|
58
|
+
return (null == (_operatorList_find = operatorList.find((item)=>null == item ? void 0 : item.selected)) ? void 0 : _operatorList_find.value) || (null == (_operatorList_ = operatorList[0]) ? void 0 : _operatorList_.value);
|
|
59
|
+
};
|
|
60
|
+
const useEnsureOperatorsValid = ()=>{
|
|
61
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
62
|
+
const operatorList = (0, useOperators_js_namespaceObject.useOperatorList)();
|
|
63
|
+
const { operators: storedOperators } = findFilterOperators(fieldSchema);
|
|
64
|
+
if (storedOperators && operatorList.length && !storedOperators[fieldSchema.name]) storedOperators[fieldSchema.name] = getDefaultFilterOperatorValue(fieldSchema, operatorList);
|
|
65
|
+
};
|
|
66
|
+
exports.findFilterOperators = __webpack_exports__.findFilterOperators;
|
|
67
|
+
exports.getDefaultFilterOperatorValue = __webpack_exports__.getDefaultFilterOperatorValue;
|
|
68
|
+
exports.useEnsureOperatorsValid = __webpack_exports__.useEnsureOperatorsValid;
|
|
69
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
70
|
+
"findFilterOperators",
|
|
71
|
+
"getDefaultFilterOperatorValue",
|
|
72
|
+
"useEnsureOperatorsValid"
|
|
73
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
74
|
+
Object.defineProperty(exports, '__esModule', {
|
|
75
|
+
value: true
|
|
76
|
+
});
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./FormLinkageRules": function(module) {
|
|
4
|
+
module.exports = import("./FormLinkageRules.js").then(function(module) {
|
|
5
|
+
return module;
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
var __webpack_module_cache__ = {};
|
|
10
|
+
function __webpack_require__(moduleId) {
|
|
11
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
12
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
13
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
14
|
+
exports: {}
|
|
15
|
+
};
|
|
16
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
17
|
+
return module.exports;
|
|
18
|
+
}
|
|
19
|
+
(()=>{
|
|
20
|
+
__webpack_require__.n = (module)=>{
|
|
21
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
22
|
+
__webpack_require__.d(getter, {
|
|
23
|
+
a: getter
|
|
24
|
+
});
|
|
25
|
+
return getter;
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
3
28
|
(()=>{
|
|
4
29
|
__webpack_require__.d = (exports1, definition)=>{
|
|
5
30
|
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
@@ -22,338 +47,200 @@ var __webpack_require__ = {};
|
|
|
22
47
|
};
|
|
23
48
|
})();
|
|
24
49
|
var __webpack_exports__ = {};
|
|
25
|
-
|
|
26
|
-
__webpack_require__.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
const withDynamicSchemaProps_js_namespaceObject = require("../../../application/hoc/withDynamicSchemaProps.js");
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]);
|
|
58
|
-
_templateObject = function() {
|
|
50
|
+
(()=>{
|
|
51
|
+
__webpack_require__.r(__webpack_exports__);
|
|
52
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
53
|
+
Form: ()=>Form
|
|
54
|
+
});
|
|
55
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
56
|
+
const external_react_namespaceObject = require("react");
|
|
57
|
+
var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_namespaceObject);
|
|
58
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
59
|
+
const client_namespaceObject = require("@tego/client");
|
|
60
|
+
const external_antd_namespaceObject = require("antd");
|
|
61
|
+
const external_antd_style_namespaceObject = require("antd-style");
|
|
62
|
+
const withDynamicSchemaProps_js_namespaceObject = require("../../../application/hoc/withDynamicSchemaProps.js");
|
|
63
|
+
const useAttach_js_namespaceObject = require("../../hooks/useAttach.js");
|
|
64
|
+
const useComponent_js_namespaceObject = require("../../hooks/useComponent.js");
|
|
65
|
+
const useProps_js_namespaceObject = require("../../hooks/useProps.js");
|
|
66
|
+
const hooks_js_namespaceObject = require("../action/hooks.js");
|
|
67
|
+
function _tagged_template_literal(strings, raw) {
|
|
68
|
+
if (!raw) raw = strings.slice(0);
|
|
69
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
70
|
+
raw: {
|
|
71
|
+
value: Object.freeze(raw)
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
function _templateObject() {
|
|
76
|
+
const data = _tagged_template_literal([
|
|
77
|
+
"\n .ant-formily-item-feedback-layout-loose {\n margin-bottom: 12px;\n }\n "
|
|
78
|
+
]);
|
|
79
|
+
_templateObject = function() {
|
|
80
|
+
return data;
|
|
81
|
+
};
|
|
59
82
|
return data;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
}
|
|
84
|
+
const LazyFormLinkageRules = /*#__PURE__*/ external_react_default().lazy(()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./FormLinkageRules")).then((module)=>({
|
|
85
|
+
default: module.FormLinkageRules
|
|
86
|
+
})));
|
|
87
|
+
const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=>{
|
|
88
|
+
let { css } = param;
|
|
89
|
+
return {
|
|
90
|
+
container: css(_templateObject())
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
const FormComponent = (props)=>{
|
|
94
|
+
const { form, children, ...others } = props;
|
|
95
|
+
const field = (0, schema_namespaceObject.useField)();
|
|
96
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
97
|
+
const f = (0, useAttach_js_namespaceObject.useAttach)(form.createVoidField({
|
|
98
|
+
...field.props,
|
|
99
|
+
basePath: ''
|
|
100
|
+
}));
|
|
101
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
|
|
102
|
+
value: void 0,
|
|
103
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FormContext.Provider, {
|
|
104
|
+
value: form,
|
|
105
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.FormLayout, {
|
|
106
|
+
layout: 'vertical',
|
|
107
|
+
...others,
|
|
108
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.RecursionField, {
|
|
109
|
+
basePath: f.address,
|
|
110
|
+
schema: fieldSchema,
|
|
111
|
+
onlyRenderProperties: true
|
|
112
|
+
})
|
|
88
113
|
})
|
|
89
114
|
})
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
const Def = (props)=>props.children;
|
|
118
|
+
const FormDecorator = (props)=>{
|
|
119
|
+
const { form, children, disabled, ...others } = props;
|
|
120
|
+
const field = (0, schema_namespaceObject.useField)();
|
|
121
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
122
|
+
const f = (0, useAttach_js_namespaceObject.useAttach)(form.createVoidField({
|
|
123
|
+
...field.props,
|
|
124
|
+
basePath: ''
|
|
125
|
+
}));
|
|
126
|
+
const Component = (0, useComponent_js_namespaceObject.useComponent)(fieldSchema['x-component'], Def);
|
|
127
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
|
|
128
|
+
value: void 0,
|
|
129
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FormContext.Provider, {
|
|
130
|
+
value: form,
|
|
131
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.FormLayout, {
|
|
132
|
+
layout: 'vertical',
|
|
133
|
+
...others,
|
|
134
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
|
|
135
|
+
value: f,
|
|
136
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Component, {
|
|
137
|
+
...field.componentProps,
|
|
138
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.RecursionField, {
|
|
139
|
+
basePath: f.address,
|
|
140
|
+
schema: fieldSchema,
|
|
141
|
+
onlyRenderProperties: true
|
|
142
|
+
})
|
|
118
143
|
})
|
|
119
144
|
})
|
|
120
145
|
})
|
|
121
146
|
})
|
|
122
|
-
})
|
|
123
|
-
});
|
|
124
|
-
};
|
|
125
|
-
const getLinkageRules = (fieldSchema)=>{
|
|
126
|
-
let linkageRules = null;
|
|
127
|
-
fieldSchema.mapProperties((schema)=>{
|
|
128
|
-
if (schema['x-linkage-rules']) linkageRules = schema['x-linkage-rules'];
|
|
129
|
-
});
|
|
130
|
-
return linkageRules;
|
|
131
|
-
};
|
|
132
|
-
const WithForm = (props)=>{
|
|
133
|
-
var _this, _fieldSchema_parent;
|
|
134
|
-
const { form } = props;
|
|
135
|
-
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
136
|
-
const { setFormValueChanged } = (0, external_index_js_namespaceObject.useActionContext)();
|
|
137
|
-
const variables = (0, index_js_namespaceObject.useVariables)();
|
|
138
|
-
const localVariables = (0, index_js_namespaceObject.useLocalVariables)({
|
|
139
|
-
currentForm: form
|
|
140
|
-
});
|
|
141
|
-
const linkageRules = (null == (_this = getLinkageRules(fieldSchema) || (null == (_fieldSchema_parent = fieldSchema.parent) ? void 0 : _fieldSchema_parent['x-linkage-rules'])) ? void 0 : _this.filter((k)=>!k.disabled)) || [];
|
|
142
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
143
|
-
const id = (0, schema_namespaceObject.uid)();
|
|
144
|
-
form.addEffects(id, ()=>{
|
|
145
|
-
(0, schema_namespaceObject.onFormInputChange)(()=>{
|
|
146
|
-
null == setFormValueChanged || setFormValueChanged(true);
|
|
147
|
-
});
|
|
148
147
|
});
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
form,
|
|
155
|
-
props.disabled,
|
|
156
|
-
setFormValueChanged
|
|
157
|
-
]);
|
|
158
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
159
|
-
const id = (0, schema_namespaceObject.uid)();
|
|
160
|
-
const disposes = [];
|
|
161
|
-
form.addEffects(id, ()=>{
|
|
162
|
-
linkageRules.forEach((rule)=>{
|
|
163
|
-
var _rule_actions;
|
|
164
|
-
null == (_rule_actions = rule.actions) || _rule_actions.forEach((action)=>{
|
|
165
|
-
var _action_targetFields;
|
|
166
|
-
if (null == (_action_targetFields = action.targetFields) ? void 0 : _action_targetFields.length) {
|
|
167
|
-
const fields = action.targetFields.join(',');
|
|
168
|
-
(0, schema_namespaceObject.onFieldInit)("*(".concat(fields, ")"), (field, form)=>{
|
|
169
|
-
var _field_initStateOfLinkageRules, _field_initStateOfLinkageRules1, _field_initStateOfLinkageRules2, _field_initStateOfLinkageRules3;
|
|
170
|
-
field['initStateOfLinkageRules'] = {
|
|
171
|
-
display: (null == (_field_initStateOfLinkageRules = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules.display) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.display),
|
|
172
|
-
required: (null == (_field_initStateOfLinkageRules1 = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules1.required) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.required || false),
|
|
173
|
-
pattern: (null == (_field_initStateOfLinkageRules2 = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules2.pattern) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.pattern),
|
|
174
|
-
value: (null == (_field_initStateOfLinkageRules3 = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules3.value) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.value || field.initialValue)
|
|
175
|
-
};
|
|
176
|
-
disposes.push((0, schema_namespaceObject.reaction)(()=>{
|
|
177
|
-
const fieldValuesInCondition = getFieldValuesInCondition({
|
|
178
|
-
linkageRules,
|
|
179
|
-
formValues: form.values
|
|
180
|
-
});
|
|
181
|
-
const variableValuesInCondition = getVariableValuesInCondition({
|
|
182
|
-
linkageRules,
|
|
183
|
-
localVariables
|
|
184
|
-
});
|
|
185
|
-
const variableValuesInExpression = getVariableValuesInExpression({
|
|
186
|
-
action,
|
|
187
|
-
localVariables
|
|
188
|
-
});
|
|
189
|
-
const result = [
|
|
190
|
-
fieldValuesInCondition,
|
|
191
|
-
variableValuesInCondition,
|
|
192
|
-
variableValuesInExpression
|
|
193
|
-
].map((item)=>JSON.stringify(item)).join(',');
|
|
194
|
-
return result;
|
|
195
|
-
}, getSubscriber(action, field, rule, variables, localVariables), {
|
|
196
|
-
fireImmediately: true
|
|
197
|
-
}));
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
});
|
|
201
|
-
});
|
|
148
|
+
};
|
|
149
|
+
const getLinkageRules = (fieldSchema)=>{
|
|
150
|
+
let linkageRules = null;
|
|
151
|
+
fieldSchema.mapProperties((schema)=>{
|
|
152
|
+
if (schema['x-linkage-rules']) linkageRules = schema['x-linkage-rules'];
|
|
202
153
|
});
|
|
203
|
-
return
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const WithoutForm = (props)=>{
|
|
219
|
-
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
220
|
-
const { setFormValueChanged } = (0, external_index_js_namespaceObject.useActionContext)();
|
|
221
|
-
const form = (0, external_react_namespaceObject.useMemo)(()=>(0, schema_namespaceObject.createForm)({
|
|
222
|
-
disabled: props.disabled,
|
|
223
|
-
effects () {
|
|
224
|
-
(0, schema_namespaceObject.onFormInputChange)((form)=>{
|
|
154
|
+
return linkageRules;
|
|
155
|
+
};
|
|
156
|
+
const WithForm = (props)=>{
|
|
157
|
+
var _fieldSchema_parent;
|
|
158
|
+
const { form } = props;
|
|
159
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
160
|
+
const { setFormValueChanged } = (0, hooks_js_namespaceObject.useActionContext)();
|
|
161
|
+
const rawLinkageRules = getLinkageRules(fieldSchema) || (null == (_fieldSchema_parent = fieldSchema.parent) ? void 0 : _fieldSchema_parent['x-linkage-rules']);
|
|
162
|
+
const linkageRules = (0, external_react_namespaceObject.useMemo)(()=>(null == rawLinkageRules ? void 0 : rawLinkageRules.filter((rule)=>!rule.disabled)) || [], [
|
|
163
|
+
rawLinkageRules
|
|
164
|
+
]);
|
|
165
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
166
|
+
const id = (0, schema_namespaceObject.uid)();
|
|
167
|
+
form.addEffects(id, ()=>{
|
|
168
|
+
(0, schema_namespaceObject.onFormInputChange)(()=>{
|
|
225
169
|
null == setFormValueChanged || setFormValueChanged(true);
|
|
226
170
|
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
children: form ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WithForm, {
|
|
250
|
-
form: form,
|
|
251
|
-
...others,
|
|
252
|
-
disabled: formDisabled
|
|
253
|
-
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WithoutForm, {
|
|
254
|
-
...others,
|
|
255
|
-
disabled: formDisabled
|
|
256
|
-
})
|
|
171
|
+
});
|
|
172
|
+
if (props.disabled) form.disabled = props.disabled;
|
|
173
|
+
return ()=>{
|
|
174
|
+
form.removeEffects(id);
|
|
175
|
+
};
|
|
176
|
+
}, [
|
|
177
|
+
form,
|
|
178
|
+
props.disabled,
|
|
179
|
+
setFormValueChanged
|
|
180
|
+
]);
|
|
181
|
+
const formElement = 'FormV2' === fieldSchema['x-decorator'] ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormDecorator, {
|
|
182
|
+
...props
|
|
183
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormComponent, {
|
|
184
|
+
...props
|
|
185
|
+
});
|
|
186
|
+
if (!linkageRules.length) return formElement;
|
|
187
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_default().Suspense, {
|
|
188
|
+
fallback: formElement,
|
|
189
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(LazyFormLinkageRules, {
|
|
190
|
+
form: form,
|
|
191
|
+
linkageRules: linkageRules,
|
|
192
|
+
children: formElement
|
|
257
193
|
})
|
|
258
|
-
})
|
|
259
|
-
});
|
|
260
|
-
}), {
|
|
261
|
-
displayName: 'Form'
|
|
262
|
-
});
|
|
263
|
-
function getSubscriber(action, field, rule, variables, localVariables) {
|
|
264
|
-
return ()=>{
|
|
265
|
-
(0, external_utils_js_namespaceObject.collectFieldStateOfLinkageRules)({
|
|
266
|
-
operator: action.operator,
|
|
267
|
-
value: action.value,
|
|
268
|
-
field,
|
|
269
|
-
condition: rule.condition,
|
|
270
|
-
variables,
|
|
271
|
-
localVariables
|
|
272
194
|
});
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
|
|
195
|
+
};
|
|
196
|
+
const WithoutForm = (props)=>{
|
|
197
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
198
|
+
const { setFormValueChanged } = (0, hooks_js_namespaceObject.useActionContext)();
|
|
199
|
+
const form = (0, external_react_namespaceObject.useMemo)(()=>(0, schema_namespaceObject.createForm)({
|
|
200
|
+
disabled: props.disabled,
|
|
201
|
+
initialValues: props.initialValues,
|
|
202
|
+
values: props.initialValues,
|
|
203
|
+
effects () {
|
|
204
|
+
(0, schema_namespaceObject.onFormInputChange)((form)=>{
|
|
205
|
+
null == setFormValueChanged || setFormValueChanged(true);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}), []);
|
|
209
|
+
return 'FormV2' === fieldSchema['x-decorator'] ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormDecorator, {
|
|
210
|
+
form: form,
|
|
211
|
+
...props
|
|
212
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormComponent, {
|
|
213
|
+
form: form,
|
|
214
|
+
...props
|
|
288
215
|
});
|
|
289
216
|
};
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
const conditions = condition[type];
|
|
316
|
-
return conditions.map((condition)=>{
|
|
317
|
-
if ('$and' in condition || '$or' in condition) return run(condition);
|
|
318
|
-
const path = (0, uitls_js_namespaceObject.getTargetField)(condition).join('.');
|
|
319
|
-
return (0, client_namespaceObject.getValuesByPath)(formValues, path);
|
|
320
|
-
}).filter(Boolean);
|
|
321
|
-
};
|
|
322
|
-
return run(rule.condition);
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
function getVariableValuesInCondition(param) {
|
|
326
|
-
let { linkageRules, localVariables } = param;
|
|
327
|
-
return linkageRules.map((rule)=>{
|
|
328
|
-
const type = Object.keys(rule.condition)[0] || '$and';
|
|
329
|
-
const conditions = rule.condition[type];
|
|
330
|
-
return conditions.map((condition)=>{
|
|
331
|
-
const jsonlogic = (0, uitls_js_namespaceObject.getInnermostKeyAndValue)(condition);
|
|
332
|
-
if (!jsonlogic) return null;
|
|
333
|
-
if ((0, isVariable_js_namespaceObject.isVariable)(jsonlogic.value)) return getVariableValue(jsonlogic.value, localVariables);
|
|
334
|
-
return jsonlogic.value;
|
|
335
|
-
}).filter(Boolean);
|
|
217
|
+
const Form = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaProps)((0, schema_namespaceObject.observer)((props)=>{
|
|
218
|
+
const field = (0, schema_namespaceObject.useField)();
|
|
219
|
+
const { styles } = useStyles();
|
|
220
|
+
const { form, disabled, ...others } = (0, useProps_js_namespaceObject.useProps)(props);
|
|
221
|
+
const formDisabled = disabled || field.disabled;
|
|
222
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.ConfigProvider, {
|
|
223
|
+
componentDisabled: formDisabled,
|
|
224
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("form", {
|
|
225
|
+
onSubmit: (e)=>e.preventDefault(),
|
|
226
|
+
className: styles.container,
|
|
227
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Spin, {
|
|
228
|
+
spinning: field.loading || false,
|
|
229
|
+
children: form ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WithForm, {
|
|
230
|
+
form: form,
|
|
231
|
+
...others,
|
|
232
|
+
disabled: formDisabled
|
|
233
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(WithoutForm, {
|
|
234
|
+
...others,
|
|
235
|
+
disabled: formDisabled
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
});
|
|
240
|
+
}), {
|
|
241
|
+
displayName: 'Form'
|
|
336
242
|
});
|
|
337
|
-
}
|
|
338
|
-
function getVariableValuesInExpression(param) {
|
|
339
|
-
let { action, localVariables } = param;
|
|
340
|
-
var _value_match;
|
|
341
|
-
const actionValue = action.value;
|
|
342
|
-
const mode = null == actionValue ? void 0 : actionValue.mode;
|
|
343
|
-
const value = (null == actionValue ? void 0 : actionValue.value) || (null == actionValue ? void 0 : actionValue.result);
|
|
344
|
-
if ('express' !== mode) return;
|
|
345
|
-
if (null == value) return;
|
|
346
|
-
return null == (_value_match = value.match(isVariable_js_namespaceObject.REGEX_OF_VARIABLE)) ? void 0 : _value_match.map((variableString)=>getVariableValue(variableString, localVariables)).filter(Boolean);
|
|
347
|
-
}
|
|
348
|
-
function getVariableValue(variableString, localVariables) {
|
|
349
|
-
var _localVariables_find;
|
|
350
|
-
if (!(0, isVariable_js_namespaceObject.isVariable)(variableString)) return;
|
|
351
|
-
const variableName = (0, getVariableName_js_namespaceObject.getVariableName)(variableString);
|
|
352
|
-
const ctx = {
|
|
353
|
-
[variableName]: null == (_localVariables_find = localVariables.find((item)=>item.name === variableName)) ? void 0 : _localVariables_find.ctx
|
|
354
|
-
};
|
|
355
|
-
return (0, client_namespaceObject.getValuesByPath)(ctx, (0, getPath_js_namespaceObject.getPath)(variableString));
|
|
356
|
-
}
|
|
243
|
+
})();
|
|
357
244
|
exports.Form = __webpack_exports__.Form;
|
|
358
245
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
359
246
|
"Form"
|