@ercioko/meblotex-api 0.2.2 → 0.2.3

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 (181) hide show
  1. package/dist/api/Api.d.ts +33 -0
  2. package/dist/api/Api.js +152 -0
  3. package/dist/api/Endpoint.d.ts +13 -0
  4. package/dist/api/Endpoint.js +126 -0
  5. package/dist/api/createApi.d.ts +52 -0
  6. package/dist/api/createApi.js +81 -0
  7. package/dist/api/error.d.ts +15 -0
  8. package/dist/api/error.js +18 -0
  9. package/{src/api/index.ts → dist/api/index.d.ts} +0 -1
  10. package/dist/api/index.js +34 -0
  11. package/dist/api/status.d.ts +3 -0
  12. package/dist/api/status.js +6 -0
  13. package/dist/api/utils/getAlert.d.ts +6 -0
  14. package/dist/api/utils/getAlert.js +65 -0
  15. package/dist/api/utils/index.js +8 -0
  16. package/dist/app_types.d.ts +607 -0
  17. package/dist/app_types.js +75 -0
  18. package/dist/components/ApiHostProvider.d.ts +7 -0
  19. package/dist/components/ApiHostProvider.js +35 -0
  20. package/dist/components/StatusTag.d.ts +11 -0
  21. package/dist/components/StatusTag.js +86 -0
  22. package/dist/components/Table/DataTableWrapper.d.ts +3 -0
  23. package/dist/components/Table/DataTableWrapper.js +44 -0
  24. package/dist/components/Table/FloatingActions.d.ts +14 -0
  25. package/dist/components/Table/FloatingActions.js +32 -0
  26. package/dist/components/Table/Spinner.d.ts +2 -0
  27. package/dist/components/Table/Spinner.js +26 -0
  28. package/dist/components/Table/Table.d.ts +28 -0
  29. package/dist/components/Table/Table.js +330 -0
  30. package/dist/components/Table/addIndexToObject.d.ts +3 -0
  31. package/dist/components/Table/addIndexToObject.js +17 -0
  32. package/dist/components/Table/areProvidedColumnsDifferent.d.ts +2 -0
  33. package/dist/components/Table/areProvidedColumnsDifferent.js +16 -0
  34. package/dist/components/Table/hooks/useFetchPage.d.ts +18 -0
  35. package/dist/components/Table/hooks/useFetchPage.js +123 -0
  36. package/dist/components/Table/hooks/useGetCellRenderer.d.ts +25 -0
  37. package/dist/components/Table/hooks/useGetCellRenderer.js +166 -0
  38. package/dist/components/Table/hooks/useGetColumnsWithCheckbox.d.ts +5 -0
  39. package/dist/components/Table/hooks/useGetColumnsWithCheckbox.js +53 -0
  40. package/dist/components/Table/hooks/useGetDeleteRow.d.ts +9 -0
  41. package/dist/components/Table/hooks/useGetDeleteRow.js +74 -0
  42. package/dist/components/Table/hooks/useGetResizeColumn.d.ts +8 -0
  43. package/dist/components/Table/hooks/useGetResizeColumn.js +28 -0
  44. package/dist/components/Table/hooks/useGetRowCheckbox.d.ts +5 -0
  45. package/dist/components/Table/hooks/useGetRowCheckbox.js +54 -0
  46. package/dist/components/Table/hooks/useLoadDataSource.d.ts +10 -0
  47. package/dist/components/Table/hooks/useLoadDataSource.js +20 -0
  48. package/dist/components/Table/hooks/usePageSize.d.ts +5 -0
  49. package/dist/components/Table/hooks/usePageSize.js +16 -0
  50. package/dist/components/Table/hooks/useRenderRowActions.d.ts +6 -0
  51. package/dist/components/Table/hooks/useRenderRowActions.js +51 -0
  52. package/dist/components/Table/hooks/useResizeColumns.d.ts +9 -0
  53. package/dist/components/Table/hooks/useResizeColumns.js +60 -0
  54. package/dist/components/Table/index.d.ts +1 -0
  55. package/dist/components/Table/index.js +8 -0
  56. package/dist/components/Table/providers/OrderProvider.d.ts +9 -0
  57. package/dist/components/Table/providers/OrderProvider.js +17 -0
  58. package/dist/components/Table/styles.d.ts +6 -0
  59. package/dist/components/Table/styles.js +37 -0
  60. package/dist/components/index.js +26 -0
  61. package/dist/config.d.ts +6 -0
  62. package/dist/config.js +8 -0
  63. package/dist/db_types.d.ts +208 -0
  64. package/dist/db_types.js +2 -0
  65. package/dist/hooks/index.js +10 -0
  66. package/dist/hooks/useApi.d.ts +2 -0
  67. package/dist/hooks/useApi.js +42 -0
  68. package/dist/hooks/useEndpoint.d.ts +2 -0
  69. package/dist/hooks/useEndpoint.js +34 -0
  70. package/dist/index.js +19 -0
  71. package/dist/lib/index.js +18 -0
  72. package/dist/lib/jednostkaNazwa.d.ts +6 -0
  73. package/dist/lib/jednostkaNazwa.js +9 -0
  74. package/dist/lib/typDokumentuNazwa.d.ts +6 -0
  75. package/dist/lib/typDokumentuNazwa.js +11 -0
  76. package/dist/src/api/Api.js +316 -0
  77. package/dist/src/api/Endpoint.js +365 -0
  78. package/dist/src/api/createApi.js +50 -0
  79. package/dist/src/api/error.js +15 -0
  80. package/dist/src/api/index.js +5 -0
  81. package/dist/src/api/status.js +3 -0
  82. package/dist/src/api/utils/getAlert.js +63 -0
  83. package/dist/src/api/utils/index.js +1 -0
  84. package/dist/src/app_types.js +72 -0
  85. package/dist/src/components/ApiHostProvider.js +11 -0
  86. package/dist/src/components/StatusTag.js +153 -0
  87. package/dist/src/components/Table/DataTableWrapper.js +115 -0
  88. package/dist/src/components/Table/FloatingActions.js +60 -0
  89. package/dist/src/components/Table/Spinner.js +40 -0
  90. package/dist/src/components/Table/Summary.js +16 -0
  91. package/dist/src/components/Table/Table.js +498 -0
  92. package/dist/src/components/Table/addIndexToObject.js +57 -0
  93. package/dist/src/components/Table/areProvidedColumnsDifferent.js +19 -0
  94. package/dist/src/components/Table/clicked.js +12 -0
  95. package/dist/src/components/Table/displayActions.js +11 -0
  96. package/dist/src/components/Table/hooks/useFetchPage.js +254 -0
  97. package/dist/src/components/Table/hooks/useGetCellRenderer.js +231 -0
  98. package/dist/src/components/Table/hooks/useGetColumnsWithCheckbox.js +33 -0
  99. package/dist/src/components/Table/hooks/useGetDeleteRow.js +181 -0
  100. package/dist/src/components/Table/hooks/useGetResizeColumn.js +72 -0
  101. package/dist/src/components/Table/hooks/useGetRowCheckbox.js +55 -0
  102. package/dist/src/components/Table/hooks/useLoadDataSource.js +16 -0
  103. package/dist/src/components/Table/hooks/usePageSize.js +15 -0
  104. package/dist/src/components/Table/hooks/useRenderRowActions.js +50 -0
  105. package/dist/src/components/Table/hooks/useResizeColumns.js +70 -0
  106. package/dist/src/components/Table/index.js +1 -0
  107. package/dist/src/components/Table/providers/OrderProvider.js +65 -0
  108. package/dist/src/components/Table/styles.js +66 -0
  109. package/dist/src/components/index.js +4 -0
  110. package/dist/src/config.js +6 -0
  111. package/dist/src/db_types.js +1 -0
  112. package/dist/src/hooks/index.js +2 -0
  113. package/dist/src/hooks/useApi.js +84 -0
  114. package/dist/src/hooks/useEndpoint.js +60 -0
  115. package/dist/src/index.js +3 -0
  116. package/dist/src/lib/index.js +2 -0
  117. package/dist/src/lib/jednostkaNazwa.js +6 -0
  118. package/dist/src/lib/typDokumentuNazwa.js +16 -0
  119. package/dist/src/utils/Query.js +73 -0
  120. package/dist/src/utils/getWZNumber.js +4 -0
  121. package/dist/src/utils/getZamowienieDokumentNumber.js +4 -0
  122. package/{src/utils/index.ts → dist/src/utils/index.js} +2 -2
  123. package/dist/utils/Query.d.ts +6 -0
  124. package/dist/utils/Query.js +33 -0
  125. package/dist/utils/getWZNumber.d.ts +2 -0
  126. package/dist/utils/getWZNumber.js +10 -0
  127. package/dist/utils/getZamowienieDokumentNumber.d.ts +2 -0
  128. package/dist/utils/getZamowienieDokumentNumber.js +8 -0
  129. package/dist/utils/index.d.ts +3 -0
  130. package/dist/utils/index.js +12 -0
  131. package/package.json +3 -2
  132. package/.eslintrc +0 -6
  133. package/.nvmrc +0 -1
  134. package/.prettierrc +0 -11
  135. package/src/api/Api.ts +0 -140
  136. package/src/api/Endpoint.ts +0 -76
  137. package/src/api/createApi.ts +0 -116
  138. package/src/api/error.ts +0 -17
  139. package/src/api/status.ts +0 -3
  140. package/src/api/utils/getAlert.ts +0 -75
  141. package/src/app_types.ts +0 -695
  142. package/src/components/ApiHostProvider.tsx +0 -13
  143. package/src/components/StatusTag.tsx +0 -83
  144. package/src/components/Table/DataTableWrapper.tsx +0 -28
  145. package/src/components/Table/FloatingActions.tsx +0 -152
  146. package/src/components/Table/Spinner.tsx +0 -35
  147. package/src/components/Table/Summary.tsx +0 -18
  148. package/src/components/Table/Table.tsx +0 -474
  149. package/src/components/Table/addIndexToObject.ts +0 -6
  150. package/src/components/Table/areProvidedColumnsDifferent.ts +0 -26
  151. package/src/components/Table/clicked.js +0 -12
  152. package/src/components/Table/displayActions.tsx +0 -19
  153. package/src/components/Table/hooks/useFetchPage.tsx +0 -83
  154. package/src/components/Table/hooks/useGetCellRenderer.tsx +0 -197
  155. package/src/components/Table/hooks/useGetColumnsWithCheckbox.tsx +0 -34
  156. package/src/components/Table/hooks/useGetDeleteRow.tsx +0 -37
  157. package/src/components/Table/hooks/useGetResizeColumn.ts +0 -33
  158. package/src/components/Table/hooks/useGetRowCheckbox.tsx +0 -25
  159. package/src/components/Table/hooks/useLoadDataSource.ts +0 -24
  160. package/src/components/Table/hooks/usePageSize.tsx +0 -20
  161. package/src/components/Table/hooks/useRenderRowActions.tsx +0 -45
  162. package/src/components/Table/hooks/useResizeColumns.ts +0 -61
  163. package/src/components/Table/index.ts +0 -1
  164. package/src/components/Table/providers/OrderProvider.tsx +0 -20
  165. package/src/components/Table/styles.ts +0 -208
  166. package/src/config.ts +0 -7
  167. package/src/db_types.ts +0 -220
  168. package/src/hooks/useApi.ts +0 -43
  169. package/src/hooks/useEndpoint.ts +0 -35
  170. package/src/lib/jednostkaNazwa.ts +0 -6
  171. package/src/lib/typDokumentuNazwa.ts +0 -8
  172. package/src/utils/Query.ts +0 -30
  173. package/src/utils/getWZNumber.ts +0 -13
  174. package/src/utils/getZamowienieDokumentNumber.ts +0 -11
  175. package/tsconfig.json +0 -25
  176. package/tsconfig.tsbuildinfo +0 -1
  177. /package/{src/api/utils/index.ts → dist/api/utils/index.d.ts} +0 -0
  178. /package/{src/components/index.ts → dist/components/index.d.ts} +0 -0
  179. /package/{src/hooks/index.ts → dist/hooks/index.d.ts} +0 -0
  180. /package/{src/index.ts → dist/index.d.ts} +0 -0
  181. /package/{src/lib/index.ts → dist/lib/index.d.ts} +0 -0
@@ -1,83 +0,0 @@
1
- import React, { FC } from 'react';
2
- import { Tag as AntTag, TagProps } from 'antd';
3
-
4
- export const statuses = [
5
- 'ZAM',
6
- 'PRZ',
7
- 'PRO',
8
- 'WYP',
9
- 'DWY',
10
- 'WYB',
11
- 'PDM',
12
- 'WZM',
13
- 'N',
14
- 'B',
15
- 'ARC',
16
- 'WZ',
17
- 'PW',
18
- ] as const;
19
-
20
- export type Status = typeof statuses[number];
21
-
22
- export const StyledTag: FC<TagProps> = ({
23
- style,
24
- ...props
25
- }) => (
26
- <AntTag
27
- style={{
28
- textAlign: 'center',
29
- overflow: 'hidden',
30
- textOverflow: 'ellipsis',
31
- position: 'absolute',
32
- top: '50%',
33
- transform: 'translateY(-50%)',
34
- right: '0',
35
- left: '0',
36
- ...style,
37
- }}
38
- {...props}
39
- />
40
- );
41
-
42
-
43
- type Props = {
44
- status: Status;
45
- Tag?: FC<TagProps>;
46
- }
47
-
48
- const StatusTag: FC<Props> = ({ status, Tag = StyledTag }) => {
49
- switch (status) {
50
- case 'ZAM':
51
- return <Tag color="cyan">Zamówione</Tag>;
52
- case 'PRZ':
53
- return <Tag color="blue">Przyjete</Tag>;
54
- case 'PRO':
55
- return <Tag color="gold">W produkcji</Tag>;
56
- case 'WYP':
57
- return <Tag color="orange">Wyprodukowane</Tag>;
58
- case 'DWY':
59
- return <Tag color="green">Do wydania</Tag>;
60
- case 'WYB':
61
- return <Tag color="lime">Wybieranie</Tag>;
62
- case 'PDM':
63
- return <Tag color="gray">Przyjęte do magazynu</Tag>;
64
- case 'WZM':
65
- return <Tag color="green">Wydane z magazynu</Tag>;
66
- case 'N':
67
- return <Tag color="gold">Bufor portal</Tag>;
68
- case 'B':
69
- return <Tag color="blue">Bufor</Tag>;
70
- case 'ARC':
71
- return <Tag color="black">Archiwum</Tag>;
72
- case 'WZ':
73
- return <Tag color="blue">Wydanie zewnętrzne</Tag>;
74
- case 'PW':
75
- return <Tag color="green">Przychód wewnętrzny</Tag>;
76
- default:
77
- // eslint-disable-next-line no-console
78
- console.log('nieznany: ', status);
79
- return <Tag color="red">Nieznany</Tag>;
80
- }
81
- }
82
-
83
- export default StatusTag;
@@ -1,28 +0,0 @@
1
- import React, { ForwardedRef, forwardRef } from 'react';
2
- import styled from 'styled-components';
3
-
4
- const Wrapper = styled.div`
5
- position: relative;
6
- width: 100%;
7
- max-height: 100%;
8
- border-bottom: 1px solid #e8e8e8;
9
- margin-top: 0;
10
- `;
11
-
12
- Wrapper.defaultProps = {
13
- className: 'data-table-wrapper',
14
- };
15
-
16
- function DataTableWrapper(
17
- { children, ...props }: React.PropsWithChildren<Record<string, unknown>>,
18
- ref: ForwardedRef<HTMLDivElement>
19
- ) {
20
- return (
21
- <Wrapper className="data-table-wrapper" {...props} ref={ref}>
22
- {children}
23
- </Wrapper>
24
- );
25
- }
26
-
27
- export default Wrapper;
28
- // export default forwardRef(DataTableWrapper);
@@ -1,152 +0,0 @@
1
- import { Space } from 'antd';
2
- import React from 'react';
3
- import { DeleteTwoTone } from '@ant-design/icons';
4
- import { ActionFunction, Actions, DataRow } from '../../app_types';
5
- import styled from 'styled-components';
6
-
7
- const StyledFloatingActions = styled.div`
8
- & {
9
- position: absolute;
10
- left: 100px;
11
- pointer-events: none;
12
- transition: width 300ms ease-in-out, padding 300ms ease-in-out;
13
- box-sizing: content-box;
14
- overflow: hidden;
15
- padding-top: 20px;
16
- z-index: 2;
17
- }
18
- &.shown {
19
- pointer-events: all;
20
- }
21
- & > div {
22
- box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.15);
23
- height: 58px;
24
- background: #fff;
25
- border-radius: 10px;
26
- margin: 10px;
27
- }
28
- & > div > div:first-child {
29
- margin-left: 27px;
30
- }
31
- & > div > div:last-child {
32
- margin-right: 27px;
33
- }
34
- & > div .action {
35
- width: 24px;
36
- height: 24px;
37
- display: flex;
38
- align-items: center;
39
- justify-content: center;
40
- transition: 150ms ease-in-out;
41
- position: relative;
42
- }
43
- & > div .action .action-tooltip {
44
- position: absolute;
45
- top: -35px;
46
- background: #595959;
47
- color: #fff;
48
- border-radius: 8px;
49
- padding: 2px 10px;
50
- display: none;
51
- }
52
- & > div .action .action-tooltip::after {
53
- content: '';
54
- position: absolute;
55
- top: 100%;
56
- left: calc(50% - 8px);
57
- display: block;
58
- width: 0;
59
- height: 0;
60
- border-width: 8px;
61
- border-style: solid;
62
- border-color: #595959 transparent transparent transparent;
63
- }
64
- & > div .action:hover {
65
- width: 48px;
66
- height: 48px;
67
- }
68
- & > div .action:hover:enabled {
69
- cursor: pointer;
70
- }
71
- & > div .action:hover .action-tooltip {
72
- display: initial;
73
- }
74
- & > div .action:hover span {
75
- background: rgba(0, 0, 0, 0.1);
76
- }
77
- & > div .action:hover span svg {
78
- font-size: 28px;
79
- }
80
- & > div .action span {
81
- padding: 10px;
82
- border-radius: 100px;
83
- transition: 150ms ease-in-out;
84
- }
85
- & > div .action span svg {
86
- transition: 150ms ease-in-out;
87
- font-size: 24px;
88
- }
89
- `
90
-
91
- export default function FloatingActions<DataType = DataRow>({
92
- actionsDimensions,
93
- actionsFor,
94
- floatingButtons,
95
- actionHover,
96
- actionLeave,
97
- hide,
98
- actions,
99
- }: {
100
- actionsDimensions: { top: number; width: number; transition: string };
101
- actionsFor: undefined;
102
- floatingButtons: ActionFunction<DataType>[] | undefined;
103
- actionHover: () => void;
104
- actionLeave: () => void;
105
- hide: (e?: MouseEvent | undefined) => void;
106
- actions: Actions<DataType>;
107
- }): JSX.Element {
108
- return (
109
- <StyledFloatingActions
110
- role="button"
111
- style={actionsDimensions}
112
- className={`floating-actions ${actionsFor ? 'shown' : ''}`}
113
- onClick={(e) => {
114
- e.stopPropagation();
115
- e.preventDefault();
116
- }}
117
- >
118
- <Space size={28}>
119
- {floatingButtons?.map((_, i) => (
120
- <div
121
- role="button"
122
- key={i.toString()}
123
- className="action"
124
- onMouseEnter={actionHover}
125
- onMouseLeave={actionLeave}
126
- onClick={() => hide()}
127
- >
128
- {actions.tooltips && actions.tooltips[i] ? (
129
- <div className="action-tooltip">{actions.tooltips[i]}</div>
130
- ) : undefined}
131
- {/* {e(actionsFor)} */}
132
- </div>
133
- ))}
134
- {actions.delete ? (
135
- <div
136
- className="action"
137
- onMouseEnter={actionHover}
138
- onMouseLeave={actionLeave}
139
- >
140
- <div className="action-tooltip">Usuń</div>
141
- {typeof actionsFor !== 'undefined' && (
142
- <DeleteTwoTone
143
- // onClick={() => deleteRow(actionsFor.id)}
144
- twoToneColor="#F5222D"
145
- />
146
- )}
147
- </div>
148
- ) : undefined}
149
- </Space>
150
- </StyledFloatingActions>
151
- );
152
- }
@@ -1,35 +0,0 @@
1
- import config from '../../config';
2
- import { Spin } from 'antd';
3
- import React from 'react';
4
- import styled from 'styled-components';
5
-
6
- const { ROW_SIZE } = config;
7
- const StyledSpinner = styled.div`
8
- & {
9
- position: absolute;
10
- bottom: -34px;
11
- left: 50%;
12
- }
13
-
14
- .ant-spin {
15
- display: flex;
16
- justify-content: center;
17
- margin: 15px 0;
18
- }
19
- `
20
-
21
- export default function Spinner() {
22
- return (
23
- <StyledSpinner
24
- className="spinner-wrapper"
25
- style={{
26
- height: ROW_SIZE,
27
- display: 'flex',
28
- justifyContent: 'center',
29
- alignItems: 'center',
30
- }}
31
- >
32
- <Spin style={{ margin: 0 }} />
33
- </StyledSpinner>
34
- );
35
- }
@@ -1,18 +0,0 @@
1
- import React from 'react';
2
- import { TableData } from './styles'
3
-
4
- export default function Summary({ summary, widths }) {
5
- return summary ? (
6
- <div className="tr summary">
7
- {summary.map((e, i) => (
8
- <TableData
9
- key={i}
10
- style={{ width: `${widths[i]}px` }}
11
- className={e === undefined ? 'td orphan' : 'td'}
12
- >
13
- {e}
14
- </TableData>
15
- ))}
16
- </div>
17
- ) : null;
18
- }