@akinon/akitable 0.0.6 → 0.1.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 (76) hide show
  1. package/dist/cjs/components/AntdTable/index.d.ts.map +1 -0
  2. package/dist/cjs/components/AntdTable/index.js +33 -0
  3. package/dist/cjs/components/Footer/index.css +6 -0
  4. package/dist/{components → cjs/components}/Footer/index.d.ts +1 -0
  5. package/dist/cjs/components/Footer/index.d.ts.map +1 -0
  6. package/dist/cjs/components/Footer/index.js +16 -0
  7. package/dist/cjs/components/Header/index.css +84 -0
  8. package/dist/{components → cjs/components}/Header/index.d.ts +1 -0
  9. package/dist/cjs/components/Header/index.d.ts.map +1 -0
  10. package/dist/cjs/components/Header/index.js +25 -0
  11. package/dist/cjs/components/HeaderActions/index.css +30 -0
  12. package/dist/{components → cjs/components}/HeaderActions/index.d.ts +1 -0
  13. package/dist/cjs/components/HeaderActions/index.d.ts.map +1 -0
  14. package/dist/cjs/components/HeaderActions/index.js +39 -0
  15. package/dist/cjs/components/Pagination/index.css +96 -0
  16. package/dist/{components → cjs/components}/Pagination/index.d.ts +1 -0
  17. package/dist/cjs/components/Pagination/index.d.ts.map +1 -0
  18. package/dist/cjs/components/Pagination/index.js +20 -0
  19. package/dist/cjs/components/index.d.ts.map +1 -0
  20. package/dist/cjs/components/index.js +13 -0
  21. package/dist/cjs/context/index.d.ts.map +1 -0
  22. package/dist/cjs/context/index.js +35 -0
  23. package/dist/cjs/index.css +28 -0
  24. package/dist/{index.d.ts → cjs/index.d.ts} +1 -0
  25. package/dist/cjs/index.d.ts.map +1 -0
  26. package/dist/cjs/index.js +96 -0
  27. package/dist/cjs/types.d.ts.map +1 -0
  28. package/dist/cjs/types.js +2 -0
  29. package/dist/esm/components/AntdTable/index.d.ts +6 -0
  30. package/dist/esm/components/AntdTable/index.d.ts.map +1 -0
  31. package/dist/esm/components/AntdTable/index.js +29 -0
  32. package/dist/esm/components/Footer/index.css +6 -0
  33. package/dist/esm/components/Footer/index.d.ts +4 -0
  34. package/dist/esm/components/Footer/index.d.ts.map +1 -0
  35. package/dist/esm/components/Footer/index.js +12 -0
  36. package/dist/esm/components/Header/index.css +84 -0
  37. package/dist/esm/components/Header/index.d.ts +10 -0
  38. package/dist/esm/components/Header/index.d.ts.map +1 -0
  39. package/dist/esm/components/Header/index.js +21 -0
  40. package/dist/esm/components/HeaderActions/index.css +30 -0
  41. package/dist/esm/components/HeaderActions/index.d.ts +9 -0
  42. package/dist/esm/components/HeaderActions/index.d.ts.map +1 -0
  43. package/dist/esm/components/HeaderActions/index.js +35 -0
  44. package/dist/esm/components/Pagination/index.css +96 -0
  45. package/dist/esm/components/Pagination/index.d.ts +4 -0
  46. package/dist/esm/components/Pagination/index.d.ts.map +1 -0
  47. package/dist/esm/components/Pagination/index.js +16 -0
  48. package/dist/esm/components/index.d.ts +6 -0
  49. package/dist/esm/components/index.d.ts.map +1 -0
  50. package/dist/esm/components/index.js +5 -0
  51. package/dist/esm/context/index.d.ts +25 -0
  52. package/dist/esm/context/index.d.ts.map +1 -0
  53. package/dist/esm/context/index.js +30 -0
  54. package/dist/esm/index.css +28 -0
  55. package/dist/esm/index.d.ts +19 -0
  56. package/dist/esm/index.d.ts.map +1 -0
  57. package/dist/esm/index.js +92 -0
  58. package/dist/esm/types.d.ts +18 -0
  59. package/dist/esm/types.d.ts.map +1 -0
  60. package/dist/esm/types.js +1 -0
  61. package/package.json +25 -18
  62. package/dist/components/AntdTable/index.d.ts.map +0 -1
  63. package/dist/components/Footer/index.d.ts.map +0 -1
  64. package/dist/components/Header/index.d.ts.map +0 -1
  65. package/dist/components/HeaderActions/index.d.ts.map +0 -1
  66. package/dist/components/Pagination/index.d.ts.map +0 -1
  67. package/dist/components/index.d.ts.map +0 -1
  68. package/dist/context/index.d.ts.map +0 -1
  69. package/dist/index.cjs +0 -2
  70. package/dist/index.d.ts.map +0 -1
  71. package/dist/index.js +0 -977
  72. package/dist/types.d.ts.map +0 -1
  73. /package/dist/{components → cjs/components}/AntdTable/index.d.ts +0 -0
  74. /package/dist/{components → cjs/components}/index.d.ts +0 -0
  75. /package/dist/{context → cjs/context}/index.d.ts +0 -0
  76. /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
package/dist/index.js DELETED
@@ -1,977 +0,0 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var n=document.createElement("style");n.appendChild(document.createTextNode(".akitable-container{border-radius:10px;width:100%}.akitable-container .row-action{width:40px;height:40px;display:flex;border:1px solid rgba(0,47,255,.273);border-radius:7px;align-items:center;justify-content:center;margin-right:5px}.akitable-container .row-action i:before{color:#222222b6}.akitable-container .akinon-table-wrapper .akinon-table-thead>tr>th{color:var(--color-ebonyClay-375);font-size:.75rem;font-weight:500;padding:6px 28px}.akitable-footer{padding:20px;display:flex;justify-content:flex-end;align-items:center}.akitable-header{padding:20px 32px 16px;display:flex;justify-content:space-between;gap:16px}.akitable-header .akinon-pagination{margin-left:auto}.akitable-header__left-block{flex:1}.akitable-header__middle-block{color:#000}.akitable-header__right-block{display:flex;justify-content:flex-end;align-items:flex-end;flex-direction:column;gap:20px}.akitable-header__export-options{display:flex;align-items:center;gap:12px}.akitable-header__export-option{cursor:pointer;display:flex;flex-direction:column;justify-content:center;align-items:center;background-color:#4482ff;color:#fff;width:36px;height:36px;border-radius:5px}.akitable-header__export-option-icon{height:16px}.akitable-header__export-option-icon>i{color:#fff;margin:0;font-size:10px;font-weight:700}.akitable-header__export-option-icon>i:before{color:#fff}.akitable-header__export-option-label{font-weight:700;font-size:11px;-webkit-user-select:none;user-select:none;cursor:pointer}.akitable-header__info{margin-bottom:.5rem}.akitable-header__title.akinon-typography{font-size:20px;margin:.5rem 0 .1rem;font-weight:700}.akitable-header__description.akinon-typography{font-size:13px;color:#797979;font-weight:400}.header-actions__apply-button.akinon-btn{font-weight:600;height:40px}.header-actions .akinon-select-single:not(.akinon-select-customize-input) .akinon-select-selector{box-sizing:border-box;height:40px;align-items:center;border-radius:5px;border:solid 1px #c8daec;width:150px}.header-actions .akinon-select-focused:not(.akinon-select-disabled).akinon-select:not(.akinon-select-customize-input) .akinon-select-selector{border-right-width:0!important}.header-actions .akinon-select-arrow{top:70%}.header-actions .akinon-select-selector{min-width:220px}.akinon-btn-secondary{color:var(--color-neutral-50);background-color:var(--color-green-500);box-shadow:0 2px #0591ff1a}.akitable-pagination-container{display:flex}.akitable-pagination-container .akinon-select-single:not(.akinon-select-customize-input) .akinon-select-selector{box-sizing:border-box;height:40px;align-items:center;border-radius:5px;border:solid 1px #c8daec}.akitable-pagination-container__pagination.akinon-pagination{display:flex;align-items:center;border-radius:5px}.akitable-pagination-container__pagination.akinon-pagination li{margin:0}.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-prev,.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-next{width:36px;border-radius:5px}.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-prev>button,.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-next>button{color:#788195}.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-prev>button:hover,.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-prev>button:focus,.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-next>button:hover,.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-next>button:focus{color:#788195}.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-simple-pager{color:#9b9b9b;height:40px;border:1px solid #c8daec;margin-inline-end:unset!important;padding-inline-end:8px!important}.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-simple-pager>input{color:#062a4a;font-weight:600;border:1px solid #c8daec;border-radius:0;box-shadow:inset 0 0 2px 2px #eef0f2;background-color:#fbfcfd}.akitable-pagination-container__pagination.akinon-pagination .akinon-pagination-simple-pager>input:hover{border:1px solid #c8daec}.akitable-pagination-container .akinon-select-selector{color:#9b9b9b!important}.akitable-pagination-container .akinon-pagination-prev{height:40px!important;border:1px solid #c8daec!important;border-right:none!important;border-top-right-radius:0%!important;border-bottom-right-radius:0%!important}.akitable-pagination-container .akinon-pagination-prev>*{height:inherit!important}.akitable-pagination-container .akinon-pagination-next{height:40px!important;border:1px solid #c8daec!important;border-left:none!important;border-top-left-radius:0%!important;border-bottom-left-radius:0%!important}.akitable-pagination-container .akinon-pagination-next>*{height:inherit!important}.akitable-pagination-container .akinon-pagination-slash{margin-inline-end:0px;margin-inline-start:12px}.akitable-pagination-container .akinon-pagination-options{height:40px!important;order:-1!important;margin-right:20px!important}")),document.head.appendChild(n)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();
2
- import { jsx as c, jsxs as B } from "react/jsx-runtime";
3
- import { theme as p, Table as le, Typography as x, Card as Y, Button as se, Select as fe, Space as ue, Pagination as de, ConfigProvider as ye } from "antd";
4
- import { useMemo as he, useReducer as me, createContext as _e, useContext as pe, useState as be } from "react";
5
- const ge = {
6
- 50: "#ffffff",
7
- 75: "#fbfcfd",
8
- 100: "#f5f5f5",
9
- 150: "#f1f3f9",
10
- 200: "#e5e5e5",
11
- 250: "#d6e1e3",
12
- 300: "#d4d4d4",
13
- 350: "#c8daec",
14
- 375: "#bfbfbf",
15
- 400: "#a3a3a3",
16
- 500: "#737373",
17
- 600: "#525252",
18
- 700: "#404040",
19
- 800: "#262626",
20
- 900: "#171717",
21
- 950: "#0a0a0a"
22
- }, Ce = {
23
- 50: "#677084",
24
- 100: "#5c6880",
25
- 150: "#58669a",
26
- 200: "#515c7c",
27
- 300: "#465178",
28
- 350: "#43464f",
29
- 375: "#3f4b5c",
30
- 400: "#3d4561",
31
- // applied from design: filters card bg
32
- 450: "#333b57",
33
- 475: "#2b344c",
34
- 500: "#293245",
35
- // applied from design: layout color
36
- 550: "#262e47",
37
- 600: "#232b3b",
38
- // applied from design: header input bg
39
- 700: "#1d2331",
40
- 800: "#171d27",
41
- 900: "#11171e",
42
- 950: "#0c111a"
43
- }, Pe = {
44
- 100: "#f5f5f5",
45
- 200: "#e5e5e5",
46
- 300: "#d4d4d4",
47
- 400: "#a3a3a3",
48
- 500: "#788195",
49
- // applied from design: header text placeholder
50
- 600: "#525252",
51
- 700: "#404040",
52
- 800: "#262626",
53
- 900: "#3b404c",
54
- // applied from design: layout border
55
- 925: "#36373b",
56
- 950: "#171717"
57
- }, Se = {
58
- 50: "#fffaf5",
59
- 100: "#fcf3eb",
60
- 200: "#fce0cf",
61
- 300: "#fac7b1",
62
- 400: "#f58d7a",
63
- 500: "#ef4444",
64
- 600: "#d93636",
65
- 700: "#b32525",
66
- 800: "#8f1818",
67
- 900: "#6b0e0e",
68
- 950: "#450606"
69
- }, Be = {
70
- 50: "#fafcf2",
71
- 100: "#f5fae6",
72
- 200: "#e5f5c1",
73
- 300: "#d2ed9d",
74
- 400: "#a9e05c",
75
- 500: "#7ed321",
76
- 600: "#6abf1b",
77
- 700: "#529e13",
78
- 800: "#3d800d",
79
- 900: "#275e07",
80
- 950: "#163d03"
81
- }, ke = {
82
- 50: "#fbf7fc",
83
- 100: "#f5eff8",
84
- 200: "#ebdef0",
85
- 300: "#dbc4e3",
86
- 400: "#c7a1d1",
87
- 500: "#ad7abb",
88
- 600: "#915c9d",
89
- 700: "#72467b",
90
- 800: "#633e6a",
91
- 900: "#543659",
92
- 950: "#341b37"
93
- }, ze = {
94
- 50: "#eef5ff",
95
- 100: "#d9e8ff",
96
- 200: "#bcd8ff",
97
- 300: "#8ec0ff",
98
- 400: "#599cff",
99
- 500: "#4482ff",
100
- // applied from design: primary button color
101
- 600: "#1b55f5",
102
- 750: "#1890ff",
103
- 700: "#1440e1",
104
- 800: "#1734b6",
105
- 900: "#19318f",
106
- 950: "#142057"
107
- }, ve = {
108
- 50: "#fffcf2",
109
- 100: "#fff8e6",
110
- 200: "#ffebbf",
111
- 300: "#fcd997",
112
- 400: "#fcb44e",
113
- 500: "#f98003",
114
- 600: "#e06e02",
115
- 700: "#ba5202",
116
- 800: "#963d02",
117
- 900: "#702900",
118
- 950: "#471700"
119
- }, Te = {
120
- 50: "#fcf2f7",
121
- 100: "#fae6ef",
122
- 200: "#f5c4d7",
123
- 300: "#eda1b9",
124
- 400: "#de5f77",
125
- 500: "#d2282e",
126
- 600: "#bd2025",
127
- 700: "#9c161a",
128
- 800: "#7d0e11",
129
- 900: "#5e080a",
130
- 950: "#3d0405"
131
- }, h = 16, i = {
132
- akinon: Te,
133
- azure: ze,
134
- orange: ve,
135
- red: Se,
136
- green: Be,
137
- purple: ke,
138
- gray: Pe,
139
- ebonyClay: Ce,
140
- neutral: ge
141
- }, s = {
142
- // We use dark algorithm from antd by default,
143
- // since our applications are dark themed.
144
- algorithm: p.darkAlgorithm,
145
- colors: i,
146
- // We also need to override antd styles with
147
- // our current color palette.
148
- token: {
149
- colorTextBase: i.neutral[100],
150
- colorText: i.neutral[100],
151
- colorTextSecondary: i.gray[500],
152
- colorTextPlaceholder: i.gray[500],
153
- colorPrimary: i.azure[500],
154
- colorError: i.red[500],
155
- colorBgLayout: i.ebonyClay[500],
156
- // effects layout bg
157
- colorBgContainer: i.ebonyClay[600],
158
- // effects card bg, table bg, input bg
159
- colorBgElevated: i.ebonyClay[400],
160
- // effects dropdown bg, select bg, notification bg
161
- controlItemBgHover: i.ebonyClay[200],
162
- // effects item bg in dropdown item when hovered
163
- controlItemBgActive: i.ebonyClay[300],
164
- // effects active item bg such in dropdown item
165
- controlItemBgActiveHover: i.ebonyClay[300],
166
- // effects active item bg such in dropdown item when hovered
167
- colorBgSpotlight: i.ebonyClay[600],
168
- //TODO: bg color of tooltip?
169
- colorBorder: i.ebonyClay[700],
170
- fontFamily: "'Jost Variable'," + p.getDesignToken().fontFamily,
171
- fontSize: h * 0.875
172
- },
173
- components: {
174
- Layout: {
175
- headerBg: i.ebonyClay[500],
176
- siderBg: i.ebonyClay[500]
177
- },
178
- Dropdown: {
179
- colorPrimary: i.neutral[100],
180
- // primary color (azure500) doesn't work well with dropdown bg
181
- controlPaddingHorizontal: h
182
- },
183
- Menu: {
184
- darkItemBg: i.ebonyClay[500],
185
- darkSubMenuItemBg: i.ebonyClay[600],
186
- darkItemSelectedBg: i.ebonyClay[700],
187
- itemBorderRadius: 0,
188
- itemMarginBlock: 0,
189
- itemMarginInline: 0,
190
- darkItemColor: i.gray[500],
191
- itemHeight: h * 3.25
192
- },
193
- Breadcrumb: {
194
- fontSize: h * 0.625,
195
- lastItemColor: i.azure[500]
196
- },
197
- Card: {
198
- colorBgContainer: i.ebonyClay[450],
199
- colorTextDescription: i.neutral[100],
200
- headerFontSize: h * 1.25,
201
- fontSize: h * 0.875
202
- },
203
- Collapse: {
204
- headerPadding: "0 0 12px",
205
- // because of ghost prop, we need to use important
206
- contentPadding: "0 0 24px !important",
207
- fontSizeIcon: h * 1.65,
208
- fontSize: h
209
- },
210
- Form: {
211
- itemMarginBottom: 16,
212
- labelColor: i.neutral[100],
213
- verticalLabelPadding: 4
214
- },
215
- Select: {
216
- colorTextDisabled: i.ebonyClay[350],
217
- colorBgContainerDisabled: i.gray[925],
218
- colorBgContainer: i.ebonyClay[475],
219
- fontSizeLG: h * 0.875,
220
- colorBorder: i.ebonyClay[550],
221
- lineWidth: 2
222
- },
223
- Input: {
224
- colorBgContainer: i.ebonyClay[475],
225
- fontSizeLG: h * 0.875,
226
- colorBorder: i.ebonyClay[550],
227
- lineWidth: 2
228
- },
229
- InputNumber: {
230
- colorBgContainer: i.ebonyClay[475],
231
- fontSizeLG: h * 0.875,
232
- colorBorder: i.ebonyClay[550],
233
- lineWidth: 2
234
- }
235
- }
236
- };
237
- p.useToken;
238
- var Z = Symbol.for("immer-nothing"), U = Symbol.for("immer-draftable"), d = Symbol.for("immer-state"), Ae = process.env.NODE_ENV !== "production" ? [
239
- // All error codes, starting by 0:
240
- function(e) {
241
- return `The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`;
242
- },
243
- function(e) {
244
- return `produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`;
245
- },
246
- "This object has been frozen and should not be mutated",
247
- function(e) {
248
- return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? " + e;
249
- },
250
- "An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",
251
- "Immer forbids circular references",
252
- "The first or second argument to `produce` must be a function",
253
- "The third argument to `produce` must be a function or undefined",
254
- "First argument to `createDraft` must be a plain object, an array, or an immerable object",
255
- "First argument to `finishDraft` must be a draft returned by `createDraft`",
256
- function(e) {
257
- return `'current' expects a draft, got: ${e}`;
258
- },
259
- "Object.defineProperty() cannot be used on an Immer draft",
260
- "Object.setPrototypeOf() cannot be used on an Immer draft",
261
- "Immer only supports deleting array indices",
262
- "Immer only supports setting array indices and the 'length' property",
263
- function(e) {
264
- return `'original' expects a draft, got: ${e}`;
265
- }
266
- // Note: if more errors are added, the errorOffset in Patches.ts should be increased
267
- // See Patches.ts for additional errors
268
- ] : [];
269
- function u(e, ...t) {
270
- if (process.env.NODE_ENV !== "production") {
271
- const r = Ae[e], n = typeof r == "function" ? r.apply(null, t) : r;
272
- throw new Error(`[Immer] ${n}`);
273
- }
274
- throw new Error(
275
- `[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`
276
- );
277
- }
278
- var P = Object.getPrototypeOf;
279
- function S(e) {
280
- return !!e && !!e[d];
281
- }
282
- function g(e) {
283
- var t;
284
- return e ? V(e) || Array.isArray(e) || !!e[U] || !!((t = e.constructor) != null && t[U]) || D(e) || N(e) : !1;
285
- }
286
- var xe = Object.prototype.constructor.toString();
287
- function V(e) {
288
- if (!e || typeof e != "object")
289
- return !1;
290
- const t = P(e);
291
- if (t === null)
292
- return !0;
293
- const r = Object.hasOwnProperty.call(t, "constructor") && t.constructor;
294
- return r === Object ? !0 : typeof r == "function" && Function.toString.call(r) === xe;
295
- }
296
- function k(e, t) {
297
- w(e) === 0 ? Object.entries(e).forEach(([r, n]) => {
298
- t(r, n, e);
299
- }) : e.forEach((r, n) => t(n, r, e));
300
- }
301
- function w(e) {
302
- const t = e[d];
303
- return t ? t.type_ : Array.isArray(e) ? 1 : D(e) ? 2 : N(e) ? 3 : 0;
304
- }
305
- function R(e, t) {
306
- return w(e) === 2 ? e.has(t) : Object.prototype.hasOwnProperty.call(e, t);
307
- }
308
- function ee(e, t, r) {
309
- const n = w(e);
310
- n === 2 ? e.set(t, r) : n === 3 ? e.add(r) : e[t] = r;
311
- }
312
- function we(e, t) {
313
- return e === t ? e !== 0 || 1 / e === 1 / t : e !== e && t !== t;
314
- }
315
- function D(e) {
316
- return e instanceof Map;
317
- }
318
- function N(e) {
319
- return e instanceof Set;
320
- }
321
- function b(e) {
322
- return e.copy_ || e.base_;
323
- }
324
- function M(e, t) {
325
- if (D(e))
326
- return new Map(e);
327
- if (N(e))
328
- return new Set(e);
329
- if (Array.isArray(e))
330
- return Array.prototype.slice.call(e);
331
- if (!t && V(e))
332
- return P(e) ? { ...e } : Object.assign(/* @__PURE__ */ Object.create(null), e);
333
- const r = Object.getOwnPropertyDescriptors(e);
334
- delete r[d];
335
- let n = Reflect.ownKeys(r);
336
- for (let o = 0; o < n.length; o++) {
337
- const a = n[o], l = r[a];
338
- l.writable === !1 && (l.writable = !0, l.configurable = !0), (l.get || l.set) && (r[a] = {
339
- configurable: !0,
340
- writable: !0,
341
- // could live with !!desc.set as well here...
342
- enumerable: l.enumerable,
343
- value: e[a]
344
- });
345
- }
346
- return Object.create(P(e), r);
347
- }
348
- function H(e, t = !1) {
349
- return E(e) || S(e) || !g(e) || (w(e) > 1 && (e.set = e.add = e.clear = e.delete = De), Object.freeze(e), t && k(e, (r, n) => H(n, !0))), e;
350
- }
351
- function De() {
352
- u(2);
353
- }
354
- function E(e) {
355
- return Object.isFrozen(e);
356
- }
357
- var Ne = {};
358
- function C(e) {
359
- const t = Ne[e];
360
- return t || u(0, e), t;
361
- }
362
- var z;
363
- function te() {
364
- return z;
365
- }
366
- function Ee(e, t) {
367
- return {
368
- drafts_: [],
369
- parent_: e,
370
- immer_: t,
371
- // Whenever the modified draft contains a draft from another scope, we
372
- // need to prevent auto-freezing so the unowned draft can be finalized.
373
- canAutoFreeze_: !0,
374
- unfinalizedDrafts_: 0
375
- };
376
- }
377
- function X(e, t) {
378
- t && (C("Patches"), e.patches_ = [], e.inversePatches_ = [], e.patchListener_ = t);
379
- }
380
- function $(e) {
381
- j(e), e.drafts_.forEach(Oe), e.drafts_ = null;
382
- }
383
- function j(e) {
384
- e === z && (z = e.parent_);
385
- }
386
- function J(e) {
387
- return z = Ee(z, e);
388
- }
389
- function Oe(e) {
390
- const t = e[d];
391
- t.type_ === 0 || t.type_ === 1 ? t.revoke_() : t.revoked_ = !0;
392
- }
393
- function Q(e, t) {
394
- t.unfinalizedDrafts_ = t.drafts_.length;
395
- const r = t.drafts_[0];
396
- return e !== void 0 && e !== r ? (r[d].modified_ && ($(t), u(4)), g(e) && (e = T(t, e), t.parent_ || A(t, e)), t.patches_ && C("Patches").generateReplacementPatches_(
397
- r[d].base_,
398
- e,
399
- t.patches_,
400
- t.inversePatches_
401
- )) : e = T(t, r, []), $(t), t.patches_ && t.patchListener_(t.patches_, t.inversePatches_), e !== Z ? e : void 0;
402
- }
403
- function T(e, t, r) {
404
- if (E(t))
405
- return t;
406
- const n = t[d];
407
- if (!n)
408
- return k(
409
- t,
410
- (o, a) => q(e, n, t, o, a, r)
411
- ), t;
412
- if (n.scope_ !== e)
413
- return t;
414
- if (!n.modified_)
415
- return A(e, n.base_, !0), n.base_;
416
- if (!n.finalized_) {
417
- n.finalized_ = !0, n.scope_.unfinalizedDrafts_--;
418
- const o = n.copy_;
419
- let a = o, l = !1;
420
- n.type_ === 3 && (a = new Set(o), o.clear(), l = !0), k(
421
- a,
422
- (f, m) => q(e, n, o, f, m, r, l)
423
- ), A(e, o, !1), r && e.patches_ && C("Patches").generatePatches_(
424
- n,
425
- r,
426
- e.patches_,
427
- e.inversePatches_
428
- );
429
- }
430
- return n.copy_;
431
- }
432
- function q(e, t, r, n, o, a, l) {
433
- if (process.env.NODE_ENV !== "production" && o === r && u(5), S(o)) {
434
- const f = a && t && t.type_ !== 3 && // Set objects are atomic since they have no keys.
435
- !R(t.assigned_, n) ? a.concat(n) : void 0, m = T(e, o, f);
436
- if (ee(r, n, m), S(m))
437
- e.canAutoFreeze_ = !1;
438
- else
439
- return;
440
- } else
441
- l && r.add(o);
442
- if (g(o) && !E(o)) {
443
- if (!e.immer_.autoFreeze_ && e.unfinalizedDrafts_ < 1)
444
- return;
445
- T(e, o), (!t || !t.scope_.parent_) && A(e, o);
446
- }
447
- }
448
- function A(e, t, r = !1) {
449
- !e.parent_ && e.immer_.autoFreeze_ && e.canAutoFreeze_ && H(t, r);
450
- }
451
- function Ie(e, t) {
452
- const r = Array.isArray(e), n = {
453
- type_: r ? 1 : 0,
454
- // Track which produce call this is associated with.
455
- scope_: t ? t.scope_ : te(),
456
- // True for both shallow and deep changes.
457
- modified_: !1,
458
- // Used during finalization.
459
- finalized_: !1,
460
- // Track which properties have been assigned (true) or deleted (false).
461
- assigned_: {},
462
- // The parent draft state.
463
- parent_: t,
464
- // The base state.
465
- base_: e,
466
- // The base proxy.
467
- draft_: null,
468
- // set below
469
- // The base copy with any updated values.
470
- copy_: null,
471
- // Called by the `produce` function.
472
- revoke_: null,
473
- isManual_: !1
474
- };
475
- let o = n, a = G;
476
- r && (o = [n], a = v);
477
- const { revoke: l, proxy: f } = Proxy.revocable(o, a);
478
- return n.draft_ = f, n.revoke_ = l, f;
479
- }
480
- var G = {
481
- get(e, t) {
482
- if (t === d)
483
- return e;
484
- const r = b(e);
485
- if (!R(r, t))
486
- return Fe(e, r, t);
487
- const n = r[t];
488
- return e.finalized_ || !g(n) ? n : n === I(e.base_, t) ? (F(e), e.copy_[t] = W(n, e)) : n;
489
- },
490
- has(e, t) {
491
- return t in b(e);
492
- },
493
- ownKeys(e) {
494
- return Reflect.ownKeys(b(e));
495
- },
496
- set(e, t, r) {
497
- const n = re(b(e), t);
498
- if (n != null && n.set)
499
- return n.set.call(e.draft_, r), !0;
500
- if (!e.modified_) {
501
- const o = I(b(e), t), a = o == null ? void 0 : o[d];
502
- if (a && a.base_ === r)
503
- return e.copy_[t] = r, e.assigned_[t] = !1, !0;
504
- if (we(r, o) && (r !== void 0 || R(e.base_, t)))
505
- return !0;
506
- F(e), L(e);
507
- }
508
- return e.copy_[t] === r && // special case: handle new props with value 'undefined'
509
- (r !== void 0 || t in e.copy_) || // special case: NaN
510
- Number.isNaN(r) && Number.isNaN(e.copy_[t]) || (e.copy_[t] = r, e.assigned_[t] = !0), !0;
511
- },
512
- deleteProperty(e, t) {
513
- return I(e.base_, t) !== void 0 || t in e.base_ ? (e.assigned_[t] = !1, F(e), L(e)) : delete e.assigned_[t], e.copy_ && delete e.copy_[t], !0;
514
- },
515
- // Note: We never coerce `desc.value` into an Immer draft, because we can't make
516
- // the same guarantee in ES5 mode.
517
- getOwnPropertyDescriptor(e, t) {
518
- const r = b(e), n = Reflect.getOwnPropertyDescriptor(r, t);
519
- return n && {
520
- writable: !0,
521
- configurable: e.type_ !== 1 || t !== "length",
522
- enumerable: n.enumerable,
523
- value: r[t]
524
- };
525
- },
526
- defineProperty() {
527
- u(11);
528
- },
529
- getPrototypeOf(e) {
530
- return P(e.base_);
531
- },
532
- setPrototypeOf() {
533
- u(12);
534
- }
535
- }, v = {};
536
- k(G, (e, t) => {
537
- v[e] = function() {
538
- return arguments[0] = arguments[0][0], t.apply(this, arguments);
539
- };
540
- });
541
- v.deleteProperty = function(e, t) {
542
- return process.env.NODE_ENV !== "production" && isNaN(parseInt(t)) && u(13), v.set.call(this, e, t, void 0);
543
- };
544
- v.set = function(e, t, r) {
545
- return process.env.NODE_ENV !== "production" && t !== "length" && isNaN(parseInt(t)) && u(14), G.set.call(this, e[0], t, r, e[0]);
546
- };
547
- function I(e, t) {
548
- const r = e[d];
549
- return (r ? b(r) : e)[t];
550
- }
551
- function Fe(e, t, r) {
552
- var o;
553
- const n = re(t, r);
554
- return n ? "value" in n ? n.value : (
555
- // This is a very special case, if the prop is a getter defined by the
556
- // prototype, we should invoke it with the draft as context!
557
- (o = n.get) == null ? void 0 : o.call(e.draft_)
558
- ) : void 0;
559
- }
560
- function re(e, t) {
561
- if (!(t in e))
562
- return;
563
- let r = P(e);
564
- for (; r; ) {
565
- const n = Object.getOwnPropertyDescriptor(r, t);
566
- if (n)
567
- return n;
568
- r = P(r);
569
- }
570
- }
571
- function L(e) {
572
- e.modified_ || (e.modified_ = !0, e.parent_ && L(e.parent_));
573
- }
574
- function F(e) {
575
- e.copy_ || (e.copy_ = M(
576
- e.base_,
577
- e.scope_.immer_.useStrictShallowCopy_
578
- ));
579
- }
580
- var Re = class {
581
- constructor(e) {
582
- this.autoFreeze_ = !0, this.useStrictShallowCopy_ = !1, this.produce = (t, r, n) => {
583
- if (typeof t == "function" && typeof r != "function") {
584
- const a = r;
585
- r = t;
586
- const l = this;
587
- return function(m = a, ...O) {
588
- return l.produce(m, (_) => r.call(this, _, ...O));
589
- };
590
- }
591
- typeof r != "function" && u(6), n !== void 0 && typeof n != "function" && u(7);
592
- let o;
593
- if (g(t)) {
594
- const a = J(this), l = W(t, void 0);
595
- let f = !0;
596
- try {
597
- o = r(l), f = !1;
598
- } finally {
599
- f ? $(a) : j(a);
600
- }
601
- return X(a, n), Q(o, a);
602
- } else if (!t || typeof t != "object") {
603
- if (o = r(t), o === void 0 && (o = t), o === Z && (o = void 0), this.autoFreeze_ && H(o, !0), n) {
604
- const a = [], l = [];
605
- C("Patches").generateReplacementPatches_(t, o, a, l), n(a, l);
606
- }
607
- return o;
608
- } else
609
- u(1, t);
610
- }, this.produceWithPatches = (t, r) => {
611
- if (typeof t == "function")
612
- return (l, ...f) => this.produceWithPatches(l, (m) => t(m, ...f));
613
- let n, o;
614
- return [this.produce(t, r, (l, f) => {
615
- n = l, o = f;
616
- }), n, o];
617
- }, typeof (e == null ? void 0 : e.autoFreeze) == "boolean" && this.setAutoFreeze(e.autoFreeze), typeof (e == null ? void 0 : e.useStrictShallowCopy) == "boolean" && this.setUseStrictShallowCopy(e.useStrictShallowCopy);
618
- }
619
- createDraft(e) {
620
- g(e) || u(8), S(e) && (e = Me(e));
621
- const t = J(this), r = W(e, void 0);
622
- return r[d].isManual_ = !0, j(t), r;
623
- }
624
- finishDraft(e, t) {
625
- const r = e && e[d];
626
- (!r || !r.isManual_) && u(9);
627
- const { scope_: n } = r;
628
- return X(n, t), Q(void 0, n);
629
- }
630
- /**
631
- * Pass true to automatically freeze all copies created by Immer.
632
- *
633
- * By default, auto-freezing is enabled.
634
- */
635
- setAutoFreeze(e) {
636
- this.autoFreeze_ = e;
637
- }
638
- /**
639
- * Pass true to enable strict shallow copy.
640
- *
641
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
642
- */
643
- setUseStrictShallowCopy(e) {
644
- this.useStrictShallowCopy_ = e;
645
- }
646
- applyPatches(e, t) {
647
- let r;
648
- for (r = t.length - 1; r >= 0; r--) {
649
- const o = t[r];
650
- if (o.path.length === 0 && o.op === "replace") {
651
- e = o.value;
652
- break;
653
- }
654
- }
655
- r > -1 && (t = t.slice(r + 1));
656
- const n = C("Patches").applyPatches_;
657
- return S(e) ? n(e, t) : this.produce(
658
- e,
659
- (o) => n(o, t)
660
- );
661
- }
662
- };
663
- function W(e, t) {
664
- const r = D(e) ? C("MapSet").proxyMap_(e, t) : N(e) ? C("MapSet").proxySet_(e, t) : Ie(e, t);
665
- return (t ? t.scope_ : te()).drafts_.push(r), r;
666
- }
667
- function Me(e) {
668
- return S(e) || u(10, e), ne(e);
669
- }
670
- function ne(e) {
671
- if (!g(e) || E(e))
672
- return e;
673
- const t = e[d];
674
- let r;
675
- if (t) {
676
- if (!t.modified_)
677
- return t.base_;
678
- t.finalized_ = !0, r = M(e, t.scope_.immer_.useStrictShallowCopy_);
679
- } else
680
- r = M(e, !0);
681
- return k(r, (n, o) => {
682
- ee(r, n, ne(o));
683
- }), t && (t.finalized_ = !1), r;
684
- }
685
- var y = new Re(), $e = y.produce;
686
- y.produceWithPatches.bind(
687
- y
688
- );
689
- y.setAutoFreeze.bind(y);
690
- y.setUseStrictShallowCopy.bind(y);
691
- y.applyPatches.bind(y);
692
- y.createDraft.bind(y);
693
- y.finishDraft.bind(y);
694
- function je(e, t, r) {
695
- var n = he(function() {
696
- return $e(e);
697
- }, [e]);
698
- return me(n, t, r);
699
- }
700
- const oe = _e(void 0), Le = ({
701
- useAkitablePagination: e,
702
- headerActions: t,
703
- children: r
704
- }) => {
705
- const n = {
706
- selectedRows: []
707
- }, [o, a] = je(
708
- (l, f) => {
709
- switch (f.type) {
710
- case "RESET":
711
- return n;
712
- case "SET_SELECTED_ROWS":
713
- l.selectedRows = f.payload;
714
- return;
715
- }
716
- },
717
- n
718
- );
719
- return /* @__PURE__ */ c(
720
- oe.Provider,
721
- {
722
- value: {
723
- state: o,
724
- dispatch: a,
725
- useAkitablePagination: e,
726
- headerActions: t
727
- },
728
- children: r
729
- }
730
- );
731
- }, K = () => {
732
- const e = pe(oe);
733
- if (e === void 0)
734
- throw new Error(
735
- "useAkitableContext must be used within a AkitableContextProvider"
736
- );
737
- return e;
738
- }, We = ({
739
- rowSelection: e,
740
- ...t
741
- }) => {
742
- const { dispatch: r } = K(), n = e && {
743
- ...e,
744
- onChange: (o, a) => {
745
- e.onChange && e.onChange(o, a, { type: "all" }), r({
746
- type: "SET_SELECTED_ROWS",
747
- payload: a
748
- });
749
- }
750
- };
751
- return /* @__PURE__ */ c(
752
- le,
753
- {
754
- bordered: !0,
755
- pagination: !1,
756
- rowSelection: n,
757
- ...t
758
- }
759
- );
760
- };
761
- const He = (e) => /* @__PURE__ */ c(x.Link, { ...e }), Ge = (e) => /* @__PURE__ */ c(x.Paragraph, { ...e }), Ke = (e) => /* @__PURE__ */ c(x.Text, { ...e }), Ue = (e) => /* @__PURE__ */ c(x.Title, { ...e }), Xe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
762
- __proto__: null,
763
- Link: He,
764
- Paragraph: Ge,
765
- Text: Ke,
766
- Title: Ue
767
- }, Symbol.toStringTag, { value: "Module" })), ae = ({ children: e, ...t }) => /* @__PURE__ */ c(Y, { ...t, children: e });
768
- Y.Meta;
769
- const Je = () => /* @__PURE__ */ c(
770
- ae,
771
- {
772
- style: {
773
- borderTopLeftRadius: 0,
774
- borderTopRightRadius: 0
775
- },
776
- children: /* @__PURE__ */ c("div", { className: "akitable-footer", children: /* @__PURE__ */ c(ie, {}) })
777
- }
778
- );
779
- const { Title: Qe, Text: qe } = Xe, Ye = ({
780
- title: e,
781
- description: t,
782
- headerMiddleBlock: r
783
- }) => /* @__PURE__ */ c(
784
- ae,
785
- {
786
- style: {
787
- borderBottomLeftRadius: 0,
788
- borderBottomRightRadius: 0
789
- },
790
- children: /* @__PURE__ */ B("div", { className: "akitable-header", children: [
791
- /* @__PURE__ */ B("div", { className: "akitable-header__left-block", children: [
792
- /* @__PURE__ */ B("div", { className: "akitable-header__info", children: [
793
- /* @__PURE__ */ c(Qe, { className: "akitable-header__title", level: 5, children: e }),
794
- /* @__PURE__ */ c(qe, { className: "akitable-header__description", children: t })
795
- ] }),
796
- /* @__PURE__ */ c(
797
- tt,
798
- {
799
- placeholder: "Please select an action",
800
- applyButtonLabel: "Apply"
801
- }
802
- )
803
- ] }),
804
- /* @__PURE__ */ c("div", { className: "akitable-header__middle-block", children: r }),
805
- /* @__PURE__ */ c("div", { className: "akitable-header__right-block", children: /* @__PURE__ */ c(ie, {}) })
806
- ] })
807
- }
808
- );
809
- const Ze = ({ children: e, ...t }) => /* @__PURE__ */ c(se, { ...t, children: e }), Ve = ({ children: e, ...t }) => /* @__PURE__ */ c(fe, { ...t, children: e }), et = ({ children: e, ...t }) => /* @__PURE__ */ c(ue, { ...t, children: e }), tt = ({
810
- placeholder: e,
811
- applyButtonLabel: t
812
- }) => {
813
- const [r, n] = be(void 0), {
814
- state: { selectedRows: o },
815
- headerActions: a
816
- } = K();
817
- if (!a)
818
- return;
819
- const l = a.map((_, ce) => ({
820
- label: _.label,
821
- value: ce,
822
- // do not check isSingleRequired in here but in action handler, since user can select multiple rows after selecting the action which will lead errors.
823
- disabled: _.disabled
824
- })), f = () => {
825
- if (r == null || (o == null ? void 0 : o.length) === 0)
826
- return;
827
- const _ = a[r];
828
- _ == null || _.handler(o);
829
- }, m = (_) => {
830
- n(_);
831
- }, O = r === void 0 || (o == null ? void 0 : o.length) === 0;
832
- return /* @__PURE__ */ B(et, { align: "baseline", className: "header-actions", children: [
833
- /* @__PURE__ */ c(
834
- Ve,
835
- {
836
- value: r,
837
- onChange: m,
838
- options: l,
839
- placeholder: e,
840
- className: "header-actions__select"
841
- }
842
- ),
843
- /* @__PURE__ */ c(
844
- Ze,
845
- {
846
- disabled: O,
847
- className: "header-actions__apply-button",
848
- onClick: f,
849
- children: t
850
- }
851
- )
852
- ] });
853
- };
854
- const rt = ({ ...e }) => /* @__PURE__ */ c(
855
- de,
856
- {
857
- ...e
858
- }
859
- ), ie = () => {
860
- const { useAkitablePagination: e } = K(), [t, r] = e, n = (o, a) => {
861
- r({
862
- ...t,
863
- currentPage: o,
864
- pageSize: a
865
- });
866
- };
867
- return /* @__PURE__ */ c("div", { className: "akitable-pagination-container", children: /* @__PURE__ */ c(
868
- rt,
869
- {
870
- className: "akitable-pagination-container__pagination",
871
- current: t.currentPage,
872
- total: t.totalDataLength,
873
- pageSize: t.pageSize,
874
- onChange: n,
875
- simple: !0,
876
- locale: {
877
- items_per_page: t.paginationLabel || "per page"
878
- }
879
- }
880
- ) });
881
- }, it = ({
882
- useAkitablePagination: e,
883
- title: t,
884
- description: r,
885
- headerActions: n,
886
- headerMiddleBlock: o,
887
- ...a
888
- }) => /* @__PURE__ */ c("div", { className: "akitable-container", children: /* @__PURE__ */ c(
889
- ye,
890
- {
891
- prefixCls: "akinon",
892
- theme: {
893
- components: {
894
- Checkbox: {
895
- colorBgBase: s.colors.neutral[50],
896
- algorithm: p.defaultAlgorithm
897
- },
898
- Card: {
899
- paddingLG: 0,
900
- colorBgContainer: s.colors.neutral[50],
901
- colorBgBase: s.colors.neutral[50],
902
- colorTextBase: s.colors.neutral[950],
903
- algorithm: p.defaultAlgorithm
904
- },
905
- Typography: {
906
- colorTextHeading: s.colors.neutral[950],
907
- colorText: s.colors.neutral[500],
908
- titleMarginBottom: 0,
909
- fontWeightStrong: 500
910
- },
911
- Select: {
912
- colorText: s.colors.neutral[950],
913
- selectorBg: s.colors.neutral[50],
914
- colorBgElevated: s.colors.neutral[100],
915
- colorBorder: s.colors.neutral[350],
916
- colorTextQuaternary: s.colors.neutral[500],
917
- optionSelectedBg: s.colors.azure[100],
918
- algorithm: p.defaultAlgorithm
919
- },
920
- Pagination: {
921
- colorText: s.colors.neutral[950],
922
- itemInputBg: s.colors.neutral[75],
923
- colorBorder: s.colors.neutral[350],
924
- borderRadius: 0,
925
- itemActiveBg: s.colors.neutral[500],
926
- colorTextDisabled: s.colors.neutral[375],
927
- marginXS: 0,
928
- itemSizeSM: 38
929
- },
930
- Spin: {
931
- colorBgContainer: s.colors.neutral[50]
932
- },
933
- Table: {
934
- headerBorderRadius: 0,
935
- headerBg: s.colors.neutral[150],
936
- headerColor: s.colors.neutral[500],
937
- borderColor: s.colors.neutral[350],
938
- fontSize: h * 0.875,
939
- colorBgContainer: s.colors.neutral[50],
940
- colorText: s.colors.neutral[500],
941
- cellPaddingInline: 28,
942
- colorBgBase: s.colors.neutral[50],
943
- algorithm: p.defaultAlgorithm
944
- },
945
- Button: {
946
- colorBgBase: s.colors.neutral[50],
947
- colorTextBase: s.colors.azure[500],
948
- colorBorder: s.colors.azure[500],
949
- borderColorDisabled: s.colors.neutral[350],
950
- algorithm: p.defaultAlgorithm
951
- }
952
- }
953
- },
954
- children: /* @__PURE__ */ B(
955
- Le,
956
- {
957
- useAkitablePagination: e,
958
- headerActions: n,
959
- children: [
960
- /* @__PURE__ */ c(
961
- Ye,
962
- {
963
- title: t,
964
- description: r,
965
- headerMiddleBlock: o
966
- }
967
- ),
968
- /* @__PURE__ */ c(We, { ...a }),
969
- /* @__PURE__ */ c(Je, {})
970
- ]
971
- }
972
- )
973
- }
974
- ) });
975
- export {
976
- it as Akitable
977
- };