@thx/controls 16.0.0-alpha.0 → 16.0.0

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 (156) hide show
  1. package/LICENSE +1 -1
  2. package/dist/esm/date/DatePicker/styles.css.js +7 -0
  3. package/dist/esm/date/DatePicker/styles.css.js.map +1 -0
  4. package/dist/esm/date/LocalDatePicker/LocalDatePicker.js +71 -0
  5. package/dist/esm/date/LocalDatePicker/LocalDatePicker.js.map +1 -0
  6. package/dist/esm/date/LocalDatePicker/MaskedDateInput.js +22 -0
  7. package/dist/esm/date/LocalDatePicker/MaskedDateInput.js.map +1 -0
  8. package/dist/esm/date/LocalMonthSelect/LocalMonthSelect.js +43 -0
  9. package/dist/esm/date/LocalMonthSelect/LocalMonthSelect.js.map +1 -0
  10. package/dist/esm/date/LocalTimePicker/LocalTimePicker.js +76 -0
  11. package/dist/esm/date/LocalTimePicker/LocalTimePicker.js.map +1 -0
  12. package/dist/esm/date/LocalTimePicker/MaskedTimeInput.js +21 -0
  13. package/dist/esm/date/LocalTimePicker/MaskedTimeInput.js.map +1 -0
  14. package/dist/esm/date/MonthDayPicker/MonthDayPicker.js +86 -0
  15. package/dist/esm/date/MonthDayPicker/MonthDayPicker.js.map +1 -0
  16. package/dist/esm/date/MonthYearPicker/MonthYearPicker.js +73 -0
  17. package/dist/esm/date/MonthYearPicker/MonthYearPicker.js.map +1 -0
  18. package/dist/esm/date/YearSelect/YearSelect.js +62 -0
  19. package/dist/esm/date/YearSelect/YearSelect.js.map +1 -0
  20. package/dist/esm/external/style-inject/dist/style-inject.es.js +29 -0
  21. package/dist/esm/external/style-inject/dist/style-inject.es.js.map +1 -0
  22. package/dist/esm/form/TForm/TForm.js +29 -0
  23. package/dist/esm/form/TForm/TForm.js.map +1 -0
  24. package/dist/esm/form/TForm/useTForm.js +90 -0
  25. package/dist/esm/form/TForm/useTForm.js.map +1 -0
  26. package/dist/esm/index.js +33 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/esm/inputs/CreditCardInput/CreditCardInput.js +71 -0
  29. package/dist/esm/inputs/CreditCardInput/CreditCardInput.js.map +1 -0
  30. package/dist/esm/inputs/CreditCardInput/CreditCardNumberInput.js +76 -0
  31. package/dist/esm/inputs/CreditCardInput/CreditCardNumberInput.js.map +1 -0
  32. package/dist/esm/inputs/CreditCardInput/styles.css.js +7 -0
  33. package/dist/esm/inputs/CreditCardInput/styles.css.js.map +1 -0
  34. package/dist/esm/inputs/MaskedInput/MaskedInput.js +21 -0
  35. package/dist/esm/inputs/MaskedInput/MaskedInput.js.map +1 -0
  36. package/dist/esm/inputs/MaskedInput/useMaskedInput.js +58 -0
  37. package/dist/esm/inputs/MaskedInput/useMaskedInput.js.map +1 -0
  38. package/dist/esm/inputs/PhoneInput/PhoneInput.js +21 -0
  39. package/dist/esm/inputs/PhoneInput/PhoneInput.js.map +1 -0
  40. package/dist/esm/inputs/RadioGroup/RadioGroup.js +25 -0
  41. package/dist/esm/inputs/RadioGroup/RadioGroup.js.map +1 -0
  42. package/dist/esm/inputs/Scriptel/Scriptel.js +52 -0
  43. package/dist/esm/inputs/Scriptel/Scriptel.js.map +1 -0
  44. package/dist/esm/inputs/Scriptel/ScriptelContext.js +6 -0
  45. package/dist/esm/inputs/Scriptel/ScriptelContext.js.map +1 -0
  46. package/dist/esm/inputs/Scriptel/scriptel/enums.js +21 -0
  47. package/dist/esm/inputs/Scriptel/scriptel/enums.js.map +1 -0
  48. package/dist/esm/inputs/Scriptel/scriptel/index.js +93 -0
  49. package/dist/esm/inputs/Scriptel/scriptel/index.js.map +1 -0
  50. package/dist/esm/inputs/Scriptel/withScriptel.js +15 -0
  51. package/dist/esm/inputs/Scriptel/withScriptel.js.map +1 -0
  52. package/dist/esm/inputs/ScriptelInput/ScriptelInput.js +67 -0
  53. package/dist/esm/inputs/ScriptelInput/ScriptelInput.js.map +1 -0
  54. package/dist/esm/inputs/SinInput/SinInput.js +54 -0
  55. package/dist/esm/inputs/SinInput/SinInput.js.map +1 -0
  56. package/dist/esm/inputs/TableInput/DropdownCell.js +26 -0
  57. package/dist/esm/inputs/TableInput/DropdownCell.js.map +1 -0
  58. package/dist/esm/inputs/TableInput/HoverCell.js +20 -0
  59. package/dist/esm/inputs/TableInput/HoverCell.js.map +1 -0
  60. package/dist/esm/inputs/TableInput/MoneyCell.js +13 -0
  61. package/dist/esm/inputs/TableInput/MoneyCell.js.map +1 -0
  62. package/dist/esm/inputs/TableInput/MoneyEditCell.js +30 -0
  63. package/dist/esm/inputs/TableInput/MoneyEditCell.js.map +1 -0
  64. package/dist/esm/inputs/TableInput/MoneySumFooter.js +15 -0
  65. package/dist/esm/inputs/TableInput/MoneySumFooter.js.map +1 -0
  66. package/dist/esm/inputs/TableInput/StringEditCell.js +34 -0
  67. package/dist/esm/inputs/TableInput/StringEditCell.js.map +1 -0
  68. package/dist/esm/inputs/TableInput/TableInput.js +75 -0
  69. package/dist/esm/inputs/TableInput/TableInput.js.map +1 -0
  70. package/dist/esm/inputs/TableInput/addRowOnTab.js +13 -0
  71. package/dist/esm/inputs/TableInput/addRowOnTab.js.map +1 -0
  72. package/dist/esm/money/MoneyCurrencyInput/MoneyCurrencyInput.js +51 -0
  73. package/dist/esm/money/MoneyCurrencyInput/MoneyCurrencyInput.js.map +1 -0
  74. package/dist/esm/money/MoneyInput/MoneyInput.js +31 -0
  75. package/dist/esm/money/MoneyInput/MoneyInput.js.map +1 -0
  76. package/dist/esm/money/useMoneyInput.js +74 -0
  77. package/dist/esm/money/useMoneyInput.js.map +1 -0
  78. package/dist/esm/step/FormStep.js +17 -0
  79. package/dist/esm/step/FormStep.js.map +1 -0
  80. package/dist/esm/step/Step.js +10 -0
  81. package/dist/esm/step/Step.js.map +1 -0
  82. package/dist/esm/step/StepProvider.js +95 -0
  83. package/dist/esm/step/StepProvider.js.map +1 -0
  84. package/dist/esm/step/stepContext.js +10 -0
  85. package/dist/esm/step/stepContext.js.map +1 -0
  86. package/dist/esm/step/useStep.js +10 -0
  87. package/dist/esm/step/useStep.js.map +1 -0
  88. package/dist/stats.html +2689 -0
  89. package/dist/stats.txt +94 -0
  90. package/dist/{date → types/date}/DatePicker/index.d.ts +0 -0
  91. package/dist/{date → types/date}/LocalDatePicker/LocalDatePicker.d.ts +1 -0
  92. package/dist/{date → types/date}/LocalDatePicker/MaskedDateInput.d.ts +0 -0
  93. package/dist/{date → types/date}/LocalDatePicker/index.d.ts +0 -0
  94. package/dist/{date → types/date}/LocalMonthSelect/LocalMonthSelect.d.ts +0 -0
  95. package/dist/{date → types/date}/LocalMonthSelect/index.d.ts +0 -0
  96. package/dist/{date → types/date}/LocalTimePicker/LocalTimePicker.d.ts +0 -0
  97. package/dist/{date → types/date}/LocalTimePicker/MaskedTimeInput.d.ts +0 -0
  98. package/dist/{date → types/date}/LocalTimePicker/index.d.ts +0 -0
  99. package/dist/{date → types/date}/MonthDayPicker/MonthDayPicker.d.ts +0 -0
  100. package/dist/{date → types/date}/MonthDayPicker/index.d.ts +0 -0
  101. package/dist/{date → types/date}/MonthYearPicker/MonthYearPicker.d.ts +0 -0
  102. package/dist/{date → types/date}/MonthYearPicker/index.d.ts +0 -0
  103. package/dist/{date → types/date}/YearSelect/YearSelect.d.ts +0 -0
  104. package/dist/{date → types/date}/YearSelect/index.d.ts +0 -0
  105. package/dist/{form → types/form}/TForm/TForm.d.ts +0 -0
  106. package/dist/{form → types/form}/TForm/index.d.ts +0 -0
  107. package/dist/{form → types/form}/TForm/types.d.ts +0 -0
  108. package/dist/{form → types/form}/TForm/useTForm.d.ts +0 -0
  109. package/dist/{index.d.ts → types/index.d.ts} +2 -1
  110. package/dist/{inputs → types/inputs}/CreditCardInput/CreditCardInput.d.ts +0 -0
  111. package/dist/{inputs → types/inputs}/CreditCardInput/CreditCardNumberInput.d.ts +0 -0
  112. package/dist/{inputs → types/inputs}/CreditCardInput/index.d.ts +0 -0
  113. package/dist/{inputs → types/inputs}/MaskedInput/MaskedInput.d.ts +0 -0
  114. package/dist/{inputs → types/inputs}/MaskedInput/index.d.ts +0 -0
  115. package/dist/{inputs → types/inputs}/MaskedInput/useMaskedInput.d.ts +1 -1
  116. package/dist/{inputs → types/inputs}/PhoneInput/PhoneInput.d.ts +0 -0
  117. package/dist/{inputs → types/inputs}/PhoneInput/index.d.ts +0 -0
  118. package/dist/{inputs → types/inputs}/RadioGroup/RadioGroup.d.ts +0 -0
  119. package/dist/{inputs → types/inputs}/RadioGroup/index.d.ts +0 -0
  120. package/dist/{inputs → types/inputs}/Scriptel/Scriptel.d.ts +0 -0
  121. package/dist/{inputs → types/inputs}/Scriptel/ScriptelContext.d.ts +0 -0
  122. package/dist/{inputs → types/inputs}/Scriptel/index.d.ts +0 -0
  123. package/dist/{inputs → types/inputs}/Scriptel/scriptel/classes.d.ts +0 -0
  124. package/dist/{inputs → types/inputs}/Scriptel/scriptel/enums.d.ts +0 -0
  125. package/dist/{inputs → types/inputs}/Scriptel/scriptel/index.d.ts +0 -0
  126. package/dist/{inputs → types/inputs}/Scriptel/scriptel/messages.d.ts +0 -0
  127. package/dist/{inputs → types/inputs}/Scriptel/withScriptel.d.ts +0 -1
  128. package/dist/{inputs → types/inputs}/ScriptelInput/ScriptelInput.d.ts +0 -0
  129. package/dist/{inputs → types/inputs}/ScriptelInput/index.d.ts +0 -0
  130. package/dist/{inputs → types/inputs}/SinInput/SinInput.d.ts +0 -0
  131. package/dist/{inputs → types/inputs}/SinInput/index.d.ts +0 -0
  132. package/dist/{inputs → types/inputs}/TableInput/DropdownCell.d.ts +0 -1
  133. package/dist/{inputs → types/inputs}/TableInput/HoverCell.d.ts +0 -1
  134. package/dist/{inputs → types/inputs}/TableInput/MoneyCell.d.ts +0 -1
  135. package/dist/{inputs → types/inputs}/TableInput/MoneyEditCell.d.ts +0 -1
  136. package/dist/{inputs → types/inputs}/TableInput/MoneySumFooter.d.ts +0 -1
  137. package/dist/{inputs → types/inputs}/TableInput/StringEditCell.d.ts +0 -1
  138. package/dist/{inputs → types/inputs}/TableInput/TableInput.d.ts +0 -0
  139. package/dist/{inputs → types/inputs}/TableInput/addRowOnTab.d.ts +0 -0
  140. package/dist/{inputs → types/inputs}/TableInput/index.d.ts +0 -0
  141. package/dist/{money → types/money}/MoneyCurrencyInput/MoneyCurrencyInput.d.ts +0 -0
  142. package/dist/{money → types/money}/MoneyCurrencyInput/index.d.ts +0 -0
  143. package/dist/{money → types/money}/MoneyInput/MoneyInput.d.ts +0 -0
  144. package/dist/{money → types/money}/MoneyInput/index.d.ts +0 -0
  145. package/dist/{money → types/money}/useMoneyInput.d.ts +0 -0
  146. package/dist/{step → types/step}/FormStep.d.ts +0 -0
  147. package/dist/{step → types/step}/Step.d.ts +0 -0
  148. package/dist/{step → types/step}/StepProvider.d.ts +0 -0
  149. package/dist/{step → types/step}/index.d.ts +0 -0
  150. package/dist/{step → types/step}/stepContext.d.ts +0 -0
  151. package/dist/{step → types/step}/useStep.d.ts +0 -0
  152. package/package.json +16 -25
  153. package/dist/index.js +0 -5460
  154. package/dist/index.min.js +0 -2
  155. package/dist/index.min.js.map +0 -1
  156. package/index.js +0 -7
@@ -0,0 +1,93 @@
1
+ import debug from 'debug';
2
+ import EventEmitter from 'eventemitter3';
3
+ import { ScriptelMessageClass, ScriptelPenStyle } from './enums.js';
4
+
5
+ const d = debug("thx.controls.inputs.Scriptel.scriptel");
6
+ function serverConnected(msg, socket) {
7
+ d("Server connected");
8
+ if (msg.serverInfo.devices.length > 0) {
9
+ const device = msg.serverInfo.devices[0];
10
+ socket.send(JSON.stringify({
11
+ _class: "DeviceOpenRequest",
12
+ uuid: device.uuid
13
+ }));
14
+ }
15
+ }
16
+ function deviceConnected(msg, socket, args) {
17
+ d(`Device connected: ${msg.device.uuid}`);
18
+ const { imageType, scale, crop, penStyle } = args;
19
+ socket.send(JSON.stringify({
20
+ _class: "RenderSettingsUpdateRequest",
21
+ renderSettings: {
22
+ _class: "RenderSettings",
23
+ type: imageType || "image/svg+xml",
24
+ scale: scale || 1,
25
+ crop: crop || false,
26
+ penStyle: penStyle ? {
27
+ renderFunction: penStyle
28
+ } : {
29
+ renderFunction: ScriptelPenStyle.Plain
30
+ }
31
+ }
32
+ }));
33
+ }
34
+ function render(msg, args, eventEmitter) {
35
+ d(`Rendered image: ${msg.type} ${msg.width}x${msg.height}`);
36
+ eventEmitter.emit("render", msg);
37
+ }
38
+ class ScriptelSocket extends EventEmitter {
39
+ constructor(args) {
40
+ super();
41
+ this.options = args;
42
+ this.socket = new WebSocket(args.omniscriptUrl || "ws://localhost:8080");
43
+ this.socket.onopen = () => {
44
+ d("Socket open");
45
+ };
46
+ this.socket.onclose = () => {
47
+ d("Socket closed");
48
+ };
49
+ this.socket.onmessage = (ev) => {
50
+ const msg = JSON.parse(ev.data);
51
+ if (!msg._class)
52
+ return;
53
+ switch (msg._class) {
54
+ case ScriptelMessageClass.ConnectionOpen:
55
+ serverConnected(msg, this.socket);
56
+ break;
57
+ case ScriptelMessageClass.DeviceOpenResponse:
58
+ deviceConnected(msg, this.socket, this.options);
59
+ break;
60
+ case ScriptelMessageClass.RenderedImage:
61
+ render(msg, this.options, this);
62
+ break;
63
+ case ScriptelMessageClass.ScriptelException:
64
+ d(`Scriptel Exception Error: ${msg.message}`);
65
+ break;
66
+ case ScriptelMessageClass.ButtonPress:
67
+ if (msg.label === "Cancel")
68
+ this.emit("cancel");
69
+ break;
70
+ case ScriptelMessageClass.ButtonDown:
71
+ if (msg.label === "OK")
72
+ this.emit("okButtonDown");
73
+ break;
74
+ case ScriptelMessageClass.PenMove:
75
+ this.emit("penMove");
76
+ break;
77
+ case ScriptelMessageClass.PenUp:
78
+ this.emit("penUp");
79
+ break;
80
+ }
81
+ };
82
+ }
83
+ calibrate() {
84
+ d("calibrate");
85
+ this.socket.send(JSON.stringify({ _class: "ForceRecalibrate" }));
86
+ }
87
+ close() {
88
+ this.socket.close();
89
+ }
90
+ }
91
+
92
+ export { ScriptelSocket };
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/inputs/Scriptel/scriptel/index.ts"],"sourcesContent":["/* globals WebSocket: true */\nimport debug from 'debug';\nimport EventEmitter from 'eventemitter3';\nimport {ScriptelMessageClass, ScriptelPenStyle} from './enums';\nimport type {ConnectionOpen, DeviceOpenResponse, Message, RenderedImage} from './messages';\n\nconst d = debug('thx.controls.inputs.Scriptel.scriptel');\n\nexport interface ScriptelSocketArgs {\n\tomniscriptUrl?: string; // Defaults to 'ws://localhost:8080'\n\timageType?: string; // Defaults to 'image/svg+xml'.\n\tscale?: number; // Defaults to 1\n\tcrop?: boolean; // Defaults to false\n\tpenStyle?: ScriptelPenStyle; // Defaults to 'PlainPenStyle'\n\trender?: () => void;\n}\n\nfunction serverConnected(msg: ConnectionOpen, socket: WebSocket) {\n\td('Server connected');\n\tif (msg.serverInfo.devices.length > 0) {\n\t\t// Grab the first available device\n\t\tconst device = msg.serverInfo.devices[0];\n\t\tsocket.send(\n\t\t\tJSON.stringify({\n\t\t\t\t_class: 'DeviceOpenRequest',\n\t\t\t\tuuid: device.uuid,\n\t\t\t}),\n\t\t);\n\t}\n}\n\nfunction deviceConnected(msg: DeviceOpenResponse, socket: WebSocket, args: ScriptelSocketArgs) {\n\td(`Device connected: ${msg.device.uuid}`);\n\tconst {imageType, scale, crop, penStyle} = args;\n\tsocket.send(\n\t\tJSON.stringify({\n\t\t\t_class: 'RenderSettingsUpdateRequest',\n\t\t\trenderSettings: {\n\t\t\t\t_class: 'RenderSettings',\n\t\t\t\ttype: imageType || 'image/svg+xml',\n\t\t\t\tscale: scale || 1,\n\t\t\t\tcrop: crop || false,\n\t\t\t\tpenStyle: penStyle\n\t\t\t\t\t? {\n\t\t\t\t\t\t\trenderFunction: penStyle,\n\t\t\t\t\t }\n\t\t\t\t\t: {\n\t\t\t\t\t\t\trenderFunction: ScriptelPenStyle.Plain,\n\t\t\t\t\t },\n\t\t\t},\n\t\t}),\n\t);\n}\n\nfunction render(msg: RenderedImage, args: ScriptelSocketArgs, eventEmitter: EventEmitter) {\n\td(`Rendered image: ${msg.type} ${msg.width}x${msg.height}`);\n\teventEmitter.emit('render', msg);\n}\n\nexport class ScriptelSocket extends EventEmitter {\n\tprivate socket: WebSocket;\n\tprivate options: ScriptelSocketArgs;\n\n\tconstructor(args: ScriptelSocketArgs) {\n\t\tsuper();\n\n\t\tthis.options = args;\n\n\t\tthis.socket = new WebSocket(args.omniscriptUrl || 'ws://localhost:8080');\n\n\t\tthis.socket.onopen = () => {\n\t\t\td('Socket open');\n\t\t};\n\n\t\tthis.socket.onclose = () => {\n\t\t\td('Socket closed');\n\t\t};\n\n\t\tthis.socket.onmessage = ev => {\n\t\t\tconst msg = JSON.parse(ev.data) as Message;\n\t\t\tif (!msg._class) return; // A message with no class.\n\n\t\t\tswitch (msg._class) {\n\t\t\t\tcase ScriptelMessageClass.ConnectionOpen:\n\t\t\t\t\tserverConnected(msg, this.socket);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScriptelMessageClass.DeviceOpenResponse:\n\t\t\t\t\tdeviceConnected(msg, this.socket, this.options);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScriptelMessageClass.RenderedImage:\n\t\t\t\t\trender(msg, this.options, this);\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScriptelMessageClass.ScriptelException:\n\t\t\t\t\td(`Scriptel Exception Error: ${msg.message}`);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase ScriptelMessageClass.ButtonPress:\n\t\t\t\t\tif (msg.label === 'Cancel') this.emit('cancel');\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScriptelMessageClass.ButtonDown:\n\t\t\t\t\tif (msg.label === 'OK') this.emit('okButtonDown');\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScriptelMessageClass.PenMove:\n\t\t\t\t\tthis.emit('penMove');\n\t\t\t\t\tbreak;\n\t\t\t\tcase ScriptelMessageClass.PenUp:\n\t\t\t\t\tthis.emit('penUp');\n\t\t\t\t\tbreak;\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-0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Scriptel } from './Scriptel.js';
3
+
4
+ function withScriptel(WrappedComponent, scriptelProps) {
5
+ return function withScriptelHoC(props) {
6
+ return /* @__PURE__ */ React.createElement(Scriptel, {
7
+ ...scriptelProps
8
+ }, /* @__PURE__ */ React.createElement(WrappedComponent, {
9
+ ...props
10
+ }));
11
+ };
12
+ }
13
+
14
+ export { withScriptel };
15
+ //# sourceMappingURL=withScriptel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withScriptel.js","sources":["../../../../src/inputs/Scriptel/withScriptel.tsx"],"sourcesContent":["import {Scriptel, ScriptelProps} from './Scriptel';\n\n/**\n * A HoC that provides a connection to a Scriptel Omniscript device.\n * You can only have a single connection open at a time.\n * @param WrappedComponent\n * @return {Object}\n */\nexport function withScriptel(WrappedComponent: any, scriptelProps: ScriptelProps) {\n\treturn function withScriptelHoC(props: any) {\n\t\treturn (\n\t\t\t<Scriptel {...scriptelProps}>\n\t\t\t\t<WrappedComponent {...props} />\n\t\t\t</Scriptel>\n\t\t);\n\t};\n}\n"],"names":[],"mappings":";;;AAQO,SAAA,YAAA,CAAsB,kBAAuB,aAA8B,EAAA;AACjF,EAAA,OAAO,yBAAyB,KAAY,EAAA;AAC3C,IAAA,uBACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAA,MAAa,GAAA,aAAA;AAAA,KAAA,kBACZ,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA;AAAA,MAAqB,GAAA,KAAA;AAAA,KAAO,CAC9B,CAAA,CAAA;AAAA,GAEF,CAAA;AACD;;;;"}
@@ -0,0 +1,67 @@
1
+ import React, { useContext, useState, useEffect } from 'react';
2
+ import debug from 'debug';
3
+ import { Button, Image } from 'semantic-ui-react';
4
+ import { ScriptelContext } from '../Scriptel/ScriptelContext.js';
5
+
6
+ debug("thx.controls.inputs.ScriptelInput");
7
+ function ScriptelInput(props) {
8
+ const { value, onChange, buttonText = "Enter Signature" } = props;
9
+ const ctx = useContext(ScriptelContext);
10
+ const [enterSignature, setEnterSignature] = useState(false);
11
+ useEffect(() => {
12
+ if (enterSignature) {
13
+ if (onChange && ctx?.renderImage) {
14
+ setEnterSignature(false);
15
+ if (ctx.renderImage.type === "image/svg+xml" || ctx.renderImage.type === "image/png") {
16
+ onChange({
17
+ type: ctx.renderImage.type,
18
+ width: ctx.renderImage.width,
19
+ height: ctx.renderImage.height,
20
+ timestamp: new Date(),
21
+ data: ctx.renderImage.data
22
+ });
23
+ }
24
+ }
25
+ if (onChange && !ctx) {
26
+ onChange();
27
+ }
28
+ }
29
+ }, [ctx]);
30
+ if (enterSignature) {
31
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", null, ctx?.isSigning ? "signing..." : "Enter a signature and click OK."), /* @__PURE__ */ React.createElement(Button, {
32
+ onClick: () => {
33
+ setEnterSignature(false);
34
+ },
35
+ color: "black",
36
+ loading: ctx?.loading,
37
+ disabled: ctx?.loading
38
+ }, "Cancel"), /* @__PURE__ */ React.createElement(Button, {
39
+ size: "mini",
40
+ as: "a",
41
+ basic: true,
42
+ onClick: () => ctx?.socket.current?.calibrate(),
43
+ disabled: ctx?.loading
44
+ }, "Calibrate"));
45
+ }
46
+ if (value && value.data) {
47
+ return /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Image, {
48
+ size: "medium",
49
+ src: value.data,
50
+ bordered: true
51
+ }), /* @__PURE__ */ React.createElement(Button, {
52
+ size: "mini",
53
+ compact: true,
54
+ onClick: () => {
55
+ setEnterSignature(false);
56
+ if (onChange)
57
+ onChange();
58
+ }
59
+ }, "Reset"));
60
+ }
61
+ return /* @__PURE__ */ React.createElement(Button, {
62
+ onClick: () => setEnterSignature(true)
63
+ }, buttonText);
64
+ }
65
+
66
+ export { ScriptelInput };
67
+ //# sourceMappingURL=ScriptelInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScriptelInput.js","sources":["../../../../src/inputs/ScriptelInput/ScriptelInput.tsx"],"sourcesContent":["import type {ScriptelSchemaType} from '@thx/yup-types';\nimport debug from 'debug';\nimport {useContext, useEffect, useState} from 'react';\nimport {Button, Image} from 'semantic-ui-react';\nimport {ScriptelContext} from '../Scriptel/ScriptelContext';\n\nconst d = debug('thx.controls.inputs.ScriptelInput');\n\nexport interface ScriptelInputProps {\n\tvalue?: ScriptelSchemaType;\n\tonChange?: (value?: ScriptelSchemaType) => void;\n\tbuttonText?: string;\n}\n\nexport function ScriptelInput(props: ScriptelInputProps) {\n\tconst {value, onChange, buttonText = 'Enter Signature'} = props;\n\tconst ctx = useContext(ScriptelContext);\n\n\tconst [enterSignature, setEnterSignature] = useState(false);\n\n\tuseEffect(() => {\n\t\tif (enterSignature) {\n\t\t\tif (onChange && ctx?.renderImage) {\n\t\t\t\tsetEnterSignature(false);\n\t\t\t\tif (ctx.renderImage.type === 'image/svg+xml' || ctx.renderImage.type === 'image/png') {\n\t\t\t\t\tonChange({\n\t\t\t\t\t\ttype: ctx.renderImage.type,\n\t\t\t\t\t\twidth: ctx.renderImage.width,\n\t\t\t\t\t\theight: ctx.renderImage.height,\n\t\t\t\t\t\ttimestamp: new Date(),\n\t\t\t\t\t\tdata: ctx.renderImage.data,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (onChange && !ctx) {\n\t\t\t\tonChange();\n\t\t\t}\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ctx]);\n\n\tif (enterSignature) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<div>{ctx?.isSigning ? 'signing...' : 'Enter a signature and click OK.'}</div>\n\t\t\t\t<Button\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tsetEnterSignature(false);\n\t\t\t\t\t}}\n\t\t\t\t\tcolor=\"black\"\n\t\t\t\t\tloading={ctx?.loading}\n\t\t\t\t\tdisabled={ctx?.loading}\n\t\t\t\t>\n\t\t\t\t\tCancel\n\t\t\t\t</Button>\n\t\t\t\t<Button size=\"mini\" as=\"a\" basic onClick={() => ctx?.socket.current?.calibrate()} disabled={ctx?.loading}>\n\t\t\t\t\tCalibrate\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tif (value && value.data) {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t<Image size=\"medium\" src={value.data} bordered />\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"mini\"\n\t\t\t\t\tcompact\n\t\t\t\t\tonClick={() => {\n\t\t\t\t\t\tsetEnterSignature(false);\n\t\t\t\t\t\tif (onChange) onChange();\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\tReset\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn <Button onClick={() => setEnterSignature(true)}>{buttonText}</Button>;\n}\n"],"names":[],"mappings":";;;;;AAMU,MAAM,mCAAmC,EAAA;AAQ5C,SAAA,aAAA,CAAuB,KAA2B,EAAA;AACxD,EAAA,MAAM,EAAC,KAAA,EAAO,QAAU,EAAA,UAAA,GAAa,iBAAqB,EAAA,GAAA,KAAA,CAAA;AAC1D,EAAM,MAAA,GAAA,GAAM,WAAW,eAAe,CAAA,CAAA;AAEtC,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAqB,CAAA,GAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAE1D,EAAA,SAAA,CAAU,MAAM;AACf,IAAA,IAAI,cAAgB,EAAA;AACnB,MAAI,IAAA,QAAA,IAAY,KAAK,WAAa,EAAA;AACjC,QAAA,iBAAA,CAAkB,KAAK,CAAA,CAAA;AACvB,QAAA,IAAI,IAAI,WAAY,CAAA,IAAA,KAAS,mBAAmB,GAAI,CAAA,WAAA,CAAY,SAAS,WAAa,EAAA;AACrF,UAAS,QAAA,CAAA;AAAA,YACR,IAAA,EAAM,IAAI,WAAY,CAAA,IAAA;AAAA,YACtB,KAAA,EAAO,IAAI,WAAY,CAAA,KAAA;AAAA,YACvB,MAAA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QAAQ,EAAA,IAAA;AAAA,KAAC,mBAC9C,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,MACA,IAAK,EAAA,MAAA;AAAA,MACL,OAAO,EAAA,IAAA;AAAA,MACP,SAAS,MAAM;AACd,QAAA,iBAAA,CAAkB,KAAK,CAAA,CAAA;AACvB,QAAI,IAAA,QAAA;AAAU,UAAS,QAAA,EAAA,CAAA;AAAA,OACxB;AAAA,KAAA,EACA,OAED,CACD,CAAA,CAAA;AAAA,GAEF;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,IAAO,OAAA,EAAS,MAAM,iBAAA,CAAkB,IAAI,CAAA;AAAA,GAAA,EAAI,UAAW,CAAA,CAAA;AACpE;;;;"}
@@ -0,0 +1,54 @@
1
+ import React, { useState, useCallback, useMemo } from 'react';
2
+ import debug from 'debug';
3
+ import { Input, Icon } from 'semantic-ui-react';
4
+ import SIN from 'social-insurance-number';
5
+ import { useMaskedInput } from '../MaskedInput/useMaskedInput.js';
6
+
7
+ debug("thx.controls.inputs.SinInput");
8
+ function SinInput(props) {
9
+ const { value, onChange, ...rest } = props;
10
+ const [color, setColor] = useState("black");
11
+ const checkValidation = useCallback((valueArray) => {
12
+ const num = valueArray.join("").replaceAll(/(_|\s|-)/g, "");
13
+ const validate = new SIN(num);
14
+ if (num.length > 0) {
15
+ if (validate.isValid()) {
16
+ setColor("green");
17
+ } else {
18
+ setColor("red");
19
+ }
20
+ } else {
21
+ setColor("black");
22
+ }
23
+ return validate.isValid();
24
+ }, []);
25
+ const mask = useMemo(() => ({
26
+ mask: "999-999-999",
27
+ isComplete: checkValidation,
28
+ greedy: false,
29
+ autoUnmask: true
30
+ }), [checkValidation]);
31
+ const cardNumberRef = useMaskedInput({
32
+ mask,
33
+ value,
34
+ onChange: (v) => {
35
+ onChange && onChange(v);
36
+ },
37
+ onSet: (v) => {
38
+ checkValidation([v || ""]);
39
+ }
40
+ });
41
+ return /* @__PURE__ */ React.createElement(Input, {
42
+ ...rest,
43
+ icon: true
44
+ }, /* @__PURE__ */ React.createElement("input", {
45
+ ref: cardNumberRef
46
+ }), /* @__PURE__ */ React.createElement(Icon, {
47
+ name: "id badge",
48
+ color,
49
+ size: "large"
50
+ }));
51
+ }
52
+
53
+ export { SinInput };
54
+ //# sourceMappingURL=SinInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SinInput.js","sources":["../../../../src/inputs/SinInput/SinInput.tsx"],"sourcesContent":["import debug from 'debug';\nimport {useCallback, useMemo, useState} from 'react';\nimport {Icon, Input, SemanticCOLORS} from 'semantic-ui-react';\nimport SIN from 'social-insurance-number';\nimport type {MaskedInputProps} from '../MaskedInput';\nimport {useMaskedInput} from '../MaskedInput/useMaskedInput';\n\nconst d = debug('thx.controls.inputs.SinInput');\n\nexport interface SinInputProps extends Omit<MaskedInputProps, 'mask'> {\n\tvalue?: string;\n\tonChange(value?: string): void;\n}\n\nexport function SinInput(props: SinInputProps) {\n\tconst {value, onChange, ...rest} = props;\n\tconst [color, setColor] = useState<SemanticCOLORS>('black');\n\n\tconst checkValidation = useCallback((valueArray: string[]) => {\n\t\tconst num = valueArray.join('').replaceAll(/(_|\\s|-)/g, '');\n\t\tconst validate = new SIN(num);\n\t\tif (num.length > 0) {\n\t\t\tif (validate.isValid()) {\n\t\t\t\tsetColor('green');\n\t\t\t} else {\n\t\t\t\tsetColor('red');\n\t\t\t}\n\t\t} else {\n\t\t\tsetColor('black');\n\t\t}\n\t\treturn validate.isValid();\n\t}, []);\n\n\tconst mask: MaskedInputProps['mask'] = useMemo(\n\t\t() => ({\n\t\t\tmask: '999-999-999',\n\t\t\tisComplete: checkValidation,\n\t\t\tgreedy: false,\n\t\t\tautoUnmask: true,\n\t\t}),\n\t\t[checkValidation],\n\t);\n\n\tconst cardNumberRef = useMaskedInput({\n\t\tmask,\n\t\tvalue,\n\t\tonChange: v => {\n\t\t\tonChange && onChange(v);\n\t\t},\n\t\tonSet: v => {\n\t\t\tcheckValidation([v || '']);\n\t\t},\n\t});\n\n\treturn (\n\t\t<Input {...rest} icon>\n\t\t\t<input ref={cardNumberRef} />\n\t\t\t<Icon name=\"id badge\" color={color} size=\"large\" />\n\t\t</Input>\n\t);\n}\n"],"names":[],"mappings":";;;;;;AAOU,MAAM,8BAA8B,EAAA;AAOvC,SAAA,QAAA,CAAkB,KAAsB,EAAA;AAC9C,EAAM,MAAA,EAAC,KAAO,EAAA,QAAA,EAAA,GAAa,IAAQ,EAAA,GAAA,KAAA,CAAA;AACnC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAY,CAAA,GAAA,QAAA,CAAyB,OAAO,CAAA,CAAA;AAE1D,EAAM,MAAA,eAAA,GAAkB,WAAY,CAAA,CAAC,UAAyB,KAAA;AAC7D,IAAA,MAAM,MAAM,UAAW,CAAA,IAAA,CAAK,EAAE,CAAE,CAAA,UAAA,CAAW,aAAa,EAAE,CAAA,CAAA;AAC1D,IAAM,MAAA,QAAA,GAAW,IAAI,GAAA,CAAI,GAAG,CAAA,CAAA;AAC5B,IAAI,IAAA,GAAA,CAAI,SAAS,CAAG,EAAA;AACnB,MAAI,IAAA,QAAA,CAAS,SAAW,EAAA;AACvB,QAAA,QAAA,CAAS,OAAO,CAAA,CAAA;AAAA,OACV,MAAA;AACN,QAAA,QAAA,CAAS,KAAK,CAAA,CAAA;AAAA,OACf;AAAA,KACM,MAAA;AACN,MAAA,QAAA,CAAS,OAAO,CAAA,CAAA;AAAA,KACjB;AACA,IAAA,OAAO,SAAS,OAAQ,EAAA,CAAA;AAAA,GACzB,EAAG,EAAE,CAAA,CAAA;AAEL,EAAM,MAAA,IAAA,GAAiC,QACtC,OAAO;AAAA,IACN,IAAM,EAAA,aAAA;AAAA,IACN,UAAY,EAAA,eAAA;AAAA,IACZ,MAAQ,EAAA,KAAA;AAAA,IACR,UAAY,EAAA,IAAA;AAAA,GACb,CAAA,EACA,CAAC,eAAe,CACjB,CAAA,CAAA;AAEA,EAAA,MAAM,gBAAgB,cAAe,CAAA;AAAA,IACpC,IAAA;AAAA,IACA,KAAA;AAAA,IACA,UAAU,CAAK,CAAA,KAAA;AACd,MAAA,QAAA,IAAY,SAAS,CAAC,CAAA,CAAA;AAAA,KACvB;AAAA,IACA,OAAO,CAAK,CAAA,KAAA;AACX,MAAgB,eAAA,CAAA,CAAC,CAAK,IAAA,EAAE,CAAC,CAAA,CAAA;AAAA,KAC1B;AAAA,GACA,CAAA,CAAA;AAED,EAAA,uBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,IAAU,GAAA,IAAA;AAAA,IAAM,IAAI,EAAA,IAAA;AAAA,GAAA,kBACnB,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA;AAAA,IAAM,GAAK,EAAA,aAAA;AAAA,GAAe,mBAC1B,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA;AAAA,IAAK,IAAK,EAAA,UAAA;AAAA,IAAW,KAAA;AAAA,IAAc,IAAK,EAAA,OAAA;AAAA,GAAQ,CAClD,CAAA,CAAA;AAEF;;;;"}
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Dropdown } from 'semantic-ui-react';
3
+
4
+ function DropdownCell(dropdownProps) {
5
+ return function DropdownCellFn(props) {
6
+ const {
7
+ value,
8
+ row: { index: rowIndex },
9
+ column: { id },
10
+ updateData
11
+ } = props;
12
+ const { value: v, onChange, ...rest } = dropdownProps;
13
+ return /* @__PURE__ */ React.createElement(Dropdown, {
14
+ ...rest,
15
+ value,
16
+ onChange: (event, val) => {
17
+ updateData(rowIndex, id, val.value);
18
+ if (onChange)
19
+ onChange(event, val);
20
+ }
21
+ });
22
+ };
23
+ }
24
+
25
+ export { DropdownCell };
26
+ //# sourceMappingURL=DropdownCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropdownCell.js","sources":["../../../../src/inputs/TableInput/DropdownCell.tsx"],"sourcesContent":["import {Dropdown} from 'semantic-ui-react';\nimport type {DropdownProps} from 'semantic-ui-react';\nimport type {TableCellProps} from './TableInput';\n\nexport function DropdownCell<D extends Record<string, unknown>>(dropdownProps: DropdownProps) {\n\treturn function DropdownCellFn(props: TableCellProps<D>) {\n\t\tconst {\n\t\t\tvalue,\n\t\t\trow: {index: rowIndex},\n\t\t\tcolumn: {id},\n\t\t\tupdateData,\n\t\t} = props;\n\n\t\t// eslint-disable-next-line no-unused-vars,@typescript-eslint/no-unused-vars\n\t\tconst {value: v, onChange, ...rest} = dropdownProps;\n\n\t\treturn (\n\t\t\t<Dropdown\n\t\t\t\t{...rest}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={(event, val) => {\n\t\t\t\t\tupdateData(rowIndex, id, val.value);\n\t\t\t\t\tif (onChange) onChange(event, val);\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\t};\n}\n"],"names":[],"mappings":";;;AAIO,SAAA,YAAA,CAAyD,aAA8B,EAAA;AAC7F,EAAA,OAAO,wBAAwB,KAA0B,EAAA;AACxD,IAAM,MAAA;AAAA,MACL,KAAA;AAAA,MACA,GAAA,EAAK,EAAC,KAAO,EAAA,QAAA,EAAA;AAAA,MACb,QAAQ,EAAC,EAAA,EAAA;AAAA,MACT,UAAA;AAAA,KACG,GAAA,KAAA,CAAA;AAGJ,IAAA,MAAM,EAAC,KAAA,EAAO,CAAG,EAAA,QAAA,EAAA,GAAa,IAAQ,EAAA,GAAA,aAAA,CAAA;AAEtC,IAAA,uBACE,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA;AAAA,MACI,GAAA,IAAA;AAAA,MACJ,KAAA;AAAA,MACA,QAAA,EAAU,CAAC,KAAA,EAAO,GAAQ,KAAA;AACzB,QAAW,UAAA,CAAA,QAAA,EAAU,EAAI,EAAA,GAAA,CAAI,KAAK,CAAA,CAAA;AAClC,QAAI,IAAA,QAAA;AAAU,UAAA,QAAA,CAAS,OAAO,GAAG,CAAA,CAAA;AAAA,OAClC;AAAA,KACD,CAAA,CAAA;AAAA,GAEF,CAAA;AACD;;;;"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import debug from 'debug';
3
+
4
+ debug("thx.controls.inputs.TableInput.HoverCell");
5
+ function HoverCell(options) {
6
+ return function HoverCellFn(props) {
7
+ const { Action } = options;
8
+ if (props.hoverRow === props.row.id) {
9
+ return /* @__PURE__ */ React.createElement("div", {
10
+ style: { textAlign: "right" }
11
+ }, /* @__PURE__ */ React.createElement(Action, {
12
+ ...props
13
+ }));
14
+ }
15
+ return null;
16
+ };
17
+ }
18
+
19
+ export { HoverCell };
20
+ //# sourceMappingURL=HoverCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HoverCell.js","sources":["../../../../src/inputs/TableInput/HoverCell.tsx"],"sourcesContent":["import debug from 'debug';\nimport type {CellProps, Renderer} from 'react-table';\n\nconst d = debug('thx.controls.inputs.TableInput.HoverCell');\n\ninterface HoverCellOptions<D extends Record<string, unknown>> {\n\tAction: Renderer<CellProps<D>>;\n}\n\nexport function HoverCell<D extends Record<string, unknown>>(options: HoverCellOptions<D>) {\n\treturn function HoverCellFn(props: CellProps<D>) {\n\t\tconst {Action} = options;\n\n\t\t// @ts-expect-error\n\t\tif (props.hoverRow === props.row.id) {\n\t\t\treturn (\n\t\t\t\t<div style={{textAlign: 'right'}}>\n\t\t\t\t\t{/* @ts-expect-error */}\n\t\t\t\t\t<Action {...props} />\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\t\treturn null;\n\t};\n}\n"],"names":[],"mappings":";;;AAGU,MAAM,0CAA0C,EAAA;AAMnD,SAAA,SAAA,CAAsD,OAA8B,EAAA;AAC1F,EAAA,OAAO,qBAAqB,KAAqB,EAAA;AAChD,IAAA,MAAM,EAAC,MAAU,EAAA,GAAA,OAAA,CAAA;AAGjB,IAAA,IAAI,KAAM,CAAA,QAAA,KAAa,KAAM,CAAA,GAAA,CAAI,EAAI,EAAA;AACpC,MAAA,uBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,QAAI,KAAA,EAAO,EAAC,SAAA,EAAW,OAAO,EAAA;AAAA,OAAA,kBAE7B,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AAAA,QAAW,GAAA,KAAA;AAAA,OAAO,CACpB,CAAA,CAAA;AAAA,KAEF;AACA,IAAO,OAAA,IAAA,CAAA;AAAA,GACR,CAAA;AACD;;;;"}
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { formatMoney } from '@thx/money';
3
+
4
+ function MoneyCell(options) {
5
+ return function MoneyCellFn(props) {
6
+ return /* @__PURE__ */ React.createElement("div", {
7
+ style: { textAlign: "right" }
8
+ }, formatMoney(options?.overrideValue ? options.overrideValue(props) : props.value));
9
+ };
10
+ }
11
+
12
+ export { MoneyCell };
13
+ //# sourceMappingURL=MoneyCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoneyCell.js","sources":["../../../../src/inputs/TableInput/MoneyCell.tsx"],"sourcesContent":["import {formatMoney} from '@thx/money';\nimport type Money from 'js-money';\nimport type {CellProps} from 'react-table';\n\ninterface MoneyCellOptions<D extends Record<string, unknown>> {\n\t/** If provided, this function will override the Money value displayed */\n\toverrideValue?: (props: CellProps<D, Money>) => Money;\n}\n\nexport function MoneyCell<D extends Record<string, unknown>>(options?: MoneyCellOptions<D>) {\n\treturn function MoneyCellFn(props: CellProps<D, Money>) {\n\t\treturn <div style={{textAlign: 'right'}}>{formatMoney(options?.overrideValue ? options.overrideValue(props) : props.value)}</div>;\n\t};\n}\n"],"names":[],"mappings":";;;AASO,SAAA,SAAA,CAAsD,OAA+B,EAAA;AAC3F,EAAA,OAAO,qBAAqB,KAA4B,EAAA;AACvD,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MAAI,KAAA,EAAO,EAAC,SAAA,EAAW,OAAO,EAAA;AAAA,KAAI,EAAA,WAAA,CAAY,SAAS,aAAgB,GAAA,OAAA,CAAQ,cAAc,KAAK,CAAA,GAAI,KAAM,CAAA,KAAK,CAAE,CAAA,CAAA;AAAA,GAC5H,CAAA;AACD;;;;"}
@@ -0,0 +1,30 @@
1
+ import React, { useState } from 'react';
2
+ import debug from 'debug';
3
+ import { MoneyInput } from '../../money/MoneyInput/MoneyInput.js';
4
+ import { addRowOnTab } from './addRowOnTab.js';
5
+
6
+ debug("thx.controls.inputs.TableInput.MoneyEditCell");
7
+ function MoneyEditCell(opts) {
8
+ return function MoneyEditCellFn(props) {
9
+ const {
10
+ value: initialValue,
11
+ row: { index: rowIndex },
12
+ column: { id },
13
+ updateData
14
+ } = props;
15
+ const [value, setValue] = useState(initialValue);
16
+ return /* @__PURE__ */ React.createElement(MoneyInput, {
17
+ fluid: true,
18
+ transparent: true,
19
+ value,
20
+ onChange: setValue,
21
+ onBlur: () => {
22
+ updateData(rowIndex, id, value);
23
+ },
24
+ onKeyDown: (event) => addRowOnTab(event, value, props, opts?.addRowOnTabIf)
25
+ });
26
+ };
27
+ }
28
+
29
+ export { MoneyEditCell };
30
+ //# sourceMappingURL=MoneyEditCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoneyEditCell.js","sources":["../../../../src/inputs/TableInput/MoneyEditCell.tsx"],"sourcesContent":["import debug from 'debug';\nimport type Money from 'js-money';\nimport {useState} from 'react';\nimport {MoneyInput} from '../../money/MoneyInput';\nimport type {TableCellProps} from './TableInput';\nimport type {AddRowOnTabIf} from './addRowOnTab';\nimport {addRowOnTab} from './addRowOnTab';\n\nconst d = debug('thx.controls.inputs.TableInput.MoneyEditCell');\n\ninterface MoneyEditCellOptions<D extends Record<string, unknown>> {\n\t/** If function is present, and returns true, will add a new row if tab is pressed on the last row */\n\taddRowOnTabIf?: AddRowOnTabIf<D, Money>;\n}\n\nexport function MoneyEditCell<D extends Record<string, unknown>>(opts?: MoneyEditCellOptions<D>) {\n\treturn function MoneyEditCellFn(props: TableCellProps<D, Money>) {\n\t\tconst {\n\t\t\tvalue: initialValue,\n\t\t\trow: {index: rowIndex},\n\t\t\tcolumn: {id},\n\t\t\tupdateData,\n\t\t} = props;\n\n\t\tconst [value, setValue] = useState(initialValue);\n\n\t\treturn (\n\t\t\t<MoneyInput\n\t\t\t\tfluid\n\t\t\t\ttransparent\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={setValue}\n\t\t\t\tonBlur={() => {\n\t\t\t\t\tupdateData(rowIndex, id, value);\n\t\t\t\t}}\n\t\t\t\tonKeyDown={(event: KeyboardEvent) => addRowOnTab(event, value, props, opts?.addRowOnTabIf)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"],"names":[],"mappings":";;;;;AAQU,MAAM,8CAA8C,EAAA;AAOvD,SAAA,aAAA,CAA0D,IAAgC,EAAA;AAChG,EAAA,OAAO,yBAAyB,KAAiC,EAAA;AAChE,IAAM,MAAA;AAAA,MACL,KAAO,EAAA,YAAA;AAAA,MACP,GAAA,EAAK,EAAC,KAAO,EAAA,QAAA,EAAA;AAAA,MACb,QAAQ,EAAC,EAAA,EAAA;AAAA,MACT,UAAA;AAAA,KACG,GAAA,KAAA,CAAA;AAEJ,IAAA,MAAM,CAAC,KAAA,EAAO,QAAY,CAAA,GAAA,QAAA,CAAS,YAAY,CAAA,CAAA;AAE/C,IAAA,uBACE,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA;AAAA,MACA,KAAK,EAAA,IAAA;AAAA,MACL,WAAW,EAAA,IAAA;AAAA,MACX,KAAA;AAAA,MACA,QAAU,EAAA,QAAA;AAAA,MACV,QAAQ,MAAM;AACb,QAAW,UAAA,CAAA,QAAA,EAAU,IAAI,KAAK,CAAA,CAAA;AAAA,OAC/B;AAAA,MACA,SAAA,EAAW,CAAC,KAAyB,KAAA,WAAA,CAAY,OAAO,KAAO,EAAA,KAAA,EAAO,MAAM,aAAa,CAAA;AAAA,KAC1F,CAAA,CAAA;AAAA,GAEF,CAAA;AACD;;;;"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { toMoney, formatMoney } from '@thx/money';
3
+
4
+ function MoneySumFooter(options) {
5
+ const { id } = options || {};
6
+ return function MoneySumFooterInstance(info) {
7
+ const sum = info.rows.reduce((memo, row) => memo.add(row.values[id]), toMoney());
8
+ return /* @__PURE__ */ React.createElement("div", {
9
+ style: { textAlign: "right" }
10
+ }, formatMoney(sum));
11
+ };
12
+ }
13
+
14
+ export { MoneySumFooter };
15
+ //# sourceMappingURL=MoneySumFooter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoneySumFooter.js","sources":["../../../../src/inputs/TableInput/MoneySumFooter.tsx"],"sourcesContent":["import {formatMoney, toMoney} from '@thx/money';\nimport type {IdType, TableInstance} from 'react-table';\n\ninterface MoneySumFooterOptions<A extends Record<string, unknown>> {\n\tid: IdType<A>;\n}\n\nexport function MoneySumFooter<A extends Record<string, unknown>>(options: MoneySumFooterOptions<A>) {\n\tconst {id} = options || {};\n\n\treturn function MoneySumFooterInstance(info: TableInstance<A>) {\n\t\tconst sum = info.rows.reduce((memo, row) => memo.add(row.values[id]), toMoney());\n\t\treturn <div style={{textAlign: 'right'}}>{formatMoney(sum)}</div>;\n\t};\n}\n"],"names":[],"mappings":";;;AAOO,SAAA,cAAA,CAA2D,OAAmC,EAAA;AACpG,EAAM,MAAA,EAAC,EAAM,EAAA,GAAA,OAAA,IAAW,EAAC,CAAA;AAEzB,EAAA,OAAO,gCAAgC,IAAwB,EAAA;AAC9D,IAAA,MAAM,GAAM,GAAA,IAAA,CAAK,IAAK,CAAA,MAAA,CAAO,CAAC,IAAM,EAAA,GAAA,KAAQ,IAAK,CAAA,GAAA,CAAI,GAAI,CAAA,MAAA,CAAO,EAAG,CAAA,CAAA,EAAG,SAAS,CAAA,CAAA;AAC/E,IAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MAAI,KAAA,EAAO,EAAC,SAAA,EAAW,OAAO,EAAA;AAAA,KAAI,EAAA,WAAA,CAAY,GAAG,CAAE,CAAA,CAAA;AAAA,GAC5D,CAAA;AACD;;;;"}
@@ -0,0 +1,34 @@
1
+ import React, { useState } from 'react';
2
+ import debug from 'debug';
3
+ import { Input } from 'semantic-ui-react';
4
+ import { addRowOnTab } from './addRowOnTab.js';
5
+
6
+ debug("thx.controls.inputs.TableInput.StringEditCell");
7
+ function StringEditCell(options) {
8
+ const { inputProps, addRowOnTabIf } = options || {};
9
+ return function StringEditCellFn(props) {
10
+ const {
11
+ value: initialValue,
12
+ row: { index },
13
+ column: { id },
14
+ updateData
15
+ } = props;
16
+ const [value, setValue] = useState(initialValue);
17
+ return /* @__PURE__ */ React.createElement(Input, {
18
+ fluid: true,
19
+ transparent: true,
20
+ ...inputProps,
21
+ value,
22
+ onChange: (ev, v) => {
23
+ setValue(v.value);
24
+ },
25
+ onBlur: () => {
26
+ updateData(index, id, value);
27
+ },
28
+ onKeyDown: (event) => addRowOnTab(event, value, props, addRowOnTabIf)
29
+ });
30
+ };
31
+ }
32
+
33
+ export { StringEditCell };
34
+ //# sourceMappingURL=StringEditCell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StringEditCell.js","sources":["../../../../src/inputs/TableInput/StringEditCell.tsx"],"sourcesContent":["import debug from 'debug';\nimport {useState} from 'react';\nimport {Input, InputProps} from 'semantic-ui-react';\nimport type {TableCellProps} from './TableInput';\nimport type {AddRowOnTabIf} from './addRowOnTab';\nimport {addRowOnTab} from './addRowOnTab';\n\nconst d = debug('thx.controls.inputs.TableInput.StringEditCell');\n\ninterface StringEditCellOptions<D extends Record<string, unknown>> {\n\t/** Override SemanticUI Input props */\n\tinputProps?: InputProps;\n\t/** If function is present, and returns true, will add a new row if tab is pressed on the last row */\n\taddRowOnTabIf?: AddRowOnTabIf<D, string>;\n}\n\nexport function StringEditCell<D extends Record<string, unknown>>(options?: StringEditCellOptions<D>) {\n\tconst {inputProps, addRowOnTabIf} = options || {};\n\n\treturn function StringEditCellFn(props: TableCellProps<D, string>) {\n\t\tconst {\n\t\t\tvalue: initialValue,\n\t\t\trow: {index},\n\t\t\tcolumn: {id},\n\t\t\tupdateData,\n\t\t} = props;\n\n\t\tconst [value, setValue] = useState(initialValue);\n\n\t\treturn (\n\t\t\t<Input\n\t\t\t\tfluid\n\t\t\t\ttransparent\n\t\t\t\t{...inputProps}\n\t\t\t\tvalue={value}\n\t\t\t\tonChange={(ev, v) => {\n\t\t\t\t\tsetValue(v.value);\n\t\t\t\t}}\n\t\t\t\tonBlur={() => {\n\t\t\t\t\tupdateData(index, id, value);\n\t\t\t\t}}\n\t\t\t\tonKeyDown={(event: KeyboardEvent) => addRowOnTab(event, value, props, addRowOnTabIf)}\n\t\t\t/>\n\t\t);\n\t};\n}\n"],"names":[],"mappings":";;;;;AAOU,MAAM,+CAA+C,EAAA;AASxD,SAAA,cAAA,CAA2D,OAAoC,EAAA;AACrG,EAAA,MAAM,EAAC,UAAA,EAAY,aAAiB,EAAA,GAAA,OAAA,IAAW,EAAC,CAAA;AAEhD,EAAA,OAAO,0BAA0B,KAAkC,EAAA;AAClE,IAAM,MAAA;AAAA,MACL,KAAO,EAAA,YAAA;AAAA,MACP,KAAK,EAAC,KAAA,EAAA;AAAA,MACN,QAAQ,EAAC,EAAA,EAAA;AAAA,MACT,UAAA;AAAA,KACG,GAAA,KAAA,CAAA;AAEJ,IAAA,MAAM,CAAC,KAAA,EAAO,QAAY,CAAA,GAAA,QAAA,CAAS,YAAY,CAAA,CAAA;AAE/C,IAAA,uBACE,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAA,MACA,KAAK,EAAA,IAAA;AAAA,MACL,WAAW,EAAA,IAAA;AAAA,MACP,GAAA,UAAA;AAAA,MACJ,KAAA;AAAA,MACA,QAAA,EAAU,CAAC,EAAA,EAAI,CAAM,KAAA;AACpB,QAAA,QAAA,CAAS,EAAE,KAAK,CAAA,CAAA;AAAA,OACjB;AAAA,MACA,QAAQ,MAAM;AACb,QAAW,UAAA,CAAA,KAAA,EAAO,IAAI,KAAK,CAAA,CAAA;AAAA,OAC5B;AAAA,MACA,WAAW,CAAC,KAAA,KAAyB,YAAY,KAAO,EAAA,KAAA,EAAO,OAAO,aAAa,CAAA;AAAA,KACpF,CAAA,CAAA;AAAA,GAEF,CAAA;AACD;;;;"}
@@ -0,0 +1,75 @@
1
+ import React, { useMemo, useState } from 'react';
2
+ import debug from 'debug';
3
+ import { FieldArray } from 'formik';
4
+ import { useTable } from 'react-table';
5
+ import { Table } from 'semantic-ui-react';
6
+
7
+ debug("thx.controls.inputs.TableInput");
8
+ function TableInputTable(props) {
9
+ const {
10
+ name,
11
+ columns,
12
+ values,
13
+ arrayHelpers,
14
+ setFieldValue,
15
+ createRow,
16
+ tableProps,
17
+ headerRowProps,
18
+ headerCellProps,
19
+ bodyProps,
20
+ rowProps,
21
+ cellProps,
22
+ footerCellProps,
23
+ footerRowProps
24
+ } = props;
25
+ const cols = useMemo(() => columns, [columns]);
26
+ const vals = useMemo(() => values, [values]);
27
+ const [hoverRow, setHoverRow] = useState("");
28
+ const { getTableProps, getTableBodyProps, headerGroups, prepareRow, rows, footerGroups } = useTable({
29
+ columns: cols,
30
+ data: vals,
31
+ updateData(rowIndex, columnId, value) {
32
+ setFieldValue(`${name}[${rowIndex}].${columnId}`, value);
33
+ },
34
+ addRow() {
35
+ arrayHelpers.push(createRow());
36
+ },
37
+ arrayHelpers
38
+ });
39
+ const hasFooter = footerGroups.some((fg) => fg.headers.some((fgh) => fgh.Footer.name !== "emptyRenderer"));
40
+ const footer = hasFooter ? /* @__PURE__ */ React.createElement(Table.Footer, null, footerGroups.map((group) => /* @__PURE__ */ React.createElement(Table.Row, {
41
+ ...{ ...group.getFooterGroupProps(), ...group.getFooterGroupProps(footerRowProps) }
42
+ }, group.headers.map((column) => /* @__PURE__ */ React.createElement(Table.HeaderCell, {
43
+ ...{ ...column.getFooterProps(), ...column.getFooterProps(footerCellProps) }
44
+ }, column.render("Footer")))))) : null;
45
+ return /* @__PURE__ */ React.createElement(Table, {
46
+ ...{ ...getTableProps(), ...getTableProps(tableProps) }
47
+ }, /* @__PURE__ */ React.createElement(Table.Header, null, headerGroups.map((headerGroup) => /* @__PURE__ */ React.createElement(Table.Row, {
48
+ ...{ ...headerGroup.getHeaderGroupProps(), ...headerGroup.getHeaderGroupProps(headerRowProps) }
49
+ }, headerGroup.headers.map((column) => /* @__PURE__ */ React.createElement(Table.HeaderCell, {
50
+ ...{ ...column.getHeaderProps(), ...column.getHeaderProps(headerCellProps) }
51
+ }, column.render("Header")))))), /* @__PURE__ */ React.createElement(Table.Body, {
52
+ ...{ ...getTableBodyProps(), ...getTableBodyProps(bodyProps) }
53
+ }, rows.map((row) => {
54
+ prepareRow(row);
55
+ return /* @__PURE__ */ React.createElement(Table.Row, {
56
+ ...{ ...row.getRowProps(), ...row.getRowProps(rowProps) },
57
+ onMouseEnter: () => setHoverRow(row.id),
58
+ onMouseLeave: () => setHoverRow("")
59
+ }, row.cells.map((cell) => /* @__PURE__ */ React.createElement(Table.Cell, {
60
+ ...{ ...cell.getCellProps(), ...cell.getCellProps(cellProps) }
61
+ }, cell.render("Cell", { hoverRow }))));
62
+ })), footer);
63
+ }
64
+ function TableInput(props) {
65
+ return /* @__PURE__ */ React.createElement(FieldArray, {
66
+ name: props.name,
67
+ render: (arrayHelpers) => /* @__PURE__ */ React.createElement(TableInputTable, {
68
+ arrayHelpers,
69
+ ...props
70
+ })
71
+ });
72
+ }
73
+
74
+ export { TableInput };
75
+ //# sourceMappingURL=TableInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableInput.js","sources":["../../../../src/inputs/TableInput/TableInput.tsx"],"sourcesContent":["import debug from 'debug';\nimport {FieldArray, FieldArrayRenderProps} from 'formik';\nimport {useMemo, useState} from 'react';\nimport {\n\tCellPropGetter,\n\tCellProps,\n\tColumn,\n\tFooterGroupPropGetter,\n\tFooterPropGetter,\n\tHeaderGroupPropGetter,\n\tHeaderPropGetter,\n\tRowPropGetter,\n\tTableBodyPropGetter,\n\tuseTable,\n} from 'react-table';\nimport {Table, TableProps} from 'semantic-ui-react';\n\nconst d = debug('thx.controls.inputs.TableInput');\n\ntype DefaultTableType = Record<string, unknown>;\n\ninterface TableInputProps<A extends DefaultTableType> {\n\tname: string;\n\tvalues: A[];\n\tcolumns: Column<A>[];\n\tsetFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => void;\n\tcreateRow: () => A;\n\ttableProps?: TableProps;\n\theaderRowProps?: HeaderGroupPropGetter<A>;\n\theaderCellProps?: HeaderPropGetter<A>;\n\tfooterRowProps?: FooterGroupPropGetter<A>;\n\tfooterCellProps?: FooterPropGetter<A>;\n\tbodyProps?: TableBodyPropGetter<A>;\n\trowProps?: RowPropGetter<A>;\n\tcellProps?: CellPropGetter<A>;\n}\n\ninterface TableInputTableProps<A extends DefaultTableType> extends TableInputProps<A> {\n\tarrayHelpers: FieldArrayRenderProps;\n}\n\nexport interface TableCellProps<D extends DefaultTableType, V = any> extends CellProps<D, V> {\n\tarrayHelpers: FieldArrayRenderProps;\n\taddRow: () => void;\n\tupdateData: (index: number, id: string, value: V) => void;\n}\n\nfunction TableInputTable<A extends DefaultTableType>(props: TableInputTableProps<A>) {\n\tconst {\n\t\tname,\n\t\tcolumns,\n\t\tvalues,\n\t\tarrayHelpers,\n\t\tsetFieldValue,\n\t\tcreateRow,\n\t\ttableProps,\n\t\theaderRowProps,\n\t\theaderCellProps,\n\t\tbodyProps,\n\t\trowProps,\n\t\tcellProps,\n\t\tfooterCellProps,\n\t\tfooterRowProps,\n\t} = props;\n\tconst cols = useMemo(() => columns, [columns]);\n\tconst vals = useMemo(() => values, [values]);\n\tconst [hoverRow, setHoverRow] = useState('');\n\n\t// React-Table hook\n\tconst {getTableProps, getTableBodyProps, headerGroups, prepareRow, rows, footerGroups} = useTable<A>({\n\t\tcolumns: cols,\n\t\tdata: vals,\n\t\t// @ts-ignore\n\t\tupdateData(rowIndex, columnId, value) {\n\t\t\tsetFieldValue(`${name}[${rowIndex}].${columnId}`, value);\n\t\t},\n\t\taddRow() {\n\t\t\tarrayHelpers.push(createRow());\n\t\t},\n\t\tarrayHelpers,\n\t});\n\n\t// @ts-ignore Check for the existence of a Footer that is not the default emptyRenderer()\n\tconst hasFooter = footerGroups.some(fg => fg.headers.some(fgh => fgh.Footer.name !== 'emptyRenderer'));\n\n\t// Build Footer if any footer renderers exist\n\tconst footer = hasFooter ? (\n\t\t<Table.Footer>\n\t\t\t{footerGroups.map(group => (\n\t\t\t\t// eslint-disable-next-line react/jsx-key\n\t\t\t\t<Table.Row {...{...group.getFooterGroupProps(), ...group.getFooterGroupProps(footerRowProps)}}>\n\t\t\t\t\t{group.headers.map(column => (\n\t\t\t\t\t\t// eslint-disable-next-line react/jsx-key\n\t\t\t\t\t\t<Table.HeaderCell {...{...column.getFooterProps(), ...column.getFooterProps(footerCellProps)}}>\n\t\t\t\t\t\t\t{column.render('Footer')}\n\t\t\t\t\t\t</Table.HeaderCell>\n\t\t\t\t\t))}\n\t\t\t\t</Table.Row>\n\t\t\t))}\n\t\t</Table.Footer>\n\t) : null;\n\n\treturn (\n\t\t<Table {...{...getTableProps(), ...getTableProps(tableProps)}}>\n\t\t\t<Table.Header>\n\t\t\t\t{headerGroups.map(headerGroup => (\n\t\t\t\t\t// eslint-disable-next-line react/jsx-key\n\t\t\t\t\t<Table.Row {...{...headerGroup.getHeaderGroupProps(), ...headerGroup.getHeaderGroupProps(headerRowProps)}}>\n\t\t\t\t\t\t{headerGroup.headers.map(column => (\n\t\t\t\t\t\t\t// eslint-disable-next-line react/jsx-key\n\t\t\t\t\t\t\t<Table.HeaderCell {...{...column.getHeaderProps(), ...column.getHeaderProps(headerCellProps)}}>\n\t\t\t\t\t\t\t\t{column.render('Header')}\n\t\t\t\t\t\t\t</Table.HeaderCell>\n\t\t\t\t\t\t))}\n\t\t\t\t\t</Table.Row>\n\t\t\t\t))}\n\t\t\t</Table.Header>\n\t\t\t<Table.Body {...{...getTableBodyProps(), ...getTableBodyProps(bodyProps)}}>\n\t\t\t\t{rows.map(row => {\n\t\t\t\t\tprepareRow(row);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t// eslint-disable-next-line react/jsx-key\n\t\t\t\t\t\t<Table.Row\n\t\t\t\t\t\t\t{...{...row.getRowProps(), ...row.getRowProps(rowProps)}}\n\t\t\t\t\t\t\tonMouseEnter={() => setHoverRow(row.id)}\n\t\t\t\t\t\t\tonMouseLeave={() => setHoverRow('')}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{row.cells.map(cell => (\n\t\t\t\t\t\t\t\t// eslint-disable-next-line react/jsx-key\n\t\t\t\t\t\t\t\t<Table.Cell {...{...cell.getCellProps(), ...cell.getCellProps(cellProps)}}>{cell.render('Cell', {hoverRow})}</Table.Cell>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</Table.Row>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</Table.Body>\n\t\t\t{footer}\n\t\t</Table>\n\t);\n}\n\n/**\n * Can be used in a TForm as a Table Input.\n * @param props\n * @constructor\n */\nexport function TableInput<A extends DefaultTableType>(props: TableInputProps<A>) {\n\treturn <FieldArray name={props.name} render={arrayHelpers => <TableInputTable arrayHelpers={arrayHelpers} {...props} />} />;\n}\n"],"names":[],"mappings":";;;;;;AAiBU,MAAM,gCAAgC,EAAA;AA8BhD,SAAA,eAAA,CAAqD,KAAgC,EAAA;AACpF,EAAM,MAAA;AAAA,IACL,IAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA,YAAA;AAAA,IACA,aAAA;AAAA,IACA,SAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,eAAA;AAAA,IACA,cAAA;AAAA,GACG,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,OAAO,OAAQ,CAAA,MAAM,OAAS,EAAA,CAAC,OAAO,CAAC,CAAA,CAAA;AAC7C,EAAA,MAAM,OAAO,OAAQ,CAAA,MAAM,MAAQ,EAAA,CAAC,MAAM,CAA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M,WAAY,CAAA,GAAA,CAAI,EAAE,CAAA;AAAA,MACtC,YAAA,EAAc,MAAM,WAAA,CAAY,EAAE,CAAA;AAAA,KAAA,EAEjC,IAAI,KAAM,CAAA,GAAA,CAAI,CAEd,IAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,MAAM,IAAN,EAAA;AAAA,MAAA,GAAe,KAAI,IAAK,CAAA,YAAA,OAAmB,IAAK,CAAA,YAAA,CAAa,SAAS,CAAC,EAAA;AAAA,KAAI,EAAA,IAAA,CAAK,OAAO,MAAQ,EAAA,EAAC,UAAS,CAAE,CAC5G,CACF,CAAA,CAAA;AAAA,GAED,CACF,CAAA,EACC,MACF,CAAA,CAAA;AAEF,CAAA;AAOO,SAAA,UAAA,CAAgD,KAA2B,EAAA;AACjF,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA;AAAA,IAAW,MAAM,KAAM,CAAA,IAAA;AAAA,IAAM,MAAA,EAAQ,kCAAiB,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA;AAAA,MAAgB,YAAA;AAAA,MAAgC,GAAA,KAAA;AAAA,KAAO,CAAA;AAAA,GAAI,CAAA,CAAA;AAC1H;;;;"}
@@ -0,0 +1,13 @@
1
+ function addRowOnTab(event, value, props, addRowOnTabIf) {
2
+ const {
3
+ row: { index: rowIndex },
4
+ rows: { length: rowsLength },
5
+ addRow
6
+ } = props;
7
+ if (event.key === "Tab" && !event.shiftKey && rowIndex + 1 === rowsLength && (addRowOnTabIf ? addRowOnTabIf(props, value) : false)) {
8
+ addRow();
9
+ }
10
+ }
11
+
12
+ export { addRowOnTab };
13
+ //# sourceMappingURL=addRowOnTab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addRowOnTab.js","sources":["../../../../src/inputs/TableInput/addRowOnTab.ts"],"sourcesContent":["import type {TableCellProps} from './TableInput';\n\nexport type AddRowOnTabIf<D extends Record<string, unknown>, V = any> = (props: TableCellProps<D, V>, newValue: V) => boolean;\n\n/**\n * Use as an onKeyDown event handler to add a new row when tab is pressed, depending on certain criteria.\n * @param event\n * @param value\n * @param props\n * @param addRowOnTabIf\n */\nexport function addRowOnTab<D extends Record<string, unknown>, V = any>(\n\tevent: KeyboardEvent,\n\tvalue: V,\n\tprops: TableCellProps<D, V>,\n\taddRowOnTabIf?: AddRowOnTabIf<D, V>,\n) {\n\tconst {\n\t\trow: {index: rowIndex},\n\t\trows: {length: rowsLength},\n\t\taddRow,\n\t} = props;\n\n\tif (event.key === 'Tab' && !event.shiftKey && rowIndex + 1 === rowsLength && (addRowOnTabIf ? addRowOnTabIf(props, value) : false)) {\n\t\taddRow();\n\t}\n}\n"],"names":[],"mappings":"AAYC,SAAA,WAAA,CAAA,KAAA,EACA,KACA,EAAA,KAAA,EACA,aACC,EAAA;AACD,EAAM,MAAA;AAAA,IACL,GAAA,EAAK,EAAC,KAAO,EAAA,QAAA,EAAA;AAAA,IACb,IAAA,EAAM,EAAC,MAAQ,EAAA,UAAA,EAAA;AAAA,IACf,MAAA;AAAA,GACG,GAAA,KAAA,CAAA;AAEJ,EAAA,IAAI,KAAM,CAAA,GAAA,KAAQ,KAAS,IAAA,CAAC,MAAM,QAAY,IAAA,QAAA,GAAW,CAAM,KAAA,UAAA,KAA+B,aAAA,GAAA,aAAA,CAAc,KAAO,EAAA,KAAK,IAAI,KAAQ,CAAA,EAAA;AACnI,IAAO,MAAA,EAAA,CAAA;AAAA,GACR;AACD;;;;"}
@@ -0,0 +1,51 @@
1
+ import React, { useCallback } from 'react';
2
+ import { toMoney } from '@thx/money';
3
+ import debug from 'debug';
4
+ import Money from 'js-money';
5
+ import { Input, Label, Dropdown } from 'semantic-ui-react';
6
+ import { useMoneyInput } from '../useMoneyInput.js';
7
+
8
+ const d = debug("thx.controls.money.MoneyCurrencyInput");
9
+ function MoneyCurrencyInput(props) {
10
+ const { name, onBlur, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, currencies, locked, ...rest } = props;
11
+ const options = currencies || [
12
+ { key: "CAD", text: "CAD", value: "CAD" },
13
+ { key: "USD", text: "USD", value: "USD" }
14
+ ];
15
+ const handleChange = useCallback((v) => {
16
+ if (!v) {
17
+ onChange && onChange(toMoney(0, defaultCurrency));
18
+ } else {
19
+ onChange && onChange(v);
20
+ }
21
+ }, [defaultCurrency, onChange]);
22
+ const val = !(value instanceof Money) && value !== void 0 ? toMoney(value) : value;
23
+ const [inputElement] = useMoneyInput({ onChange: handleChange, prefix, showPrefix, value: val, wholeNumber });
24
+ const handleDropdownChange = useCallback((e, v) => {
25
+ const newCurrencyCode = v.value;
26
+ const newMoney = new Money(value?.amount || 0, newCurrencyCode);
27
+ d("Change", value, newCurrencyCode, newMoney);
28
+ onChange && onChange(newMoney);
29
+ }, [onChange, value]);
30
+ const currencyCode = value?.currency || defaultCurrency?.code || "CAD";
31
+ d("Render", value, currencyCode);
32
+ return /* @__PURE__ */ React.createElement(Input, {
33
+ ...rest,
34
+ labelPosition: "right"
35
+ }, /* @__PURE__ */ React.createElement("input", {
36
+ name,
37
+ ref: inputElement,
38
+ onBlur,
39
+ readOnly: locked
40
+ }), /* @__PURE__ */ React.createElement(Label, {
41
+ basic: true
42
+ }, /* @__PURE__ */ React.createElement(Dropdown, {
43
+ disabled: locked,
44
+ options,
45
+ value: currencyCode,
46
+ onChange: handleDropdownChange
47
+ })));
48
+ }
49
+
50
+ export { MoneyCurrencyInput };
51
+ //# sourceMappingURL=MoneyCurrencyInput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoneyCurrencyInput.js","sources":["../../../../src/money/MoneyCurrencyInput/MoneyCurrencyInput.tsx"],"sourcesContent":["import {toMoney} from '@thx/money';\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport debug from 'debug';\nimport Money, {CurrencyString} from 'js-money';\nimport {SyntheticEvent, useCallback} from 'react';\nimport {Dropdown, DropdownProps, Input, InputProps, Label} from 'semantic-ui-react';\nimport type {MoneyInputProps} from '../MoneyInput';\nimport {useMoneyInput} from '../useMoneyInput';\n\nconst d = debug('thx.controls.money.MoneyCurrencyInput');\n\nexport interface MoneyCurrencyInputProps extends MoneyInputProps {\n\tcurrencies?: {key: string; value: string; text: string}[];\n}\n\nexport function MoneyCurrencyInput(props: MoneyCurrencyInputProps & Omit<InputProps, 'onChange'>) {\n\tconst {name, onBlur, prefix, defaultCurrency, onChange, showPrefix, value, wholeNumber, currencies, locked, ...rest} = props;\n\n\tconst options = currencies || [\n\t\t{key: 'CAD', text: 'CAD', value: 'CAD'},\n\t\t{key: 'USD', text: 'USD', value: 'USD'},\n\t];\n\n\tconst handleChange = useCallback(\n\t\t(v?: Money) => {\n\t\t\tif (!v) {\n\t\t\t\tonChange && onChange(toMoney(0, defaultCurrency));\n\t\t\t} else {\n\t\t\t\tonChange && onChange(v);\n\t\t\t}\n\t\t},\n\t\t[defaultCurrency, onChange],\n\t);\n\n\tconst val = !(value instanceof Money) && value !== undefined ? toMoney(value) : value;\n\n\tconst [inputElement] = useMoneyInput({onChange: handleChange, prefix, showPrefix, value: val, wholeNumber});\n\n\tconst handleDropdownChange = useCallback(\n\t\t(e: SyntheticEvent<HTMLElement, Event>, v: DropdownProps) => {\n\t\t\tconst newCurrencyCode = v.value as CurrencyString;\n\t\t\tconst newMoney = new Money(value?.amount || 0, newCurrencyCode);\n\n\t\t\td('Change', value, newCurrencyCode, newMoney);\n\t\t\t// setInputValue(newMoney);\n\t\t\tonChange && onChange(newMoney);\n\t\t\t// forceUpdate();\n\t\t},\n\t\t[onChange, value],\n\t);\n\n\tconst currencyCode = value?.currency || defaultCurrency?.code || 'CAD';\n\td('Render', value, currencyCode);\n\n\treturn (\n\t\t<Input {...rest} labelPosition=\"right\">\n\t\t\t<input name={name} ref={inputElement} onBlur={onBlur} readOnly={locked} />\n\t\t\t<Label basic>\n\t\t\t\t<Dropdown disabled={locked} options={options} value={currencyCode} onChange={handleDropdownChange} />\n\t\t\t</Label>\n\t\t</Input>\n\t);\n}\n"],"names":[],"mappings":";;;;;;;AASA,MA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