@tachybase/client 1.6.21 → 1.6.23

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.
Files changed (191) hide show
  1. package/es/api-client/APIClient.d.ts +2 -1
  2. package/es/api-client/APIClient.mjs +6 -3
  3. package/es/application/Plugin.d.ts +2 -2
  4. package/es/application/hoc/withDynamicSchemaProps.mjs +1 -1
  5. package/es/application/schema-initializer/hooks/index.mjs +4 -1
  6. package/es/application/schema-settings/components/SchemaSettingsChildren.mjs +14 -14
  7. package/es/application/utils/clientModuleRegistry.d.ts +2 -0
  8. package/es/application/utils/clientModuleRegistry.mjs +9 -0
  9. package/es/application/utils/globalDeps.mjs +2 -2
  10. package/es/block-provider/BlockProvider.d.ts +1 -27
  11. package/es/block-provider/BlockProvider.mjs +1 -3
  12. package/es/block-provider/BlockRequestContext.d.ts +27 -0
  13. package/es/block-provider/BlockRequestContext.mjs +5 -0
  14. package/es/block-provider/FormBlockContext.d.ts +32 -0
  15. package/es/block-provider/FormBlockContext.mjs +5 -0
  16. package/es/block-provider/FormBlockProvider.d.ts +1 -33
  17. package/es/block-provider/FormBlockProvider.mjs +4 -5
  18. package/es/built-in/acl/ACLCollectionFieldProvider.d.ts +1 -0
  19. package/es/built-in/acl/ACLCollectionFieldProvider.mjs +42 -0
  20. package/es/built-in/acl/ACLContext.d.ts +9 -0
  21. package/es/built-in/acl/ACLContext.mjs +24 -0
  22. package/es/built-in/acl/ACLPlugin.mjs +2 -1
  23. package/es/built-in/acl/ACLProvider.d.ts +0 -11
  24. package/es/built-in/acl/ACLProvider.mjs +6 -51
  25. package/es/built-in/acl/index.d.ts +2 -0
  26. package/es/built-in/acl/index.mjs +2 -0
  27. package/es/built-in/locale/LocalePlugin.d.ts +2 -0
  28. package/es/built-in/locale/LocalePlugin.mjs +13 -4
  29. package/es/collection-manager/hooks/useCollectionManager_deprecated.mjs +2 -1
  30. package/es/collection-manager/sub-table.d.ts +1 -1
  31. package/es/data-source/data-source/DataSourceManager.d.ts +1 -2
  32. package/es/data-source/data-source/DataSourceManager.mjs +1 -2
  33. package/es/data-source/data-source/constants.d.ts +2 -0
  34. package/es/data-source/data-source/constants.mjs +3 -0
  35. package/es/data-source/utils.d.ts +2 -2
  36. package/es/data-source/utils.mjs +1 -1
  37. package/es/exports.d.ts +46 -0
  38. package/es/exports.mjs +46 -0
  39. package/es/filter-provider/utils.d.ts +2 -14
  40. package/es/filter-provider/utils.mjs +2 -57
  41. package/es/index.d.ts +1 -46
  42. package/es/index.mjs +4 -46
  43. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +2 -86
  44. package/es/record-provider/index.mjs +3 -3
  45. package/es/schema-component/antd/action/Action.mjs +7 -6
  46. package/es/schema-component/antd/action/hooks.mjs +3 -2
  47. package/es/schema-component/antd/association-field/AssociationSelect.mjs +4 -3
  48. package/es/schema-component/antd/association-field/hooks.mjs +18 -1
  49. package/es/schema-component/antd/cron/CronSet.mjs +9 -3
  50. package/es/schema-component/antd/filter/conditionUtils.d.ts +2 -0
  51. package/es/schema-component/antd/filter/conditionUtils.mjs +133 -0
  52. package/es/schema-component/antd/filter/dateValueUtils.d.ts +13 -0
  53. package/es/schema-component/antd/filter/dateValueUtils.mjs +66 -0
  54. package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -4
  55. package/es/schema-component/antd/filter/useFilterActionProps.mjs +3 -181
  56. package/es/schema-component/antd/filter/useGetFilterOptions.d.ts +2 -0
  57. package/es/schema-component/antd/filter/useGetFilterOptions.mjs +54 -0
  58. package/es/schema-component/antd/form/Form.mjs +1 -1
  59. package/es/schema-component/antd/form-item/FormItem.FilterFormDesigner.mjs +1 -1
  60. package/es/schema-component/antd/form-item/FormItem.d.ts +1 -1
  61. package/es/schema-component/antd/form-item/FormItem.mjs +14 -12
  62. package/es/schema-component/antd/form-item/SchemaSettingOptions.d.ts +1 -14
  63. package/es/schema-component/antd/form-item/SchemaSettingOptions.mjs +1 -33
  64. package/es/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.mjs +4 -3
  65. package/es/schema-component/antd/form-item/hooks/useParseDefaultValue.mjs +5 -3
  66. package/es/schema-component/antd/form-item/operatorUtils.d.ts +14 -0
  67. package/es/schema-component/antd/form-item/operatorUtils.mjs +36 -0
  68. package/es/schema-component/antd/form-v2/Form.mjs +26 -167
  69. package/es/schema-component/antd/form-v2/FormLinkageRules.d.ts +9 -0
  70. package/es/schema-component/antd/form-v2/FormLinkageRules.mjs +191 -0
  71. package/es/schema-component/antd/form-v2/Templates.mjs +1 -1
  72. package/es/schema-component/antd/grid/Grid.mjs +5 -2
  73. package/es/schema-component/antd/grid-card/GridCard.Item.mjs +2 -2
  74. package/es/schema-component/antd/icon-picker/IconFilterInput.mjs +12 -4
  75. package/es/schema-component/antd/icon-picker/IconPicker.mjs +1 -1
  76. package/es/schema-component/antd/input/Json.d.ts +1 -4
  77. package/es/schema-component/antd/input/ReadPretty.mjs +2 -2
  78. package/es/schema-component/antd/input-number/ReadPretty.mjs +1 -1
  79. package/es/schema-component/antd/markdown/Markdown.Void.Designer.mjs +2 -1
  80. package/es/schema-component/antd/markdown/Markdown.Void.mjs +10 -2
  81. package/es/schema-component/antd/markdown/Markdown.mjs +1 -1
  82. package/es/schema-component/antd/markdown/util.mjs +5 -0
  83. package/es/schema-component/antd/rich-text/RichText.mjs +1 -1
  84. package/es/schema-component/antd/select/FormulaSelect.mjs +1 -2
  85. package/es/schema-component/antd/select/ReadPretty.mjs +2 -2
  86. package/es/schema-component/antd/select/Select.mjs +1 -2
  87. package/es/schema-component/antd/select/utils.d.ts +2 -1
  88. package/es/schema-component/antd/select/utils.mjs +2 -2
  89. package/es/schema-component/antd/time-picker/ReadPretty.mjs +1 -1
  90. package/es/schema-component/antd/upload/ReadPretty.mjs +5 -5
  91. package/es/schema-component/antd/upload/Upload.mjs +6 -5
  92. package/es/schema-component/antd/variable/Input.mjs +1 -1
  93. package/es/schema-component/antd/variable/TextArea.mjs +1 -1
  94. package/es/schema-component/hooks/useDesigner.mjs +9 -3
  95. package/es/schema-component/hooks/useOptionalNavigate.d.ts +1 -0
  96. package/es/schema-component/hooks/useOptionalNavigate.mjs +2 -0
  97. package/es/schema-settings/DataTemplates/components/Designer.mjs +2 -1
  98. package/es/schema-settings/VariableInput/hooks/useBaseVariable.mjs +2 -1
  99. package/es/schema-settings/VariableInput/hooks/useBlockCollection.mjs +1 -1
  100. package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.mjs +2 -1
  101. package/es/schema-settings/VariableInput/hooks/useFormVariable.mjs +1 -1
  102. package/es/schema-settings/VariableInput/hooks/useRecordVariable.mjs +1 -1
  103. package/es/style/theme/AntdAppProvider.mjs +2 -2
  104. package/es/user/ChangePassword.d.ts +4 -1
  105. package/es/user/CurrentUserContext.d.ts +2 -0
  106. package/es/user/CurrentUserContext.mjs +5 -0
  107. package/es/user/CurrentUserProvider.d.ts +0 -3
  108. package/es/user/CurrentUserProvider.mjs +3 -5
  109. package/es/user/EditProfile.d.ts +4 -1
  110. package/es/user/LanguageSettings.d.ts +4 -1
  111. package/es/user/SwitchRole.d.ts +4 -1
  112. package/es/user/index.d.ts +1 -0
  113. package/es/user/index.mjs +1 -0
  114. package/es/variables/VariablesProvider.mjs +1 -1
  115. package/lib/api-client/APIClient.js +8 -5
  116. package/lib/application/hoc/withDynamicSchemaProps.js +3 -3
  117. package/lib/application/schema-initializer/hooks/index.js +4 -1
  118. package/lib/application/schema-settings/components/SchemaSettingsChildren.js +14 -14
  119. package/lib/application/utils/clientModuleRegistry.js +46 -0
  120. package/lib/application/utils/globalDeps.js +2 -2
  121. package/lib/block-provider/BlockProvider.js +6 -8
  122. package/lib/block-provider/BlockRequestContext.js +42 -0
  123. package/lib/block-provider/FormBlockContext.js +42 -0
  124. package/lib/block-provider/FormBlockProvider.js +13 -14
  125. package/lib/built-in/acl/ACLCollectionFieldProvider.js +76 -0
  126. package/lib/built-in/acl/ACLContext.js +70 -0
  127. package/lib/built-in/acl/ACLPlugin.js +2 -1
  128. package/lib/built-in/acl/ACLProvider.js +13 -76
  129. package/lib/built-in/acl/index.js +27 -9
  130. package/lib/built-in/locale/LocalePlugin.js +17 -5
  131. package/lib/collection-manager/hooks/useCollectionManager_deprecated.js +4 -3
  132. package/lib/data-source/data-source/DataSourceManager.js +6 -7
  133. package/lib/data-source/data-source/constants.js +40 -0
  134. package/lib/data-source/utils.js +2 -2
  135. package/lib/exports.js +769 -0
  136. package/lib/filter-provider/utils.js +7 -63
  137. package/lib/index.js +10 -714
  138. package/lib/record-provider/index.js +6 -6
  139. package/lib/schema-component/antd/action/Action.js +9 -8
  140. package/lib/schema-component/antd/action/hooks.js +3 -2
  141. package/lib/schema-component/antd/association-field/AssociationSelect.js +3 -2
  142. package/lib/schema-component/antd/association-field/hooks.js +18 -1
  143. package/lib/schema-component/antd/cron/CronSet.js +8 -2
  144. package/lib/schema-component/antd/filter/conditionUtils.js +180 -0
  145. package/lib/schema-component/antd/filter/dateValueUtils.js +116 -0
  146. package/lib/schema-component/antd/filter/useFilterActionProps.js +7 -186
  147. package/lib/schema-component/antd/filter/useGetFilterOptions.js +91 -0
  148. package/lib/schema-component/antd/form/Form.js +4 -4
  149. package/lib/schema-component/antd/form-item/FormItem.FilterFormDesigner.js +2 -2
  150. package/lib/schema-component/antd/form-item/FormItem.js +23 -20
  151. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +6 -38
  152. package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js +9 -7
  153. package/lib/schema-component/antd/form-item/hooks/useParseDefaultValue.js +12 -8
  154. package/lib/schema-component/antd/form-item/operatorUtils.js +76 -0
  155. package/lib/schema-component/antd/form-v2/Form.js +204 -317
  156. package/lib/schema-component/antd/form-v2/FormLinkageRules.js +236 -0
  157. package/lib/schema-component/antd/form-v2/Templates.js +2 -2
  158. package/lib/schema-component/antd/grid/Grid.js +10 -7
  159. package/lib/schema-component/antd/grid-card/GridCard.Item.js +2 -2
  160. package/lib/schema-component/antd/icon-picker/IconFilterInput.js +12 -4
  161. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -1
  162. package/lib/schema-component/antd/input/ReadPretty.js +10 -10
  163. package/lib/schema-component/antd/input-number/ReadPretty.js +1 -1
  164. package/lib/schema-component/antd/markdown/Markdown.Void.Designer.js +6 -5
  165. package/lib/schema-component/antd/markdown/Markdown.Void.js +138 -111
  166. package/lib/schema-component/antd/markdown/Markdown.js +2 -2
  167. package/lib/schema-component/antd/markdown/util.js +5 -0
  168. package/lib/schema-component/antd/rich-text/RichText.js +2 -2
  169. package/lib/schema-component/antd/select/FormulaSelect.js +1 -2
  170. package/lib/schema-component/antd/select/ReadPretty.js +2 -2
  171. package/lib/schema-component/antd/select/Select.js +1 -2
  172. package/lib/schema-component/antd/select/utils.js +6 -3
  173. package/lib/schema-component/antd/time-picker/ReadPretty.js +2 -2
  174. package/lib/schema-component/antd/upload/ReadPretty.js +5 -5
  175. package/lib/schema-component/antd/upload/Upload.js +6 -5
  176. package/lib/schema-component/antd/variable/Input.js +1 -1
  177. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  178. package/lib/schema-component/hooks/useDesigner.js +57 -23
  179. package/lib/schema-component/hooks/useOptionalNavigate.js +36 -0
  180. package/lib/schema-settings/DataTemplates/components/Designer.js +4 -3
  181. package/lib/schema-settings/VariableInput/hooks/useBaseVariable.js +4 -3
  182. package/lib/schema-settings/VariableInput/hooks/useBlockCollection.js +2 -2
  183. package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +4 -3
  184. package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +2 -2
  185. package/lib/schema-settings/VariableInput/hooks/useRecordVariable.js +2 -2
  186. package/lib/style/theme/AntdAppProvider.js +4 -4
  187. package/lib/user/CurrentUserContext.js +42 -0
  188. package/lib/user/CurrentUserProvider.js +6 -14
  189. package/lib/user/index.js +24 -12
  190. package/lib/variables/VariablesProvider.js +2 -2
  191. 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 __webpack_require__ = {};
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
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- Form: ()=>Form
28
- });
29
- const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
- const external_react_namespaceObject = require("react");
31
- const schema_namespaceObject = require("@tachybase/schema");
32
- const client_namespaceObject = require("@tego/client");
33
- const external_antd_namespaceObject = require("antd");
34
- const external_antd_style_namespaceObject = require("antd-style");
35
- const external_index_js_namespaceObject = require("../index.js");
36
- const external_index_js_namespaceObject_1 = require("../../index.js");
37
- const withDynamicSchemaProps_js_namespaceObject = require("../../../application/hoc/withDynamicSchemaProps.js");
38
- const type_js_namespaceObject = require("../../../schema-settings/LinkageRules/type.js");
39
- const index_js_namespaceObject = require("../../../variables/index.js");
40
- const getPath_js_namespaceObject = require("../../../variables/utils/getPath.js");
41
- const getVariableName_js_namespaceObject = require("../../../variables/utils/getVariableName.js");
42
- const isVariable_js_namespaceObject = require("../../../variables/utils/isVariable.js");
43
- const uitls_js_namespaceObject = require("../../common/utils/uitls.js");
44
- const useProps_js_namespaceObject = require("../../hooks/useProps.js");
45
- const external_utils_js_namespaceObject = require("./utils.js");
46
- function _tagged_template_literal(strings, raw) {
47
- if (!raw) raw = strings.slice(0);
48
- return Object.freeze(Object.defineProperties(strings, {
49
- raw: {
50
- value: Object.freeze(raw)
51
- }
52
- }));
53
- }
54
- function _templateObject() {
55
- const data = _tagged_template_literal([
56
- "\n .ant-formily-item-feedback-layout-loose {\n margin-bottom: 12px;\n }\n "
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
- return data;
62
- }
63
- const useStyles = (0, external_antd_style_namespaceObject.createStyles)((param)=>{
64
- let { css } = param;
65
- return {
66
- container: css(_templateObject())
67
- };
68
- });
69
- const FormComponent = (props)=>{
70
- const { form, children, ...others } = props;
71
- const field = (0, schema_namespaceObject.useField)();
72
- const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
73
- const f = (0, external_index_js_namespaceObject_1.useAttach)(form.createVoidField({
74
- ...field.props,
75
- basePath: ''
76
- }));
77
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
78
- value: void 0,
79
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FormContext.Provider, {
80
- value: form,
81
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.FormLayout, {
82
- layout: 'vertical',
83
- ...others,
84
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.RecursionField, {
85
- basePath: f.address,
86
- schema: fieldSchema,
87
- onlyRenderProperties: true
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 Def = (props)=>props.children;
94
- const FormDecorator = (props)=>{
95
- const { form, children, disabled, ...others } = props;
96
- const field = (0, schema_namespaceObject.useField)();
97
- const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
98
- const f = (0, external_index_js_namespaceObject_1.useAttach)(form.createVoidField({
99
- ...field.props,
100
- basePath: ''
101
- }));
102
- const Component = (0, external_index_js_namespaceObject_1.useComponent)(fieldSchema['x-component'], Def);
103
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
104
- value: void 0,
105
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FormContext.Provider, {
106
- value: form,
107
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.FormLayout, {
108
- layout: 'vertical',
109
- ...others,
110
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.FieldContext.Provider, {
111
- value: f,
112
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Component, {
113
- ...field.componentProps,
114
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(schema_namespaceObject.RecursionField, {
115
- basePath: f.address,
116
- schema: fieldSchema,
117
- onlyRenderProperties: true
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
- if (props.disabled) form.disabled = props.disabled;
150
- return ()=>{
151
- form.removeEffects(id);
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
- form.removeEffects(id);
205
- disposes.forEach((dispose)=>{
206
- dispose();
207
- });
208
- };
209
- }, [
210
- linkageRules
211
- ]);
212
- return 'FormV2' === fieldSchema['x-decorator'] ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormDecorator, {
213
- ...props
214
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormComponent, {
215
- ...props
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
- return 'FormV2' === fieldSchema['x-decorator'] ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormDecorator, {
230
- form: form,
231
- ...props
232
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FormComponent, {
233
- form: form,
234
- ...props
235
- });
236
- };
237
- const Form = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaProps)((0, schema_namespaceObject.observer)((props)=>{
238
- const field = (0, schema_namespaceObject.useField)();
239
- const { styles } = useStyles();
240
- const { form, disabled, ...others } = (0, useProps_js_namespaceObject.useProps)(props);
241
- const formDisabled = disabled || field.disabled;
242
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.ConfigProvider, {
243
- componentDisabled: formDisabled,
244
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("form", {
245
- onSubmit: (e)=>e.preventDefault(),
246
- className: styles.container,
247
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Spin, {
248
- spinning: field.loading || false,
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
- setTimeout(async ()=>{
274
- var _field_stateOfLinkageRules;
275
- const fieldName = getFieldNameByOperator(action.operator);
276
- if (!(null == (_field_stateOfLinkageRules = field.stateOfLinkageRules) ? void 0 : _field_stateOfLinkageRules[fieldName])) return;
277
- let stateList = field.stateOfLinkageRules[fieldName];
278
- stateList = await Promise.all(stateList);
279
- stateList = stateList.filter((v)=>v.condition);
280
- const lastState = stateList[stateList.length - 1];
281
- if ('value' === fieldName) {
282
- if (stateList.length > 1) field.value = lastState.value;
283
- } else {
284
- field[fieldName] = null == lastState ? void 0 : lastState.value;
285
- if ('display' === fieldName && (null == lastState ? void 0 : lastState.value) === 'none') field.value = void 0;
286
- }
287
- field.stateOfLinkageRules[fieldName] = null;
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
- function getFieldNameByOperator(operator) {
292
- switch(operator){
293
- case type_js_namespaceObject.ActionType.Required:
294
- case type_js_namespaceObject.ActionType.InRequired:
295
- return 'required';
296
- case type_js_namespaceObject.ActionType.Visible:
297
- case type_js_namespaceObject.ActionType.None:
298
- case type_js_namespaceObject.ActionType.Hidden:
299
- return 'display';
300
- case type_js_namespaceObject.ActionType.Editable:
301
- case type_js_namespaceObject.ActionType.ReadOnly:
302
- case type_js_namespaceObject.ActionType.ReadPretty:
303
- return 'pattern';
304
- case type_js_namespaceObject.ActionType.Value:
305
- return 'value';
306
- default:
307
- return null;
308
- }
309
- }
310
- function getFieldValuesInCondition(param) {
311
- let { linkageRules, formValues } = param;
312
- return linkageRules.map((rule)=>{
313
- const run = (condition)=>{
314
- const type = Object.keys(condition)[0] || '$and';
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"