@tachybase/client 0.23.58 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/es/api-client/APIClient.d.ts +5 -2
  2. package/es/api-client/APIClient.mjs +93 -49
  3. package/es/api-client/hooks/useRequest.d.ts +2 -0
  4. package/es/application/Application.d.ts +3 -0
  5. package/es/application/Application.mjs +11 -0
  6. package/es/application/CustomRouterContextProvider.d.ts +54 -0
  7. package/es/application/CustomRouterContextProvider.mjs +209 -0
  8. package/es/application/RouterManager.d.ts +8 -3
  9. package/es/application/RouterManager.mjs +48 -15
  10. package/es/application/schema-initializer/context/index.d.ts +1 -1
  11. package/es/block-provider/hooks/index.d.ts +2 -0
  12. package/es/block-provider/hooks/index.mjs +25 -21
  13. package/es/built-in/context-menu/ContextMenu.provider.mjs +6 -6
  14. package/es/built-in/context-menu/ContextMenuItemsProps.d.ts +4 -4
  15. package/es/built-in/context-menu/ContextMenuItemsProps.mjs +6 -6
  16. package/es/built-in/context-menu/index.mjs +1 -1
  17. package/es/built-in/context-menu/useContextMenu.d.ts +2 -2
  18. package/es/built-in/index.mjs +5 -0
  19. package/es/built-in/page-style/PageStyle.provider.mjs +2 -2
  20. package/es/collection-manager/templates/sql.d.ts +1 -1
  21. package/es/collection-manager/templates/view.d.ts +1 -1
  22. package/es/data-source/collection-field-interface/CollectionFieldInterface.d.ts +1 -0
  23. package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +18 -0
  24. package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.d.ts +8 -1
  25. package/es/data-source/collection-field-interface/CollectionFieldInterfaceManager.mjs +20 -0
  26. package/es/data-source/commonsSettingsItem/fieldComponent.mjs +3 -1
  27. package/es/data-source/data-source/DataSource.d.ts +1 -1
  28. package/es/filter-provider/utils.mjs +6 -0
  29. package/es/i18n/i18n.mjs +7 -12
  30. package/es/modules/actions/delete/deleteActionSettings.mjs +10 -0
  31. package/es/modules/blocks/data-blocks/form/FilterItemCustomSettings.mjs +1 -1
  32. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +9 -4
  33. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +2 -2
  34. package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +4 -0
  35. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +44 -0
  36. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +4 -0
  37. package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +9 -0
  38. package/es/modules/fields/component/SubTable/secondLevelSelect.d.ts +11 -0
  39. package/es/modules/fields/component/SubTable/secondLevelSelect.mjs +102 -0
  40. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.d.ts +79 -41
  41. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +103 -100
  42. package/es/powered-by/index.mjs +4 -7
  43. package/es/schema-component/antd/action/Action.Designer.mjs +38 -3
  44. package/es/schema-component/antd/action/Action.Modal.mjs +0 -1
  45. package/es/schema-component/antd/action/Action.mjs +1 -3
  46. package/es/schema-component/antd/association-field/SubTabs/InternalCollapse.mjs +2 -1
  47. package/es/schema-component/antd/checkbox/Checkbox.mjs +6 -4
  48. package/es/schema-component/antd/index.d.ts +1 -0
  49. package/es/schema-component/antd/index.mjs +1 -0
  50. package/es/schema-component/antd/media-card/MediaCard.d.ts +11 -0
  51. package/es/schema-component/antd/media-card/MediaCard.mjs +35 -0
  52. package/es/schema-component/antd/media-card/index.d.ts +1 -0
  53. package/es/schema-component/antd/media-card/index.mjs +1 -0
  54. package/es/schema-component/antd/media-card/style.d.ts +3 -0
  55. package/es/schema-component/antd/media-card/style.mjs +25 -0
  56. package/es/schema-component/antd/page/Page.mjs +34 -24
  57. package/es/schema-component/antd/password/utils.d.ts +1 -1
  58. package/es/schema-component/common/dnd-context/index.mjs +1 -7
  59. package/es/schema-component/common/sortable-item/DragHandlePageTab.d.ts +1 -0
  60. package/es/schema-component/common/sortable-item/DragHandlePageTab.mjs +71 -0
  61. package/es/schema-component/common/sortable-item/DragHandlePageTab.style.d.ts +3 -0
  62. package/es/schema-component/common/sortable-item/DragHandlePageTab.style.mjs +25 -0
  63. package/es/schema-items/GeneralSettings.mjs +5 -0
  64. package/es/schema-settings/EditCustomDefaultValue.mjs +1 -1
  65. package/es/schema-settings/SchemaSettings.mjs +1 -1
  66. package/es/schema-settings/SchemaSettingsDefaultValue.mjs +2 -0
  67. package/es/schema-settings/utils/createModalSettingsItem.d.ts +26 -0
  68. package/es/schema-settings/utils/createModalSettingsItem.mjs +46 -0
  69. package/es/schema-settings/utils/createSelectSettingsItem.d.ts +25 -0
  70. package/es/schema-settings/utils/createSelectSettingsItem.mjs +40 -0
  71. package/es/schema-settings/utils/createSwitchSettingsItem.d.ts +21 -0
  72. package/es/schema-settings/utils/createSwitchSettingsItem.mjs +38 -0
  73. package/es/schema-settings/utils/createTextSettingsItem.d.ts +9 -0
  74. package/es/schema-settings/utils/createTextSettingsItem.mjs +21 -0
  75. package/es/schema-settings/utils/index.d.ts +4 -0
  76. package/es/schema-settings/utils/index.mjs +4 -0
  77. package/es/schema-settings/utils/util.d.ts +12 -0
  78. package/es/schema-settings/utils/util.mjs +24 -0
  79. package/es/user/CurrentUserProvider.mjs +6 -3
  80. package/lib/api-client/APIClient.js +93 -49
  81. package/lib/application/Application.js +11 -0
  82. package/lib/application/CustomRouterContextProvider.js +276 -0
  83. package/lib/application/RouterManager.js +49 -15
  84. package/lib/application/schema-initializer/hooks/index.js +2 -2
  85. package/lib/block-provider/hooks/index.js +76 -58
  86. package/lib/built-in/context-menu/ContextMenu.provider.js +6 -6
  87. package/lib/built-in/context-menu/ContextMenuItemsProps.js +6 -6
  88. package/lib/built-in/context-menu/index.js +1 -1
  89. package/lib/built-in/index.js +5 -0
  90. package/lib/built-in/page-style/PageStyle.provider.js +2 -2
  91. package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +18 -0
  92. package/lib/data-source/collection-field-interface/CollectionFieldInterfaceManager.js +20 -0
  93. package/lib/data-source/commonsSettingsItem/fieldComponent.js +3 -1
  94. package/lib/filter-provider/utils.js +6 -0
  95. package/lib/i18n/i18n.js +7 -12
  96. package/lib/locale/en_US.js +1 -0
  97. package/lib/locale/zh-CN.js +10 -1
  98. package/lib/modules/actions/delete/deleteActionSettings.js +10 -0
  99. package/lib/modules/blocks/data-blocks/form/FilterItemCustomSettings.js +1 -1
  100. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +9 -4
  101. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +2 -2
  102. package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +4 -0
  103. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +44 -0
  104. package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +4 -0
  105. package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +9 -0
  106. package/lib/modules/fields/component/SubTable/secondLevelSelect.js +136 -0
  107. package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +104 -103
  108. package/lib/powered-by/index.js +4 -7
  109. package/lib/schema-component/antd/action/Action.Designer.js +38 -3
  110. package/lib/schema-component/antd/action/Action.Modal.js +0 -1
  111. package/lib/schema-component/antd/action/Action.js +1 -3
  112. package/lib/schema-component/antd/association-field/SubTabs/InternalCollapse.js +2 -1
  113. package/lib/schema-component/antd/checkbox/Checkbox.js +6 -4
  114. package/lib/schema-component/antd/index.js +18 -4
  115. package/lib/schema-component/antd/media-card/MediaCard.js +69 -0
  116. package/lib/schema-component/antd/media-card/index.js +65 -0
  117. package/lib/schema-component/antd/media-card/style.js +59 -0
  118. package/lib/schema-component/antd/page/Page.js +34 -24
  119. package/lib/schema-component/common/dnd-context/index.js +1 -7
  120. package/lib/schema-component/common/sortable-item/DragHandlePageTab.js +105 -0
  121. package/lib/schema-component/common/sortable-item/DragHandlePageTab.style.js +59 -0
  122. package/lib/schema-items/GeneralSettings.js +5 -0
  123. package/lib/schema-settings/EditCustomDefaultValue.js +1 -1
  124. package/lib/schema-settings/SchemaSettings.js +1 -1
  125. package/lib/schema-settings/SchemaSettingsDefaultValue.js +2 -0
  126. package/lib/schema-settings/utils/createModalSettingsItem.js +94 -0
  127. package/lib/schema-settings/utils/createSelectSettingsItem.js +88 -0
  128. package/lib/schema-settings/utils/createSwitchSettingsItem.js +86 -0
  129. package/lib/schema-settings/utils/createTextSettingsItem.js +55 -0
  130. package/lib/schema-settings/utils/index.js +92 -0
  131. package/lib/schema-settings/utils/util.js +74 -0
  132. package/lib/user/CurrentUserProvider.js +6 -3
  133. package/package.json +7 -7
@@ -1,5 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
2
- import "react";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__style_index_mjs__ from "../style/index.mjs";
4
4
  function _tagged_template_literal(strings, raw) {
5
5
  if (!raw) raw = strings.slice(0);
@@ -31,13 +31,10 @@ const PoweredBy = ()=>{
31
31
  const { styles } = useStyles();
32
32
  const date = new Date();
33
33
  const year = date.getFullYear();
34
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
34
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
35
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
35
36
  className: styles.powerBy,
36
- children: [
37
- "\xa92023-",
38
- year,
39
- " TachyBase Team"
40
- ]
37
+ children: "\xa92023-".concat(year, " ").concat(t('TachyBase Team'))
41
38
  });
42
39
  };
43
40
  export { PoweredBy };
@@ -351,19 +351,53 @@ function WorkflowConfig() {
351
351
  const formAction = null == formBlock ? void 0 : formBlock.type;
352
352
  const buttonAction = fieldSchema['x-action'];
353
353
  const description = {
354
- submit: t('Workflow will be triggered before or after submitting succeeded based on workflow type.', {
354
+ submit: t('Workflow will be triggered before or after submitting succeeded.', {
355
355
  ns: 'workflow'
356
356
  }),
357
- 'customize:save': t('Workflow will be triggered before or after submitting succeeded based on workflow type.', {
357
+ 'customize:save': t('Workflow will be triggered before or after submitting succeeded.', {
358
358
  ns: 'workflow'
359
359
  }),
360
360
  'customize:triggerWorkflows': t('Workflow will be triggered directly once the button clicked, without data saving.', {
361
361
  ns: 'workflow'
362
362
  }),
363
- destroy: t('Workflow will be triggered before deleting succeeded.', {
363
+ destroy: t('Workflow will be triggered before or after submitting succeeded.', {
364
364
  ns: 'workflow'
365
365
  })
366
366
  }[null == fieldSchema ? void 0 : fieldSchema['x-action']];
367
+ let orderColumn = {};
368
+ if ([
369
+ 'submit',
370
+ 'customize:save',
371
+ 'destroy'
372
+ ].includes(null == fieldSchema ? void 0 : fieldSchema['x-action'])) orderColumn = {
373
+ order: {
374
+ type: 'void',
375
+ 'x-component': 'ArrayTable.Column',
376
+ 'x-component-props': {
377
+ title: t('Sequentially', {
378
+ ns: 'workflow'
379
+ })
380
+ },
381
+ properties: {
382
+ order: {
383
+ type: 'string',
384
+ 'x-decorator': 'FormItem',
385
+ 'x-component': 'Select',
386
+ default: 'after',
387
+ enum: [
388
+ {
389
+ label: t('After'),
390
+ value: 'after'
391
+ },
392
+ {
393
+ label: t('Before'),
394
+ value: 'before'
395
+ }
396
+ ]
397
+ }
398
+ }
399
+ }
400
+ };
367
401
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettings_mjs__.SchemaSettingsActionModalItem, {
368
402
  title: t('Bind workflows', {
369
403
  ns: 'workflow'
@@ -464,6 +498,7 @@ function WorkflowConfig() {
464
498
  }
465
499
  }
466
500
  },
501
+ ...orderColumn,
467
502
  operations: {
468
503
  type: 'void',
469
504
  'x-component': 'ArrayTable.Column',
@@ -59,7 +59,6 @@ const ActionModal = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)(
59
59
  if (s['x-component'] === footerNodeName) return s;
60
60
  return buf;
61
61
  });
62
- console.log('%c Line:41 🍧 styles.container', 'font-size:18px;color:#e41a6a;background:#7f2b82', styles.container);
63
62
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Modal, {
64
63
  className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])(others.className, null == modalProps ? void 0 : modalProps.className, styles.container, 'amplifier-block'),
65
64
  style: {
@@ -54,9 +54,7 @@ const Action = (0, __WEBPACK_EXTERNAL_MODULE__application_hoc_withDynamicSchemaP
54
54
  const openMode = null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops['openMode'];
55
55
  const openSize = null == fieldSchema ? void 0 : null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1['openSize'];
56
56
  const disabled = form.disabled || field.disabled || (null === (_field_data = field.data) || void 0 === _field_data ? void 0 : _field_data.disabled) || propsDisabled;
57
- const linkageRules = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>(null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [], [
58
- fieldSchema
59
- ]);
57
+ const linkageRules = (null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [];
60
58
  const { designable } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useDesignable)();
61
59
  const tarComponent = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useComponent)(component) || component;
62
60
  const { modal } = __WEBPACK_EXTERNAL_MODULE_antd__.App.useApp();
@@ -158,6 +158,7 @@ const InternalTabs = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)
158
158
  (0, __WEBPACK_EXTERNAL_MODULE_ahooks__.useDeepCompareEffect)(()=>{
159
159
  if (!defOptions.length) return;
160
160
  const fieldTabs = field.value;
161
+ if (!fieldTabs) return;
161
162
  if (quickAddParentField && (null == quickAddParentField ? void 0 : quickAddParentField.value) !== 'none') {
162
163
  const filterParantOptions = tabsParantFilterOptions(defOptions, fieldTabs, quickAddField);
163
164
  setDefOptions(filterParantOptions);
@@ -235,7 +236,7 @@ const InternalTabs = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)
235
236
  element.style.color = '#1e1e1e';
236
237
  });
237
238
  },
238
- children: item.label
239
+ children: item.label || null
239
240
  }, item.id))
240
241
  }),
241
242
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
@@ -1,5 +1,5 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
2
- import "react";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
@@ -33,13 +33,15 @@ const InternalCheckbox = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.conne
33
33
  }), (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapReadPretty)(ReadPretty));
34
34
  const InternalRadioGroup = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((props)=>{
35
35
  const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
36
- const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
36
+ const [value, setValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)();
37
37
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Radio.Group, {
38
38
  ...props,
39
39
  onChange: (value)=>{
40
- if ('null' !== value.target.value) props.onChange(value);
41
- else field['value'] = void 0;
40
+ if ('null' !== value.target.value) props.onChange(value.target.value);
41
+ else props.onChange(null);
42
+ setValue(value.target.value);
42
43
  },
44
+ value: props.value || value,
43
45
  options: [
44
46
  {
45
47
  label: t('?'),
@@ -57,5 +57,6 @@ export * from './tree';
57
57
  export * from './unixTimestamp';
58
58
  export * from './upload';
59
59
  export * from './variable';
60
+ export * from './media-card';
60
61
  export { PageHeader } from '@ant-design/pro-layout';
61
62
  export { CodeMirror } from '@tachybase/components';
@@ -59,6 +59,7 @@ export * from "./tree/index.mjs";
59
59
  export * from "./unixTimestamp/index.mjs";
60
60
  export * from "./upload/index.mjs";
61
61
  export * from "./variable/index.mjs";
62
+ export * from "./media-card/index.mjs";
62
63
  var __webpack_exports__CodeMirror = __WEBPACK_EXTERNAL_MODULE__tachybase_components__.CodeMirror;
63
64
  var __webpack_exports__PageHeader = __WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader;
64
65
  var __webpack_exports__genStyleHook = __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHook;
@@ -0,0 +1,11 @@
1
+ interface MediaCardProps {
2
+ color: string;
3
+ icon: string;
4
+ title: string;
5
+ layout?: 'horizontal' | 'vertical';
6
+ needHover?: boolean;
7
+ className?: string;
8
+ onClick?: () => void;
9
+ }
10
+ export declare const MediaCard: (props: MediaCardProps) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,35 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
3
+ import * as __WEBPACK_EXTERNAL_MODULE__icon_index_mjs__ from "../../../icon/index.mjs";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
5
+ const MediaCard = (props)=>{
6
+ const { icon, color, title, layout = 'horizontal', onClick = ()=>{}, className, needHover = true } = props;
7
+ const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
8
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
9
+ className: (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.cx)(styles.mediaCardStyle, {
10
+ layout: 'vertical' === layout,
11
+ 'need-hover': needHover
12
+ }, className),
13
+ onClick: onClick,
14
+ children: [
15
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
16
+ className: "icon-wrapper",
17
+ style: {
18
+ backgroundColor: null != color ? color : '#e5e5e5'
19
+ },
20
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
21
+ className: "icon",
22
+ type: null != icon ? icon : 'AppstoreOutlined',
23
+ style: {
24
+ color: null != color ? color : '#e5e5e5'
25
+ }
26
+ })
27
+ }),
28
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
29
+ className: "title",
30
+ children: title
31
+ })
32
+ ]
33
+ });
34
+ };
35
+ export { MediaCard };
@@ -0,0 +1 @@
1
+ export * from './MediaCard';
@@ -0,0 +1 @@
1
+ export * from "./MediaCard.mjs";
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ mediaCardStyle: import("antd-style").SerializedStyles;
3
+ }>;
@@ -0,0 +1,25 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
2
+ function _tagged_template_literal(strings, raw) {
3
+ if (!raw) raw = strings.slice(0);
4
+ return Object.freeze(Object.defineProperties(strings, {
5
+ raw: {
6
+ value: Object.freeze(raw)
7
+ }
8
+ }));
9
+ }
10
+ function _templateObject() {
11
+ const data = _tagged_template_literal([
12
+ "\n display: flex;\n flex-direction: row;\n justify-content: center;\n align-items: center;\n gap: 10px;\n width: fit-content;\n padding: 10px;\n cursor: pointer;\n\n &.layout {\n flex-direction: column;\n }\n :hover {\n border-radius: 10px;\n transform: scale(1.05);\n transition: all 0.3s;\n }\n\n &.need-hover:hover {\n background-color: var(--colorPrimaryText);\n }\n\n .icon-wrapper {\n padding: 20px;\n border-radius: 40%;\n .icon {\n padding: 10px;\n border-radius: 50%;\n background-color: #ffffff;\n font-size: 20px;\n }\n }\n\n .title {\n flex: 1;\n display: inline-block;\n font-size: 16px;\n color: #2f2f2f;\n overflow: hidden;\n }\n "
13
+ ]);
14
+ _templateObject = function() {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+ const useStyles = (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.createStyles)((param)=>{
20
+ let { css, token } = param;
21
+ return {
22
+ mediaCardStyle: css(_templateObject())
23
+ };
24
+ });
25
+ export { useStyles };
@@ -4,6 +4,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__tachybase_components__ from "@tachybase/c
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__ from "@ant-design/pro-layout";
7
+ import * as __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__ from "@dnd-kit/core";
7
8
  import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
8
9
  import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
9
10
  import * as __WEBPACK_EXTERNAL_MODULE_classnames__ from "classnames";
@@ -21,6 +22,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelO
21
22
  import * as __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__ from "../../../style/theme/index.mjs";
22
23
  import * as __WEBPACK_EXTERNAL_MODULE__common_index_mjs__ from "../../common/index.mjs";
23
24
  import * as __WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__ from "../../common/sortable-item/index.mjs";
25
+ import * as __WEBPACK_EXTERNAL_MODULE__common_sortable_item_DragHandlePageTab_mjs__ from "../../common/sortable-item/DragHandlePageTab.mjs";
24
26
  import * as __WEBPACK_EXTERNAL_MODULE__core_index_mjs__ from "../../core/index.mjs";
25
27
  import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
26
28
  import * as __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__ from "../error-fallback/index.mjs";
@@ -89,7 +91,7 @@ const PageHeader = (props)=>{
89
91
  const { theme } = (0, __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__.useGlobalTheme)();
90
92
  const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
91
93
  const compile = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCompile)();
92
- const { hiddenScrollArea } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__.useContextMenu)();
94
+ const { showScrollArea } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__.useContextMenu)();
93
95
  const hidePageTitle = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
94
96
  const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
95
97
  const items = fieldSchema.mapProperties((schema)=>({
@@ -108,12 +110,12 @@ const PageHeader = (props)=>{
108
110
  ghost: false,
109
111
  title: pageHeaderTitle || ' ',
110
112
  ...parentProps,
111
- extra: !enablePageTabs && !hiddenScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {}),
113
+ extra: !enablePageTabs && showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {}),
112
114
  footer: enablePageTabs && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabComponent, {
113
115
  activeKey: activeKey,
114
116
  setLoading: setLoading,
115
117
  setSearchParams: setSearchParams,
116
- hiddenScrollArea: hiddenScrollArea,
118
+ showScrollArea: showScrollArea,
117
119
  options: options,
118
120
  theme: theme,
119
121
  items: items
@@ -122,9 +124,14 @@ const PageHeader = (props)=>{
122
124
  });
123
125
  };
124
126
  const TabComponent = (props)=>{
125
- const { activeKey, setLoading, setSearchParams, hiddenScrollArea, options, theme, items } = props;
127
+ const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
126
128
  const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
127
129
  const [hasMounted, setHasMounted] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
130
+ const sensors = (0, __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.useSensors)((0, __WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.useSensor)(__WEBPACK_EXTERNAL_MODULE__dnd_kit_core__.PointerSensor, {
131
+ activationConstraint: {
132
+ distance: 5
133
+ }
134
+ }));
128
135
  const handleTabClick = (activeKey)=>{
129
136
  setLoading(true);
130
137
  setSearchParams([
@@ -143,6 +150,7 @@ const TabComponent = (props)=>{
143
150
  });
144
151
  }, []);
145
152
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_index_mjs__.DndContext, {
153
+ sensors: sensors,
146
154
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tabs, {
147
155
  className: styles.tabComponentClass,
148
156
  type: "card",
@@ -153,7 +161,7 @@ const TabComponent = (props)=>{
153
161
  onTabClick: handleTabClick,
154
162
  tabBarExtraContent: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabBarExtraContent, {
155
163
  theme: theme,
156
- hiddenScrollArea: hiddenScrollArea,
164
+ showScrollArea: showScrollArea,
157
165
  options: options
158
166
  })
159
167
  })
@@ -163,31 +171,33 @@ const TabItem = (props)=>{
163
171
  const { schema } = props;
164
172
  const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
165
173
  const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
166
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__.SortableItem, {
174
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__.SortableItem, {
167
175
  id: schema.name,
168
176
  schema: schema,
169
177
  className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('tb-action-link', 'designerCss', props.className, styles.tabItemClass),
170
- children: [
171
- schema['x-icon'] && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
172
- style: {
173
- marginRight: 8
174
- },
175
- type: schema['x-icon']
176
- }),
177
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
178
- children: schema.title || t('Unnamed')
179
- }),
180
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
181
- className: "tab-designer-wrapper",
182
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__.PageTabDesigner, {
183
- schema: schema
178
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_DragHandlePageTab_mjs__.DragHandlePageTab, {
179
+ children: [
180
+ schema['x-icon'] && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
181
+ style: {
182
+ marginRight: 8
183
+ },
184
+ type: schema['x-icon']
185
+ }),
186
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
187
+ children: schema.title || t('Unnamed')
188
+ }),
189
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
190
+ className: "tab-designer-wrapper",
191
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__.PageTabDesigner, {
192
+ schema: schema
193
+ })
184
194
  })
185
- })
186
- ]
195
+ ]
196
+ })
187
197
  });
188
198
  };
189
199
  const TabBarExtraContent = (props)=>{
190
- const { hiddenScrollArea, options, theme } = props;
200
+ const { showScrollArea, options, theme } = props;
191
201
  const dn = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
192
202
  const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
193
203
  const { getAriaLabel } = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelOfSchemaInitializer_mjs__.useGetAriaLabelOfSchemaInitializer)();
@@ -220,7 +230,7 @@ const TabBarExtraContent = (props)=>{
220
230
  icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.PlusOutlined, {}),
221
231
  onClick: handleAddTab
222
232
  }),
223
- !hiddenScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {
233
+ showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {
224
234
  className: "scroll-area-extra-content"
225
235
  })
226
236
  ]
@@ -1 +1 @@
1
- export declare const getStrength: (val: any) => 0 | 100 | 20 | 40 | 60 | 80;
1
+ export declare const getStrength: (val: any) => 0 | 20 | 100 | 40 | 60 | 80;
@@ -83,13 +83,7 @@ const DndContext = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.observer)((
83
83
  dropAnimation: {
84
84
  duration: 10,
85
85
  easing: 'cubic-bezier(0.18, 0.67, 0.6, 1.22)'
86
- },
87
- children: visible && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
88
- style: {
89
- whiteSpace: 'nowrap'
90
- },
91
- children: t('Dragging')
92
- })
86
+ }
93
87
  }),
94
88
  props.children
95
89
  ]
@@ -0,0 +1 @@
1
+ export declare const DragHandlePageTab: (props: any) => any;
@@ -0,0 +1,71 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
4
+ import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__DragHandlePageTab_style_mjs__ from "./DragHandlePageTab.style.mjs";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__SortableItem_mjs__ from "./SortableItem.mjs";
7
+ const DragHandlePageTab = (props)=>{
8
+ const { isSubMenu, children, className: overStyle, isAdminMenu } = props;
9
+ const { draggable } = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__SortableItem_mjs__.SortableContext);
10
+ const { designable } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
11
+ const { attributes, listeners, setNodeRef, transform, isDragging } = draggable;
12
+ const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__DragHandlePageTab_style_mjs__.useStyles)();
13
+ const ref = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
14
+ const [dimensions, setDimensions] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({
15
+ width: 0,
16
+ height: 0
17
+ });
18
+ const [initialPosition, setInitialPosition] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)({
19
+ x: 0,
20
+ y: 0
21
+ });
22
+ const centerOffset = {
23
+ x: 4 * dimensions.width,
24
+ y: 3 * dimensions.height
25
+ };
26
+ const style = {
27
+ position: isDragging ? 'fixed' : 'static',
28
+ top: isDragging ? initialPosition.y - centerOffset.y : 0,
29
+ left: isDragging ? initialPosition.x - centerOffset.x : 0,
30
+ width: isDragging ? 'max-content' : '100%',
31
+ height: isDragging ? 'max-content' : '100%',
32
+ zIndex: isDragging ? 999 : 'auto',
33
+ pointerEvents: isDragging ? 'none' : 'auto',
34
+ transform: transform ? "translate3d(".concat(transform.x, "px, ").concat(transform.y, "px, 0) scale(").concat(isDragging ? 1.05 : 1, ")") : void 0,
35
+ boxShadow: isDragging ? '0 4px 8px rgba(0, 0, 0, 0.1)' : 'none'
36
+ };
37
+ const handleMouseDown = (event)=>{
38
+ if (ref.current) {
39
+ const { width, height } = ref.current.getBoundingClientRect();
40
+ const { clientX, clientY } = event;
41
+ setDimensions({
42
+ width,
43
+ height
44
+ });
45
+ setInitialPosition({
46
+ x: clientX,
47
+ y: clientY
48
+ });
49
+ }
50
+ };
51
+ if (!designable) return children;
52
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
53
+ ref: setNodeRef,
54
+ className: (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.cx)(styles.dragHandleMenu, {
55
+ draggable: isDragging,
56
+ leftBorder: isSubMenu && isDragging,
57
+ adminMenu: isAdminMenu && isDragging
58
+ }, overStyle),
59
+ style: style,
60
+ ...listeners,
61
+ ...attributes,
62
+ role: "none",
63
+ onMouseDown: handleMouseDown,
64
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
65
+ ref: ref,
66
+ className: 'wrapper',
67
+ children: children
68
+ })
69
+ });
70
+ };
71
+ export { DragHandlePageTab };
@@ -0,0 +1,3 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ dragHandleMenu: import("antd-style").SerializedStyles;
3
+ }>;
@@ -0,0 +1,25 @@
1
+ import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
2
+ function _tagged_template_literal(strings, raw) {
3
+ if (!raw) raw = strings.slice(0);
4
+ return Object.freeze(Object.defineProperties(strings, {
5
+ raw: {
6
+ value: Object.freeze(raw)
7
+ }
8
+ }));
9
+ }
10
+ function _templateObject() {
11
+ const data = _tagged_template_literal([
12
+ "\n position: relative;\n width: 100%;\n height: 100%;\n\n &.draggable {\n cursor: move;\n padding: 0 10px;\n border-radius: 5px;\n background: #f0f0f0;\n }\n\n .wrapper {\n display: flex;\n flex-direction: row;\n justify-content: space-around;\n }\n "
13
+ ]);
14
+ _templateObject = function() {
15
+ return data;
16
+ };
17
+ return data;
18
+ }
19
+ const useStyles = (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.createStyles)((param)=>{
20
+ let { css, token } = param;
21
+ return {
22
+ dragHandleMenu: css(_templateObject())
23
+ };
24
+ });
25
+ export { useStyles };
@@ -3,6 +3,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
3
3
  import * as __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__ from "../application/schema-toolbar/index.mjs";
4
4
  import * as __WEBPACK_EXTERNAL_MODULE__collection_manager_index_mjs__ from "../collection-manager/index.mjs";
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../schema-component/index.mjs";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsDefaultValue_mjs__ from "../schema-settings/SchemaSettingsDefaultValue.mjs";
6
7
  const generalSettingsItems = [
7
8
  {
8
9
  name: 'editFieldTitle',
@@ -202,6 +203,10 @@ const generalSettingsItems = [
202
203
  const { required = true } = (0, __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__.useSchemaToolbar)();
203
204
  return !field.readPretty && 'FormField' !== fieldSchema['x-component'] && required;
204
205
  }
206
+ },
207
+ {
208
+ name: 'editDefaultValue',
209
+ Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsDefaultValue_mjs__.SchemaSettingsDefaultValue
205
210
  }
206
211
  ];
207
212
  export { generalSettingsItems };
@@ -30,7 +30,7 @@ const EditCustomDefaultValue = ()=>{
30
30
  }
31
31
  },
32
32
  onSubmit: (param)=>{
33
- let { default: { value } } = param;
33
+ let { default: { value = null } } = param;
34
34
  field.setValue(value);
35
35
  fieldSchema['default'] = value;
36
36
  fieldSchema['x-component-props'] = {
@@ -41,7 +41,7 @@ function _tagged_template_literal(strings, raw) {
41
41
  }
42
42
  function _templateObject() {
43
43
  const data = _tagged_template_literal([
44
- "\n .ant-dropdown-menu-item-group-list {\n max-height: 300px;\n overflow-y: auto;\n }\n "
44
+ "\n .ant-dropdown-menu-item-group-list {\n max-height: 400px;\n overflow-y: auto;\n }\n "
45
45
  ]);
46
46
  _templateObject = function() {
47
47
  return data;
@@ -180,6 +180,8 @@ const SchemaSettingsDefaultValue = function(props) {
180
180
  const schema = {
181
181
  ['x-uid']: fieldSchema['x-uid']
182
182
  };
183
+ v.default = v.default || null;
184
+ field.value = v.default;
183
185
  fieldSchema.default = v.default;
184
186
  if (!v.default && 0 !== v.default) field.value = null;
185
187
  schema.default = v.default;
@@ -0,0 +1,26 @@
1
+ import { ISchema } from '@tachybase/schema';
2
+ import { TFunction } from 'i18next';
3
+ import { SchemaSettingsItemType } from '../../application';
4
+ export interface CreateModalSchemaSettingsItemProps {
5
+ name: string;
6
+ title: string | ((t: TFunction<'translation', undefined>) => string);
7
+ parentSchemaKey?: string;
8
+ defaultValue?: any;
9
+ useDefaultValue?: () => any;
10
+ schema: (defaultValue: any) => ISchema;
11
+ valueKeys?: string[];
12
+ useVisible?: () => boolean;
13
+ width?: number | string;
14
+ useSubmit?: () => (values: any) => void;
15
+ /**
16
+ * @default 'common'
17
+ */
18
+ type?: 'common' | 'field';
19
+ }
20
+ /**
21
+ * create `switch` type schema settings item
22
+ *
23
+ * @internal
24
+ * @unstable
25
+ */
26
+ export declare function createModalSettingsItem(options: CreateModalSchemaSettingsItemProps): SchemaSettingsItemType;