@tachybase/client 0.23.22 → 0.23.35

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 (187) hide show
  1. package/es/application/schema-initializer/components/SchemaInitializerChildren.mjs +1 -1
  2. package/es/built-in/admin-layout/InternalAdminLayout.mjs +4 -2
  3. package/es/built-in/admin-layout/MenuEditor.mjs +2 -2
  4. package/es/built-in/admin-layout/style.d.ts +1 -1
  5. package/es/built-in/admin-layout/style.mjs +4 -4
  6. package/es/built-in/assistant/Assistant.provider.d.ts +0 -6
  7. package/es/built-in/assistant/Assistant.provider.mjs +15 -112
  8. package/es/built-in/assistant/index.d.ts +0 -1
  9. package/es/built-in/assistant/index.mjs +0 -7
  10. package/es/built-in/attachment-preview/previewers/file-pdf.mjs +4 -2
  11. package/es/built-in/context-menu/ContextMenu.provider.d.ts +1 -0
  12. package/es/built-in/context-menu/ContextMenu.provider.mjs +29 -1
  13. package/es/built-in/context-menu/index.mjs +1 -0
  14. package/es/built-in/index.mjs +44 -5
  15. package/es/built-in/page-style/TabHeader.d.ts +1 -1
  16. package/es/built-in/page-style/TabHeader.mjs +26 -33
  17. package/es/built-in/page-style/TabHeader.style.d.ts +4 -0
  18. package/es/built-in/page-style/TabHeader.style.mjs +35 -0
  19. package/es/built-in/pinned-list/PinnedPluginListProvider.d.ts +3 -1
  20. package/es/built-in/pinned-list/PinnedPluginListProvider.mjs +5 -4
  21. package/es/built-in/scroll-assistant/useJoystick.mjs +3 -1
  22. package/es/built-in/setting-layout/SettingLayout.mjs +10 -1
  23. package/es/built-in/{assistant/calculator → setting-layout}/style.d.ts +1 -1
  24. package/es/built-in/setting-layout/style.mjs +25 -0
  25. package/es/collection-manager/action-hooks.d.ts +1 -4
  26. package/es/collection-manager/action-hooks.mjs +39 -11
  27. package/es/icon/preloaded.mjs +4 -4
  28. package/es/modules/actions/associate/AssociateActionInitializer.d.ts +1 -0
  29. package/es/modules/actions/associate/AssociateActionInitializer.mjs +71 -0
  30. package/es/modules/actions/associate/AssociateActionProvider.d.ts +7 -0
  31. package/es/modules/actions/associate/AssociateActionProvider.mjs +82 -0
  32. package/es/modules/actions/associate/AssociateActionSettings.d.ts +2 -0
  33. package/es/modules/actions/associate/AssociateActionSettings.mjs +57 -0
  34. package/es/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.mjs +2 -1
  35. package/es/modules/blocks/data-blocks/form/RecordFormBlockInitializer.mjs +21 -14
  36. package/es/modules/blocks/data-blocks/form/createEditFormBlockUISchema.d.ts +1 -2
  37. package/es/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.mjs +2 -1
  38. package/es/modules/blocks/data-blocks/list/listBlockSettings.mjs +2 -1
  39. package/es/modules/blocks/data-blocks/table/TableActionInitializers.mjs +15 -0
  40. package/es/modules/blocks/data-blocks/table/tableBlockSettings.mjs +2 -1
  41. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +2 -2
  42. package/es/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.mjs +2 -1
  43. package/es/modules/fields/component/Cascader/cascaderComponentFieldSettings.mjs +2 -1
  44. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +4 -0
  45. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +16 -2
  46. package/es/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.mjs +2 -1
  47. package/es/modules/menu/GroupItem.mjs +5 -1
  48. package/es/modules/menu/LinkMenuItem.mjs +7 -3
  49. package/es/modules/menu/PageMenuItem.mjs +5 -1
  50. package/es/modules/menu/UploadMenuItem.d.ts +1 -0
  51. package/es/modules/menu/UploadMenuItem.mjs +81 -0
  52. package/es/modules/menu/menuItemInitializer.d.ts +0 -4
  53. package/es/modules/menu/menuItemInitializer.mjs +3 -23
  54. package/es/schema-component/antd/action/Action.Designer.mjs +4 -1
  55. package/es/schema-component/antd/association-select/AssociationSelect.mjs +4 -2
  56. package/es/schema-component/antd/checkbox/Checkbox.mjs +11 -6
  57. package/es/schema-component/antd/date-picker/DatePicker.mjs +4 -0
  58. package/es/schema-component/antd/form-item/FormItem.Settings.d.ts +2 -0
  59. package/es/schema-component/antd/form-item/FormItem.Settings.mjs +14 -1
  60. package/es/schema-component/antd/form-v2/Form.Settings.mjs +2 -1
  61. package/es/schema-component/antd/grid-card/GridCard.Designer.mjs +2 -1
  62. package/es/schema-component/antd/list/List.Designer.mjs +2 -1
  63. package/es/schema-component/antd/menu/AdminMenu.d.ts +1 -0
  64. package/es/schema-component/antd/menu/AdminMenu.mjs +71 -0
  65. package/es/schema-component/antd/menu/AdminMenu.style.d.ts +4 -0
  66. package/es/schema-component/antd/menu/AdminMenu.style.mjs +36 -0
  67. package/es/schema-component/antd/menu/Menu.Designer.d.ts +1 -1
  68. package/es/schema-component/antd/menu/Menu.Designer.mjs +59 -40
  69. package/es/schema-component/antd/menu/Menu.mjs +108 -141
  70. package/es/schema-component/antd/menu/Menu.styles.d.ts +1 -2
  71. package/es/schema-component/antd/menu/Menu.styles.mjs +8 -20
  72. package/es/schema-component/antd/menu/MenuSearch.d.ts +5 -0
  73. package/es/schema-component/antd/menu/MenuSearch.mjs +32 -0
  74. package/es/schema-component/antd/menu/tools.d.ts +9 -0
  75. package/es/schema-component/antd/menu/tools.mjs +36 -0
  76. package/es/schema-component/antd/scroll-area/ScrollArea.mjs +0 -17
  77. package/es/schema-component/antd/select/Select.d.ts +3 -13
  78. package/es/schema-component/antd/select/Select.mjs +33 -2
  79. package/es/schema-component/antd/table/Table.Void.Designer.mjs +2 -1
  80. package/es/schema-component/antd/table-v2/TableBlockDesigner.mjs +2 -1
  81. package/es/schema-component/antd/table-v2/TableSelectorDesigner.mjs +2 -1
  82. package/es/schema-component/common/dnd-context/index.d.ts +1 -2
  83. package/es/schema-component/common/sortable-item/DragHandleMenu.d.ts +1 -0
  84. package/es/schema-component/common/sortable-item/DragHandleMenu.mjs +78 -0
  85. package/es/schema-component/common/sortable-item/DragHandleMenu.style.d.ts +3 -0
  86. package/es/schema-component/common/sortable-item/DragHandleMenu.style.mjs +25 -0
  87. package/es/schema-initializer/SchemaInitializerPlugin.mjs +5 -2
  88. package/es/schema-initializer/utils.mjs +9 -7
  89. package/es/schema-settings/GeneralSchemaDesigner.d.ts +2 -1
  90. package/es/schema-settings/GeneralSchemaDesigner.mjs +9 -1
  91. package/es/schema-settings/SchemaSettings.d.ts +3 -1
  92. package/es/schema-settings/SchemaSettings.mjs +16 -4
  93. package/es/schema-settings/SchemaSettingsPlugin.mjs +2 -0
  94. package/es/schema-settings/SchemaSettingsSortingRule.mjs +2 -1
  95. package/es/schema-settings/styles.mjs +2 -2
  96. package/lib/application/schema-initializer/components/SchemaInitializerChildren.js +1 -1
  97. package/lib/built-in/admin-layout/InternalAdminLayout.js +4 -2
  98. package/lib/built-in/admin-layout/MenuEditor.js +2 -2
  99. package/lib/built-in/admin-layout/style.js +4 -4
  100. package/lib/built-in/assistant/Assistant.provider.js +16 -115
  101. package/lib/built-in/assistant/index.js +3 -16
  102. package/lib/built-in/attachment-preview/previewers/file-pdf.js +4 -2
  103. package/lib/built-in/context-menu/ContextMenu.provider.js +29 -0
  104. package/lib/built-in/context-menu/index.js +1 -0
  105. package/lib/built-in/index.js +44 -5
  106. package/lib/built-in/page-style/TabHeader.js +26 -33
  107. package/lib/built-in/page-style/TabHeader.style.js +69 -0
  108. package/lib/built-in/pinned-list/PinnedPluginListProvider.js +5 -4
  109. package/lib/built-in/scroll-assistant/useJoystick.js +17 -1
  110. package/lib/built-in/setting-layout/SettingLayout.js +10 -1
  111. package/lib/built-in/{assistant/calculator/CalculatorKey.js → setting-layout/style.js} +25 -11
  112. package/lib/collection-manager/action-hooks.js +39 -11
  113. package/lib/icon/preloaded.js +4 -4
  114. package/lib/locale/en_US.js +8 -0
  115. package/lib/locale/zh-CN.js +8 -0
  116. package/lib/modules/actions/associate/AssociateActionInitializer.js +105 -0
  117. package/lib/modules/actions/associate/AssociateActionProvider.js +116 -0
  118. package/lib/modules/actions/associate/AssociateActionSettings.js +91 -0
  119. package/lib/modules/blocks/data-blocks/details-multi/detailsWithPaginationSettings.js +2 -1
  120. package/lib/modules/blocks/data-blocks/form/RecordFormBlockInitializer.js +21 -14
  121. package/lib/modules/blocks/data-blocks/grid-card/gridCardBlockSettings.js +2 -1
  122. package/lib/modules/blocks/data-blocks/list/listBlockSettings.js +2 -1
  123. package/lib/modules/blocks/data-blocks/table/TableActionInitializers.js +15 -0
  124. package/lib/modules/blocks/data-blocks/table/tableBlockSettings.js +2 -1
  125. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +2 -2
  126. package/lib/modules/blocks/data-blocks/table-selector/tableSelectorBlockSettings.js +2 -1
  127. package/lib/modules/fields/component/Cascader/cascaderComponentFieldSettings.js +2 -1
  128. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +4 -0
  129. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +16 -2
  130. package/lib/modules/fields/component/SubTable/subTablePopoverComponentFieldSettings.js +2 -1
  131. package/lib/modules/menu/GroupItem.js +5 -1
  132. package/lib/modules/menu/LinkMenuItem.js +7 -3
  133. package/lib/modules/menu/PageMenuItem.js +5 -1
  134. package/lib/modules/menu/UploadMenuItem.js +115 -0
  135. package/lib/modules/menu/menuItemInitializer.js +2 -23
  136. package/lib/schema-component/antd/action/Action.Designer.js +4 -1
  137. package/lib/schema-component/antd/association-select/AssociationSelect.js +4 -2
  138. package/lib/schema-component/antd/checkbox/Checkbox.js +11 -6
  139. package/lib/schema-component/antd/date-picker/DatePicker.js +4 -0
  140. package/lib/schema-component/antd/form-item/FormItem.Settings.js +16 -1
  141. package/lib/schema-component/antd/form-v2/Form.Settings.js +2 -1
  142. package/lib/schema-component/antd/grid-card/GridCard.Designer.js +2 -1
  143. package/lib/schema-component/antd/list/List.Designer.js +2 -1
  144. package/lib/schema-component/antd/menu/AdminMenu.js +105 -0
  145. package/lib/schema-component/antd/menu/AdminMenu.style.js +70 -0
  146. package/lib/schema-component/antd/menu/Menu.Designer.js +59 -40
  147. package/lib/schema-component/antd/menu/Menu.js +108 -141
  148. package/lib/schema-component/antd/menu/Menu.styles.js +8 -20
  149. package/lib/schema-component/antd/menu/MenuSearch.js +80 -0
  150. package/lib/schema-component/antd/menu/tools.js +72 -0
  151. package/lib/schema-component/antd/scroll-area/ScrollArea.js +0 -17
  152. package/lib/schema-component/antd/select/Select.js +33 -2
  153. package/lib/schema-component/antd/table/Table.Void.Designer.js +2 -1
  154. package/lib/schema-component/antd/table-v2/TableBlockDesigner.js +2 -1
  155. package/lib/schema-component/antd/table-v2/TableSelectorDesigner.js +2 -1
  156. package/lib/schema-component/common/sortable-item/DragHandleMenu.js +112 -0
  157. package/lib/schema-component/common/sortable-item/DragHandleMenu.style.js +59 -0
  158. package/lib/schema-initializer/SchemaInitializerPlugin.js +5 -2
  159. package/lib/schema-initializer/utils.js +9 -7
  160. package/lib/schema-settings/GeneralSchemaDesigner.js +9 -1
  161. package/lib/schema-settings/SchemaSettings.js +16 -4
  162. package/lib/schema-settings/SchemaSettingsPlugin.js +2 -0
  163. package/lib/schema-settings/SchemaSettingsSortingRule.js +2 -1
  164. package/lib/schema-settings/styles.js +2 -2
  165. package/package.json +8 -7
  166. package/es/built-in/assistant/calculator/AutoScalingText.d.ts +0 -3
  167. package/es/built-in/assistant/calculator/AutoScalingText.mjs +0 -33
  168. package/es/built-in/assistant/calculator/Calculator.d.ts +0 -2
  169. package/es/built-in/assistant/calculator/Calculator.mjs +0 -235
  170. package/es/built-in/assistant/calculator/CalculatorDisplay.d.ts +0 -4
  171. package/es/built-in/assistant/calculator/CalculatorDisplay.mjs +0 -21
  172. package/es/built-in/assistant/calculator/CalculatorKey.d.ts +0 -5
  173. package/es/built-in/assistant/calculator/CalculatorKey.mjs +0 -11
  174. package/es/built-in/assistant/calculator/CalculatorProvider.d.ts +0 -10
  175. package/es/built-in/assistant/calculator/CalculatorProvider.mjs +0 -29
  176. package/es/built-in/assistant/calculator/Draggable.d.ts +0 -8
  177. package/es/built-in/assistant/calculator/Draggable.mjs +0 -54
  178. package/es/built-in/assistant/calculator/style.mjs +0 -25
  179. package/es/built-in/assistant/search-and-jump/index.d.ts +0 -16
  180. package/es/built-in/assistant/search-and-jump/index.mjs +0 -59
  181. package/lib/built-in/assistant/calculator/AutoScalingText.js +0 -67
  182. package/lib/built-in/assistant/calculator/Calculator.js +0 -283
  183. package/lib/built-in/assistant/calculator/CalculatorDisplay.js +0 -55
  184. package/lib/built-in/assistant/calculator/CalculatorProvider.js +0 -65
  185. package/lib/built-in/assistant/calculator/Draggable.js +0 -102
  186. package/lib/built-in/assistant/calculator/style.js +0 -59
  187. package/lib/built-in/assistant/search-and-jump/index.js +0 -96
@@ -1,235 +0,0 @@
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__CalculatorDisplay_mjs__ from "./CalculatorDisplay.mjs";
4
- import * as __WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__ from "./CalculatorKey.mjs";
5
- import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
6
- const CalculatorOperations = {
7
- '/': (prevValue, nextValue)=>prevValue / nextValue,
8
- '*': (prevValue, nextValue)=>prevValue * nextValue,
9
- '+': (prevValue, nextValue)=>prevValue + nextValue,
10
- '-': (prevValue, nextValue)=>prevValue - nextValue,
11
- '=': (prevValue, nextValue)=>nextValue
12
- };
13
- const Calculator = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].forwardRef((param, ref)=>{
14
- let { className } = param;
15
- const [value, setValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
16
- const [displayValue, setDisplayValue] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)('0');
17
- const [operator, setOperator] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(null);
18
- const [waitingForOperand, setWaitingForOperand] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
19
- const clearAll = ()=>{
20
- setValue(null);
21
- setDisplayValue('0');
22
- setOperator(null);
23
- setWaitingForOperand(false);
24
- };
25
- const clearDisplay = ()=>{
26
- setDisplayValue('0');
27
- };
28
- const clearLastChar = ()=>{
29
- setDisplayValue(displayValue.substring(0, displayValue.length - 1) || '0');
30
- };
31
- const toggleSign = ()=>{
32
- const newValue = -1 * parseFloat(displayValue);
33
- setDisplayValue(String(newValue));
34
- };
35
- const inputPercent = ()=>{
36
- const currentValue = parseFloat(displayValue);
37
- if (0 === currentValue) return;
38
- const fixedDigits = displayValue.replace(/^-?\d*\.?/, '');
39
- const newValue = parseFloat(displayValue) / 100;
40
- setDisplayValue(String(newValue.toFixed(fixedDigits.length + 2)));
41
- };
42
- const inputDot = ()=>{
43
- if (!/\./.test(displayValue)) {
44
- setDisplayValue(displayValue + '.');
45
- setWaitingForOperand(false);
46
- }
47
- };
48
- const inputDigit = (digit)=>{
49
- if (waitingForOperand) {
50
- setDisplayValue(String(digit));
51
- setWaitingForOperand(false);
52
- } else setDisplayValue('0' === displayValue ? String(digit) : displayValue + digit);
53
- };
54
- const performOperation = (nextOperator)=>{
55
- const inputValue = parseFloat(displayValue);
56
- if (null == value) setValue(inputValue);
57
- else if (operator) {
58
- const currentValue = value || 0;
59
- const newValue = CalculatorOperations[operator](currentValue, inputValue);
60
- setValue(newValue);
61
- setDisplayValue(String(newValue));
62
- }
63
- setWaitingForOperand(true);
64
- setOperator(nextOperator);
65
- };
66
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
67
- const handleKeyDown = (event)=>{
68
- let { key } = event;
69
- if ('Enter' === key) key = '=';
70
- if (/\d/.test(key)) {
71
- event.preventDefault();
72
- inputDigit(parseInt(key, 10));
73
- } else if (key in CalculatorOperations) {
74
- event.preventDefault();
75
- performOperation(key);
76
- } else if ('.' === key) {
77
- event.preventDefault();
78
- inputDot();
79
- } else if ('%' === key) {
80
- event.preventDefault();
81
- inputPercent();
82
- } else if ('Backspace' === key) {
83
- event.preventDefault();
84
- clearLastChar();
85
- } else if ('Clear' === key) {
86
- event.preventDefault();
87
- if ('0' !== displayValue) clearDisplay();
88
- else clearAll();
89
- }
90
- };
91
- document.addEventListener('keydown', handleKeyDown);
92
- return ()=>{
93
- document.removeEventListener('keydown', handleKeyDown);
94
- };
95
- });
96
- const clearKey = '0' !== displayValue;
97
- const clearText = clearKey ? 'C' : 'AC';
98
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
99
- className: "calculator",
100
- ref: ref,
101
- children: [
102
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorDisplay_mjs__.CalculatorDisplay, {
103
- value: displayValue
104
- }),
105
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
106
- className: "calculator-keypad",
107
- children: [
108
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
109
- className: "input-keys",
110
- children: [
111
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
112
- className: "function-keys",
113
- children: [
114
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
115
- className: "key-clear",
116
- onPress: ()=>clearKey ? clearDisplay() : clearAll(),
117
- children: clearText
118
- }),
119
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
120
- className: "key-sign",
121
- onPress: ()=>toggleSign(),
122
- children: "\xb1"
123
- }),
124
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
125
- className: "key-percent",
126
- onPress: ()=>inputPercent(),
127
- children: "%"
128
- })
129
- ]
130
- }),
131
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
132
- className: "digit-keys",
133
- children: [
134
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
135
- className: "key-0",
136
- onPress: ()=>inputDigit(0),
137
- children: "0"
138
- }),
139
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
140
- className: "key-dot",
141
- onPress: ()=>inputDot(),
142
- children: "●"
143
- }),
144
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
145
- className: "key-1",
146
- onPress: ()=>inputDigit(1),
147
- children: "1"
148
- }),
149
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
150
- className: "key-2",
151
- onPress: ()=>inputDigit(2),
152
- children: "2"
153
- }),
154
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
155
- className: "key-3",
156
- onPress: ()=>inputDigit(3),
157
- children: "3"
158
- }),
159
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
160
- className: "key-4",
161
- onPress: ()=>inputDigit(4),
162
- children: "4"
163
- }),
164
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
165
- className: "key-5",
166
- onPress: ()=>inputDigit(5),
167
- children: "5"
168
- }),
169
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
170
- className: "key-6",
171
- onPress: ()=>inputDigit(6),
172
- children: "6"
173
- }),
174
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
175
- className: "key-7",
176
- onPress: ()=>inputDigit(7),
177
- children: "7"
178
- }),
179
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
180
- className: "key-8",
181
- onPress: ()=>inputDigit(8),
182
- children: "8"
183
- }),
184
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
185
- className: "key-9",
186
- onPress: ()=>inputDigit(9),
187
- children: "9"
188
- })
189
- ]
190
- })
191
- ]
192
- }),
193
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
194
- className: "operator-keys",
195
- children: [
196
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
197
- className: "key-divide",
198
- onPress: ()=>performOperation('/'),
199
- children: "\xf7"
200
- }),
201
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
202
- className: "key-multiply",
203
- onPress: ()=>performOperation('*'),
204
- children: "\xd7"
205
- }),
206
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
207
- className: "key-subtract",
208
- onPress: ()=>performOperation('-'),
209
- children: "−"
210
- }),
211
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
212
- className: "key-add",
213
- onPress: ()=>performOperation('+'),
214
- children: "+"
215
- }),
216
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__CalculatorKey_mjs__.CalculatorKey, {
217
- className: "key-equals",
218
- onPress: ()=>performOperation('='),
219
- children: "="
220
- })
221
- ]
222
- })
223
- ]
224
- })
225
- ]
226
- });
227
- });
228
- const CalculatorWrapper = /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].forwardRef((props, ref)=>{
229
- const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
230
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(Calculator, {
231
- ref: ref,
232
- className: styles.container
233
- });
234
- });
235
- export { CalculatorWrapper };
@@ -1,4 +0,0 @@
1
- export declare const CalculatorDisplay: ({ value, ...props }: {
2
- [x: string]: any;
3
- value: any;
4
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,21 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
2
- import "react";
3
- import * as __WEBPACK_EXTERNAL_MODULE__AutoScalingText_mjs__ from "./AutoScalingText.mjs";
4
- const CalculatorDisplay = (param)=>{
5
- let { value, ...props } = param;
6
- const language = navigator.language || 'en-US';
7
- let formattedValue = parseFloat(value).toLocaleString(language, {
8
- useGrouping: true,
9
- maximumFractionDigits: 6
10
- });
11
- const match = value.match(/\.\d*?(0*)$/);
12
- if (match) formattedValue += /[1-9]/.test(match[0]) ? match[1] : match[0];
13
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
14
- ...props,
15
- className: "calculator-display",
16
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__AutoScalingText_mjs__.AutoScalingText, {
17
- children: formattedValue
18
- })
19
- });
20
- };
21
- export { CalculatorDisplay };
@@ -1,5 +0,0 @@
1
- export declare const CalculatorKey: ({ onPress, className, ...props }: {
2
- [x: string]: any;
3
- onPress: any;
4
- className: any;
5
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,11 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
2
- import "react";
3
- const CalculatorKey = (param)=>{
4
- let { onPress, className, ...props } = param;
5
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("button", {
6
- onClick: onPress,
7
- className: "calculator-key ".concat(className),
8
- ...props
9
- });
10
- };
11
- export { CalculatorKey };
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- export interface CalculatorProps {
3
- visible: any;
4
- setVisible: any;
5
- }
6
- export declare const CalculatorContext: React.Context<Partial<CalculatorProps>>;
7
- export declare const useCalculator: () => Partial<CalculatorProps>;
8
- export declare const CalculatorProvider: ({ children }: {
9
- children: any;
10
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,29 +0,0 @@
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_react_dom__ from "react-dom";
4
- import * as __WEBPACK_EXTERNAL_MODULE__Calculator_mjs__ from "./Calculator.mjs";
5
- import * as __WEBPACK_EXTERNAL_MODULE__Draggable_mjs__ from "./Draggable.mjs";
6
- import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
7
- const CalculatorContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)({});
8
- const useCalculator = ()=>(0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(CalculatorContext);
9
- const CalculatorProvider = (param)=>{
10
- let { children } = param;
11
- const [visible, setVisible] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
12
- const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
13
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(CalculatorContext.Provider, {
14
- value: {
15
- visible,
16
- setVisible
17
- },
18
- children: [
19
- children,
20
- visible ? /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_dom__.createPortal)(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
21
- className: styles.container,
22
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__Draggable_mjs__.Draggable, {
23
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__Calculator_mjs__.CalculatorWrapper, {})
24
- })
25
- }), document.body) : null
26
- ]
27
- });
28
- };
29
- export { CalculatorContext, CalculatorProvider, useCalculator };
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export declare const Draggable: ({ children, updateTransform, }: {
3
- children: any;
4
- updateTransform?: (transformStr: any, tx: any, ty: any, tdom: any) => void;
5
- }) => React.DetailedReactHTMLElement<{
6
- ref: React.MutableRefObject<any>;
7
- style: any;
8
- }, HTMLElement>;
@@ -1,54 +0,0 @@
1
- import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
2
- const Draggable = (param)=>{
3
- let { children, updateTransform = (transformStr, tx, ty, tdom)=>{
4
- tdom.style.transform = transformStr;
5
- } } = param;
6
- const ref = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)();
7
- const positionRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)({
8
- startX: 0,
9
- startY: 0,
10
- dx: 0,
11
- dy: 0,
12
- tx: 0,
13
- ty: 0
14
- });
15
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
16
- const node = ref.current;
17
- if (!node) return;
18
- const start = (event)=>{
19
- if (0 !== event.button) return;
20
- document.addEventListener('mousemove', docMove);
21
- positionRef.current.startX = event.pageX - positionRef.current.dx;
22
- positionRef.current.startY = event.pageY - positionRef.current.dy;
23
- };
24
- const docMove = (event)=>{
25
- const tx = event.pageX - positionRef.current.startX;
26
- const ty = event.pageY - positionRef.current.startY;
27
- const transformStr = "translate(".concat(tx, "px,").concat(ty, "px)");
28
- updateTransform(transformStr, tx, ty, node);
29
- positionRef.current.dx = tx;
30
- positionRef.current.dy = ty;
31
- };
32
- const docMouseUp = (event)=>{
33
- document.removeEventListener('mousemove', docMove);
34
- };
35
- node.addEventListener('mousedown', start);
36
- document.addEventListener('mouseup', docMouseUp);
37
- return ()=>{
38
- node.removeEventListener('mousedown', start);
39
- document.removeEventListener('mouseup', docMouseUp);
40
- };
41
- }, [
42
- updateTransform
43
- ]);
44
- const newStyle = {
45
- ...children.props.style,
46
- cursor: 'move',
47
- userSelect: 'none'
48
- };
49
- return /*#__PURE__*/ __WEBPACK_EXTERNAL_MODULE_react__["default"].cloneElement(__WEBPACK_EXTERNAL_MODULE_react__["default"].Children.only(children), {
50
- ref,
51
- style: newStyle
52
- });
53
- };
54
- export { Draggable };
@@ -1,25 +0,0 @@
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: fixed;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 320px;\n height: 520px;\n z-index: 1350;\n\n button {\n display: block;\n background: none;\n border: none;\n padding: 0;\n font-family: inherit;\n user-select: none;\n cursor: pointer;\n outline: none;\n\n -webkit-tap-highlight-color: rgba(0, 0, 0, 0);\n }\n\n button:active {\n box-shadow: inset 0px 0px 80px 0px rgba(0, 0, 0, 0.25);\n }\n\n .calculator {\n width: 100%;\n height: 100%;\n background: black;\n\n display: flex;\n flex-direction: column;\n }\n\n #wrapper .calculator {\n box-shadow: 0px 0px 20px 0px #aaa;\n }\n\n .calculator-display {\n color: white;\n background: #1c191c;\n line-height: 130px;\n font-size: 6em;\n\n flex: 1;\n }\n\n .auto-scaling-text {\n display: inline-block;\n }\n\n .calculator-display .auto-scaling-text {\n padding: 0 30px;\n position: absolute;\n right: 0;\n transform-origin: right;\n }\n\n .calculator-keypad {\n height: 400px;\n\n display: flex;\n }\n\n .calculator .input-keys {\n width: 240px;\n }\n\n .calculator .function-keys {\n display: flex;\n }\n\n .calculator .digit-keys {\n background: #e0e0e7;\n\n display: flex;\n flex-direction: row;\n flex-wrap: wrap-reverse;\n }\n\n .calculator-key {\n width: 80px;\n height: 80px;\n border-top: 1px solid #777;\n border-right: 1px solid #666;\n text-align: center;\n line-height: 80px;\n }\n .calculator .function-keys .calculator-key {\n font-size: 2em;\n }\n .calculator .function-keys .key-multiply {\n line-height: 50px;\n }\n .calculator .digit-keys .calculator-key {\n font-size: 2.25em;\n }\n .calculator .digit-keys .key-0 {\n width: 160px;\n text-align: left;\n padding-left: 32px;\n }\n .calculator .digit-keys .key-dot {\n padding-top: 1em;\n font-size: 0.75em;\n }\n .calculator .operator-keys .calculator-key {\n color: white;\n border-right: 0;\n font-size: 3em;\n }\n\n .calculator .function-keys {\n background: linear-gradient(to bottom, rgba(202, 202, 204, 1) 0%, rgba(196, 194, 204, 1) 100%);\n }\n .calculator .operator-keys {\n background: linear-gradient(to bottom, rgba(252, 156, 23, 1) 0%, rgba(247, 126, 27, 1) 100%);\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 } = param;
21
- return {
22
- container: css(_templateObject())
23
- };
24
- });
25
- export { useStyles };
@@ -1,16 +0,0 @@
1
- import React from 'react';
2
- export declare const SearchAndJumpContext: React.Context<{
3
- open: boolean;
4
- setOpen: (open: boolean | ((open: boolean) => boolean)) => void;
5
- }>;
6
- export declare const SearchAndJumpProvider: ({ children }: {
7
- children: any;
8
- }) => import("react/jsx-runtime").JSX.Element;
9
- export declare const useSearchAndJump: () => {
10
- open: boolean;
11
- setOpen: (open: boolean | ((open: boolean) => boolean)) => void;
12
- };
13
- export declare const SearchAndJump: ({ open, setOpen }: {
14
- open: any;
15
- setOpen: any;
16
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,59 +0,0 @@
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__ from "antd";
4
- const SearchAndJumpContext = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react__.createContext)({
5
- open: false,
6
- setOpen: (open)=>{}
7
- });
8
- const SearchAndJumpProvider = (param)=>{
9
- let { children } = param;
10
- const [open, setOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
11
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(SearchAndJumpContext.Provider, {
12
- value: {
13
- open,
14
- setOpen
15
- },
16
- children: [
17
- children,
18
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(SearchAndJump, {
19
- open: open,
20
- setOpen: setOpen
21
- })
22
- ]
23
- });
24
- };
25
- const useSearchAndJump = ()=>(0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(SearchAndJumpContext);
26
- const SearchAndJump = (param)=>{
27
- let { open, setOpen } = param;
28
- const inputRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)();
29
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
30
- if (open && inputRef.current) setTimeout(()=>{
31
- inputRef.current.focus();
32
- }, 0);
33
- }, [
34
- open,
35
- inputRef
36
- ]);
37
- const handleOk = ()=>{
38
- setOpen(false);
39
- };
40
- const handleCancel = ()=>{
41
- setOpen(false);
42
- };
43
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Modal, {
44
- title: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Input, {
45
- style: {
46
- width: '100%'
47
- },
48
- autoFocus: true,
49
- ref: inputRef
50
- }),
51
- closable: false,
52
- open: open,
53
- onOk: handleOk,
54
- onCancel: handleCancel,
55
- footer: null,
56
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("p", {})
57
- });
58
- };
59
- export { SearchAndJump, SearchAndJumpContext, SearchAndJumpProvider, useSearchAndJump };
@@ -1,67 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = function(exports1, definition) {
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = function(obj, prop) {
13
- return Object.prototype.hasOwnProperty.call(obj, prop);
14
- };
15
- })();
16
- (()=>{
17
- __webpack_require__.r = function(exports1) {
18
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
19
- value: 'Module'
20
- });
21
- Object.defineProperty(exports1, '__esModule', {
22
- value: true
23
- });
24
- };
25
- })();
26
- var __webpack_exports__ = {};
27
- __webpack_require__.r(__webpack_exports__);
28
- __webpack_require__.d(__webpack_exports__, {
29
- AutoScalingText: ()=>AutoScalingText
30
- });
31
- const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
- const external_react_namespaceObject = require("react");
33
- const AutoScalingText = (param)=>{
34
- let { children } = param;
35
- const ref = (0, external_react_namespaceObject.useRef)();
36
- const [scale, setScale] = (0, external_react_namespaceObject.useState)(1);
37
- (0, external_react_namespaceObject.useEffect)(()=>{
38
- const observer = new ResizeObserver((entries)=>{
39
- const node = entries[0].target;
40
- const parentNode = node.parentNode;
41
- const availableWidth = parentNode.offsetWidth;
42
- const actualWidth = node.offsetWidth;
43
- const actualScale = availableWidth / actualWidth;
44
- setScale((scale)=>{
45
- if (actualScale < 1) return actualScale;
46
- if (scale < 1) return 1;
47
- });
48
- });
49
- const node = ref.current;
50
- observer.observe(node);
51
- return ()=>observer.unobserve(node);
52
- }, []);
53
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
54
- className: "auto-scaling-text",
55
- style: {
56
- transition: 'transform 0.5s ease',
57
- transform: "scale(".concat(scale, ",").concat(scale, ")")
58
- },
59
- ref: ref,
60
- children: children
61
- });
62
- };
63
- var __webpack_export_target__ = exports;
64
- for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
65
- if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
66
- value: true
67
- });