@tachybase/client 1.6.20 → 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.
Files changed (190) 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 +3 -3
  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/collection-manager/hooks/useCollectionManager_deprecated.mjs +2 -1
  28. package/es/collection-manager/sub-table.d.ts +1 -1
  29. package/es/data-source/data-source/DataSourceManager.d.ts +1 -2
  30. package/es/data-source/data-source/DataSourceManager.mjs +1 -2
  31. package/es/data-source/data-source/constants.d.ts +2 -0
  32. package/es/data-source/data-source/constants.mjs +3 -0
  33. package/es/data-source/utils.d.ts +2 -2
  34. package/es/data-source/utils.mjs +1 -1
  35. package/es/exports.d.ts +46 -0
  36. package/es/exports.mjs +46 -0
  37. package/es/filter-provider/utils.d.ts +2 -14
  38. package/es/filter-provider/utils.mjs +2 -57
  39. package/es/index.d.ts +1 -46
  40. package/es/index.mjs +4 -46
  41. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +2 -86
  42. package/es/record-provider/index.mjs +3 -3
  43. package/es/schema-component/antd/action/Action.mjs +7 -6
  44. package/es/schema-component/antd/action/hooks.mjs +3 -2
  45. package/es/schema-component/antd/association-field/AssociationSelect.mjs +4 -3
  46. package/es/schema-component/antd/association-field/hooks.mjs +18 -1
  47. package/es/schema-component/antd/cron/CronSet.mjs +9 -3
  48. package/es/schema-component/antd/date-picker/util.mjs +4 -0
  49. package/es/schema-component/antd/filter/conditionUtils.d.ts +2 -0
  50. package/es/schema-component/antd/filter/conditionUtils.mjs +133 -0
  51. package/es/schema-component/antd/filter/dateValueUtils.d.ts +13 -0
  52. package/es/schema-component/antd/filter/dateValueUtils.mjs +66 -0
  53. package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -4
  54. package/es/schema-component/antd/filter/useFilterActionProps.mjs +3 -181
  55. package/es/schema-component/antd/filter/useGetFilterOptions.d.ts +2 -0
  56. package/es/schema-component/antd/filter/useGetFilterOptions.mjs +54 -0
  57. package/es/schema-component/antd/form/Form.mjs +1 -1
  58. package/es/schema-component/antd/form-item/FormItem.FilterFormDesigner.mjs +1 -1
  59. package/es/schema-component/antd/form-item/FormItem.d.ts +1 -1
  60. package/es/schema-component/antd/form-item/FormItem.mjs +14 -12
  61. package/es/schema-component/antd/form-item/SchemaSettingOptions.d.ts +1 -14
  62. package/es/schema-component/antd/form-item/SchemaSettingOptions.mjs +1 -33
  63. package/es/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.mjs +4 -3
  64. package/es/schema-component/antd/form-item/hooks/useParseDefaultValue.mjs +5 -3
  65. package/es/schema-component/antd/form-item/operatorUtils.d.ts +14 -0
  66. package/es/schema-component/antd/form-item/operatorUtils.mjs +36 -0
  67. package/es/schema-component/antd/form-v2/Form.mjs +26 -167
  68. package/es/schema-component/antd/form-v2/FormLinkageRules.d.ts +9 -0
  69. package/es/schema-component/antd/form-v2/FormLinkageRules.mjs +191 -0
  70. package/es/schema-component/antd/form-v2/Templates.mjs +1 -1
  71. package/es/schema-component/antd/grid/Grid.mjs +6 -4
  72. package/es/schema-component/antd/grid-card/GridCard.Item.mjs +2 -2
  73. package/es/schema-component/antd/icon-picker/IconFilterInput.mjs +12 -4
  74. package/es/schema-component/antd/icon-picker/IconPicker.mjs +1 -1
  75. package/es/schema-component/antd/input/Json.d.ts +1 -4
  76. package/es/schema-component/antd/input/ReadPretty.mjs +2 -2
  77. package/es/schema-component/antd/input-number/ReadPretty.mjs +1 -1
  78. package/es/schema-component/antd/markdown/Markdown.Void.Designer.mjs +2 -1
  79. package/es/schema-component/antd/markdown/Markdown.Void.mjs +10 -2
  80. package/es/schema-component/antd/markdown/Markdown.mjs +1 -1
  81. package/es/schema-component/antd/markdown/util.mjs +5 -0
  82. package/es/schema-component/antd/rich-text/RichText.mjs +1 -1
  83. package/es/schema-component/antd/select/FormulaSelect.mjs +1 -2
  84. package/es/schema-component/antd/select/ReadPretty.mjs +2 -2
  85. package/es/schema-component/antd/select/Select.mjs +1 -2
  86. package/es/schema-component/antd/select/utils.d.ts +2 -1
  87. package/es/schema-component/antd/select/utils.mjs +2 -2
  88. package/es/schema-component/antd/time-picker/ReadPretty.mjs +1 -1
  89. package/es/schema-component/antd/upload/ReadPretty.mjs +5 -5
  90. package/es/schema-component/antd/upload/Upload.mjs +6 -5
  91. package/es/schema-component/antd/variable/Input.mjs +1 -1
  92. package/es/schema-component/antd/variable/TextArea.mjs +1 -1
  93. package/es/schema-component/hooks/useDesigner.mjs +9 -3
  94. package/es/schema-component/hooks/useOptionalNavigate.d.ts +1 -0
  95. package/es/schema-component/hooks/useOptionalNavigate.mjs +2 -0
  96. package/es/schema-settings/DataTemplates/components/Designer.mjs +2 -1
  97. package/es/schema-settings/VariableInput/hooks/useBaseVariable.mjs +2 -1
  98. package/es/schema-settings/VariableInput/hooks/useBlockCollection.mjs +1 -1
  99. package/es/schema-settings/VariableInput/hooks/useContextAssociationFields.mjs +2 -1
  100. package/es/schema-settings/VariableInput/hooks/useFormVariable.mjs +1 -1
  101. package/es/schema-settings/VariableInput/hooks/useRecordVariable.mjs +1 -1
  102. package/es/style/theme/AntdAppProvider.mjs +2 -2
  103. package/es/user/ChangePassword.d.ts +4 -1
  104. package/es/user/CurrentUserContext.d.ts +2 -0
  105. package/es/user/CurrentUserContext.mjs +5 -0
  106. package/es/user/CurrentUserProvider.d.ts +0 -3
  107. package/es/user/CurrentUserProvider.mjs +3 -5
  108. package/es/user/EditProfile.d.ts +4 -1
  109. package/es/user/LanguageSettings.d.ts +4 -1
  110. package/es/user/SwitchRole.d.ts +4 -1
  111. package/es/user/index.d.ts +1 -0
  112. package/es/user/index.mjs +1 -0
  113. package/es/variables/VariablesProvider.mjs +1 -1
  114. package/lib/api-client/APIClient.js +8 -5
  115. package/lib/application/hoc/withDynamicSchemaProps.js +3 -3
  116. package/lib/application/schema-initializer/hooks/index.js +4 -1
  117. package/lib/application/schema-settings/components/SchemaSettingsChildren.js +14 -14
  118. package/lib/application/utils/clientModuleRegistry.js +46 -0
  119. package/lib/application/utils/globalDeps.js +2 -2
  120. package/lib/block-provider/BlockProvider.js +6 -8
  121. package/lib/block-provider/BlockRequestContext.js +42 -0
  122. package/lib/block-provider/FormBlockContext.js +42 -0
  123. package/lib/block-provider/FormBlockProvider.js +13 -14
  124. package/lib/built-in/acl/ACLCollectionFieldProvider.js +76 -0
  125. package/lib/built-in/acl/ACLContext.js +70 -0
  126. package/lib/built-in/acl/ACLPlugin.js +2 -1
  127. package/lib/built-in/acl/ACLProvider.js +13 -76
  128. package/lib/built-in/acl/index.js +27 -9
  129. package/lib/collection-manager/hooks/useCollectionManager_deprecated.js +4 -3
  130. package/lib/data-source/data-source/DataSourceManager.js +6 -7
  131. package/lib/data-source/data-source/constants.js +40 -0
  132. package/lib/data-source/utils.js +2 -2
  133. package/lib/exports.js +769 -0
  134. package/lib/filter-provider/utils.js +7 -63
  135. package/lib/index.js +10 -714
  136. package/lib/record-provider/index.js +6 -6
  137. package/lib/schema-component/antd/action/Action.js +9 -8
  138. package/lib/schema-component/antd/action/hooks.js +3 -2
  139. package/lib/schema-component/antd/association-field/AssociationSelect.js +3 -2
  140. package/lib/schema-component/antd/association-field/hooks.js +18 -1
  141. package/lib/schema-component/antd/cron/CronSet.js +8 -2
  142. package/lib/schema-component/antd/date-picker/util.js +4 -0
  143. package/lib/schema-component/antd/filter/conditionUtils.js +180 -0
  144. package/lib/schema-component/antd/filter/dateValueUtils.js +116 -0
  145. package/lib/schema-component/antd/filter/useFilterActionProps.js +7 -186
  146. package/lib/schema-component/antd/filter/useGetFilterOptions.js +91 -0
  147. package/lib/schema-component/antd/form/Form.js +4 -4
  148. package/lib/schema-component/antd/form-item/FormItem.FilterFormDesigner.js +2 -2
  149. package/lib/schema-component/antd/form-item/FormItem.js +23 -20
  150. package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +6 -38
  151. package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js +9 -7
  152. package/lib/schema-component/antd/form-item/hooks/useParseDefaultValue.js +12 -8
  153. package/lib/schema-component/antd/form-item/operatorUtils.js +76 -0
  154. package/lib/schema-component/antd/form-v2/Form.js +204 -317
  155. package/lib/schema-component/antd/form-v2/FormLinkageRules.js +236 -0
  156. package/lib/schema-component/antd/form-v2/Templates.js +2 -2
  157. package/lib/schema-component/antd/grid/Grid.js +11 -9
  158. package/lib/schema-component/antd/grid-card/GridCard.Item.js +2 -2
  159. package/lib/schema-component/antd/icon-picker/IconFilterInput.js +12 -4
  160. package/lib/schema-component/antd/icon-picker/IconPicker.js +1 -1
  161. package/lib/schema-component/antd/input/ReadPretty.js +10 -10
  162. package/lib/schema-component/antd/input-number/ReadPretty.js +1 -1
  163. package/lib/schema-component/antd/markdown/Markdown.Void.Designer.js +6 -5
  164. package/lib/schema-component/antd/markdown/Markdown.Void.js +138 -111
  165. package/lib/schema-component/antd/markdown/Markdown.js +2 -2
  166. package/lib/schema-component/antd/markdown/util.js +5 -0
  167. package/lib/schema-component/antd/rich-text/RichText.js +2 -2
  168. package/lib/schema-component/antd/select/FormulaSelect.js +1 -2
  169. package/lib/schema-component/antd/select/ReadPretty.js +2 -2
  170. package/lib/schema-component/antd/select/Select.js +1 -2
  171. package/lib/schema-component/antd/select/utils.js +6 -3
  172. package/lib/schema-component/antd/time-picker/ReadPretty.js +2 -2
  173. package/lib/schema-component/antd/upload/ReadPretty.js +5 -5
  174. package/lib/schema-component/antd/upload/Upload.js +6 -5
  175. package/lib/schema-component/antd/variable/Input.js +1 -1
  176. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  177. package/lib/schema-component/hooks/useDesigner.js +57 -23
  178. package/lib/schema-component/hooks/useOptionalNavigate.js +36 -0
  179. package/lib/schema-settings/DataTemplates/components/Designer.js +4 -3
  180. package/lib/schema-settings/VariableInput/hooks/useBaseVariable.js +4 -3
  181. package/lib/schema-settings/VariableInput/hooks/useBlockCollection.js +2 -2
  182. package/lib/schema-settings/VariableInput/hooks/useContextAssociationFields.js +4 -3
  183. package/lib/schema-settings/VariableInput/hooks/useFormVariable.js +2 -2
  184. package/lib/schema-settings/VariableInput/hooks/useRecordVariable.js +2 -2
  185. package/lib/style/theme/AntdAppProvider.js +4 -4
  186. package/lib/user/CurrentUserContext.js +42 -0
  187. package/lib/user/CurrentUserProvider.js +6 -14
  188. package/lib/user/index.js +24 -12
  189. package/lib/variables/VariablesProvider.js +2 -2
  190. package/package.json +5 -4
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ FormLinkageRules: ()=>FormLinkageRules
37
+ });
38
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
39
+ const external_react_namespaceObject = require("react");
40
+ const schema_namespaceObject = require("@tachybase/schema");
41
+ const client_namespaceObject = require("@tego/client");
42
+ const type_js_namespaceObject = require("../../../schema-settings/LinkageRules/type.js");
43
+ const useLocalVariables_js_namespaceObject = require("../../../variables/hooks/useLocalVariables.js");
44
+ var useLocalVariables_js_default = /*#__PURE__*/ __webpack_require__.n(useLocalVariables_js_namespaceObject);
45
+ const useVariables_js_namespaceObject = require("../../../variables/hooks/useVariables.js");
46
+ var useVariables_js_default = /*#__PURE__*/ __webpack_require__.n(useVariables_js_namespaceObject);
47
+ const getPath_js_namespaceObject = require("../../../variables/utils/getPath.js");
48
+ const getVariableName_js_namespaceObject = require("../../../variables/utils/getVariableName.js");
49
+ const isVariable_js_namespaceObject = require("../../../variables/utils/isVariable.js");
50
+ const uitls_js_namespaceObject = require("../../common/utils/uitls.js");
51
+ const external_utils_js_namespaceObject = require("./utils.js");
52
+ const FormLinkageRules = (param)=>{
53
+ let { children, form, linkageRules } = param;
54
+ const variables = useVariables_js_default()();
55
+ const localVariables = useLocalVariables_js_default()({
56
+ currentForm: form
57
+ });
58
+ const variablesRef = (0, external_react_namespaceObject.useRef)(variables);
59
+ const localVariablesRef = (0, external_react_namespaceObject.useRef)(localVariables);
60
+ variablesRef.current = variables;
61
+ localVariablesRef.current = localVariables;
62
+ (0, external_react_namespaceObject.useEffect)(()=>{
63
+ const id = (0, schema_namespaceObject.uid)();
64
+ const disposes = [];
65
+ const timers = new Set();
66
+ let disposed = false;
67
+ form.addEffects(id, ()=>{
68
+ linkageRules.forEach((rule)=>{
69
+ var _rule_actions;
70
+ null == (_rule_actions = rule.actions) || _rule_actions.forEach((action)=>{
71
+ var _action_targetFields;
72
+ if (null == (_action_targetFields = action.targetFields) ? void 0 : _action_targetFields.length) {
73
+ const fields = action.targetFields.join(',');
74
+ (0, schema_namespaceObject.onFieldInit)("*(".concat(fields, ")"), (field, form)=>{
75
+ var _field_initStateOfLinkageRules, _field_initStateOfLinkageRules1, _field_initStateOfLinkageRules2, _field_initStateOfLinkageRules3;
76
+ field['initStateOfLinkageRules'] = {
77
+ display: (null == (_field_initStateOfLinkageRules = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules.display) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.display),
78
+ required: (null == (_field_initStateOfLinkageRules1 = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules1.required) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.required || false),
79
+ pattern: (null == (_field_initStateOfLinkageRules2 = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules2.pattern) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.pattern),
80
+ value: (null == (_field_initStateOfLinkageRules3 = field.initStateOfLinkageRules) ? void 0 : _field_initStateOfLinkageRules3.value) || (0, external_utils_js_namespaceObject.getTempFieldState)(true, field.value || field.initialValue)
81
+ };
82
+ disposes.push((0, schema_namespaceObject.reaction)(()=>{
83
+ const latestLocalVariables = localVariablesRef.current;
84
+ const fieldValuesInCondition = getFieldValuesInCondition({
85
+ linkageRules,
86
+ formValues: form.values
87
+ });
88
+ const variableValuesInCondition = getVariableValuesInCondition({
89
+ linkageRules,
90
+ localVariables: latestLocalVariables
91
+ });
92
+ const variableValuesInExpression = getVariableValuesInExpression({
93
+ action,
94
+ localVariables: latestLocalVariables
95
+ });
96
+ return [
97
+ fieldValuesInCondition,
98
+ variableValuesInCondition,
99
+ variableValuesInExpression
100
+ ].map((item)=>JSON.stringify(item)).join(',');
101
+ }, getSubscriber(action, field, rule, variablesRef, localVariablesRef, {
102
+ timers,
103
+ isDisposed: ()=>disposed
104
+ }), {
105
+ fireImmediately: true
106
+ }));
107
+ });
108
+ }
109
+ });
110
+ });
111
+ });
112
+ return ()=>{
113
+ disposed = true;
114
+ form.removeEffects(id);
115
+ disposes.forEach((dispose)=>{
116
+ dispose();
117
+ });
118
+ timers.forEach((timer)=>{
119
+ clearTimeout(timer);
120
+ });
121
+ timers.clear();
122
+ };
123
+ }, [
124
+ form,
125
+ linkageRules
126
+ ]);
127
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
128
+ children: children
129
+ });
130
+ };
131
+ function getSubscriber(action, field, rule, variablesRef, localVariablesRef, scheduler) {
132
+ return ()=>{
133
+ if (scheduler.isDisposed()) return;
134
+ (0, external_utils_js_namespaceObject.collectFieldStateOfLinkageRules)({
135
+ operator: action.operator,
136
+ value: action.value,
137
+ field,
138
+ condition: rule.condition,
139
+ variables: variablesRef.current,
140
+ localVariables: localVariablesRef.current
141
+ });
142
+ const timer = setTimeout(async ()=>{
143
+ var _field_stateOfLinkageRules;
144
+ scheduler.timers.delete(timer);
145
+ if (scheduler.isDisposed()) return;
146
+ const fieldName = getFieldNameByOperator(action.operator);
147
+ if (!(null == (_field_stateOfLinkageRules = field.stateOfLinkageRules) ? void 0 : _field_stateOfLinkageRules[fieldName])) return;
148
+ let stateList = field.stateOfLinkageRules[fieldName];
149
+ stateList = await Promise.all(stateList);
150
+ if (scheduler.isDisposed()) return;
151
+ stateList = stateList.filter((v)=>v.condition);
152
+ const lastState = stateList[stateList.length - 1];
153
+ if ('value' === fieldName) {
154
+ if (stateList.length > 1) field.value = lastState.value;
155
+ } else {
156
+ field[fieldName] = null == lastState ? void 0 : lastState.value;
157
+ if ('display' === fieldName && (null == lastState ? void 0 : lastState.value) === 'none') field.value = void 0;
158
+ }
159
+ field.stateOfLinkageRules[fieldName] = null;
160
+ });
161
+ scheduler.timers.add(timer);
162
+ };
163
+ }
164
+ function getFieldNameByOperator(operator) {
165
+ switch(operator){
166
+ case type_js_namespaceObject.ActionType.Required:
167
+ case type_js_namespaceObject.ActionType.InRequired:
168
+ return 'required';
169
+ case type_js_namespaceObject.ActionType.Visible:
170
+ case type_js_namespaceObject.ActionType.None:
171
+ case type_js_namespaceObject.ActionType.Hidden:
172
+ return 'display';
173
+ case type_js_namespaceObject.ActionType.Editable:
174
+ case type_js_namespaceObject.ActionType.ReadOnly:
175
+ case type_js_namespaceObject.ActionType.ReadPretty:
176
+ return 'pattern';
177
+ case type_js_namespaceObject.ActionType.Value:
178
+ return 'value';
179
+ default:
180
+ return null;
181
+ }
182
+ }
183
+ function getFieldValuesInCondition(param) {
184
+ let { linkageRules, formValues } = param;
185
+ return linkageRules.map((rule)=>{
186
+ const run = (condition)=>{
187
+ const type = Object.keys(condition)[0] || '$and';
188
+ const conditions = condition[type];
189
+ return conditions.map((condition)=>{
190
+ if ('$and' in condition || '$or' in condition) return run(condition);
191
+ const path = (0, uitls_js_namespaceObject.getTargetField)(condition).join('.');
192
+ return (0, client_namespaceObject.getValuesByPath)(formValues, path);
193
+ }).filter(Boolean);
194
+ };
195
+ return run(rule.condition);
196
+ });
197
+ }
198
+ function getVariableValuesInCondition(param) {
199
+ let { linkageRules, localVariables } = param;
200
+ return linkageRules.map((rule)=>{
201
+ const type = Object.keys(rule.condition)[0] || '$and';
202
+ const conditions = rule.condition[type];
203
+ return conditions.map((condition)=>{
204
+ const jsonlogic = (0, uitls_js_namespaceObject.getInnermostKeyAndValue)(condition);
205
+ if (!jsonlogic) return null;
206
+ if ((0, isVariable_js_namespaceObject.isVariable)(jsonlogic.value)) return getVariableValue(jsonlogic.value, localVariables);
207
+ return jsonlogic.value;
208
+ }).filter(Boolean);
209
+ });
210
+ }
211
+ function getVariableValuesInExpression(param) {
212
+ let { action, localVariables } = param;
213
+ var _value_match;
214
+ const actionValue = action.value;
215
+ const mode = null == actionValue ? void 0 : actionValue.mode;
216
+ const value = (null == actionValue ? void 0 : actionValue.value) || (null == actionValue ? void 0 : actionValue.result);
217
+ if ('express' !== mode) return;
218
+ if (null == value) return;
219
+ return null == (_value_match = value.match(isVariable_js_namespaceObject.REGEX_OF_VARIABLE)) ? void 0 : _value_match.map((variableString)=>getVariableValue(variableString, localVariables)).filter(Boolean);
220
+ }
221
+ function getVariableValue(variableString, localVariables) {
222
+ var _localVariables_find;
223
+ if (!(0, isVariable_js_namespaceObject.isVariable)(variableString)) return;
224
+ const variableName = (0, getVariableName_js_namespaceObject.getVariableName)(variableString);
225
+ const ctx = {
226
+ [variableName]: null == (_localVariables_find = localVariables.find((item)=>item.name === variableName)) ? void 0 : _localVariables_find.ctx
227
+ };
228
+ return (0, client_namespaceObject.getValuesByPath)(ctx, (0, getPath_js_namespaceObject.getPath)(variableString));
229
+ }
230
+ exports.FormLinkageRules = __webpack_exports__.FormLinkageRules;
231
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
232
+ "FormLinkageRules"
233
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
234
+ Object.defineProperty(exports, '__esModule', {
235
+ value: true
236
+ });
@@ -47,14 +47,14 @@ const external_react_i18next_namespaceObject = require("react-i18next");
47
47
  const index_js_namespaceObject = require("../__builtins__/index.js");
48
48
  const external_api_client_index_js_namespaceObject = require("../../../api-client/index.js");
49
49
  const external_block_provider_index_js_namespaceObject = require("../../../block-provider/index.js");
50
- const FormBlockProvider_js_namespaceObject = require("../../../block-provider/FormBlockProvider.js");
50
+ const FormBlockContext_js_namespaceObject = require("../../../block-provider/FormBlockContext.js");
51
51
  const external_collection_manager_index_js_namespaceObject = require("../../../collection-manager/index.js");
52
52
  const FormDataTemplates_js_namespaceObject = require("../../../schema-settings/DataTemplates/FormDataTemplates.js");
53
53
  const external_remote_select_index_js_namespaceObject = require("../remote-select/index.js");
54
54
  const useDataTemplates = ()=>{
55
55
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
56
56
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
57
- const { duplicateData } = (0, FormBlockProvider_js_namespaceObject.useFormBlockContext)();
57
+ const { duplicateData } = (0, FormBlockContext_js_namespaceObject.useFormBlockContext)();
58
58
  const { getCollectionJoinField } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
59
59
  if (duplicateData) return duplicateData;
60
60
  const { items = [], display = true } = findDataTemplates(fieldSchema);
@@ -49,9 +49,11 @@ var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_c
49
49
  const external_lodash_namespaceObject = require("lodash");
50
50
  var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
51
51
  const index_js_namespaceObject = require("../__builtins__/index.js");
52
- const external_index_js_namespaceObject = require("../../../index.js");
53
- const external_block_provider_index_js_namespaceObject = require("../../../block-provider/index.js");
54
- const dnd_context_index_js_namespaceObject = require("../../common/dnd-context/index.js");
52
+ const hooks_index_js_namespaceObject = require("../../../application/schema-initializer/hooks/index.js");
53
+ const FormBlockContext_js_namespaceObject = require("../../../block-provider/FormBlockContext.js");
54
+ const FormBlockProvider_js_namespaceObject = require("../../../block-provider/FormBlockProvider.js");
55
+ const SchemaComponent_js_namespaceObject = require("../../core/SchemaComponent.js");
56
+ const useDesignable_js_namespaceObject = require("../../hooks/useDesignable.js");
55
57
  const external_Grid_style_js_namespaceObject = require("./Grid.style.js");
56
58
  var external_Grid_style_js_default = /*#__PURE__*/ __webpack_require__.n(external_Grid_style_js_namespaceObject);
57
59
  const GridRowContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)({});
@@ -72,7 +74,7 @@ const ColDivider = (props)=>{
72
74
  id: props.id,
73
75
  data: props.data
74
76
  });
75
- const { dn, designable } = (0, external_index_js_namespaceObject.useDesignable)();
77
+ const { dn, designable } = (0, useDesignable_js_namespaceObject.useDesignable)();
76
78
  const dividerRef = (0, external_react_namespaceObject.useRef)();
77
79
  const droppableStyle = (0, external_react_namespaceObject.useMemo)(()=>{
78
80
  if (!isOver) return {};
@@ -285,7 +287,7 @@ const DndWrapper = (props)=>{
285
287
  if (false === props.dndContext) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(jsx_runtime_namespaceObject.Fragment, {
286
288
  children: props.children
287
289
  });
288
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(dnd_context_index_js_namespaceObject.DndContext, {
290
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(core_namespaceObject.DndContext, {
289
291
  ...props.dndContext,
290
292
  children: props.children
291
293
  });
@@ -297,11 +299,11 @@ const Grid = (0, schema_namespaceObject.observer)((props)=>{
297
299
  const gridRef = (0, external_react_namespaceObject.useRef)(null);
298
300
  const field = (0, schema_namespaceObject.useField)();
299
301
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
300
- const { render } = (0, external_index_js_namespaceObject.useSchemaInitializerRender)(fieldSchema['x-initializer'], fieldSchema['x-initializer-props']);
302
+ const { render } = (0, hooks_index_js_namespaceObject.useSchemaInitializerRender)(fieldSchema['x-initializer'], fieldSchema['x-initializer-props']);
301
303
  const InitializerComponent = (props)=>render(props);
302
304
  const addr = field.address.toString();
303
305
  const rows = useRowProperties();
304
- const { setPrintContent } = (0, external_index_js_namespaceObject.useFormBlockContext)();
306
+ const { setPrintContent } = (0, FormBlockContext_js_namespaceObject.useFormBlockContext)();
305
307
  const { wrapSSR, componentCls, hashId } = external_Grid_style_js_default()();
306
308
  const distributedValue = void 0 === distributed ? (null == fieldSchema ? void 0 : fieldSchema.parent['x-component']) === 'Page' || (null == fieldSchema ? void 0 : fieldSchema.parent['x-component']) === 'Tabs.TabPane' : distributed;
307
309
  (0, external_react_namespaceObject.useEffect)(()=>{
@@ -340,7 +342,7 @@ const Grid = (0, schema_namespaceObject.observer)((props)=>{
340
342
  }) : null,
341
343
  rows.map((schema, index)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_react_default().Fragment, {
342
344
  children: [
343
- distributedValue ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.SchemaComponent, {
345
+ distributedValue ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SchemaComponent_js_namespaceObject.SchemaComponent, {
344
346
  name: schema.name,
345
347
  schema: schema,
346
348
  distributed: true
@@ -376,7 +378,7 @@ Grid.Row = (0, schema_namespaceObject.observer)(()=>{
376
378
  const addr = field.address.toString();
377
379
  const cols = useColProperties();
378
380
  const { showDivider } = useGridContext();
379
- const { type } = (0, external_block_provider_index_js_namespaceObject.useFormBlockType)();
381
+ const { type } = (0, FormBlockProvider_js_namespaceObject.useFormBlockType)();
380
382
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GridRowContext.Provider, {
381
383
  value: {
382
384
  schema: fieldSchema,
@@ -31,11 +31,11 @@ require("react");
31
31
  const schema_namespaceObject = require("@tachybase/schema");
32
32
  const external_antd_namespaceObject = require("antd");
33
33
  const external_antd_style_namespaceObject = require("antd-style");
34
- const external_react_router_dom_namespaceObject = require("react-router-dom");
35
34
  const withDynamicSchemaProps_js_namespaceObject = require("../../../application/hoc/withDynamicSchemaProps.js");
36
35
  const index_js_namespaceObject = require("../../../data-source/index.js");
37
36
  const CollectionRecordProvider_js_namespaceObject = require("../../../data-source/collection-record/CollectionRecordProvider.js");
38
37
  const external_record_provider_index_js_namespaceObject = require("../../../record-provider/index.js");
38
+ const useOptionalNavigate_js_namespaceObject = require("../../hooks/useOptionalNavigate.js");
39
39
  const external_hooks_js_namespaceObject = require("./hooks.js");
40
40
  function _tagged_template_literal(strings, raw) {
41
41
  if (!raw) raw = strings.slice(0);
@@ -75,7 +75,7 @@ const GridCardItem = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSc
75
75
  const field = (0, schema_namespaceObject.useField)();
76
76
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
77
77
  const parentRecordData = (0, CollectionRecordProvider_js_namespaceObject.useCollectionParentRecordData)();
78
- const navigate = (0, external_react_router_dom_namespaceObject.useNavigate)();
78
+ const navigate = (0, useOptionalNavigate_js_namespaceObject.useOptionalNavigate)();
79
79
  const { styles } = useStyles();
80
80
  const detailUrl = (0, external_hooks_js_namespaceObject.useGridCustomPageUrl)({
81
81
  field,
@@ -36,6 +36,7 @@ __webpack_require__.d(__webpack_exports__, {
36
36
  IconFilterInput: ()=>IconFilterInput
37
37
  });
38
38
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
39
+ const external_react_namespaceObject = require("react");
39
40
  const external_antd_namespaceObject = require("antd");
40
41
  const external_lodash_namespaceObject = require("lodash");
41
42
  var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
@@ -43,10 +44,17 @@ const external_react_i18next_namespaceObject = require("react-i18next");
43
44
  const IconFilterInput = (props)=>{
44
45
  const { changeFilterKey } = props;
45
46
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
46
- const onChange = external_lodash_default().debounce((e)=>{
47
- const inputValue = e.target.value;
48
- changeFilterKey(inputValue);
49
- }, 100);
47
+ const onChange = (0, external_react_namespaceObject.useMemo)(()=>external_lodash_default().debounce((e)=>{
48
+ const inputValue = e.target.value;
49
+ changeFilterKey(inputValue);
50
+ }, 100), [
51
+ changeFilterKey
52
+ ]);
53
+ (0, external_react_namespaceObject.useEffect)(()=>()=>{
54
+ onChange.cancel();
55
+ }, [
56
+ onChange
57
+ ]);
50
58
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Input, {
51
59
  allowClear: true,
52
60
  placeholder: t("The key in Antd, such as 'ApiOutlined', ignoring case"),
@@ -30,8 +30,8 @@ __webpack_require__.d(__webpack_exports__, {
30
30
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
31
31
  const external_react_namespaceObject = require("react");
32
32
  const schema_namespaceObject = require("@tachybase/schema");
33
- const icons_namespaceObject = require("@ant-design/icons");
34
33
  const client_namespaceObject = require("@tego/client");
34
+ const icons_namespaceObject = require("@ant-design/icons");
35
35
  const external_antd_namespaceObject = require("antd");
36
36
  const external_react_i18next_namespaceObject = require("react-i18next");
37
37
  const index_js_namespaceObject = require("../../../icon/index.js");
@@ -38,12 +38,12 @@ __webpack_require__.d(__webpack_exports__, {
38
38
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
39
39
  require("react");
40
40
  const schema_namespaceObject = require("@tachybase/schema");
41
- const client_namespaceObject = require("@tego/client");
42
41
  const css_namespaceObject = require("@emotion/css");
43
42
  const external_antd_namespaceObject = require("antd");
44
43
  const external_classnames_namespaceObject = require("classnames");
45
44
  var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_classnames_namespaceObject);
46
- const external_index_js_namespaceObject = require("../../index.js");
45
+ const index_js_namespaceObject = require("../__builtins__/index.js");
46
+ const useCompile_js_namespaceObject = require("../../hooks/useCompile.js");
47
47
  const external_EllipsisWithTooltip_js_namespaceObject = require("./EllipsisWithTooltip.js");
48
48
  const external_shared_js_namespaceObject = require("./shared.js");
49
49
  function _tagged_template_literal(strings, raw) {
@@ -65,8 +65,8 @@ function _templateObject() {
65
65
  }
66
66
  const ReadPretty = ()=>null;
67
67
  const _Input = (props)=>{
68
- const prefixCls = (0, client_namespaceObject.usePrefixCls)("description-input", props);
69
- const compile = (0, external_index_js_namespaceObject.useCompile)();
68
+ const prefixCls = (0, index_js_namespaceObject.usePrefixCls)("description-input", props);
69
+ const compile = (0, useCompile_js_namespaceObject.useCompile)();
70
70
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
71
71
  className: external_classnames_default()(prefixCls, props.className),
72
72
  style: {
@@ -87,8 +87,8 @@ const _Input = (props)=>{
87
87
  });
88
88
  };
89
89
  const _TextArea = (props)=>{
90
- const prefixCls = (0, client_namespaceObject.usePrefixCls)("description-textarea", props);
91
- const compile = (0, external_index_js_namespaceObject.useCompile)();
90
+ const prefixCls = (0, index_js_namespaceObject.usePrefixCls)("description-textarea", props);
91
+ const compile = (0, useCompile_js_namespaceObject.useCompile)();
92
92
  var _props_value;
93
93
  const value = compile(null != (_props_value = props.value) ? _props_value : '');
94
94
  const { autop = true, ellipsis, text } = props;
@@ -127,8 +127,8 @@ function convertToText(html) {
127
127
  return (null == text ? void 0 : text.replace(/[\n\r]/g, '')) || '';
128
128
  }
129
129
  const _Html = (props)=>{
130
- const prefixCls = (0, client_namespaceObject.usePrefixCls)("description-textarea", props);
131
- const compile = (0, external_index_js_namespaceObject.useCompile)();
130
+ const prefixCls = (0, index_js_namespaceObject.usePrefixCls)("description-textarea", props);
131
+ const compile = (0, useCompile_js_namespaceObject.useCompile)();
132
132
  var _props_value;
133
133
  const value = compile(null != (_props_value = props.value) ? _props_value : '');
134
134
  const { autop = true, ellipsis } = props;
@@ -160,7 +160,7 @@ const _Html = (props)=>{
160
160
  };
161
161
  const _URL = (props)=>{
162
162
  var _props_value;
163
- const prefixCls = (0, client_namespaceObject.usePrefixCls)("description-url", props);
163
+ const prefixCls = (0, index_js_namespaceObject.usePrefixCls)("description-url", props);
164
164
  const content = props.value && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Typography.Link, {
165
165
  ellipsis: true,
166
166
  target: '_blank',
@@ -180,7 +180,7 @@ const _URL = (props)=>{
180
180
  });
181
181
  };
182
182
  const _JSON = (props)=>{
183
- const prefixCls = (0, client_namespaceObject.usePrefixCls)('json', props);
183
+ const prefixCls = (0, index_js_namespaceObject.usePrefixCls)('json', props);
184
184
  var _props_space;
185
185
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("pre", {
186
186
  className: external_classnames_default()(prefixCls, props.className, (0, css_namespaceObject.css)(_templateObject())),
@@ -33,7 +33,7 @@ __webpack_require__.d(__webpack_exports__, {
33
33
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
34
34
  const external_react_namespaceObject = require("react");
35
35
  const schema_namespaceObject = require("@tachybase/schema");
36
- const client_namespaceObject = require("@tego/client");
36
+ const client_namespaceObject = require("@tachybase/utils/client");
37
37
  const external_d3_format_namespaceObject = require("d3-format");
38
38
  const external_mathjs_namespaceObject = require("mathjs");
39
39
  function countDecimalPlaces(value) {
@@ -30,20 +30,21 @@ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
30
30
  require("react");
31
31
  const schema_namespaceObject = require("@tachybase/schema");
32
32
  const external_react_i18next_namespaceObject = require("react-i18next");
33
- const index_js_namespaceObject = require("../../../schema-settings/index.js");
33
+ const GeneralSchemaDesigner_js_namespaceObject = require("../../../schema-settings/GeneralSchemaDesigner.js");
34
+ const SchemaSettings_js_namespaceObject = require("../../../schema-settings/SchemaSettings.js");
34
35
  const MarkdownVoidDesigner = ()=>{
35
36
  const field = (0, schema_namespaceObject.useField)();
36
37
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
37
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(index_js_namespaceObject.GeneralSchemaDesigner, {
38
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(GeneralSchemaDesigner_js_namespaceObject.GeneralSchemaDesigner, {
38
39
  children: [
39
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.SchemaSettingsItem, {
40
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SchemaSettings_js_namespaceObject.SchemaSettingsItem, {
40
41
  title: t('Edit markdown'),
41
42
  onClick: ()=>{
42
43
  field.editable = true;
43
44
  }
44
45
  }),
45
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.SchemaSettingsDivider, {}),
46
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.SchemaSettingsRemove, {
46
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SchemaSettings_js_namespaceObject.SchemaSettingsDivider, {}),
47
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(SchemaSettings_js_namespaceObject.SchemaSettingsRemove, {
47
48
  removeParentsIfNoChildren: true,
48
49
  breakRemoveOn: {
49
50
  'x-component': 'Grid'