@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.
- 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/date-picker/util.mjs +4 -0
- 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/date-picker/util.js +4 -0
- 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
|
@@ -37,14 +37,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
37
37
|
useFilterActionProps: ()=>useFilterActionProps,
|
|
38
38
|
useFilterOptions: ()=>useFilterOptions,
|
|
39
39
|
useFilterFieldOptions: ()=>useFilterFieldOptions,
|
|
40
|
-
getCustomCondition: ()=>getCustomCondition,
|
|
41
|
-
useGetFilterOptions: ()=>useGetFilterOptions,
|
|
42
|
-
removeNullCondition: ()=>removeNullCondition,
|
|
43
|
-
useGetFilterFieldOptions: ()=>useGetFilterFieldOptions
|
|
40
|
+
getCustomCondition: ()=>external_conditionUtils_js_namespaceObject.getCustomCondition,
|
|
41
|
+
useGetFilterOptions: ()=>external_useGetFilterOptions_js_namespaceObject.useGetFilterOptions,
|
|
42
|
+
removeNullCondition: ()=>external_conditionUtils_js_namespaceObject.removeNullCondition,
|
|
43
|
+
useGetFilterFieldOptions: ()=>external_useGetFilterOptions_js_namespaceObject.useGetFilterFieldOptions
|
|
44
44
|
});
|
|
45
45
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
46
|
-
const external_flat_namespaceObject = require("flat");
|
|
47
|
-
var external_flat_default = /*#__PURE__*/ __webpack_require__.n(external_flat_namespaceObject);
|
|
48
46
|
const external_lodash_namespaceObject = require("lodash");
|
|
49
47
|
var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
|
|
50
48
|
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
@@ -52,65 +50,14 @@ const index_js_namespaceObject = require("../../../block-provider/index.js");
|
|
|
52
50
|
const external_collection_manager_index_js_namespaceObject = require("../../../collection-manager/index.js");
|
|
53
51
|
const utils_js_namespaceObject = require("../../../filter-provider/utils.js");
|
|
54
52
|
const setDataLoadingModeSettingsItem_js_namespaceObject = require("../../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem.js");
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const useGetFilterOptions = ()=>{
|
|
58
|
-
const { getCollectionFields } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
59
|
-
const getFilterFieldOptions = useGetFilterFieldOptions();
|
|
60
|
-
return (collectionName, dataSource)=>{
|
|
61
|
-
const fields = getCollectionFields(collectionName, dataSource);
|
|
62
|
-
const options = getFilterFieldOptions(fields);
|
|
63
|
-
return options;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
53
|
+
const external_conditionUtils_js_namespaceObject = require("./conditionUtils.js");
|
|
54
|
+
const external_useGetFilterOptions_js_namespaceObject = require("./useGetFilterOptions.js");
|
|
66
55
|
const useFilterOptions = (collectionName)=>{
|
|
67
56
|
const { getCollectionFields } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
68
57
|
const fields = getCollectionFields(collectionName);
|
|
69
58
|
const options = useFilterFieldOptions(fields);
|
|
70
59
|
return options;
|
|
71
60
|
};
|
|
72
|
-
const useGetFilterFieldOptions = ()=>{
|
|
73
|
-
var _fieldSchema_xcomponentprops;
|
|
74
|
-
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
75
|
-
const nonfilterable = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.nonfilterable) || [];
|
|
76
|
-
const { getCollectionFields, getInterface } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
77
|
-
const field2option = (field, depth)=>{
|
|
78
|
-
var _field_uiSchema, _operators_filter;
|
|
79
|
-
if (nonfilterable.length && 1 === depth && nonfilterable.includes(field.name)) return;
|
|
80
|
-
if (!field.interface) return;
|
|
81
|
-
const fieldInterface = getInterface(field.interface);
|
|
82
|
-
if (!(null == fieldInterface ? void 0 : fieldInterface.filterable)) return;
|
|
83
|
-
const { nested, children, operators } = fieldInterface.filterable;
|
|
84
|
-
const option = {
|
|
85
|
-
name: field.name,
|
|
86
|
-
type: field.type,
|
|
87
|
-
target: field.target,
|
|
88
|
-
title: (null == field ? void 0 : null == (_field_uiSchema = field.uiSchema) ? void 0 : _field_uiSchema.title) || field.name,
|
|
89
|
-
schema: null == field ? void 0 : field.uiSchema,
|
|
90
|
-
interface: field.interface,
|
|
91
|
-
operators: (null == operators ? void 0 : null == (_operators_filter = operators.filter) ? void 0 : _operators_filter.call(operators, (operator)=>!(null == operator ? void 0 : operator.visible) || operator.visible(field))) || []
|
|
92
|
-
};
|
|
93
|
-
if (field.target && depth > 2) return;
|
|
94
|
-
if (depth > 2) return option;
|
|
95
|
-
if (null == children ? void 0 : children.length) option['children'] = children;
|
|
96
|
-
if (nested) {
|
|
97
|
-
const targetFields = getCollectionFields(field.target);
|
|
98
|
-
const options = getOptions(targetFields, depth + 1).filter(Boolean);
|
|
99
|
-
option['children'] = option['children'] || [];
|
|
100
|
-
option['children'].push(...options);
|
|
101
|
-
}
|
|
102
|
-
return option;
|
|
103
|
-
};
|
|
104
|
-
const getOptions = (fields, depth)=>{
|
|
105
|
-
const options = [];
|
|
106
|
-
fields.forEach((field)=>{
|
|
107
|
-
const option = field2option(field, depth);
|
|
108
|
-
if (option) options.push(option);
|
|
109
|
-
});
|
|
110
|
-
return options;
|
|
111
|
-
};
|
|
112
|
-
return (fields)=>getOptions(fields, 1);
|
|
113
|
-
};
|
|
114
61
|
const useFilterFieldOptions = (fields)=>{
|
|
115
62
|
var _fieldSchema_xcomponentprops;
|
|
116
63
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
@@ -152,132 +99,6 @@ const useFilterFieldOptions = (fields)=>{
|
|
|
152
99
|
};
|
|
153
100
|
return getOptions(fields, 1);
|
|
154
101
|
};
|
|
155
|
-
const isEmpty = (obj)=>Array.isArray(obj) && 0 === obj.length || obj && 0 === Object.keys(obj).length && Object.getPrototypeOf(obj) === Object.prototype;
|
|
156
|
-
const CUSTOM_FILTER_VARIABLE_REGEXP = /^\{\{\$nFilter\.([^}]+)\}\}$/;
|
|
157
|
-
const getCustomFilterValue = function(items, key) {
|
|
158
|
-
let rawItems = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
|
|
159
|
-
if (rawItems && key in rawItems) return rawItems[key];
|
|
160
|
-
if (key in items) return items[key];
|
|
161
|
-
const arrayItems = Object.keys(items).filter((itemKey)=>itemKey.startsWith("".concat(key, ".")) && /^\d+$/.test(itemKey.slice(key.length + 1))).sort((a, b)=>Number(a.slice(key.length + 1)) - Number(b.slice(key.length + 1))).map((itemKey)=>items[itemKey]);
|
|
162
|
-
return arrayItems.length ? arrayItems : void 0;
|
|
163
|
-
};
|
|
164
|
-
const findCustomFieldSchemaInTree = (schema, key)=>{
|
|
165
|
-
if (!schema) return null;
|
|
166
|
-
if (schema.name === "__custom.".concat(key) || schema.name === key) return schema;
|
|
167
|
-
const properties = schema.properties || {};
|
|
168
|
-
for (const propertyKey of Object.keys(properties)){
|
|
169
|
-
if (propertyKey === "__custom.".concat(key) || propertyKey === key) return properties[propertyKey];
|
|
170
|
-
const found = findCustomFieldSchemaInTree(properties[propertyKey], key);
|
|
171
|
-
if (found) return found;
|
|
172
|
-
}
|
|
173
|
-
return null;
|
|
174
|
-
};
|
|
175
|
-
const findCustomFieldSchema = (schema, key)=>{
|
|
176
|
-
let current = schema;
|
|
177
|
-
while(current){
|
|
178
|
-
const found = findCustomFieldSchemaInTree(current, key);
|
|
179
|
-
if (found) return found;
|
|
180
|
-
current = current.parent;
|
|
181
|
-
}
|
|
182
|
-
return null;
|
|
183
|
-
};
|
|
184
|
-
const getDatePickerComponent = (fieldSchema)=>{
|
|
185
|
-
var _fieldSchema_xcomponentprops;
|
|
186
|
-
if ((null == fieldSchema ? void 0 : fieldSchema['x-component']) === 'CollectionField') {
|
|
187
|
-
var _fieldSchema_xcomponentprops1;
|
|
188
|
-
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.component;
|
|
189
|
-
}
|
|
190
|
-
return (null == fieldSchema ? void 0 : fieldSchema['x-component']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
|
|
191
|
-
};
|
|
192
|
-
const getDatePickerShowTime = (fieldSchema)=>{
|
|
193
|
-
var _fieldSchema_xcomponentprops;
|
|
194
|
-
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
|
|
195
|
-
};
|
|
196
|
-
const expandArrayValueFilter = function(filterSchemaItem, filterKey, value, customFlat) {
|
|
197
|
-
let options = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {};
|
|
198
|
-
const pathParts = filterKey.split('.');
|
|
199
|
-
const operator = pathParts.pop();
|
|
200
|
-
if ('$dateBetween' === operator && Array.isArray(value)) {
|
|
201
|
-
const valueInfo = (0, util_js_namespaceObject.resolveDatePickerRangeValueInfo)(value, {
|
|
202
|
-
component: options.component,
|
|
203
|
-
showTime: options.showTime,
|
|
204
|
-
preferDateBoundaryFallback: options.useDefaultDateBoundary
|
|
205
|
-
});
|
|
206
|
-
filterSchemaItem[filterKey] = (0, utils_js_namespaceObject.normalizeDateBetweenValue)(value, {
|
|
207
|
-
useDefaultDateBoundary: options.useDefaultDateBoundary,
|
|
208
|
-
valueMode: valueInfo.mode,
|
|
209
|
-
valueSource: valueInfo.source,
|
|
210
|
-
preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
|
|
211
|
-
});
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (!Array.isArray(value) || utils_js_namespaceObject.FILTER_OPERATORS_WITH_ARRAY_VALUES.has(operator || '')) {
|
|
215
|
-
filterSchemaItem[filterKey] = value;
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
if (0 === value.length) return void delete filterSchemaItem[filterKey];
|
|
219
|
-
let branchEndIndex = -1;
|
|
220
|
-
for(let index = pathParts.length - 2; index >= 0; index--)if ([
|
|
221
|
-
'$and',
|
|
222
|
-
'$or'
|
|
223
|
-
].includes(pathParts[index]) && /^\d+$/.test(pathParts[index + 1])) {
|
|
224
|
-
branchEndIndex = index;
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
const branchPath = branchEndIndex >= 0 ? pathParts.slice(0, branchEndIndex + 2).join('.') : '';
|
|
228
|
-
const fieldPath = pathParts.slice(branchEndIndex + 2).join('.');
|
|
229
|
-
const conditions = value.map((item)=>customFlat.unflatten({
|
|
230
|
-
["".concat(fieldPath, ".").concat(operator)]: item
|
|
231
|
-
}));
|
|
232
|
-
delete filterSchemaItem[filterKey];
|
|
233
|
-
filterSchemaItem[branchPath ? "".concat(branchPath, ".$or") : '$or'] = conditions;
|
|
234
|
-
};
|
|
235
|
-
const getCustomCondition = function(filter, fieldSchema) {
|
|
236
|
-
let customFlat = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : external_flat_default();
|
|
237
|
-
var _filterSchema_$and, _filterSchema_$or;
|
|
238
|
-
const filterSchema = fieldSchema ? fieldSchema['x-filter-rules'] : '';
|
|
239
|
-
const filterSchemaItem = customFlat(filterSchema || '');
|
|
240
|
-
const items = customFlat(filter || {});
|
|
241
|
-
const isCustomFilter = (null == filterSchema ? void 0 : null == (_filterSchema_$and = filterSchema.$and) ? void 0 : _filterSchema_$and.length) || (null == filterSchema ? void 0 : null == (_filterSchema_$or = filterSchema.$or) ? void 0 : _filterSchema_$or.length);
|
|
242
|
-
const isFilterCustom = isCustomFilter ? (0, external_utils_js_namespaceObject.hasDuplicateKeys)(items, filterSchemaItem) : false;
|
|
243
|
-
if (isFilterCustom) return customFlat.unflatten(items);
|
|
244
|
-
if (!isCustomFilter) return customFlat.unflatten({});
|
|
245
|
-
{
|
|
246
|
-
var _flatFieldSchema_$and, _flatFieldSchema_$or;
|
|
247
|
-
for(const filterKey in filterSchemaItem){
|
|
248
|
-
const match = 'string' == typeof filterSchemaItem[filterKey] && filterSchemaItem[filterKey].match(CUSTOM_FILTER_VARIABLE_REGEXP);
|
|
249
|
-
if (!match) continue;
|
|
250
|
-
const customFieldSchema = findCustomFieldSchema(fieldSchema, match[1]);
|
|
251
|
-
expandArrayValueFilter(filterSchemaItem, filterKey, getCustomFilterValue(items, match[1], filter || {}), customFlat, {
|
|
252
|
-
useDefaultDateBoundary: (0, utils_js_namespaceObject.shouldUseDefaultDateBoundary)(customFieldSchema),
|
|
253
|
-
component: getDatePickerComponent(customFieldSchema),
|
|
254
|
-
showTime: getDatePickerShowTime(customFieldSchema)
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
for(const item in filterSchemaItem)if (!filterSchemaItem[item] || filterSchemaItem[item].includes('$nFilter')) delete filterSchemaItem[item];
|
|
258
|
-
const flatFieldSchema = customFlat.unflatten(filterSchemaItem);
|
|
259
|
-
flatFieldSchema['$and'] = null == flatFieldSchema ? void 0 : null == (_flatFieldSchema_$and = flatFieldSchema['$and']) ? void 0 : _flatFieldSchema_$and.filter(Boolean);
|
|
260
|
-
flatFieldSchema['$or'] = null == flatFieldSchema ? void 0 : null == (_flatFieldSchema_$or = flatFieldSchema['$or']) ? void 0 : _flatFieldSchema_$or.filter(Boolean);
|
|
261
|
-
return flatFieldSchema;
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
const removeNullCondition = function(filter) {
|
|
265
|
-
let customFlat = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : external_flat_default();
|
|
266
|
-
const items = customFlat(filter || {});
|
|
267
|
-
const values = {};
|
|
268
|
-
for(const key in items){
|
|
269
|
-
const value = items[key];
|
|
270
|
-
if (null != value && !isEmpty(value)) values[key] = value;
|
|
271
|
-
}
|
|
272
|
-
for (const key of Object.keys(values))if (key.endsWith('$dateBetween.0')) {
|
|
273
|
-
const key1 = key.replace(/\$dateBetween\.0$/, '$dateBetween.1');
|
|
274
|
-
if (!(key1 in values)) values[key1] = values[key];
|
|
275
|
-
} else if (key.endsWith('$dateBetween.1')) {
|
|
276
|
-
const key0 = key.replace(/\$dateBetween\.1$/, '$dateBetween.0');
|
|
277
|
-
if (!(key0 in values)) values[key0] = values[key];
|
|
278
|
-
}
|
|
279
|
-
return customFlat.unflatten(values);
|
|
280
|
-
};
|
|
281
102
|
const useFilterActionProps = ()=>{
|
|
282
103
|
const { name } = (0, external_collection_manager_index_js_namespaceObject.useCollection_deprecated)();
|
|
283
104
|
const options = useFilterOptions(name);
|
|
@@ -298,7 +119,7 @@ const useFilterFieldProps = (param)=>{
|
|
|
298
119
|
onSubmit (values) {
|
|
299
120
|
var _service_params_, _service_params, _service_params1;
|
|
300
121
|
const defaultFilter = params.filter;
|
|
301
|
-
const filter = removeNullCondition(null == values ? void 0 : values.filter);
|
|
122
|
+
const filter = (0, external_conditionUtils_js_namespaceObject.removeNullCondition)(null == values ? void 0 : values.filter);
|
|
302
123
|
if ('manual' === dataLoadingMode && external_lodash_default().isEmpty(filter)) return service.mutate(void 0);
|
|
303
124
|
const filters = (null == (_service_params = service.params) ? void 0 : null == (_service_params_ = _service_params[1]) ? void 0 : _service_params_.filters) || {};
|
|
304
125
|
filters["filterAction"] = filter;
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
useGetFilterOptions: ()=>useGetFilterOptions,
|
|
28
|
+
useGetFilterFieldOptions: ()=>useGetFilterFieldOptions
|
|
29
|
+
});
|
|
30
|
+
const schema_namespaceObject = require("@tachybase/schema");
|
|
31
|
+
const index_js_namespaceObject = require("../../../collection-manager/index.js");
|
|
32
|
+
const useGetFilterFieldOptions = ()=>{
|
|
33
|
+
var _fieldSchema_xcomponentprops;
|
|
34
|
+
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
35
|
+
const nonfilterable = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.nonfilterable) || [];
|
|
36
|
+
const { getCollectionFields, getInterface } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
37
|
+
const field2option = (field, depth)=>{
|
|
38
|
+
var _field_uiSchema, _operators_filter;
|
|
39
|
+
if (nonfilterable.length && 1 === depth && nonfilterable.includes(field.name)) return;
|
|
40
|
+
if (!field.interface) return;
|
|
41
|
+
const fieldInterface = getInterface(field.interface);
|
|
42
|
+
if (!(null == fieldInterface ? void 0 : fieldInterface.filterable)) return;
|
|
43
|
+
const { nested, children, operators } = fieldInterface.filterable;
|
|
44
|
+
const option = {
|
|
45
|
+
name: field.name,
|
|
46
|
+
type: field.type,
|
|
47
|
+
target: field.target,
|
|
48
|
+
title: (null == field ? void 0 : null == (_field_uiSchema = field.uiSchema) ? void 0 : _field_uiSchema.title) || field.name,
|
|
49
|
+
schema: null == field ? void 0 : field.uiSchema,
|
|
50
|
+
interface: field.interface,
|
|
51
|
+
operators: (null == operators ? void 0 : null == (_operators_filter = operators.filter) ? void 0 : _operators_filter.call(operators, (operator)=>!(null == operator ? void 0 : operator.visible) || operator.visible(field))) || []
|
|
52
|
+
};
|
|
53
|
+
if (field.target && depth > 2) return;
|
|
54
|
+
if (depth > 2) return option;
|
|
55
|
+
if (null == children ? void 0 : children.length) option['children'] = children;
|
|
56
|
+
if (nested) {
|
|
57
|
+
const targetFields = getCollectionFields(field.target);
|
|
58
|
+
const options = getOptions(targetFields, depth + 1).filter(Boolean);
|
|
59
|
+
option['children'] = option['children'] || [];
|
|
60
|
+
option['children'].push(...options);
|
|
61
|
+
}
|
|
62
|
+
return option;
|
|
63
|
+
};
|
|
64
|
+
const getOptions = (fields, depth)=>{
|
|
65
|
+
const options = [];
|
|
66
|
+
fields.forEach((field)=>{
|
|
67
|
+
const option = field2option(field, depth);
|
|
68
|
+
if (option) options.push(option);
|
|
69
|
+
});
|
|
70
|
+
return options;
|
|
71
|
+
};
|
|
72
|
+
return (fields)=>getOptions(fields, 1);
|
|
73
|
+
};
|
|
74
|
+
const useGetFilterOptions = ()=>{
|
|
75
|
+
const { getCollectionFields } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
76
|
+
const getFilterFieldOptions = useGetFilterFieldOptions();
|
|
77
|
+
return (collectionName, dataSource)=>{
|
|
78
|
+
const fields = getCollectionFields(collectionName, dataSource);
|
|
79
|
+
const options = getFilterFieldOptions(fields);
|
|
80
|
+
return options;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
exports.useGetFilterFieldOptions = __webpack_exports__.useGetFilterFieldOptions;
|
|
84
|
+
exports.useGetFilterOptions = __webpack_exports__.useGetFilterOptions;
|
|
85
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
86
|
+
"useGetFilterFieldOptions",
|
|
87
|
+
"useGetFilterOptions"
|
|
88
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
89
|
+
Object.defineProperty(exports, '__esModule', {
|
|
90
|
+
value: true
|
|
91
|
+
});
|
|
@@ -31,16 +31,16 @@ const external_react_namespaceObject = require("react");
|
|
|
31
31
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
32
32
|
const client_namespaceObject = require("@tego/client");
|
|
33
33
|
const external_antd_namespaceObject = require("antd");
|
|
34
|
-
const external_index_js_namespaceObject = require("../../index.js");
|
|
35
34
|
const index_js_namespaceObject = require("../../../api-client/index.js");
|
|
36
35
|
const external_collection_manager_index_js_namespaceObject = require("../../../collection-manager/index.js");
|
|
37
36
|
const external_schema_settings_index_js_namespaceObject = require("../../../schema-settings/index.js");
|
|
38
37
|
const external_schema_templates_index_js_namespaceObject = require("../../../schema-templates/index.js");
|
|
38
|
+
const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
|
|
39
39
|
const FormComponent = (props)=>{
|
|
40
40
|
const { form, children, ...others } = props;
|
|
41
41
|
const field = (0, schema_namespaceObject.useField)();
|
|
42
42
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
43
|
-
const f = (0,
|
|
43
|
+
const f = (0, external_hooks_index_js_namespaceObject.useAttach)(form.createVoidField({
|
|
44
44
|
...field.props,
|
|
45
45
|
basePath: ''
|
|
46
46
|
}));
|
|
@@ -65,11 +65,11 @@ const FormDecorator = (props)=>{
|
|
|
65
65
|
const { form, children, disabled, ...others } = props;
|
|
66
66
|
const field = (0, schema_namespaceObject.useField)();
|
|
67
67
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
68
|
-
const f = (0,
|
|
68
|
+
const f = (0, external_hooks_index_js_namespaceObject.useAttach)(form.createVoidField({
|
|
69
69
|
...field.props,
|
|
70
70
|
basePath: ''
|
|
71
71
|
}));
|
|
72
|
-
const Component = (0,
|
|
72
|
+
const Component = (0, external_hooks_index_js_namespaceObject.useComponent)(fieldSchema['x-component'], Def);
|
|
73
73
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
74
74
|
form.disabled = disabled || field.disabled;
|
|
75
75
|
}, [
|
|
@@ -28,8 +28,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
30
|
require("react");
|
|
31
|
-
const
|
|
32
|
-
const FilterFormDesigner = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
31
|
+
const GeneralSchemaDesigner_js_namespaceObject = require("../../../schema-settings/GeneralSchemaDesigner.js");
|
|
32
|
+
const FilterFormDesigner = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GeneralSchemaDesigner_js_namespaceObject.GeneralSchemaDesigner, {
|
|
33
33
|
schemaSettings: "FilterFormItemSettings"
|
|
34
34
|
});
|
|
35
35
|
exports.FilterFormDesigner = __webpack_exports__.FilterFormDesigner;
|
|
@@ -43,22 +43,24 @@ const client_namespaceObject = require("@tego/client");
|
|
|
43
43
|
const external_antd_style_namespaceObject = require("antd-style");
|
|
44
44
|
const external_classnames_namespaceObject = require("classnames");
|
|
45
45
|
var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_classnames_namespaceObject);
|
|
46
|
-
const
|
|
46
|
+
const useApp_js_namespaceObject = require("../../../application/hooks/useApp.js");
|
|
47
47
|
const useFormActiveFields_js_namespaceObject = require("../../../block-provider/hooks/useFormActiveFields.js");
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
const
|
|
48
|
+
const ACLCollectionFieldProvider_js_namespaceObject = require("../../../built-in/acl/ACLCollectionFieldProvider.js");
|
|
49
|
+
const CollectionFieldProvider_js_namespaceObject = require("../../../data-source/collection-field/CollectionFieldProvider.js");
|
|
50
|
+
const ConfigSetting_provider_js_namespaceObject = require("../../../data-source/data-block/context/ConfigSetting.provider.js");
|
|
51
|
+
const GeneralSchemaDesigner_js_namespaceObject = require("../../../schema-settings/GeneralSchemaDesigner.js");
|
|
52
52
|
const useContextVariable_js_namespaceObject = require("../../../variables/hooks/useContextVariable.js");
|
|
53
53
|
var useContextVariable_js_default = /*#__PURE__*/ __webpack_require__.n(useContextVariable_js_namespaceObject);
|
|
54
|
-
const
|
|
54
|
+
const useVariables_js_namespaceObject = require("../../../variables/hooks/useVariables.js");
|
|
55
|
+
var useVariables_js_default = /*#__PURE__*/ __webpack_require__.n(useVariables_js_namespaceObject);
|
|
56
|
+
const BlockItem_js_namespaceObject = require("../block-item/BlockItem.js");
|
|
55
57
|
const shared_js_namespaceObject = require("../input/shared.js");
|
|
56
58
|
const external_FormItem_FilterFormDesigner_js_namespaceObject = require("./FormItem.FilterFormDesigner.js");
|
|
57
59
|
const useLazyLoadDisplayAssociationFieldsOfForm_js_namespaceObject = require("./hooks/useLazyLoadDisplayAssociationFieldsOfForm.js");
|
|
58
60
|
var useLazyLoadDisplayAssociationFieldsOfForm_js_default = /*#__PURE__*/ __webpack_require__.n(useLazyLoadDisplayAssociationFieldsOfForm_js_namespaceObject);
|
|
59
61
|
const useParseDefaultValue_js_namespaceObject = require("./hooks/useParseDefaultValue.js");
|
|
60
62
|
var useParseDefaultValue_js_default = /*#__PURE__*/ __webpack_require__.n(useParseDefaultValue_js_namespaceObject);
|
|
61
|
-
const
|
|
63
|
+
const external_operatorUtils_js_namespaceObject = require("./operatorUtils.js");
|
|
62
64
|
function _tagged_template_literal(strings, raw) {
|
|
63
65
|
if (!raw) raw = strings.slice(0);
|
|
64
66
|
return Object.freeze(Object.defineProperties(strings, {
|
|
@@ -109,11 +111,11 @@ const FormItem = (props)=>{
|
|
|
109
111
|
const field = (0, schema_namespaceObject.useField)();
|
|
110
112
|
const schema = (0, schema_namespaceObject.useFieldSchema)();
|
|
111
113
|
const contextVariable = useContextVariable_js_default()();
|
|
112
|
-
const variables = (
|
|
114
|
+
const variables = useVariables_js_default()();
|
|
113
115
|
const { addActiveFieldName } = (0, useFormActiveFields_js_namespaceObject.useFormActiveFields)() || {};
|
|
114
|
-
const { layoutDirection } = (0,
|
|
116
|
+
const { layoutDirection } = (0, ConfigSetting_provider_js_namespaceObject.useContextConfigSetting)();
|
|
115
117
|
const finishLayoutDirection = null != selfLayoutDirection ? selfLayoutDirection : layoutDirection;
|
|
116
|
-
(0,
|
|
118
|
+
(0, external_operatorUtils_js_namespaceObject.useEnsureOperatorsValid)();
|
|
117
119
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
118
120
|
null == variables || variables.registerVariable(contextVariable);
|
|
119
121
|
}, [
|
|
@@ -151,28 +153,29 @@ const FormItem = (props)=>{
|
|
|
151
153
|
}), [
|
|
152
154
|
showTitle
|
|
153
155
|
]);
|
|
154
|
-
|
|
156
|
+
const item = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(client_namespaceObject.FormItem, {
|
|
157
|
+
className: className,
|
|
158
|
+
...props,
|
|
159
|
+
extra: extra
|
|
160
|
+
});
|
|
161
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CollectionFieldProvider_js_namespaceObject.CollectionFieldProvider, {
|
|
155
162
|
allowNull: true,
|
|
156
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
163
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(BlockItem_js_namespaceObject.BlockItem, {
|
|
157
164
|
className: 'tb-form-item',
|
|
158
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
159
|
-
children:
|
|
160
|
-
className: className,
|
|
161
|
-
...props,
|
|
162
|
-
extra: extra
|
|
163
|
-
})
|
|
165
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ACLCollectionFieldProvider_js_namespaceObject.ACLCollectionFieldProvider, {
|
|
166
|
+
children: item
|
|
164
167
|
})
|
|
165
168
|
})
|
|
166
169
|
});
|
|
167
170
|
};
|
|
168
171
|
FormItem.displayName = 'FormItem';
|
|
169
172
|
FormItem.Designer = function() {
|
|
170
|
-
const app = (0,
|
|
173
|
+
const app = (0, useApp_js_namespaceObject.useApp)();
|
|
171
174
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
172
175
|
const settingsName = "FormItemSettings:".concat(fieldSchema['x-interface']);
|
|
173
176
|
const defaultActionSettings = 'FormItemSettings';
|
|
174
177
|
const hasFieldItem = app.schemaSettingsManager.has(settingsName);
|
|
175
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
178
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(GeneralSchemaDesigner_js_namespaceObject.GeneralSchemaDesigner, {
|
|
176
179
|
schemaSettings: hasFieldItem ? settingsName : defaultActionSettings
|
|
177
180
|
});
|
|
178
181
|
};
|
|
@@ -37,9 +37,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
37
37
|
EditComponent: ()=>EditComponent,
|
|
38
38
|
EditRequired: ()=>EditRequired,
|
|
39
39
|
EditValidationRules: ()=>EditValidationRules,
|
|
40
|
-
findFilterOperators: ()=>findFilterOperators,
|
|
41
|
-
getDefaultFilterOperatorValue: ()=>getDefaultFilterOperatorValue,
|
|
42
|
-
useEnsureOperatorsValid: ()=>useEnsureOperatorsValid,
|
|
40
|
+
findFilterOperators: ()=>external_operatorUtils_js_namespaceObject.findFilterOperators,
|
|
41
|
+
getDefaultFilterOperatorValue: ()=>external_operatorUtils_js_namespaceObject.getDefaultFilterOperatorValue,
|
|
42
|
+
useEnsureOperatorsValid: ()=>external_operatorUtils_js_namespaceObject.useEnsureOperatorsValid,
|
|
43
43
|
EditTooltip: ()=>EditTooltip,
|
|
44
44
|
EditTitleField: ()=>EditTitleField,
|
|
45
45
|
EditOperator: ()=>EditOperator,
|
|
@@ -61,33 +61,7 @@ const isPatternDisabled_js_namespaceObject = require("../../../schema-settings/i
|
|
|
61
61
|
const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
|
|
62
62
|
const useOperators_js_namespaceObject = require("../filter/useOperators.js");
|
|
63
63
|
const external_FormItem_js_namespaceObject = require("./FormItem.js");
|
|
64
|
-
const
|
|
65
|
-
while(schema){
|
|
66
|
-
if (schema['x-filter-operators']) return {
|
|
67
|
-
operators: schema['x-filter-operators'],
|
|
68
|
-
uid: schema['x-uid']
|
|
69
|
-
};
|
|
70
|
-
schema = schema.parent;
|
|
71
|
-
}
|
|
72
|
-
return {};
|
|
73
|
-
};
|
|
74
|
-
const getSchemaFilterComponent = (schema)=>{
|
|
75
|
-
var _schema_xcomponentprops;
|
|
76
|
-
return (null == schema ? void 0 : null == (_schema_xcomponentprops = schema['x-component-props']) ? void 0 : _schema_xcomponentprops.component) || (null == schema ? void 0 : schema['x-component']);
|
|
77
|
-
};
|
|
78
|
-
const getDefaultFilterOperatorValue = function(schema) {
|
|
79
|
-
let operatorList = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : [];
|
|
80
|
-
var _operatorList_find, _operatorList_;
|
|
81
|
-
const component = getSchemaFilterComponent(schema);
|
|
82
|
-
if (component) {
|
|
83
|
-
const matched = operatorList.find((item)=>{
|
|
84
|
-
var _item_schema;
|
|
85
|
-
return (null == item ? void 0 : null == (_item_schema = item.schema) ? void 0 : _item_schema['x-component']) === component;
|
|
86
|
-
});
|
|
87
|
-
if (null == matched ? void 0 : matched.value) return matched.value;
|
|
88
|
-
}
|
|
89
|
-
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);
|
|
90
|
-
};
|
|
64
|
+
const external_operatorUtils_js_namespaceObject = require("./operatorUtils.js");
|
|
91
65
|
const EditTitle = ()=>{
|
|
92
66
|
var _collectionField_uiSchema;
|
|
93
67
|
const { getCollectionJoinField } = (0, external_collection_manager_index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
@@ -491,12 +465,6 @@ const EditPattern = ()=>{
|
|
|
491
465
|
}
|
|
492
466
|
}, "pattern");
|
|
493
467
|
};
|
|
494
|
-
const useEnsureOperatorsValid = ()=>{
|
|
495
|
-
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
496
|
-
const operatorList = (0, useOperators_js_namespaceObject.useOperatorList)();
|
|
497
|
-
const { operators: storedOperators } = findFilterOperators(fieldSchema);
|
|
498
|
-
if (storedOperators && operatorList.length && !storedOperators[fieldSchema.name]) storedOperators[fieldSchema.name] = getDefaultFilterOperatorValue(fieldSchema, operatorList);
|
|
499
|
-
};
|
|
500
468
|
const EditOperator = ()=>{
|
|
501
469
|
const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
|
|
502
470
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
@@ -504,8 +472,8 @@ const EditOperator = ()=>{
|
|
|
504
472
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
505
473
|
const { dn } = (0, external_hooks_index_js_namespaceObject.useDesignable)();
|
|
506
474
|
const operatorList = (0, useOperators_js_namespaceObject.useOperatorList)();
|
|
507
|
-
const { operators: storedOperators = {}, uid } = findFilterOperators(fieldSchema);
|
|
508
|
-
if (operatorList.length && !storedOperators[fieldSchema.name]) storedOperators[fieldSchema.name] = getDefaultFilterOperatorValue(fieldSchema, operatorList);
|
|
475
|
+
const { operators: storedOperators = {}, uid } = (0, external_operatorUtils_js_namespaceObject.findFilterOperators)(fieldSchema);
|
|
476
|
+
if (operatorList.length && !storedOperators[fieldSchema.name]) storedOperators[fieldSchema.name] = (0, external_operatorUtils_js_namespaceObject.getDefaultFilterOperatorValue)(fieldSchema, operatorList);
|
|
509
477
|
return operatorList.length ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_schema_settings_index_js_namespaceObject.SchemaSettingsSelectItem, {
|
|
510
478
|
title: t('Operator'),
|
|
511
479
|
value: storedOperators[fieldSchema.name],
|
package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js
CHANGED
|
@@ -41,24 +41,26 @@ const client_namespaceObject = require("@tego/client");
|
|
|
41
41
|
const external_lodash_namespaceObject = require("lodash");
|
|
42
42
|
var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
|
|
43
43
|
const index_js_namespaceObject = require("../../../../block-provider/hooks/index.js");
|
|
44
|
-
const
|
|
44
|
+
const useCollection_deprecated_js_namespaceObject = require("../../../../collection-manager/hooks/useCollection_deprecated.js");
|
|
45
|
+
const useCollectionManager_deprecated_js_namespaceObject = require("../../../../collection-manager/hooks/useCollectionManager_deprecated.js");
|
|
45
46
|
const CollectionRecordProvider_js_namespaceObject = require("../../../../data-source/collection-record/CollectionRecordProvider.js");
|
|
46
|
-
const
|
|
47
|
-
const
|
|
47
|
+
const useFlag_js_namespaceObject = require("../../../../flag-provider/hooks/useFlag.js");
|
|
48
|
+
const useVariables_js_namespaceObject = require("../../../../variables/hooks/useVariables.js");
|
|
49
|
+
var useVariables_js_default = /*#__PURE__*/ __webpack_require__.n(useVariables_js_namespaceObject);
|
|
48
50
|
const transformVariableValue_js_namespaceObject = require("../../../../variables/utils/transformVariableValue.js");
|
|
49
51
|
const hooks_js_namespaceObject = require("../../association-field/hooks.js");
|
|
50
52
|
const external_utils_js_namespaceObject = require("../utils.js");
|
|
51
53
|
const useLazyLoadDisplayAssociationFieldsOfForm_useLazyLoadDisplayAssociationFieldsOfForm = ()=>{
|
|
52
54
|
var _sourceCollectionFieldRef_current;
|
|
53
|
-
const { name } = (0,
|
|
54
|
-
const { getCollectionJoinField } = (0,
|
|
55
|
+
const { name } = (0, useCollection_deprecated_js_namespaceObject.useCollection_deprecated)();
|
|
56
|
+
const { getCollectionJoinField } = (0, useCollectionManager_deprecated_js_namespaceObject.useCollectionManager_deprecated)();
|
|
55
57
|
const form = (0, schema_namespaceObject.useForm)();
|
|
56
58
|
const recordData = (0, CollectionRecordProvider_js_namespaceObject.useCollectionRecordData)();
|
|
57
59
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
58
|
-
const variables = (
|
|
60
|
+
const variables = useVariables_js_default()();
|
|
59
61
|
const field = (0, schema_namespaceObject.useField)();
|
|
60
62
|
const { formValue: subFormValue } = (0, hooks_js_namespaceObject.useSubFormValue)();
|
|
61
|
-
const { isInSubForm, isInSubTable } = (0,
|
|
63
|
+
const { isInSubForm, isInSubTable } = (0, useFlag_js_namespaceObject.useFlag)() || {};
|
|
62
64
|
const { getAssociationAppends } = (0, index_js_namespaceObject.useAssociationNames)();
|
|
63
65
|
const schemaName = fieldSchema.name.toString();
|
|
64
66
|
const formValue = external_lodash_default().cloneDeep(isInSubForm || isInSubTable ? subFormValue : form.values);
|
|
@@ -41,10 +41,14 @@ const client_namespaceObject = require("@tego/client");
|
|
|
41
41
|
const external_lodash_namespaceObject = require("lodash");
|
|
42
42
|
var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
|
|
43
43
|
const index_js_namespaceObject = require("../../../../record-provider/index.js");
|
|
44
|
-
const
|
|
44
|
+
const useCollection_deprecated_js_namespaceObject = require("../../../../collection-manager/hooks/useCollection_deprecated.js");
|
|
45
45
|
const CollectionRecordProvider_js_namespaceObject = require("../../../../data-source/collection-record/CollectionRecordProvider.js");
|
|
46
|
-
const
|
|
47
|
-
const
|
|
46
|
+
const useFlag_js_namespaceObject = require("../../../../flag-provider/hooks/useFlag.js");
|
|
47
|
+
const constants_js_namespaceObject = require("../../../../variables/constants.js");
|
|
48
|
+
const useLocalVariables_js_namespaceObject = require("../../../../variables/hooks/useLocalVariables.js");
|
|
49
|
+
var useLocalVariables_js_default = /*#__PURE__*/ __webpack_require__.n(useLocalVariables_js_namespaceObject);
|
|
50
|
+
const useVariables_js_namespaceObject = require("../../../../variables/hooks/useVariables.js");
|
|
51
|
+
var useVariables_js_default = /*#__PURE__*/ __webpack_require__.n(useVariables_js_namespaceObject);
|
|
48
52
|
const getPath_js_namespaceObject = require("../../../../variables/utils/getPath.js");
|
|
49
53
|
const getVariableName_js_namespaceObject = require("../../../../variables/utils/getVariableName.js");
|
|
50
54
|
const isVariable_js_namespaceObject = require("../../../../variables/utils/isVariable.js");
|
|
@@ -54,11 +58,11 @@ const external_useSpecialCase_js_namespaceObject = require("./useSpecialCase.js"
|
|
|
54
58
|
const useParseDefaultValue = ()=>{
|
|
55
59
|
const field = (0, schema_namespaceObject.useField)();
|
|
56
60
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
57
|
-
const variables = (
|
|
58
|
-
const localVariables = (
|
|
61
|
+
const variables = useVariables_js_default()();
|
|
62
|
+
const localVariables = useLocalVariables_js_default()();
|
|
59
63
|
const recordV2 = (0, CollectionRecordProvider_js_namespaceObject.useCollectionRecord)();
|
|
60
|
-
const { isInAssignFieldValues, isInSetDefaultValueDialog, isInFormDataTemplate, isInSubTable, isInSubForm } = (0,
|
|
61
|
-
const { getField } = (0,
|
|
64
|
+
const { isInAssignFieldValues, isInSetDefaultValueDialog, isInFormDataTemplate, isInSubTable, isInSubForm } = (0, useFlag_js_namespaceObject.useFlag)() || {};
|
|
65
|
+
const { getField } = (0, useCollection_deprecated_js_namespaceObject.useCollection_deprecated)();
|
|
62
66
|
const { isSpecialCase, setDefaultValue } = (0, external_useSpecialCase_js_namespaceObject.useSpecialCase)();
|
|
63
67
|
const index = (0, index_js_namespaceObject.useRecordIndex)();
|
|
64
68
|
const findVariable = (0, external_react_namespaceObject.useCallback)((name)=>{
|
|
@@ -93,7 +97,7 @@ const useParseDefaultValue = ()=>{
|
|
|
93
97
|
field.loading = false;
|
|
94
98
|
} else if (!/\{\{.+\}\}/g.test(fieldSchema.default) && field.setInitialValue) field.setInitialValue(fieldSchema.default);
|
|
95
99
|
};
|
|
96
|
-
const run = external_lodash_default().debounce(_run,
|
|
100
|
+
const run = external_lodash_default().debounce(_run, constants_js_namespaceObject.DEBOUNCE_WAIT);
|
|
97
101
|
if ((0, isVariable_js_namespaceObject.isVariable)(fieldSchema.default)) {
|
|
98
102
|
const variableName = (0, getVariableName_js_namespaceObject.getVariableName)(fieldSchema.default);
|
|
99
103
|
const variable = findVariable(variableName);
|