@nocobase/client 0.7.6-alpha.2 → 0.8.0-alpha.4

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 (235) hide show
  1. package/es/acl/ACLShortcut.d.ts +2 -0
  2. package/es/acl/ACLShortcut.js +31 -2
  3. package/es/api-client/APIClient.d.ts +1 -0
  4. package/es/api-client/APIClient.js +6 -1
  5. package/es/application/Application.d.ts +3 -1
  6. package/es/application/Application.js +131 -39
  7. package/es/block-provider/BlockProvider.js +12 -1
  8. package/es/block-provider/CalendarBlockProvider.d.ts +1 -0
  9. package/es/block-provider/CalendarBlockProvider.js +6 -3
  10. package/es/block-provider/TableSelectorProvider.js +21 -6
  11. package/es/block-provider/hooks/index.d.ts +6 -0
  12. package/es/block-provider/hooks/index.js +485 -115
  13. package/es/collection-manager/CollectionManagerProvider.js +26 -45
  14. package/es/collection-manager/CollectionManagerShortcut.d.ts +2 -0
  15. package/es/collection-manager/CollectionManagerShortcut.js +38 -3
  16. package/es/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
  17. package/es/collection-manager/Configuration/AddFieldAction.js +44 -13
  18. package/es/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
  19. package/es/collection-manager/Configuration/EditFieldAction.js +24 -11
  20. package/es/collection-manager/Configuration/index.d.ts +2 -0
  21. package/es/collection-manager/Configuration/index.js +2 -0
  22. package/es/collection-manager/Configuration/schemas/collectionFields.js +2 -2
  23. package/es/collection-manager/index.d.ts +1 -0
  24. package/es/collection-manager/index.js +2 -1
  25. package/es/collection-manager/interfaces/index.d.ts +1 -0
  26. package/es/collection-manager/interfaces/index.js +1 -0
  27. package/es/collection-manager/interfaces/json.d.ts +2 -0
  28. package/es/collection-manager/interfaces/json.js +48 -0
  29. package/es/collection-manager/interfaces/m2o.js +3 -3
  30. package/es/collection-manager/interfaces/o2m.js +5 -6
  31. package/es/collection-manager/interfaces/o2o.js +5 -5
  32. package/es/collection-manager/interfaces/properties/index.d.ts +14 -0
  33. package/es/collection-manager/interfaces/properties/index.js +23 -0
  34. package/es/collection-manager/interfaces/sequence.js +13 -9
  35. package/es/index.d.ts +1 -0
  36. package/es/index.js +1 -0
  37. package/es/locale/en_US.d.ts +14 -1
  38. package/es/locale/en_US.js +15 -2
  39. package/es/locale/ja_JP.d.ts +2 -1
  40. package/es/locale/ja_JP.js +2 -1
  41. package/es/locale/ru_RU.d.ts +2 -1
  42. package/es/locale/ru_RU.js +2 -1
  43. package/es/locale/tr_TR.d.ts +1 -1
  44. package/es/locale/tr_TR.js +1 -1
  45. package/es/locale/zh_CN.d.ts +40 -1
  46. package/es/locale/zh_CN.js +41 -2
  47. package/es/plugin-manager/PluginManager.js +35 -23
  48. package/es/pm/PluginManagerLink.d.ts +2 -0
  49. package/es/pm/PluginManagerLink.js +111 -0
  50. package/es/pm/index.d.ts +4 -0
  51. package/es/pm/index.js +422 -0
  52. package/es/route-switch/antd/admin-layout/index.js +1 -1
  53. package/es/schema-component/antd/action/Action.Designer.js +35 -12
  54. package/es/schema-component/antd/action/Action.Modal.js +4 -2
  55. package/es/schema-component/antd/action/Action.js +3 -3
  56. package/es/schema-component/antd/action/context.d.ts +2 -0
  57. package/es/schema-component/antd/action/hooks.d.ts +1 -0
  58. package/es/schema-component/antd/calendar/Calendar.Designer.js +19 -6
  59. package/es/schema-component/antd/calendar/Calendar.js +23 -2
  60. package/es/schema-component/antd/calendar/Title.js +18 -3
  61. package/es/schema-component/antd/calendar/components/Header.d.ts +10 -0
  62. package/es/schema-component/antd/calendar/components/Header.js +43 -0
  63. package/es/schema-component/antd/calendar/style.less +53 -9
  64. package/es/schema-component/antd/calendar/types.d.ts +6 -0
  65. package/es/schema-component/antd/calendar/utils.d.ts +2 -0
  66. package/es/schema-component/antd/calendar/utils.js +7 -0
  67. package/es/schema-component/antd/checkbox/Checkbox.js +13 -4
  68. package/es/schema-component/antd/formula-input/FormulaInput.js +28 -37
  69. package/es/schema-component/antd/input/Input.d.ts +1 -0
  70. package/es/schema-component/antd/input/Input.js +2 -0
  71. package/es/schema-component/antd/input/Json.d.ts +6 -0
  72. package/es/schema-component/antd/input/Json.js +41 -0
  73. package/es/schema-component/antd/input/ReadPretty.d.ts +3 -0
  74. package/es/schema-component/antd/input/ReadPretty.js +15 -0
  75. package/es/schema-component/antd/input/index.d.ts +1 -0
  76. package/es/schema-component/antd/input/index.js +2 -1
  77. package/es/schema-component/antd/markdown/Markdown.Void.js +5 -2
  78. package/es/schema-component/antd/radio/Radio.js +2 -1
  79. package/es/schema-component/antd/select/ReadPretty.js +2 -1
  80. package/es/schema-component/antd/table-v2/TableSelectorDesigner.js +16 -2
  81. package/es/schema-component/antd/upload/Upload.js +2 -1
  82. package/es/schema-component/antd/upload/shared.js +5 -6
  83. package/es/schema-component/antd/upload/type.d.ts +2 -0
  84. package/es/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
  85. package/es/schema-initializer/buttons/BulkEditFormItemInitializers.js +50 -0
  86. package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
  87. package/es/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +35 -0
  88. package/es/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
  89. package/es/schema-initializer/buttons/FormActionInitializers.js +118 -0
  90. package/es/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
  91. package/es/schema-initializer/buttons/TabPaneInitializers.js +13 -0
  92. package/es/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
  93. package/es/schema-initializer/buttons/TableActionInitializers.js +45 -0
  94. package/es/schema-initializer/buttons/index.d.ts +2 -0
  95. package/es/schema-initializer/buttons/index.js +2 -0
  96. package/es/schema-initializer/components/BulkEditField.d.ts +7 -0
  97. package/es/schema-initializer/components/BulkEditField.js +187 -0
  98. package/es/schema-initializer/components/index.d.ts +1 -0
  99. package/es/schema-initializer/components/index.js +2 -1
  100. package/es/schema-initializer/items/BlockInitializer.js +8 -8
  101. package/es/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
  102. package/es/schema-initializer/items/BulkEditSubmitActionInitializer.js +24 -0
  103. package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
  104. package/es/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +103 -0
  105. package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
  106. package/es/schema-initializer/items/CustomizeBulkEditActionInitializer.js +61 -0
  107. package/es/schema-initializer/items/index.d.ts +3 -0
  108. package/es/schema-initializer/items/index.js +3 -0
  109. package/es/schema-initializer/utils.d.ts +1 -0
  110. package/es/schema-initializer/utils.js +67 -12
  111. package/es/schema-settings/SchemaSettings.d.ts +6 -0
  112. package/es/schema-settings/SchemaSettings.js +4 -1
  113. package/es/schema-templates/BlockTemplatePage.d.ts +1 -0
  114. package/es/schema-templates/BlockTemplatePage.js +7 -0
  115. package/es/schema-templates/SchemaTemplateShortcut.js +1 -1
  116. package/es/system-settings/SystemSettingsShortcut.d.ts +2 -0
  117. package/es/system-settings/SystemSettingsShortcut.js +134 -5
  118. package/lib/acl/ACLShortcut.d.ts +2 -0
  119. package/lib/acl/ACLShortcut.js +41 -4
  120. package/lib/api-client/APIClient.d.ts +1 -0
  121. package/lib/api-client/APIClient.js +6 -1
  122. package/lib/application/Application.d.ts +3 -1
  123. package/lib/application/Application.js +139 -39
  124. package/lib/block-provider/BlockProvider.js +11 -0
  125. package/lib/block-provider/CalendarBlockProvider.d.ts +1 -0
  126. package/lib/block-provider/CalendarBlockProvider.js +6 -3
  127. package/lib/block-provider/TableSelectorProvider.js +21 -6
  128. package/lib/block-provider/hooks/index.d.ts +6 -0
  129. package/lib/block-provider/hooks/index.js +496 -115
  130. package/lib/collection-manager/CollectionManagerProvider.js +28 -47
  131. package/lib/collection-manager/CollectionManagerShortcut.d.ts +2 -0
  132. package/lib/collection-manager/CollectionManagerShortcut.js +47 -4
  133. package/lib/collection-manager/Configuration/AddFieldAction.d.ts +5 -1
  134. package/lib/collection-manager/Configuration/AddFieldAction.js +48 -12
  135. package/lib/collection-manager/Configuration/EditFieldAction.d.ts +1 -0
  136. package/lib/collection-manager/Configuration/EditFieldAction.js +26 -10
  137. package/lib/collection-manager/Configuration/index.d.ts +2 -0
  138. package/lib/collection-manager/Configuration/index.js +26 -0
  139. package/lib/collection-manager/Configuration/schemas/collectionFields.js +2 -2
  140. package/lib/collection-manager/index.d.ts +1 -0
  141. package/lib/collection-manager/index.js +14 -0
  142. package/lib/collection-manager/interfaces/index.d.ts +1 -0
  143. package/lib/collection-manager/interfaces/index.js +13 -0
  144. package/lib/collection-manager/interfaces/json.d.ts +2 -0
  145. package/lib/collection-manager/interfaces/json.js +58 -0
  146. package/lib/collection-manager/interfaces/m2o.js +2 -2
  147. package/lib/collection-manager/interfaces/o2m.js +4 -5
  148. package/lib/collection-manager/interfaces/o2o.js +4 -4
  149. package/lib/collection-manager/interfaces/properties/index.d.ts +14 -0
  150. package/lib/collection-manager/interfaces/properties/index.js +25 -1
  151. package/lib/collection-manager/interfaces/sequence.js +13 -9
  152. package/lib/index.d.ts +1 -0
  153. package/lib/index.js +13 -0
  154. package/lib/locale/en_US.d.ts +14 -1
  155. package/lib/locale/en_US.js +15 -2
  156. package/lib/locale/ja_JP.d.ts +2 -1
  157. package/lib/locale/ja_JP.js +2 -1
  158. package/lib/locale/ru_RU.d.ts +2 -1
  159. package/lib/locale/ru_RU.js +2 -1
  160. package/lib/locale/tr_TR.d.ts +1 -1
  161. package/lib/locale/tr_TR.js +1 -1
  162. package/lib/locale/zh_CN.d.ts +40 -1
  163. package/lib/locale/zh_CN.js +41 -2
  164. package/lib/plugin-manager/PluginManager.js +33 -21
  165. package/lib/pm/PluginManagerLink.d.ts +2 -0
  166. package/lib/pm/PluginManagerLink.js +138 -0
  167. package/lib/pm/index.d.ts +4 -0
  168. package/lib/pm/index.js +474 -0
  169. package/lib/route-switch/antd/admin-layout/index.js +1 -1
  170. package/lib/schema-component/antd/action/Action.Designer.js +35 -12
  171. package/lib/schema-component/antd/action/Action.Modal.js +4 -2
  172. package/lib/schema-component/antd/action/Action.js +3 -3
  173. package/lib/schema-component/antd/action/context.d.ts +2 -0
  174. package/lib/schema-component/antd/action/hooks.d.ts +1 -0
  175. package/lib/schema-component/antd/calendar/Calendar.Designer.js +19 -6
  176. package/lib/schema-component/antd/calendar/Calendar.js +24 -2
  177. package/lib/schema-component/antd/calendar/Title.js +18 -2
  178. package/lib/schema-component/antd/calendar/components/Header.d.ts +10 -0
  179. package/lib/schema-component/antd/calendar/components/Header.js +57 -0
  180. package/lib/schema-component/antd/calendar/style.less +53 -9
  181. package/lib/schema-component/antd/calendar/types.d.ts +6 -0
  182. package/lib/schema-component/antd/calendar/utils.d.ts +2 -0
  183. package/lib/schema-component/antd/calendar/utils.js +18 -2
  184. package/lib/schema-component/antd/checkbox/Checkbox.js +13 -4
  185. package/lib/schema-component/antd/formula-input/FormulaInput.js +28 -37
  186. package/lib/schema-component/antd/input/Input.d.ts +1 -0
  187. package/lib/schema-component/antd/input/Input.js +3 -0
  188. package/lib/schema-component/antd/input/Json.d.ts +6 -0
  189. package/lib/schema-component/antd/input/Json.js +53 -0
  190. package/lib/schema-component/antd/input/ReadPretty.d.ts +3 -0
  191. package/lib/schema-component/antd/input/ReadPretty.js +16 -0
  192. package/lib/schema-component/antd/input/index.d.ts +1 -0
  193. package/lib/schema-component/antd/input/index.js +13 -0
  194. package/lib/schema-component/antd/markdown/Markdown.Void.js +8 -2
  195. package/lib/schema-component/antd/radio/Radio.js +2 -1
  196. package/lib/schema-component/antd/select/ReadPretty.js +2 -1
  197. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +17 -2
  198. package/lib/schema-component/antd/upload/Upload.js +2 -1
  199. package/lib/schema-component/antd/upload/shared.js +4 -5
  200. package/lib/schema-component/antd/upload/type.d.ts +2 -0
  201. package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.d.ts +1 -0
  202. package/lib/schema-initializer/buttons/BulkEditFormItemInitializers.js +66 -0
  203. package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.d.ts +1 -0
  204. package/lib/schema-initializer/buttons/CreateFormBulkEditBlockInitializers.js +50 -0
  205. package/lib/schema-initializer/buttons/FormActionInitializers.d.ts +132 -0
  206. package/lib/schema-initializer/buttons/FormActionInitializers.js +121 -2
  207. package/lib/schema-initializer/buttons/TabPaneInitializers.d.ts +1 -0
  208. package/lib/schema-initializer/buttons/TabPaneInitializers.js +18 -2
  209. package/lib/schema-initializer/buttons/TableActionInitializers.d.ts +56 -2
  210. package/lib/schema-initializer/buttons/TableActionInitializers.js +45 -0
  211. package/lib/schema-initializer/buttons/index.d.ts +2 -0
  212. package/lib/schema-initializer/buttons/index.js +26 -0
  213. package/lib/schema-initializer/components/BulkEditField.d.ts +7 -0
  214. package/lib/schema-initializer/components/BulkEditField.js +210 -0
  215. package/lib/schema-initializer/components/index.d.ts +1 -0
  216. package/lib/schema-initializer/components/index.js +13 -0
  217. package/lib/schema-initializer/items/BlockInitializer.js +8 -7
  218. package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.d.ts +1 -0
  219. package/lib/schema-initializer/items/BulkEditSubmitActionInitializer.js +37 -0
  220. package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.d.ts +1 -0
  221. package/lib/schema-initializer/items/CreateFormBulkEditBlockInitializer.js +121 -0
  222. package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.d.ts +1 -0
  223. package/lib/schema-initializer/items/CustomizeBulkEditActionInitializer.js +74 -0
  224. package/lib/schema-initializer/items/index.d.ts +3 -0
  225. package/lib/schema-initializer/items/index.js +39 -0
  226. package/lib/schema-initializer/utils.d.ts +1 -0
  227. package/lib/schema-initializer/utils.js +71 -13
  228. package/lib/schema-settings/SchemaSettings.d.ts +6 -0
  229. package/lib/schema-settings/SchemaSettings.js +3 -0
  230. package/lib/schema-templates/BlockTemplatePage.d.ts +1 -0
  231. package/lib/schema-templates/BlockTemplatePage.js +12 -2
  232. package/lib/schema-templates/SchemaTemplateShortcut.js +1 -1
  233. package/lib/system-settings/SystemSettingsShortcut.d.ts +2 -0
  234. package/lib/system-settings/SystemSettingsShortcut.js +145 -7
  235. package/package.json +5 -4
@@ -1,6 +1,6 @@
1
1
  var _templateObject, _templateObject2;
2
2
 
3
- var _excluded = ["footerNodeName"];
3
+ var _excluded = ["footerNodeName", "width"];
4
4
 
5
5
  function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
6
6
 
@@ -24,6 +24,8 @@ import { useActionContext } from '.';
24
24
  export var ActionModal = observer(function (props) {
25
25
  var _props$footerNodeName = props.footerNodeName,
26
26
  footerNodeName = _props$footerNodeName === void 0 ? 'Action.Modal.Footer' : _props$footerNodeName,
27
+ _props$width = props.width,
28
+ width = _props$width === void 0 ? '80%' : _props$width,
27
29
  others = _objectWithoutProperties(props, _excluded);
28
30
 
29
31
  var _useActionContext = useActionContext(),
@@ -44,7 +46,7 @@ export var ActionModal = observer(function (props) {
44
46
  e.stopPropagation();
45
47
  }
46
48
  }, /*#__PURE__*/React.createElement(Modal, _objectSpread(_objectSpread({
47
- width: '80%',
49
+ width: width,
48
50
  title: field.title
49
51
  }, others), {}, {
50
52
  destroyOnClose: true,
@@ -1,4 +1,4 @@
1
- var _excluded = ["popover", "confirm", "containerRefKey", "component", "useAction", "className", "disabled", "icon", "title"];
1
+ var _excluded = ["popover", "confirm", "containerRefKey", "component", "useAction", "className", "icon", "title"];
2
2
 
3
3
  var _templateObject, _templateObject2;
4
4
 
@@ -55,7 +55,6 @@ export var Action = observer(function (props) {
55
55
  _props$useAction = props.useAction,
56
56
  useAction = _props$useAction === void 0 ? useA : _props$useAction,
57
57
  className = props.className,
58
- disabled = props.disabled,
59
58
  icon = props.icon,
60
59
  title = props.title,
61
60
  others = _objectWithoutProperties(props, _excluded);
@@ -125,7 +124,8 @@ export var Action = observer(function (props) {
125
124
  formValueChanged: formValueChanged,
126
125
  setFormValueChanged: setFormValueChanged,
127
126
  openMode: openMode,
128
- containerRefKey: containerRefKey
127
+ containerRefKey: containerRefKey,
128
+ fieldSchema: fieldSchema
129
129
  }
130
130
  }, popover && /*#__PURE__*/React.createElement(RecursionField, {
131
131
  basePath: field.address,
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { Schema } from '@formily/react';
2
3
  export declare const ActionContext: import("react").Context<ActionContextProps>;
3
4
  export interface ActionContextProps {
4
5
  button?: any;
@@ -8,4 +9,5 @@ export interface ActionContextProps {
8
9
  containerRefKey?: string;
9
10
  formValueChanged?: boolean;
10
11
  setFormValueChanged?: (v: boolean) => void;
12
+ fieldSchema?: Schema;
11
13
  }
@@ -9,6 +9,7 @@ export declare const useActionContext: () => {
9
9
  containerRefKey?: string;
10
10
  formValueChanged?: boolean;
11
11
  setFormValueChanged?: (v: boolean) => void;
12
+ fieldSchema?: import("@formily/react").Schema<any, any, any, any, any, any, any, any, any>;
12
13
  };
13
14
  export declare const useCloseAction: () => {
14
15
  run(): Promise<void>;
@@ -86,12 +86,25 @@ export var CalendarDesigner = function CalendarDesigner() {
86
86
  });
87
87
  dn.refresh();
88
88
  }
89
+ }), /*#__PURE__*/React.createElement(SchemaSettings.SwitchItem, {
90
+ title: t('Show lunar'),
91
+ checked: field.decoratorProps.showLunar,
92
+ onChange: function onChange(v) {
93
+ var _schema2;
94
+
95
+ field.decoratorProps.showLunar = v;
96
+ fieldSchema['x-decorator-props']['showLunar'] = v;
97
+ dn.emit('patch', {
98
+ schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, 'x-decorator-props', field.decoratorProps), _schema2)
99
+ });
100
+ dn.refresh();
101
+ }
89
102
  }), /*#__PURE__*/React.createElement(SchemaSettings.SelectItem, {
90
103
  title: t('Start date field'),
91
104
  value: fieldNames.start,
92
105
  options: useOptions('date'),
93
106
  onChange: function onChange(start) {
94
- var _schema2;
107
+ var _schema3;
95
108
 
96
109
  var fieldNames = field.decoratorProps.fieldNames || {};
97
110
  fieldNames['start'] = start;
@@ -99,7 +112,7 @@ export var CalendarDesigner = function CalendarDesigner() {
99
112
  fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
100
113
  service.refresh();
101
114
  dn.emit('patch', {
102
- schema: (_schema2 = {}, _defineProperty(_schema2, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema2, 'x-decorator-props', field.decoratorProps), _schema2)
115
+ schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-decorator-props', field.decoratorProps), _schema3)
103
116
  });
104
117
  dn.refresh();
105
118
  }
@@ -108,7 +121,7 @@ export var CalendarDesigner = function CalendarDesigner() {
108
121
  value: fieldNames.end,
109
122
  options: useOptions('date'),
110
123
  onChange: function onChange(end) {
111
- var _schema3;
124
+ var _schema4;
112
125
 
113
126
  var fieldNames = field.decoratorProps.fieldNames || {};
114
127
  fieldNames['end'] = end;
@@ -116,7 +129,7 @@ export var CalendarDesigner = function CalendarDesigner() {
116
129
  fieldSchema['x-decorator-props']['fieldNames'] = fieldNames;
117
130
  service.refresh();
118
131
  dn.emit('patch', {
119
- schema: (_schema3 = {}, _defineProperty(_schema3, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema3, 'x-decorator-props', field.decoratorProps), _schema3)
132
+ schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-decorator-props', field.decoratorProps), _schema4)
120
133
  });
121
134
  dn.refresh();
122
135
  }
@@ -138,7 +151,7 @@ export var CalendarDesigner = function CalendarDesigner() {
138
151
  // icon: field.componentProps.icon,
139
152
  },
140
153
  onSubmit: function onSubmit(_ref) {
141
- var _service$params, _schema4;
154
+ var _service$params, _schema5;
142
155
 
143
156
  var filter = _ref.filter;
144
157
  var params = field.decoratorProps.params || {};
@@ -149,7 +162,7 @@ export var CalendarDesigner = function CalendarDesigner() {
149
162
  filter: filter
150
163
  }));
151
164
  dn.emit('patch', {
152
- schema: (_schema4 = {}, _defineProperty(_schema4, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema4, 'x-decorator-props', field.decoratorProps), _schema4)
165
+ schema: (_schema5 = {}, _defineProperty(_schema5, 'x-uid', fieldSchema['x-uid']), _defineProperty(_schema5, 'x-decorator-props', field.decoratorProps), _schema5)
153
166
  });
154
167
  }
155
168
  }), /*#__PURE__*/React.createElement(SchemaSettings.Divider, null), /*#__PURE__*/React.createElement(SchemaSettings.Template, {
@@ -29,6 +29,7 @@ import { RecordProvider } from '../../../';
29
29
  import { i18n } from '../../../i18n';
30
30
  import { useProps } from '../../hooks/useProps';
31
31
  import { ActionContext } from '../action';
32
+ import Header from './components/Header';
32
33
  import { CalendarToolbarContext } from './context';
33
34
  import './style.less';
34
35
  var localizer = momentLocalizer(moment);
@@ -122,7 +123,8 @@ var CalendarRecordViewer = function CalendarRecordViewer(props) {
122
123
  export var Calendar = observer(function (props) {
123
124
  var _useProps = useProps(props),
124
125
  dataSource = _useProps.dataSource,
125
- fieldNames = _useProps.fieldNames;
126
+ fieldNames = _useProps.fieldNames,
127
+ showLunar = _useProps.showLunar;
126
128
 
127
129
  var events = useEvents(dataSource, fieldNames);
128
130
 
@@ -187,7 +189,26 @@ export var Calendar = observer(function (props) {
187
189
  },
188
190
  defaultDate: new Date(),
189
191
  components: {
190
- toolbar: Toolbar
192
+ toolbar: function toolbar(props) {
193
+ return /*#__PURE__*/React.createElement(Toolbar, _objectSpread(_objectSpread({}, props), {}, {
194
+ showLunar: showLunar
195
+ }));
196
+ },
197
+ week: {
198
+ header: function header(props) {
199
+ return /*#__PURE__*/React.createElement(Header, _objectSpread(_objectSpread({}, props), {}, {
200
+ type: "week",
201
+ showLunar: showLunar
202
+ }));
203
+ }
204
+ },
205
+ month: {
206
+ dateHeader: function dateHeader(props) {
207
+ return /*#__PURE__*/React.createElement(Header, _objectSpread(_objectSpread({}, props), {}, {
208
+ showLunar: showLunar
209
+ }));
210
+ }
211
+ }
191
212
  },
192
213
  localizer: localizer
193
214
  }));
@@ -1,19 +1,34 @@
1
1
  import { observer } from '@formily/react';
2
- import React, { useContext } from 'react';
2
+ import React, { useContext, useMemo } from 'react';
3
3
  import { useDesignable } from '../../hooks';
4
4
  import { CalendarToolbarContext } from './context';
5
+ import { getLunarDay } from './utils';
5
6
  export var Title = observer(function () {
6
7
  var _useDesignable = useDesignable(),
7
8
  DesignableBar = _useDesignable.DesignableBar;
8
9
 
9
10
  var _useContext = useContext(CalendarToolbarContext),
10
- label = _useContext.label;
11
+ date = _useContext.date,
12
+ view = _useContext.view,
13
+ label = _useContext.label,
14
+ showLunar = _useContext.showLunar;
11
15
 
16
+ var lunarElement = useMemo(function () {
17
+ if (!showLunar || view !== 'day') {
18
+ return;
19
+ }
20
+
21
+ return /*#__PURE__*/React.createElement("span", null, getLunarDay(date));
22
+ }, [view, date, showLunar]);
12
23
  return /*#__PURE__*/React.createElement("div", {
13
24
  className: "ant-btn-group",
14
25
  style: {
15
26
  fontSize: '1.75em',
16
27
  fontWeight: 300
17
28
  }
18
- }, label, /*#__PURE__*/React.createElement(DesignableBar, null));
29
+ }, /*#__PURE__*/React.createElement("span", null, label), /*#__PURE__*/React.createElement("span", {
30
+ style: {
31
+ marginLeft: '4px'
32
+ }
33
+ }, lunarElement), /*#__PURE__*/React.createElement(DesignableBar, null));
19
34
  });
@@ -0,0 +1,10 @@
1
+ declare const Header: ({ date, label, drilldownView, onDrillDown, showLunar, type, localizer }: {
2
+ date: any;
3
+ label: any;
4
+ drilldownView: any;
5
+ onDrillDown: any;
6
+ showLunar?: boolean;
7
+ type: any;
8
+ localizer: any;
9
+ }) => JSX.Element;
10
+ export default Header;
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { useMemo } from 'react';
3
+ import { getLunarDay } from '../utils';
4
+
5
+ var Header = function Header(_ref) {
6
+ var date = _ref.date,
7
+ label = _ref.label,
8
+ drilldownView = _ref.drilldownView,
9
+ onDrillDown = _ref.onDrillDown,
10
+ _ref$showLunar = _ref.showLunar,
11
+ showLunar = _ref$showLunar === void 0 ? false : _ref$showLunar,
12
+ type = _ref.type,
13
+ localizer = _ref.localizer;
14
+ var lunarElement = useMemo(function () {
15
+ if (!showLunar) {
16
+ return;
17
+ }
18
+
19
+ return /*#__PURE__*/React.createElement("span", {
20
+ className: "rbc-date-lunar"
21
+ }, getLunarDay(date));
22
+ }, [date, showLunar]);
23
+ var child = useMemo(function () {
24
+ if (type === 'week') {
25
+ return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", null, localizer.format(date, 'ddd')), /*#__PURE__*/React.createElement("div", {
26
+ className: "rbc-date-wrap"
27
+ }, /*#__PURE__*/React.createElement("span", {
28
+ className: "rbc-date-solar"
29
+ }, localizer.format(date, 'DD')), lunarElement));
30
+ } else {
31
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
32
+ className: "rbc-date-solar"
33
+ }, label), lunarElement);
34
+ }
35
+ }, [type]);
36
+ var Wrapper = drilldownView ? 'a' : React.Fragment;
37
+ return /*#__PURE__*/React.createElement(Wrapper, {
38
+ onClick: onDrillDown,
39
+ role: "cell"
40
+ }, child);
41
+ };
42
+
43
+ export default Header;
@@ -74,7 +74,6 @@ button.rbc-input::-moz-focus-inner {
74
74
  text-overflow: ellipsis;
75
75
  white-space: nowrap;
76
76
  padding: 4px 12px;
77
- text-align: right;
78
77
  vertical-align: middle;
79
78
  // font-weight: 500;
80
79
  min-height: 32px;
@@ -338,24 +337,39 @@ button.rbc-input::-moz-focus-inner {
338
337
  // cursor: pointer;
339
338
  flex: 1 1 0;
340
339
  min-width: 0;
341
- padding-right: 12px;
340
+ padding-left: 12px;
342
341
  padding-top: 4px;
343
- text-align: right;
344
342
  }
345
- .rbc-date-cell.rbc-now a {
343
+ .rbc-date-cell.rbc-now span {
346
344
  // font-weight: bold;
347
345
  color: #1890ff;
348
346
  }
349
- .rbc-date-cell > a,
350
- .rbc-date-cell > a:active,
351
- .rbc-date-cell > a:visited {
347
+ .rbc-date-cell a,
348
+ .rbc-date-cell a:active,
349
+ .rbc-date-cell a:visited {
352
350
  color: inherit;
353
351
  text-decoration: none;
354
352
  }
355
- .rbc-date-cell > a:hover {
353
+ .rbc-date-cell a:hover {
356
354
  color: #1890ff;
357
355
  }
358
356
 
357
+ .rbc-date-cell .rbc-date-solar {
358
+ font-weight: 500;
359
+ }
360
+
361
+ .rbc-date-cell .rbc-date-lunar {
362
+ padding-left: 12px;
363
+ }
364
+
365
+ .rbc-date-cell:not(.rbc-off-range) .rbc-date-lunar {
366
+ color: #aaa
367
+ }
368
+
369
+ .rbc-date-cell .rbc-date-lunar:hover {
370
+ color: inherit
371
+ }
372
+
359
373
  .rbc-row-bg {
360
374
  display: flex;
361
375
  flex-direction: row;
@@ -553,6 +567,36 @@ button.rbc-input::-moz-focus-inner {
553
567
  .rbc-time-header-cell {
554
568
  min-height: 32px !important;
555
569
  }
570
+ .rbc-time-header-cell .rbc-header {
571
+ display: flex;
572
+ }
573
+ .rbc-time-header-cell .rbc-header.rbc-today {
574
+ border-color: #1890ff;
575
+ background-color: #e6f7ff;
576
+ color: #1890ff
577
+ }
578
+
579
+ .rbc-time-header-cell .rbc-header a {
580
+ display: flex;
581
+ flex-direction: column;
582
+ }
583
+
584
+ .rbc-time-header-cell .rbc-date-wrap {
585
+ display: flex;
586
+ align-items: center;
587
+ }
588
+
589
+ .rbc-time-header-cell .rbc-date-solar {
590
+ font-size: 18px;
591
+ }
592
+ .rbc-time-header-cell .rbc-date-lunar {
593
+ margin-left: 4px;
594
+ }
595
+
596
+ .rbc-time-header-cell .rbc-header:not(.rbc-today) .rbc-date-lunar {
597
+ color: #aaa;
598
+ }
599
+
556
600
  .rbc-calendar.view-week {
557
601
  .rbc-time-header-cell {
558
602
  margin-top: -32px;
@@ -695,7 +739,7 @@ button.rbc-input::-moz-focus-inner {
695
739
 
696
740
  .rbc-time-header-content {
697
741
  flex: 1;
698
- display: flex;
742
+ // display: flex;
699
743
  min-width: 0;
700
744
  flex-direction: column;
701
745
  // border-left: 1px solid #f0f0f0;
@@ -5,4 +5,10 @@ export interface ToolbarProps {
5
5
  views?: any;
6
6
  onNavigate?: (action: string) => void;
7
7
  onView?: (view: string) => void;
8
+
9
+ date: string;
10
+ /**
11
+ * 是否展示农历
12
+ */
13
+ showLunar: boolean;
8
14
  }
@@ -1,6 +1,8 @@
1
+ import moment from 'moment';
1
2
  export declare const toEvents: (data: any[], fieldNames: any) => {
2
3
  id: any;
3
4
  title: any;
4
5
  start: Date;
5
6
  end: Date;
6
7
  }[];
8
+ export declare const getLunarDay: (date: moment.MomentInput) => string | number;
@@ -1,4 +1,6 @@
1
1
  import { get } from 'lodash';
2
+ import moment from 'moment';
3
+ import solarLunar from 'solarlunar-es';
2
4
  import { i18n } from '../../../i18n';
3
5
  export var toEvents = function toEvents(data, fieldNames) {
4
6
  return data === null || data === void 0 ? void 0 : data.map(function (item) {
@@ -9,4 +11,9 @@ export var toEvents = function toEvents(data, fieldNames) {
9
11
  end: new Date(get(item, fieldNames.end || fieldNames.start))
10
12
  };
11
13
  });
14
+ };
15
+ export var getLunarDay = function getLunarDay(date) {
16
+ var md = moment(date);
17
+ var result = solarLunar.solar2lunar(md.year(), md.month() + 1, md.date());
18
+ return typeof result !== 'number' ? result.lunarFestival || result.term || result.dayCn : result;
12
19
  };
@@ -10,7 +10,15 @@ import { isValid } from '@formily/shared';
10
10
  import { Checkbox as AntdCheckbox, Tag } from 'antd';
11
11
  import uniq from 'lodash/uniq';
12
12
  import React from 'react';
13
- export var Checkbox = connect(AntdCheckbox, mapProps({
13
+ export var Checkbox = connect(function (props) {
14
+ var changeHandler = function changeHandler(val) {
15
+ props === null || props === void 0 ? void 0 : props.onChange(val);
16
+ };
17
+
18
+ return /*#__PURE__*/React.createElement(AntdCheckbox, _objectSpread(_objectSpread({}, props), {}, {
19
+ onChange: changeHandler
20
+ }));
21
+ }, mapProps({
14
22
  value: 'checked',
15
23
  onInput: 'onChange'
16
24
  }, function (props, field) {
@@ -18,7 +26,7 @@ export var Checkbox = connect(AntdCheckbox, mapProps({
18
26
  return _objectSpread({}, props);
19
27
  }), mapReadPretty(function (props) {
20
28
  if (!isValid(props.value)) {
21
- return /*#__PURE__*/React.createElement("div", null);
29
+ return null;
22
30
  }
23
31
 
24
32
  return props.value ? /*#__PURE__*/React.createElement(CheckOutlined, {
@@ -32,7 +40,7 @@ Checkbox.Group = connect(AntdCheckbox.Group, mapProps({
32
40
  dataSource: 'options'
33
41
  }), mapReadPretty(function (props) {
34
42
  if (!isValid(props.value)) {
35
- return /*#__PURE__*/React.createElement("div", null);
43
+ return null;
36
44
  }
37
45
 
38
46
  var _props$options = props.options,
@@ -45,7 +53,8 @@ Checkbox.Group = connect(AntdCheckbox.Group, mapProps({
45
53
  }).map(function (option, key) {
46
54
  return /*#__PURE__*/React.createElement(Tag, {
47
55
  key: key,
48
- color: option.color
56
+ color: option.color,
57
+ icon: option.icon
49
58
  }, option.label);
50
59
  }));
51
60
  }));
@@ -42,13 +42,8 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
42
42
 
43
43
  var _useState3 = useState(null),
44
44
  _useState4 = _slicedToArray(_useState3, 2),
45
- formula = _useState4[0],
46
- setFormula = _useState4[1];
47
-
48
- var _useState5 = useState(null),
49
- _useState6 = _slicedToArray(_useState5, 2),
50
- html = _useState6[0],
51
- setHtml = _useState6[1];
45
+ html = _useState4[0],
46
+ setHtml = _useState4[1];
52
47
 
53
48
  var numColumns = new Map();
54
49
  var scope = {};
@@ -59,42 +54,37 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
59
54
  scope[field.name] = 1;
60
55
  });
61
56
  var keys = Array.from(numColumns.keys());
62
- var initHtml;
63
-
64
- if (value) {
65
- initHtml = value;
66
- numColumns.forEach(function (value, key) {
67
- initHtml = initHtml.replaceAll(key, "<span contentEditable=\"false\" style=\"border: 1px solid #aaa; padding: 2px 5px;\">".concat(value, "</span>"));
68
- });
69
- }
70
-
71
57
  useEffect(function () {
72
- if (onChange && formula) {
73
- var v = formula || '';
58
+ if (value) {
59
+ var newHtml = value;
74
60
  numColumns.forEach(function (value, key) {
75
- v = v.replaceAll(value, key);
61
+ newHtml = newHtml.replaceAll(key, "<span contentEditable=\"false\" ><input disabled=\"disabled\" style=\"width:".concat(18 * value.length, "px;max-width: 120px\" value=\"").concat(value, "\"/><span hidden>").concat(key, "</span></span>"));
76
62
  });
63
+ newHtml = "".concat(newHtml, "<span style=\"padding-left: 5px\"></span>"); // set extra span for cursor focus on last position
77
64
 
78
- if (v != value) {
79
- onChange(v);
80
- }
65
+ setHtml(newHtml);
66
+ } else {
67
+ setHtml('');
81
68
  }
82
- }, [formula]);
69
+ }, [value]);
83
70
  var menu = /*#__PURE__*/React.createElement(Menu, {
84
71
  onClick: function () {
85
72
  var _onClick = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(args) {
86
- var replaceFormula, replaceHtml;
73
+ var replaceFormula;
87
74
  return regeneratorRuntime.wrap(function _callee$(_context) {
88
75
  while (1) {
89
76
  switch (_context.prev = _context.next) {
90
77
  case 0:
91
- replaceFormula = formula.replace('@', numColumns.get(args.key));
92
- replaceHtml = html.replace('@', "<span contentEditable=\"false\" style=\"border: 1px solid #aaa; padding: 2px 5px;\">".concat(numColumns.get(args.key), "</span>"));
93
- setFormula(replaceFormula);
94
- setHtml(replaceHtml);
78
+ replaceFormula = field.value.replace('@', args.key);
79
+
80
+ if (onChange && replaceFormula != field.value) {
81
+ onChange(replaceFormula);
82
+ }
83
+
95
84
  setDropdownVisible(false);
85
+ inputRef.current.focus();
96
86
 
97
- case 5:
87
+ case 4:
98
88
  case "end":
99
89
  return _context.stop();
100
90
  }
@@ -115,12 +105,12 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
115
105
  }));
116
106
 
117
107
  var handleChange = function handleChange(e) {
118
- var current = inputRef.current;
119
- setFormula(e.currentTarget.textContent);
120
- setHtml(current.innerHTML);
121
-
122
- if (e.currentTarget.textContent == '' && onChange) {
123
- onChange(null);
108
+ if (onChange) {
109
+ if (e.currentTarget.textContent == '') {
110
+ onChange(null);
111
+ } else {
112
+ onChange(e.currentTarget.textContent);
113
+ }
124
114
  }
125
115
  };
126
116
 
@@ -148,7 +138,8 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
148
138
  try {
149
139
  math.evaluate(field.value, scope);
150
140
  field.feedbacks = [];
151
- } catch (_unused) {
141
+ } catch (e) {
142
+ console.error(field.value, scope, e.message);
152
143
  field.setFeedback({
153
144
  type: 'error',
154
145
  code: 'FormulaError',
@@ -165,7 +156,7 @@ var AntdFormulaInput = function AntdFormulaInput(props) {
165
156
  className: "ant-input",
166
157
  onChange: handleChange,
167
158
  onKeyDown: handleKeyDown,
168
- html: html || initHtml || ''
159
+ html: html || ''
169
160
  }));
170
161
  };
171
162
 
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  declare type ComposedInput = React.FC<InputProps> & {
4
4
  TextArea?: React.FC<TextAreaProps>;
5
5
  URL?: React.FC<InputProps>;
6
+ JSON?: React.FC<TextAreaProps>;
6
7
  };
7
8
  export declare const Input: ComposedInput;
8
9
  export default Input;
@@ -9,6 +9,7 @@ import { connect, mapProps, mapReadPretty } from '@formily/react';
9
9
  import { Input as AntdInput } from 'antd';
10
10
  import React from 'react';
11
11
  import { ReadPretty } from './ReadPretty';
12
+ import { Json } from './Json';
12
13
  export var Input = connect(AntdInput, mapProps(function (props, field) {
13
14
  return _objectSpread(_objectSpread({}, props), {}, {
14
15
  suffix: /*#__PURE__*/React.createElement("span", null, (field === null || field === void 0 ? void 0 : field['loading']) || (field === null || field === void 0 ? void 0 : field['validating']) ? /*#__PURE__*/React.createElement(LoadingOutlined, null) : props.suffix)
@@ -23,4 +24,5 @@ Input.TextArea = connect(AntdInput.TextArea, mapProps(function (props, field) {
23
24
  }, props);
24
25
  }), mapReadPretty(ReadPretty.TextArea));
25
26
  Input.URL = connect(AntdInput, mapReadPretty(ReadPretty.URL));
27
+ Input.JSON = connect(Json, mapReadPretty(ReadPretty.JSON));
26
28
  export default Input;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { TextAreaProps } from 'antd/lib/input';
3
+ export declare function Json({ value, onChange, space, ...props }: TextAreaProps & {
4
+ value: any;
5
+ space: number;
6
+ }): JSX.Element;
@@ -0,0 +1,41 @@
1
+ var _excluded = ["value", "onChange", "space"];
2
+
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
+
7
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
8
+
9
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
+
11
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
12
+
13
+ import React from 'react';
14
+ import { useField } from '@formily/react';
15
+ import { Input } from 'antd';
16
+ export function Json(_ref) {
17
+ var value = _ref.value,
18
+ _onChange = _ref.onChange,
19
+ _ref$space = _ref.space,
20
+ space = _ref$space === void 0 ? 2 : _ref$space,
21
+ props = _objectWithoutProperties(_ref, _excluded);
22
+
23
+ var field = useField();
24
+ return /*#__PURE__*/React.createElement(Input.TextArea, _objectSpread(_objectSpread({}, props), {}, {
25
+ defaultValue: value != null ? JSON.stringify(value, null, space) : '',
26
+ onChange: function onChange(ev) {
27
+ try {
28
+ var v = ev.target.value.trim() !== '' ? JSON.parse(ev.target.value) : null;
29
+ field.setFeedback({});
30
+
31
+ _onChange(v);
32
+ } catch (err) {
33
+ field.setFeedback({
34
+ type: 'error',
35
+ code: 'JSONSyntaxError',
36
+ messages: [err.message]
37
+ });
38
+ }
39
+ }
40
+ }));
41
+ }
@@ -14,6 +14,9 @@ declare type Composed = {
14
14
  autop?: boolean;
15
15
  }>;
16
16
  Html?: any;
17
+ JSON?: React.FC<TextAreaProps & {
18
+ space: number;
19
+ }>;
17
20
  };
18
21
  export declare const ReadPretty: Composed;
19
22
  export {};