@tachybase/client 1.6.21 → 1.6.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +2 -2
- 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/built-in/locale/LocalePlugin.d.ts +2 -0
- package/es/built-in/locale/LocalePlugin.mjs +13 -4
- package/es/collection-manager/hooks/useCollectionManager_deprecated.mjs +2 -1
- package/es/collection-manager/sub-table.d.ts +1 -1
- package/es/data-source/data-source/DataSourceManager.d.ts +1 -2
- package/es/data-source/data-source/DataSourceManager.mjs +1 -2
- package/es/data-source/data-source/constants.d.ts +2 -0
- package/es/data-source/data-source/constants.mjs +3 -0
- package/es/data-source/utils.d.ts +2 -2
- package/es/data-source/utils.mjs +1 -1
- package/es/exports.d.ts +46 -0
- package/es/exports.mjs +46 -0
- package/es/filter-provider/utils.d.ts +2 -14
- package/es/filter-provider/utils.mjs +2 -57
- package/es/index.d.ts +1 -46
- package/es/index.mjs +4 -46
- package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +2 -86
- package/es/record-provider/index.mjs +3 -3
- package/es/schema-component/antd/action/Action.mjs +7 -6
- package/es/schema-component/antd/action/hooks.mjs +3 -2
- package/es/schema-component/antd/association-field/AssociationSelect.mjs +4 -3
- package/es/schema-component/antd/association-field/hooks.mjs +18 -1
- package/es/schema-component/antd/cron/CronSet.mjs +9 -3
- package/es/schema-component/antd/filter/conditionUtils.d.ts +2 -0
- package/es/schema-component/antd/filter/conditionUtils.mjs +133 -0
- package/es/schema-component/antd/filter/dateValueUtils.d.ts +13 -0
- package/es/schema-component/antd/filter/dateValueUtils.mjs +66 -0
- package/es/schema-component/antd/filter/useFilterActionProps.d.ts +2 -4
- package/es/schema-component/antd/filter/useFilterActionProps.mjs +3 -181
- package/es/schema-component/antd/filter/useGetFilterOptions.d.ts +2 -0
- package/es/schema-component/antd/filter/useGetFilterOptions.mjs +54 -0
- package/es/schema-component/antd/form/Form.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.FilterFormDesigner.mjs +1 -1
- package/es/schema-component/antd/form-item/FormItem.d.ts +1 -1
- package/es/schema-component/antd/form-item/FormItem.mjs +14 -12
- package/es/schema-component/antd/form-item/SchemaSettingOptions.d.ts +1 -14
- package/es/schema-component/antd/form-item/SchemaSettingOptions.mjs +1 -33
- package/es/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.mjs +4 -3
- package/es/schema-component/antd/form-item/hooks/useParseDefaultValue.mjs +5 -3
- package/es/schema-component/antd/form-item/operatorUtils.d.ts +14 -0
- package/es/schema-component/antd/form-item/operatorUtils.mjs +36 -0
- package/es/schema-component/antd/form-v2/Form.mjs +26 -167
- package/es/schema-component/antd/form-v2/FormLinkageRules.d.ts +9 -0
- package/es/schema-component/antd/form-v2/FormLinkageRules.mjs +191 -0
- package/es/schema-component/antd/form-v2/Templates.mjs +1 -1
- package/es/schema-component/antd/grid/Grid.mjs +5 -2
- 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/built-in/locale/LocalePlugin.js +17 -5
- package/lib/collection-manager/hooks/useCollectionManager_deprecated.js +4 -3
- package/lib/data-source/data-source/DataSourceManager.js +6 -7
- package/lib/data-source/data-source/constants.js +40 -0
- package/lib/data-source/utils.js +2 -2
- package/lib/exports.js +769 -0
- package/lib/filter-provider/utils.js +7 -63
- package/lib/index.js +10 -714
- package/lib/record-provider/index.js +6 -6
- package/lib/schema-component/antd/action/Action.js +9 -8
- package/lib/schema-component/antd/action/hooks.js +3 -2
- package/lib/schema-component/antd/association-field/AssociationSelect.js +3 -2
- package/lib/schema-component/antd/association-field/hooks.js +18 -1
- package/lib/schema-component/antd/cron/CronSet.js +8 -2
- package/lib/schema-component/antd/filter/conditionUtils.js +180 -0
- package/lib/schema-component/antd/filter/dateValueUtils.js +116 -0
- package/lib/schema-component/antd/filter/useFilterActionProps.js +7 -186
- package/lib/schema-component/antd/filter/useGetFilterOptions.js +91 -0
- package/lib/schema-component/antd/form/Form.js +4 -4
- package/lib/schema-component/antd/form-item/FormItem.FilterFormDesigner.js +2 -2
- package/lib/schema-component/antd/form-item/FormItem.js +23 -20
- package/lib/schema-component/antd/form-item/SchemaSettingOptions.js +6 -38
- package/lib/schema-component/antd/form-item/hooks/useLazyLoadDisplayAssociationFieldsOfForm.js +9 -7
- package/lib/schema-component/antd/form-item/hooks/useParseDefaultValue.js +12 -8
- package/lib/schema-component/antd/form-item/operatorUtils.js +76 -0
- package/lib/schema-component/antd/form-v2/Form.js +204 -317
- package/lib/schema-component/antd/form-v2/FormLinkageRules.js +236 -0
- package/lib/schema-component/antd/form-v2/Templates.js +2 -2
- package/lib/schema-component/antd/grid/Grid.js +10 -7
- 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
|
@@ -35,16 +35,16 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
35
35
|
});
|
|
36
36
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
37
37
|
const external_react_namespaceObject = require("react");
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
const
|
|
38
|
+
const useCollection_deprecated_js_namespaceObject = require("../collection-manager/hooks/useCollection_deprecated.js");
|
|
39
|
+
const CollectionRecordProvider_js_namespaceObject = require("../data-source/collection-record/CollectionRecordProvider.js");
|
|
40
|
+
const CurrentUserContext_js_namespaceObject = require("../user/CurrentUserContext.js");
|
|
41
41
|
const RecordContext_deprecated = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)({});
|
|
42
42
|
RecordContext_deprecated.displayName = 'RecordContext_deprecated';
|
|
43
43
|
const RecordIndexContext = /*#__PURE__*/ (0, external_react_namespaceObject.createContext)(null);
|
|
44
44
|
RecordIndexContext.displayName = 'RecordIndexContext';
|
|
45
45
|
const RecordProvider = (props)=>{
|
|
46
46
|
const { record, children, parent, isNew } = props;
|
|
47
|
-
const { name: __collectionName } = (0,
|
|
47
|
+
const { name: __collectionName } = (0, useCollection_deprecated_js_namespaceObject.useCollection_deprecated)();
|
|
48
48
|
const value = {
|
|
49
49
|
...record
|
|
50
50
|
};
|
|
@@ -52,7 +52,7 @@ const RecordProvider = (props)=>{
|
|
|
52
52
|
value['__collectionName'] = __collectionName;
|
|
53
53
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(RecordContext_deprecated.Provider, {
|
|
54
54
|
value: value,
|
|
55
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
55
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(CollectionRecordProvider_js_namespaceObject.CollectionRecordProvider, {
|
|
56
56
|
isNew: isNew,
|
|
57
57
|
record: record,
|
|
58
58
|
parentRecord: parent,
|
|
@@ -79,7 +79,7 @@ function useRecordIndex() {
|
|
|
79
79
|
const useRecordIsOwn = ()=>{
|
|
80
80
|
var _ctx_data_data, _ctx_data;
|
|
81
81
|
const record = useRecord();
|
|
82
|
-
const ctx = (0,
|
|
82
|
+
const ctx = (0, CurrentUserContext_js_namespaceObject.useCurrentUserContext)();
|
|
83
83
|
if (!(null == record ? void 0 : record.createdById)) return false;
|
|
84
84
|
return (null == record ? void 0 : record.createdById) === (null == ctx ? void 0 : null == (_ctx_data = ctx.data) ? void 0 : null == (_ctx_data_data = _ctx_data.data) ? void 0 : _ctx_data_data.id);
|
|
85
85
|
};
|
|
@@ -46,8 +46,6 @@ var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_c
|
|
|
46
46
|
const external_lodash_namespaceObject = require("lodash");
|
|
47
47
|
var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
|
|
48
48
|
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
49
|
-
const external_react_router_dom_namespaceObject = require("react-router-dom");
|
|
50
|
-
const external_index_js_namespaceObject = require("../../index.js");
|
|
51
49
|
const index_js_namespaceObject = require("../../../application/index.js");
|
|
52
50
|
const withDynamicSchemaProps_js_namespaceObject = require("../../../application/hoc/withDynamicSchemaProps.js");
|
|
53
51
|
const acl_index_js_namespaceObject = require("../../../built-in/acl/index.js");
|
|
@@ -58,7 +56,10 @@ const external_record_provider_index_js_namespaceObject = require("../../../reco
|
|
|
58
56
|
const external_variables_index_js_namespaceObject = require("../../../variables/index.js");
|
|
59
57
|
const external_common_index_js_namespaceObject = require("../../common/index.js");
|
|
60
58
|
const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
|
|
59
|
+
const useDesignable_js_namespaceObject = require("../../hooks/useDesignable.js");
|
|
60
|
+
const useOptionalNavigate_js_namespaceObject = require("../../hooks/useOptionalNavigate.js");
|
|
61
61
|
const useProps_js_namespaceObject = require("../../hooks/useProps.js");
|
|
62
|
+
const Popover_js_namespaceObject = require("../popover/Popover.js");
|
|
62
63
|
const external_Action_Area_js_namespaceObject = require("./Action.Area.js");
|
|
63
64
|
const external_Action_Container_js_namespaceObject = require("./Action.Container.js");
|
|
64
65
|
var external_Action_Container_js_default = /*#__PURE__*/ __webpack_require__.n(external_Action_Container_js_namespaceObject);
|
|
@@ -75,10 +76,10 @@ const useCompiledAction_js_namespaceObject = require("./hooks/useCompiledAction.
|
|
|
75
76
|
const useGetAriaLabelOfAction_js_namespaceObject = require("./hooks/useGetAriaLabelOfAction.js");
|
|
76
77
|
const external_utils_js_namespaceObject = require("./utils.js");
|
|
77
78
|
const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaProps)((0, schema_namespaceObject.observer)((props)=>{
|
|
78
|
-
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _field_data, _field_data1;
|
|
79
|
+
var _app_usePageMode, _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _field_data, _field_data1;
|
|
79
80
|
const { isShow = true, popover, confirm, openMode: om, containerRefKey, component, useAction = external_hooks_js_namespaceObject.useA, className, icon, title, onClick, style, openSize: os, disabled: propsDisabled, actionCallback, addChild, ...others } = (0, useProps_js_namespaceObject.useProps)(props);
|
|
80
81
|
const aclCtx = (0, acl_index_js_namespaceObject.useACLActionParamsContext)();
|
|
81
|
-
const navigate = (0,
|
|
82
|
+
const navigate = (0, useOptionalNavigate_js_namespaceObject.useOptionalNavigate)();
|
|
82
83
|
const { wrapSSR, componentCls, hashId } = external_Action_style_js_default()();
|
|
83
84
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
84
85
|
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
@@ -86,7 +87,7 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
86
87
|
const Designer = (0, external_hooks_index_js_namespaceObject.useDesigner)();
|
|
87
88
|
const field = (0, schema_namespaceObject.useField)();
|
|
88
89
|
const app = (0, index_js_namespaceObject.useApp)();
|
|
89
|
-
const pageMode = app.usePageMode();
|
|
90
|
+
const pageMode = null == (_app_usePageMode = app.usePageMode) ? void 0 : _app_usePageMode.call(app);
|
|
90
91
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
91
92
|
const { run, element } = (0, useCompiledAction_js_namespaceObject.useCompiledAction)(useAction, actionCallback);
|
|
92
93
|
const form = (0, schema_namespaceObject.useForm)();
|
|
@@ -97,7 +98,7 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
97
98
|
const openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize'];
|
|
98
99
|
const disabled = form.disabled || field.disabled || (null == (_field_data = field.data) ? void 0 : _field_data.disabled) || propsDisabled;
|
|
99
100
|
const linkageRules = (null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [];
|
|
100
|
-
const { designable } = (0,
|
|
101
|
+
const { designable } = (0, useDesignable_js_namespaceObject.useDesignable)();
|
|
101
102
|
const tarComponent = (0, external_hooks_index_js_namespaceObject.useComponent)(component) || component;
|
|
102
103
|
const { modal } = external_antd_namespaceObject.App.useApp();
|
|
103
104
|
const variables = (0, external_variables_index_js_namespaceObject.useVariables)();
|
|
@@ -234,8 +235,8 @@ const Action = (0, withDynamicSchemaProps_js_namespaceObject.withDynamicSchemaPr
|
|
|
234
235
|
displayName: 'Action'
|
|
235
236
|
});
|
|
236
237
|
Action.Popover = (0, schema_namespaceObject.observer)((props)=>{
|
|
237
|
-
const { button, visible, setVisible } = (0,
|
|
238
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
238
|
+
const { button, visible, setVisible } = (0, external_hooks_js_namespaceObject.useActionContext)();
|
|
239
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Popover_js_namespaceObject.StablePopover, {
|
|
239
240
|
...props,
|
|
240
241
|
destroyTooltipOnHide: true,
|
|
241
242
|
open: visible,
|
|
@@ -33,7 +33,7 @@ const external_react_namespaceObject = require("react");
|
|
|
33
33
|
const schema_namespaceObject = require("@tachybase/schema");
|
|
34
34
|
const external_antd_namespaceObject = require("antd");
|
|
35
35
|
const external_react_i18next_namespaceObject = require("react-i18next");
|
|
36
|
-
const
|
|
36
|
+
const FormBlockContext_js_namespaceObject = require("../../../block-provider/FormBlockContext.js");
|
|
37
37
|
const external_context_js_namespaceObject = require("./context.js");
|
|
38
38
|
const useA = ()=>({
|
|
39
39
|
async run () {}
|
|
@@ -79,7 +79,8 @@ const useCloseAction = ()=>{
|
|
|
79
79
|
};
|
|
80
80
|
const useLinkageAction = ()=>{
|
|
81
81
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
82
|
-
const
|
|
82
|
+
const ctx = (0, FormBlockContext_js_namespaceObject.useFormBlockContext)();
|
|
83
|
+
const isRecordAction = 'create' !== ctx.type && (null == fieldSchema ? void 0 : fieldSchema['x-acl-action']) !== 'create' && (null == fieldSchema ? void 0 : fieldSchema['x-action']) !== 'create';
|
|
83
84
|
const isAction = [
|
|
84
85
|
'Action.Link',
|
|
85
86
|
'Action'
|
|
@@ -81,6 +81,7 @@ const InternalAssociationSelect = (0, schema_namespaceObject.observer)((props)=>
|
|
|
81
81
|
const isAllowAddNew = fieldSchema['x-add-new'];
|
|
82
82
|
const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
|
|
83
83
|
const { multiple } = props;
|
|
84
|
+
const fieldNames = (0, external_hooks_js_namespaceObject.useFieldNames)(props);
|
|
84
85
|
const form = (0, schema_namespaceObject.useForm)();
|
|
85
86
|
const api = (0, external_index_js_namespaceObject.useAPIClient)();
|
|
86
87
|
const resource = api.resource(collectionField.target);
|
|
@@ -108,11 +109,10 @@ const InternalAssociationSelect = (0, schema_namespaceObject.observer)((props)=>
|
|
|
108
109
|
};
|
|
109
110
|
}, []);
|
|
110
111
|
const handleCreateAction = async (props)=>{
|
|
111
|
-
var _field_componentProps_fieldNames, _field_componentProps;
|
|
112
112
|
const { search: value, callBack } = props;
|
|
113
113
|
const { data: { data } } = await resource.create({
|
|
114
114
|
values: {
|
|
115
|
-
[
|
|
115
|
+
[fieldNames.label || 'id']: value
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
if (data) {
|
|
@@ -161,6 +161,7 @@ const InternalAssociationSelect = (0, schema_namespaceObject.observer)((props)=>
|
|
|
161
161
|
width: '100%'
|
|
162
162
|
},
|
|
163
163
|
...props,
|
|
164
|
+
fieldNames: fieldNames,
|
|
164
165
|
size: 'middle',
|
|
165
166
|
objectValue: objectValue,
|
|
166
167
|
value: value || innerValue,
|
|
@@ -175,12 +175,29 @@ function useServiceOptions(props) {
|
|
|
175
175
|
const useFieldNames = (props)=>{
|
|
176
176
|
var _fieldSchema_xcomponentprops_field_uiSchema_xcomponentprops, _fieldSchema_xcomponentprops_field_uiSchema, _fieldSchema_xcomponentprops_field, _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
|
|
177
177
|
const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
|
|
178
|
+
const { options: collectionField } = useAssociationFieldContext();
|
|
179
|
+
const { getCollection } = (0, index_js_namespaceObject.useCollectionManager_deprecated)();
|
|
178
180
|
const fieldNames = (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : null == (_fieldSchema_xcomponentprops_field = _fieldSchema_xcomponentprops['field']) ? void 0 : null == (_fieldSchema_xcomponentprops_field_uiSchema = _fieldSchema_xcomponentprops_field['uiSchema']) ? void 0 : null == (_fieldSchema_xcomponentprops_field_uiSchema_xcomponentprops = _fieldSchema_xcomponentprops_field_uiSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops_field_uiSchema_xcomponentprops['fieldNames']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['fieldNames']) || props.fieldNames;
|
|
179
|
-
return {
|
|
181
|
+
if (fieldNames) return {
|
|
180
182
|
label: 'label',
|
|
181
183
|
value: 'value',
|
|
182
184
|
...fieldNames
|
|
183
185
|
};
|
|
186
|
+
if (null == collectionField ? void 0 : collectionField.target) {
|
|
187
|
+
const targetCollection = getCollection(collectionField.target);
|
|
188
|
+
if (targetCollection) {
|
|
189
|
+
var _targetCollection_getPrimaryKey;
|
|
190
|
+
const pk = targetCollection.filterTargetKey || (null == (_targetCollection_getPrimaryKey = targetCollection.getPrimaryKey) ? void 0 : _targetCollection_getPrimaryKey.call(targetCollection)) || 'id';
|
|
191
|
+
return {
|
|
192
|
+
label: targetCollection.titleField || pk,
|
|
193
|
+
value: pk
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
label: 'label',
|
|
199
|
+
value: 'value'
|
|
200
|
+
};
|
|
184
201
|
};
|
|
185
202
|
const SubFormContext = (0, external_react_namespaceObject.createContext)(null);
|
|
186
203
|
SubFormContext.displayName = 'SubFormContext';
|
|
@@ -62,6 +62,7 @@ const CronSetInternal = (props)=>{
|
|
|
62
62
|
label: compile(item.label)
|
|
63
63
|
})), [
|
|
64
64
|
props.options,
|
|
65
|
+
uiSchemaOptions,
|
|
65
66
|
customizeOption
|
|
66
67
|
]);
|
|
67
68
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
@@ -124,7 +125,8 @@ const ReadPretty = (props)=>{
|
|
|
124
125
|
const { getField } = (0, index_js_namespaceObject.useCollection_deprecated)();
|
|
125
126
|
const uiSchemaOptions = null == (_getField = getField(null == fieldSchema ? void 0 : fieldSchema.name)) ? void 0 : _getField.uiSchema.enum;
|
|
126
127
|
const options = (0, external_react_namespaceObject.useMemo)(()=>(props.options || []).concat(uiSchemaOptions || []), [
|
|
127
|
-
props.options
|
|
128
|
+
props.options,
|
|
129
|
+
uiSchemaOptions
|
|
128
130
|
]);
|
|
129
131
|
const label = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
130
132
|
var _options_find;
|
|
@@ -140,7 +142,11 @@ const ReadPretty = (props)=>{
|
|
|
140
142
|
}))
|
|
141
143
|
});
|
|
142
144
|
};
|
|
143
|
-
const CronSet = (0, schema_namespaceObject.connect)(CronSetInternal, (0, schema_namespaceObject.
|
|
145
|
+
const CronSet = (0, schema_namespaceObject.connect)(CronSetInternal, (0, schema_namespaceObject.mapProps)({
|
|
146
|
+
dataSource: 'options',
|
|
147
|
+
value: 'value',
|
|
148
|
+
onInput: 'onChange'
|
|
149
|
+
}), (0, schema_namespaceObject.mapReadPretty)(ReadPretty));
|
|
144
150
|
exports.CronSet = __webpack_exports__.CronSet;
|
|
145
151
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
146
152
|
"CronSet"
|
|
@@ -0,0 +1,180 @@
|
|
|
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
|
+
getCustomCondition: ()=>getCustomCondition,
|
|
37
|
+
removeNullCondition: ()=>removeNullCondition
|
|
38
|
+
});
|
|
39
|
+
const external_flat_namespaceObject = require("flat");
|
|
40
|
+
var external_flat_default = /*#__PURE__*/ __webpack_require__.n(external_flat_namespaceObject);
|
|
41
|
+
const util_js_namespaceObject = require("../date-picker/util.js");
|
|
42
|
+
const external_dateValueUtils_js_namespaceObject = require("./dateValueUtils.js");
|
|
43
|
+
const external_utils_js_namespaceObject = require("./utils.js");
|
|
44
|
+
const isEmpty = (obj)=>Array.isArray(obj) && 0 === obj.length || obj && 0 === Object.keys(obj).length && Object.getPrototypeOf(obj) === Object.prototype;
|
|
45
|
+
const CUSTOM_FILTER_VARIABLE_REGEXP = /^\{\{\$nFilter\.([^}]+)\}\}$/;
|
|
46
|
+
const getCustomFilterValue = function(items, key) {
|
|
47
|
+
let rawItems = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
|
|
48
|
+
if (rawItems && key in rawItems) return rawItems[key];
|
|
49
|
+
if (key in items) return items[key];
|
|
50
|
+
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]);
|
|
51
|
+
return arrayItems.length ? arrayItems : void 0;
|
|
52
|
+
};
|
|
53
|
+
const findCustomFieldSchemaInTree = (schema, key)=>{
|
|
54
|
+
if (!schema) return null;
|
|
55
|
+
if (schema.name === "__custom.".concat(key) || schema.name === key) return schema;
|
|
56
|
+
const properties = schema.properties || {};
|
|
57
|
+
for (const propertyKey of Object.keys(properties)){
|
|
58
|
+
if (propertyKey === "__custom.".concat(key) || propertyKey === key) return properties[propertyKey];
|
|
59
|
+
const found = findCustomFieldSchemaInTree(properties[propertyKey], key);
|
|
60
|
+
if (found) return found;
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
};
|
|
64
|
+
const findCustomFieldSchema = (schema, key)=>{
|
|
65
|
+
let current = schema;
|
|
66
|
+
while(current){
|
|
67
|
+
const found = findCustomFieldSchemaInTree(current, key);
|
|
68
|
+
if (found) return found;
|
|
69
|
+
current = current.parent;
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
};
|
|
73
|
+
const getDatePickerComponent = (fieldSchema)=>{
|
|
74
|
+
var _fieldSchema_xcomponentprops;
|
|
75
|
+
if ((null == fieldSchema ? void 0 : fieldSchema['x-component']) === 'CollectionField') {
|
|
76
|
+
var _fieldSchema_xcomponentprops1;
|
|
77
|
+
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.component;
|
|
78
|
+
}
|
|
79
|
+
return (null == fieldSchema ? void 0 : fieldSchema['x-component']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
|
|
80
|
+
};
|
|
81
|
+
const getDatePickerShowTime = (fieldSchema)=>{
|
|
82
|
+
var _fieldSchema_xcomponentprops;
|
|
83
|
+
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.showTime;
|
|
84
|
+
};
|
|
85
|
+
const expandArrayValueFilter = function(filterSchemaItem, filterKey, value, customFlat) {
|
|
86
|
+
let options = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : {};
|
|
87
|
+
const pathParts = filterKey.split('.');
|
|
88
|
+
const operator = pathParts.pop();
|
|
89
|
+
if ('$dateBetween' === operator && Array.isArray(value)) {
|
|
90
|
+
const valueInfo = (0, util_js_namespaceObject.resolveDatePickerRangeValueInfo)(value, {
|
|
91
|
+
component: options.component,
|
|
92
|
+
showTime: options.showTime,
|
|
93
|
+
preferDateBoundaryFallback: options.useDefaultDateBoundary
|
|
94
|
+
});
|
|
95
|
+
filterSchemaItem[filterKey] = (0, external_dateValueUtils_js_namespaceObject.normalizeDateBetweenValue)(value, {
|
|
96
|
+
useDefaultDateBoundary: options.useDefaultDateBoundary,
|
|
97
|
+
valueMode: valueInfo.mode,
|
|
98
|
+
valueSource: valueInfo.source,
|
|
99
|
+
preferDateBoundaryFallback: 'retained-date-boundary' === valueInfo.source
|
|
100
|
+
});
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (!Array.isArray(value) || external_dateValueUtils_js_namespaceObject.FILTER_OPERATORS_WITH_ARRAY_VALUES.has(operator || '')) {
|
|
104
|
+
filterSchemaItem[filterKey] = value;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (0 === value.length) return void delete filterSchemaItem[filterKey];
|
|
108
|
+
let branchEndIndex = -1;
|
|
109
|
+
for(let index = pathParts.length - 2; index >= 0; index--)if ([
|
|
110
|
+
'$and',
|
|
111
|
+
'$or'
|
|
112
|
+
].includes(pathParts[index]) && /^\d+$/.test(pathParts[index + 1])) {
|
|
113
|
+
branchEndIndex = index;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
const branchPath = branchEndIndex >= 0 ? pathParts.slice(0, branchEndIndex + 2).join('.') : '';
|
|
117
|
+
const fieldPath = pathParts.slice(branchEndIndex + 2).join('.');
|
|
118
|
+
const conditions = value.map((item)=>customFlat.unflatten({
|
|
119
|
+
["".concat(fieldPath, ".").concat(operator)]: item
|
|
120
|
+
}));
|
|
121
|
+
delete filterSchemaItem[filterKey];
|
|
122
|
+
filterSchemaItem[branchPath ? "".concat(branchPath, ".$or") : '$or'] = conditions;
|
|
123
|
+
};
|
|
124
|
+
const getCustomCondition = function(filter, fieldSchema) {
|
|
125
|
+
let customFlat = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : external_flat_default();
|
|
126
|
+
var _filterSchema_$and, _filterSchema_$or;
|
|
127
|
+
const filterSchema = fieldSchema ? fieldSchema['x-filter-rules'] : '';
|
|
128
|
+
const filterSchemaItem = customFlat(filterSchema || '');
|
|
129
|
+
const items = customFlat(filter || {});
|
|
130
|
+
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);
|
|
131
|
+
const isFilterCustom = isCustomFilter ? (0, external_utils_js_namespaceObject.hasDuplicateKeys)(items, filterSchemaItem) : false;
|
|
132
|
+
if (isFilterCustom) return customFlat.unflatten(items);
|
|
133
|
+
if (!isCustomFilter) return customFlat.unflatten({});
|
|
134
|
+
{
|
|
135
|
+
for(const filterKey in filterSchemaItem){
|
|
136
|
+
const match = 'string' == typeof filterSchemaItem[filterKey] && filterSchemaItem[filterKey].match(CUSTOM_FILTER_VARIABLE_REGEXP);
|
|
137
|
+
if (!match) continue;
|
|
138
|
+
const customFieldSchema = findCustomFieldSchema(fieldSchema, match[1]);
|
|
139
|
+
expandArrayValueFilter(filterSchemaItem, filterKey, getCustomFilterValue(items, match[1], filter || {}), customFlat, {
|
|
140
|
+
useDefaultDateBoundary: (0, external_dateValueUtils_js_namespaceObject.shouldUseDefaultDateBoundary)(customFieldSchema),
|
|
141
|
+
component: getDatePickerComponent(customFieldSchema),
|
|
142
|
+
showTime: getDatePickerShowTime(customFieldSchema)
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
for(const item in filterSchemaItem){
|
|
146
|
+
const value = filterSchemaItem[item];
|
|
147
|
+
if (null == value || '' === value || 'string' == typeof value && value.includes('$nFilter')) delete filterSchemaItem[item];
|
|
148
|
+
}
|
|
149
|
+
const flatFieldSchema = customFlat.unflatten(filterSchemaItem);
|
|
150
|
+
if (Array.isArray(null == flatFieldSchema ? void 0 : flatFieldSchema['$and'])) flatFieldSchema['$and'] = flatFieldSchema['$and'].filter(Boolean);
|
|
151
|
+
if (Array.isArray(null == flatFieldSchema ? void 0 : flatFieldSchema['$or'])) flatFieldSchema['$or'] = flatFieldSchema['$or'].filter(Boolean);
|
|
152
|
+
return flatFieldSchema;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
const removeNullCondition = function(filter) {
|
|
156
|
+
let customFlat = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : external_flat_default();
|
|
157
|
+
const items = customFlat(filter || {});
|
|
158
|
+
const values = {};
|
|
159
|
+
for(const key in items){
|
|
160
|
+
const value = items[key];
|
|
161
|
+
if (null != value && !isEmpty(value)) values[key] = value;
|
|
162
|
+
}
|
|
163
|
+
for (const key of Object.keys(values))if (key.endsWith('$dateBetween.0')) {
|
|
164
|
+
const key1 = key.replace(/\$dateBetween\.0$/, '$dateBetween.1');
|
|
165
|
+
if (!(key1 in values)) values[key1] = values[key];
|
|
166
|
+
} else if (key.endsWith('$dateBetween.1')) {
|
|
167
|
+
const key0 = key.replace(/\$dateBetween\.1$/, '$dateBetween.0');
|
|
168
|
+
if (!(key0 in values)) values[key0] = values[key];
|
|
169
|
+
}
|
|
170
|
+
return customFlat.unflatten(values);
|
|
171
|
+
};
|
|
172
|
+
exports.getCustomCondition = __webpack_exports__.getCustomCondition;
|
|
173
|
+
exports.removeNullCondition = __webpack_exports__.removeNullCondition;
|
|
174
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
175
|
+
"getCustomCondition",
|
|
176
|
+
"removeNullCondition"
|
|
177
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
178
|
+
Object.defineProperty(exports, '__esModule', {
|
|
179
|
+
value: true
|
|
180
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
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
|
+
normalizeDateBetweenValue: ()=>normalizeDateBetweenValue,
|
|
37
|
+
FILTER_OPERATORS_WITH_ARRAY_VALUES: ()=>FILTER_OPERATORS_WITH_ARRAY_VALUES,
|
|
38
|
+
shouldUseDefaultDateBoundary: ()=>shouldUseDefaultDateBoundary
|
|
39
|
+
});
|
|
40
|
+
const external_dayjs_namespaceObject = require("dayjs");
|
|
41
|
+
var external_dayjs_default = /*#__PURE__*/ __webpack_require__.n(external_dayjs_namespaceObject);
|
|
42
|
+
const util_js_namespaceObject = require("../date-picker/util.js");
|
|
43
|
+
const FILTER_OPERATORS_WITH_ARRAY_VALUES = new Set([
|
|
44
|
+
'$match',
|
|
45
|
+
'$notMatch',
|
|
46
|
+
'$anyOf',
|
|
47
|
+
'$noneOf',
|
|
48
|
+
'$childIn',
|
|
49
|
+
'$childNotIn',
|
|
50
|
+
'$dateBetween',
|
|
51
|
+
'$in',
|
|
52
|
+
'$notIn'
|
|
53
|
+
]);
|
|
54
|
+
const getDatePickerComponent = (fieldSchema)=>{
|
|
55
|
+
var _fieldSchema_xcomponentprops;
|
|
56
|
+
if ((null == fieldSchema ? void 0 : fieldSchema['x-component']) === 'CollectionField') {
|
|
57
|
+
var _fieldSchema_xcomponentprops1;
|
|
58
|
+
return null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.component;
|
|
59
|
+
}
|
|
60
|
+
return (null == fieldSchema ? void 0 : fieldSchema['x-component']) || (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.component);
|
|
61
|
+
};
|
|
62
|
+
const isDateOnlyString = (value)=>'string' == typeof value && /^\d{4}-\d{2}-\d{2}$/.test(value);
|
|
63
|
+
const hasExplicitTime = (value)=>'string' == typeof value && /[T\s]\d{2}:\d{2}/.test(value);
|
|
64
|
+
const normalizeLocalDateBoundaryInput = (value)=>{
|
|
65
|
+
if ('string' != typeof value) return value;
|
|
66
|
+
return value.replace(/Z$/, '').replace(/[+-]\d\d:\d\d$/, '');
|
|
67
|
+
};
|
|
68
|
+
const normalizeDateBetweenBoundary = function(value, boundary) {
|
|
69
|
+
let options = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : {};
|
|
70
|
+
const m = external_dayjs_default()(value);
|
|
71
|
+
if (!m.isValid()) return value;
|
|
72
|
+
if (isDateOnlyString(value)) return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
|
|
73
|
+
if ('date' === options.valueMode) {
|
|
74
|
+
if ('metadata' === options.valueSource || 'retained-local-date-boundary' === options.valueSource) return m.toISOString();
|
|
75
|
+
const localBoundary = external_dayjs_default()(normalizeLocalDateBoundaryInput(value));
|
|
76
|
+
return ('start' === boundary ? localBoundary.startOf('day') : localBoundary.endOf('day')).toISOString();
|
|
77
|
+
}
|
|
78
|
+
if (hasExplicitTime(value)) return m.toISOString();
|
|
79
|
+
if (!options.useDefaultDateBoundary) return m.toISOString();
|
|
80
|
+
return ('start' === boundary ? m.startOf('day') : m.endOf('day')).toISOString();
|
|
81
|
+
};
|
|
82
|
+
const shouldApplyDefaultDateBoundary = function(start, end, value) {
|
|
83
|
+
let options = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
|
|
84
|
+
if ('datetime' === options.valueMode) return false;
|
|
85
|
+
if ('date' === options.valueMode) return true;
|
|
86
|
+
if (!options.useDefaultDateBoundary) return false;
|
|
87
|
+
if (isDateOnlyString(start) || isDateOnlyString(end)) return true;
|
|
88
|
+
return options.preferDateBoundaryFallback && 'date' === options.valueMode && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(start, 'start') && (0, util_js_namespaceObject.isDatePickerDefaultRangeBoundaryValue)(end, 'end');
|
|
89
|
+
};
|
|
90
|
+
const normalizeDateBetweenValue = function(value) {
|
|
91
|
+
let options = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
|
|
92
|
+
const normalized = value.filter(Boolean);
|
|
93
|
+
if (0 === normalized.length) return null;
|
|
94
|
+
const start = normalized[0];
|
|
95
|
+
const end = 1 === normalized.length ? normalized[0] : normalized[normalized.length - 1];
|
|
96
|
+
const boundaryOptions = {
|
|
97
|
+
...options,
|
|
98
|
+
useDefaultDateBoundary: shouldApplyDefaultDateBoundary(start, end, value, options)
|
|
99
|
+
};
|
|
100
|
+
return [
|
|
101
|
+
normalizeDateBetweenBoundary(start, 'start', boundaryOptions),
|
|
102
|
+
normalizeDateBetweenBoundary(end, 'end', boundaryOptions)
|
|
103
|
+
];
|
|
104
|
+
};
|
|
105
|
+
const shouldUseDefaultDateBoundary = (fieldSchema)=>'DatePicker.RangePicker' === getDatePickerComponent(fieldSchema);
|
|
106
|
+
exports.FILTER_OPERATORS_WITH_ARRAY_VALUES = __webpack_exports__.FILTER_OPERATORS_WITH_ARRAY_VALUES;
|
|
107
|
+
exports.normalizeDateBetweenValue = __webpack_exports__.normalizeDateBetweenValue;
|
|
108
|
+
exports.shouldUseDefaultDateBoundary = __webpack_exports__.shouldUseDefaultDateBoundary;
|
|
109
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
110
|
+
"FILTER_OPERATORS_WITH_ARRAY_VALUES",
|
|
111
|
+
"normalizeDateBetweenValue",
|
|
112
|
+
"shouldUseDefaultDateBoundary"
|
|
113
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
114
|
+
Object.defineProperty(exports, '__esModule', {
|
|
115
|
+
value: true
|
|
116
|
+
});
|