wini-web-components 2.2.8 → 2.3.2

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 (63) hide show
  1. package/dist/component/button/button.d.ts +16 -16
  2. package/dist/component/button/button.js +39 -39
  3. package/dist/component/calendar/calendar.d.ts +30 -46
  4. package/dist/component/calendar/calendar.js +437 -432
  5. package/dist/component/checkbox/checkbox.d.ts +24 -22
  6. package/dist/component/checkbox/checkbox.js +120 -81
  7. package/dist/component/component-status.d.ts +8 -8
  8. package/dist/component/component-status.js +39 -39
  9. package/dist/component/date-picker/date-picker.d.ts +25 -36
  10. package/dist/component/date-picker/date-picker.js +362 -359
  11. package/dist/component/dialog/dialog.d.ts +36 -34
  12. package/dist/component/dialog/dialog.js +99 -97
  13. package/dist/component/import-file/import-file.d.ts +24 -36
  14. package/dist/component/import-file/import-file.js +154 -119
  15. package/dist/component/infinite-scroll/infinite-scroll.d.ts +17 -17
  16. package/dist/component/infinite-scroll/infinite-scroll.js +103 -103
  17. package/dist/component/input-multi-select/input-multi-select.d.ts +21 -38
  18. package/dist/component/input-multi-select/input-multi-select.js +334 -323
  19. package/dist/component/input-opt/input-opt.d.ts +21 -21
  20. package/dist/component/input-opt/input-opt.js +157 -147
  21. package/dist/component/number-picker/number-picker.d.ts +19 -19
  22. package/dist/component/number-picker/number-picker.js +137 -127
  23. package/dist/component/pagination/pagination.d.ts +13 -13
  24. package/dist/component/pagination/pagination.js +93 -82
  25. package/dist/component/popup/popup.d.ts +33 -33
  26. package/dist/component/popup/popup.js +138 -105
  27. package/dist/component/progress-bar/progress-bar.d.ts +16 -16
  28. package/dist/component/progress-bar/progress-bar.js +35 -36
  29. package/dist/component/progress-circle/progress-circle.d.ts +14 -14
  30. package/dist/component/progress-circle/progress-circle.js +30 -31
  31. package/dist/component/radio-button/radio-button.d.ts +20 -20
  32. package/dist/component/radio-button/radio-button.js +64 -64
  33. package/dist/component/rating/rating.d.ts +23 -23
  34. package/dist/component/rating/rating.js +73 -74
  35. package/dist/component/select1/select1.d.ts +31 -50
  36. package/dist/component/select1/select1.js +320 -309
  37. package/dist/component/slider/slider.d.ts +31 -31
  38. package/dist/component/slider/slider.js +80 -81
  39. package/dist/component/switch/switch.d.ts +23 -23
  40. package/dist/component/switch/switch.js +80 -81
  41. package/dist/component/table/table.d.ts +51 -51
  42. package/dist/component/table/table.js +119 -119
  43. package/dist/component/tag/tag.d.ts +17 -17
  44. package/dist/component/tag/tag.js +39 -39
  45. package/dist/component/text/text.d.ts +16 -16
  46. package/dist/component/text/text.js +51 -51
  47. package/dist/component/text-area/text-area.d.ts +28 -28
  48. package/dist/component/text-area/text-area.js +83 -73
  49. package/dist/component/text-field/text-field.d.ts +33 -33
  50. package/dist/component/text-field/text-field.js +107 -97
  51. package/dist/component/toast-noti/toast-noti.d.ts +5 -5
  52. package/dist/component/toast-noti/toast-noti.js +28 -28
  53. package/dist/component/wini-icon/winicon.d.ts +16 -16
  54. package/dist/component/wini-icon/winicon.js +121 -112
  55. package/dist/form/login/view.d.ts +40 -40
  56. package/dist/form/login/view.js +66 -65
  57. package/dist/i18n.d.ts +2 -0
  58. package/dist/i18n.js +125 -0
  59. package/dist/index.d.ts +32 -31
  60. package/dist/index.js +1 -1
  61. package/dist/language/i18n.d.ts +2 -0
  62. package/dist/language/i18n.js +125 -0
  63. package/package.json +5 -3
@@ -1,127 +1,137 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.NumberPicker = void 0;
41
- var react_1 = __importStar(require("react"));
42
- var number_picker_module_css_1 = __importDefault(require("./number-picker.module.css"));
43
- var NumberPicker = function (_a) {
44
- var id = _a.id, value = _a.value, onChange = _a.onChange, disabled = _a.disabled, readOnly = _a.readOnly, className = _a.className, helperText = _a.helperText, helperTextColor = _a.helperTextColor, max = _a.max, min = _a.min, style = _a.style, _b = _a.type, type = _b === void 0 ? "icon-button" : _b, _c = _a.volume, volume = _c === void 0 ? 1 : _c;
45
- var _d = (0, react_1.useState)(0), val = _d[0], setValue = _d[1];
46
- var inputRef = (0, react_1.useRef)(null);
47
- (0, react_1.useEffect)(function () {
48
- if (inputRef.current) {
49
- setValue(value !== null && value !== void 0 ? value : 0);
50
- inputRef.current.value = "".concat(value !== null && value !== void 0 ? value : 0);
51
- }
52
- }, [value, inputRef]);
53
- return react_1.default.createElement("div", { id: id, className: "row ".concat(number_picker_module_css_1.default["number-picker-container"], " ").concat(className !== null && className !== void 0 ? className : "body-2", " ").concat((helperText === null || helperText === void 0 ? void 0 : helperText.length) && number_picker_module_css_1.default['helper-text']), "number-picker-type": type !== null && type !== void 0 ? type : "icon-button", "helper-text": helperText, style: style ? __assign(__assign({}, { '--helper-text-color': helperTextColor !== null && helperTextColor !== void 0 ? helperTextColor : '#e14337' }), style) : { '--helper-text-color': helperTextColor !== null && helperTextColor !== void 0 ? helperTextColor : '#e14337' } },
54
- react_1.default.createElement("div", { className: "row", onClick: function () {
55
- var newValue = val - volume;
56
- if (min === undefined || newValue >= min) {
57
- if (volume % 1 === 0)
58
- newValue = Math.round(newValue);
59
- else
60
- newValue = parseFloat(newValue.toFixed(1));
61
- setValue(newValue);
62
- if (inputRef.current)
63
- inputRef.current.value = "".concat(newValue);
64
- if (onChange)
65
- onChange(newValue);
66
- }
67
- } },
68
- react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
69
- react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1.3335 7.93907C1.3335 7.60435 1.60484 7.33301 1.93956 7.33301H14.0608C14.3955 7.33301 14.6668 7.60435 14.6668 7.93907C14.6668 8.27379 14.3955 8.54513 14.0608 8.54513H1.93956C1.60484 8.54513 1.3335 8.27379 1.3335 7.93907Z" }))),
70
- react_1.default.createElement("input", { ref: inputRef, readOnly: readOnly, disabled: disabled, onKeyDown: function (ev) {
71
- switch (ev.key.toLowerCase()) {
72
- case "enter":
73
- ev.target.blur();
74
- break;
75
- default:
76
- break;
77
- }
78
- }, onFocus: function (ev) { ev.target.select(); }, onBlur: function (ev) {
79
- var newValue = volume % 1 === 0 ? parseInt(ev.target.value.trim()) : parseFloat(ev.target.value.trim());
80
- if (isNaN(newValue))
81
- ev.target.value = "".concat(val);
82
- else {
83
- if (volume % 1 === 0)
84
- newValue = Math.round(newValue);
85
- else
86
- newValue = parseFloat(newValue.toFixed(1));
87
- if (min !== undefined && newValue < min) {
88
- setValue(min);
89
- if (inputRef.current)
90
- inputRef.current.value = "".concat(min);
91
- if (onChange)
92
- onChange(min);
93
- }
94
- else if (max !== undefined && newValue > max) {
95
- setValue(max);
96
- if (inputRef.current)
97
- inputRef.current.value = "".concat(max);
98
- if (onChange)
99
- onChange(max);
100
- }
101
- else {
102
- setValue(newValue);
103
- if (inputRef.current)
104
- inputRef.current.value = "".concat(newValue);
105
- if (onChange)
106
- onChange(newValue);
107
- }
108
- }
109
- } }),
110
- react_1.default.createElement("div", { className: "row", onClick: function () {
111
- var newValue = val + volume;
112
- if (max === undefined || newValue <= max) {
113
- if (volume % 1 === 0)
114
- newValue = Math.round(newValue);
115
- else
116
- newValue = parseFloat(newValue.toFixed(1));
117
- setValue(newValue);
118
- if (inputRef.current)
119
- inputRef.current.value = "".concat(newValue);
120
- if (onChange)
121
- onChange(newValue);
122
- }
123
- } },
124
- react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
125
- react_1.default.createElement("path", { d: "M8.60622 1.93907C8.60622 1.60435 8.33488 1.33301 8.00016 1.33301C7.66544 1.33301 7.3941 1.60435 7.3941 1.93907V7.39361H1.93956C1.60484 7.39361 1.3335 7.66496 1.3335 7.99967C1.3335 8.33439 1.60484 8.60574 1.93956 8.60574H7.3941V14.0603C7.3941 14.395 7.66544 14.6663 8.00016 14.6663C8.33488 14.6663 8.60622 14.395 8.60622 14.0603V8.60574H14.0608C14.3955 8.60574 14.6668 8.33439 14.6668 7.99967C14.6668 7.66496 14.3955 7.39361 14.0608 7.39361H8.60622V1.93907Z" }))));
126
- };
127
- exports.NumberPicker = NumberPicker;
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __importDefault = (this && this.__importDefault) || function (mod) {
47
+ return (mod && mod.__esModule) ? mod : { "default": mod };
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.NumberPicker = void 0;
51
+ var react_1 = __importStar(require("react"));
52
+ var number_picker_module_css_1 = __importDefault(require("./number-picker.module.css"));
53
+ var NumberPicker = function (_a) {
54
+ var id = _a.id, value = _a.value, onChange = _a.onChange, disabled = _a.disabled, readOnly = _a.readOnly, className = _a.className, helperText = _a.helperText, helperTextColor = _a.helperTextColor, max = _a.max, min = _a.min, style = _a.style, _b = _a.type, type = _b === void 0 ? "icon-button" : _b, _c = _a.volume, volume = _c === void 0 ? 1 : _c;
55
+ var _d = (0, react_1.useState)(0), val = _d[0], setValue = _d[1];
56
+ var inputRef = (0, react_1.useRef)(null);
57
+ (0, react_1.useEffect)(function () {
58
+ if (inputRef.current) {
59
+ setValue(value !== null && value !== void 0 ? value : 0);
60
+ inputRef.current.value = "".concat(value !== null && value !== void 0 ? value : 0);
61
+ }
62
+ }, [value, inputRef]);
63
+ return react_1.default.createElement("div", { id: id, className: "row ".concat(number_picker_module_css_1.default["number-picker-container"], " ").concat(className !== null && className !== void 0 ? className : "body-2", " ").concat((helperText === null || helperText === void 0 ? void 0 : helperText.length) && number_picker_module_css_1.default['helper-text']), "number-picker-type": type !== null && type !== void 0 ? type : "icon-button", "helper-text": helperText, style: style ? __assign(__assign({}, { '--helper-text-color': helperTextColor !== null && helperTextColor !== void 0 ? helperTextColor : '#e14337' }), style) : { '--helper-text-color': helperTextColor !== null && helperTextColor !== void 0 ? helperTextColor : '#e14337' } },
64
+ react_1.default.createElement("div", { className: "row", onClick: function () {
65
+ var newValue = val - volume;
66
+ if (min === undefined || newValue >= min) {
67
+ if (volume % 1 === 0)
68
+ newValue = Math.round(newValue);
69
+ else
70
+ newValue = parseFloat(newValue.toFixed(1));
71
+ setValue(newValue);
72
+ if (inputRef.current)
73
+ inputRef.current.value = "".concat(newValue);
74
+ if (onChange)
75
+ onChange(newValue);
76
+ }
77
+ } },
78
+ react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
79
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1.3335 7.93907C1.3335 7.60435 1.60484 7.33301 1.93956 7.33301H14.0608C14.3955 7.33301 14.6668 7.60435 14.6668 7.93907C14.6668 8.27379 14.3955 8.54513 14.0608 8.54513H1.93956C1.60484 8.54513 1.3335 8.27379 1.3335 7.93907Z" }))),
80
+ react_1.default.createElement("input", { ref: inputRef, readOnly: readOnly, disabled: disabled, onKeyDown: function (ev) {
81
+ switch (ev.key.toLowerCase()) {
82
+ case "enter":
83
+ ev.target.blur();
84
+ break;
85
+ default:
86
+ break;
87
+ }
88
+ }, onFocus: function (ev) { ev.target.select(); }, onBlur: function (ev) {
89
+ var newValue = volume % 1 === 0 ? parseInt(ev.target.value.trim()) : parseFloat(ev.target.value.trim());
90
+ if (isNaN(newValue))
91
+ ev.target.value = "".concat(val);
92
+ else {
93
+ if (volume % 1 === 0)
94
+ newValue = Math.round(newValue);
95
+ else
96
+ newValue = parseFloat(newValue.toFixed(1));
97
+ if (min !== undefined && newValue < min) {
98
+ setValue(min);
99
+ if (inputRef.current)
100
+ inputRef.current.value = "".concat(min);
101
+ if (onChange)
102
+ onChange(min);
103
+ }
104
+ else if (max !== undefined && newValue > max) {
105
+ setValue(max);
106
+ if (inputRef.current)
107
+ inputRef.current.value = "".concat(max);
108
+ if (onChange)
109
+ onChange(max);
110
+ }
111
+ else {
112
+ setValue(newValue);
113
+ if (inputRef.current)
114
+ inputRef.current.value = "".concat(newValue);
115
+ if (onChange)
116
+ onChange(newValue);
117
+ }
118
+ }
119
+ } }),
120
+ react_1.default.createElement("div", { className: "row", onClick: function () {
121
+ var newValue = val + volume;
122
+ if (max === undefined || newValue <= max) {
123
+ if (volume % 1 === 0)
124
+ newValue = Math.round(newValue);
125
+ else
126
+ newValue = parseFloat(newValue.toFixed(1));
127
+ setValue(newValue);
128
+ if (inputRef.current)
129
+ inputRef.current.value = "".concat(newValue);
130
+ if (onChange)
131
+ onChange(newValue);
132
+ }
133
+ } },
134
+ react_1.default.createElement("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
135
+ react_1.default.createElement("path", { d: "M8.60622 1.93907C8.60622 1.60435 8.33488 1.33301 8.00016 1.33301C7.66544 1.33301 7.3941 1.60435 7.3941 1.93907V7.39361H1.93956C1.60484 7.39361 1.3335 7.66496 1.3335 7.99967C1.3335 8.33439 1.60484 8.60574 1.93956 8.60574H7.3941V14.0603C7.3941 14.395 7.66544 14.6663 8.00016 14.6663C8.33488 14.6663 8.60622 14.395 8.60622 14.0603V8.60574H14.0608C14.3955 8.60574 14.6668 8.33439 14.6668 7.99967C14.6668 7.66496 14.3955 7.39361 14.0608 7.39361H8.60622V1.93907Z" }))));
136
+ };
137
+ exports.NumberPicker = NumberPicker;
@@ -1,13 +1,13 @@
1
- import React, { CSSProperties } from "react";
2
- interface Props {
3
- id?: string;
4
- currentPage: number;
5
- itemPerPage: number;
6
- totalItem: number;
7
- onChangePage: Function;
8
- hideGoToPage?: boolean;
9
- hidePageSize?: boolean;
10
- style: CSSProperties;
11
- }
12
- export declare function Pagination({ id, currentPage, itemPerPage, totalItem, onChangePage, hidePageSize, hideGoToPage, style }: Props): React.JSX.Element;
13
- export {};
1
+ import React, { CSSProperties } from "react";
2
+ interface Props {
3
+ id?: string;
4
+ currentPage: number;
5
+ itemPerPage: number;
6
+ totalItem: number;
7
+ onChangePage: Function;
8
+ hideGoToPage?: boolean;
9
+ hidePageSize?: boolean;
10
+ style: CSSProperties;
11
+ }
12
+ export declare function Pagination({ id, currentPage, itemPerPage, totalItem, onChangePage, hidePageSize, hideGoToPage, style }: Props): React.JSX.Element;
13
+ export {};
@@ -1,82 +1,93 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Pagination = void 0;
30
- var react_1 = __importStar(require("react"));
31
- var react_paginate_1 = __importDefault(require("react-paginate"));
32
- var pagination_module_css_1 = __importDefault(require("./pagination.module.css"));
33
- var select1_1 = require("../select1/select1");
34
- var text_1 = require("../text/text");
35
- var text_field_1 = require("../text-field/text-field");
36
- var winicon_1 = require("../wini-icon/winicon");
37
- function Pagination(_a) {
38
- var id = _a.id, currentPage = _a.currentPage, itemPerPage = _a.itemPerPage, totalItem = _a.totalItem, onChangePage = _a.onChangePage, _b = _a.hidePageSize, hidePageSize = _b === void 0 ? false : _b, _c = _a.hideGoToPage, hideGoToPage = _c === void 0 ? false : _c, style = _a.style;
39
- var goToPageRef = (0, react_1.useRef)();
40
- (0, react_1.useEffect)(function () {
41
- if (goToPageRef.current) {
42
- var _inputPage = goToPageRef.current.getInput();
43
- if (_inputPage)
44
- _inputPage.value = currentPage.toString();
45
- }
46
- }, [currentPage]);
47
- if (currentPage > 1 && (totalItem === 0 || (Math.floor(totalItem / itemPerPage) + (totalItem % itemPerPage === 0 ? 0 : 1)) < currentPage)) {
48
- onChangePage(1, itemPerPage);
49
- return react_1.default.createElement("div", null);
50
- }
51
- else if (totalItem > 0) {
52
- return react_1.default.createElement("div", { id: id, className: "".concat(pagination_module_css_1.default['custom-pagination'], " row"), style: style },
53
- hidePageSize ? null : react_1.default.createElement("div", { className: "row", style: { gap: '0.8rem' } },
54
- react_1.default.createElement(select1_1.Select1, { readOnly: true, placeholder: itemPerPage.toString(), options: [10, 20, 50, 80, 100, 150, 200].map(function (item, _) { return { id: item, name: item }; }), style: { borderRadius: '0.4rem', width: '5.6rem', padding: '0 0.8rem', height: '2.4rem' }, onChange: function (ev) {
55
- onChangePage(currentPage, isNaN(parseInt(ev.id)) ? itemPerPage : parseInt(ev.id));
56
- } }),
57
- react_1.default.createElement(text_1.Text, { className: "body-3" },
58
- "of ",
59
- totalItem,
60
- " items")),
61
- react_1.default.createElement("div", { style: { flex: 1 } }),
62
- react_1.default.createElement(react_paginate_1.default, { onPageChange: function (ev) {
63
- onChangePage(ev.selected + 1, itemPerPage);
64
- }, forcePage: currentPage - 1, breakClassName: "row button-text-3", breakLabel: "...", pageCount: Math.ceil(totalItem / itemPerPage), previousClassName: "row", previousLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/left-arrow", size: "1.4rem" }), nextClassName: "row", nextLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/right-arrow", size: "1.4rem" }), containerClassName: "".concat(pagination_module_css_1.default['pagination'], " row"), pageClassName: "row button-text-3", activeClassName: pagination_module_css_1.default['active'], hrefBuilder: function (pageIndex) {
65
- return pageIndex >= 1 && pageIndex <= Math.ceil(totalItem / itemPerPage) ? "/page/".concat(pageIndex) : '#';
66
- }, renderOnZeroPageCount: null }),
67
- hideGoToPage ? null : react_1.default.createElement(react_1.default.Fragment, null,
68
- react_1.default.createElement("div", { style: { height: '1.6rem', backgroundColor: "var(--neutral-bolder-border-color)", width: 1 } }),
69
- react_1.default.createElement(text_1.Text, { className: "label-3" }, "Go to page"),
70
- react_1.default.createElement(text_field_1.TextField, { ref: goToPageRef, style: { width: '4.8rem', textAlign: "center", padding: 0, height: '2.4rem', borderRadius: '0.4rem' }, className: "body-3", type: "number", onBlur: function (ev) {
71
- var _tmp = ev.target.value.trim().length ? parseInt(ev.target.value.trim()) : undefined;
72
- if (_tmp && !isNaN(_tmp) && _tmp > 0 && _tmp <= Math.ceil(totalItem / itemPerPage)) {
73
- onChangePage(_tmp, itemPerPage);
74
- }
75
- else
76
- ev.target.value = "";
77
- } })));
78
- }
79
- else
80
- return react_1.default.createElement("div", { id: id });
81
- }
82
- exports.Pagination = Pagination;
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.Pagination = Pagination;
40
+ var react_1 = __importStar(require("react"));
41
+ var react_paginate_1 = __importDefault(require("react-paginate"));
42
+ var pagination_module_css_1 = __importDefault(require("./pagination.module.css"));
43
+ var select1_1 = require("../select1/select1");
44
+ var text_1 = require("../text/text");
45
+ var text_field_1 = require("../text-field/text-field");
46
+ var winicon_1 = require("../wini-icon/winicon");
47
+ var react_i18next_1 = require("react-i18next");
48
+ function Pagination(_a) {
49
+ var id = _a.id, currentPage = _a.currentPage, itemPerPage = _a.itemPerPage, totalItem = _a.totalItem, onChangePage = _a.onChangePage, _b = _a.hidePageSize, hidePageSize = _b === void 0 ? false : _b, _c = _a.hideGoToPage, hideGoToPage = _c === void 0 ? false : _c, style = _a.style;
50
+ var goToPageRef = (0, react_1.useRef)(null);
51
+ var t = (0, react_i18next_1.useTranslation)().t;
52
+ (0, react_1.useEffect)(function () {
53
+ if (goToPageRef.current) {
54
+ var _inputPage = goToPageRef.current.getInput();
55
+ if (_inputPage)
56
+ _inputPage.value = currentPage.toString();
57
+ }
58
+ }, [currentPage]);
59
+ if (currentPage > 1 && (totalItem === 0 || (Math.floor(totalItem / itemPerPage) + (totalItem % itemPerPage === 0 ? 0 : 1)) < currentPage)) {
60
+ onChangePage(1, itemPerPage);
61
+ return react_1.default.createElement("div", null);
62
+ }
63
+ else if (totalItem > 0) {
64
+ return react_1.default.createElement("div", { id: id, className: "".concat(pagination_module_css_1.default['custom-pagination'], " row"), style: style },
65
+ hidePageSize ? null : react_1.default.createElement("div", { className: "row", style: { gap: '0.8rem' } },
66
+ react_1.default.createElement(select1_1.Select1, { readOnly: true, placeholder: itemPerPage.toString(), options: [10, 20, 50, 80, 100, 150, 200].map(function (item, _) { return { id: item, name: item }; }), style: { borderRadius: '0.4rem', width: '5.6rem', padding: '0 0.8rem', height: '2.4rem' }, onChange: function (ev) {
67
+ onChangePage(currentPage, isNaN(parseInt(ev.id)) ? itemPerPage : parseInt(ev.id));
68
+ } }),
69
+ react_1.default.createElement(text_1.Text, { className: "body-3" }, t("ofItems", { totalItem: totalItem }))),
70
+ react_1.default.createElement("div", { style: { flex: 1 } }),
71
+ react_1.default.createElement(react_paginate_1.default, { onPageChange: function (ev) {
72
+ onChangePage(ev.selected + 1, itemPerPage);
73
+ }, forcePage: currentPage - 1, breakClassName: "row button-text-3", breakLabel: "...", pageCount: Math.ceil(totalItem / itemPerPage), previousClassName: "row", previousLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/left-arrow", size: "1.4rem" }), nextClassName: "row", nextLabel: react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/right-arrow", size: "1.4rem" }), containerClassName: "".concat(pagination_module_css_1.default['pagination'], " row"), pageClassName: "row button-text-3", activeClassName: pagination_module_css_1.default['active'], hrefBuilder: function (pageIndex) {
74
+ return pageIndex >= 1 && pageIndex <= Math.ceil(totalItem / itemPerPage) ? "/page/".concat(pageIndex) : '#';
75
+ }, renderOnZeroPageCount: null }),
76
+ hideGoToPage ? null : react_1.default.createElement(react_1.default.Fragment, null,
77
+ react_1.default.createElement("div", { style: { height: '1.6rem', backgroundColor: "var(--neutral-bolder-border-color)", width: 1 } }),
78
+ react_1.default.createElement(text_1.Text, { className: "label-3" },
79
+ t("go"),
80
+ " ",
81
+ t("page").toLowerCase()),
82
+ react_1.default.createElement(text_field_1.TextField, { ref: goToPageRef, style: { width: '4.8rem', textAlign: "center", padding: 0, height: '2.4rem', borderRadius: '0.4rem' }, className: "body-3", type: "number", onBlur: function (ev) {
83
+ var _tmp = ev.target.value.trim().length ? parseInt(ev.target.value.trim()) : undefined;
84
+ if (_tmp && !isNaN(_tmp) && _tmp > 0 && _tmp <= Math.ceil(totalItem / itemPerPage)) {
85
+ onChangePage(_tmp, itemPerPage);
86
+ }
87
+ else
88
+ ev.target.value = "";
89
+ } })));
90
+ }
91
+ else
92
+ return react_1.default.createElement("div", { id: id });
93
+ }
@@ -1,33 +1,33 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
- import './popup.css';
3
- interface PopupState {
4
- readonly open?: boolean;
5
- heading?: ReactNode;
6
- body?: ReactNode;
7
- content?: ReactNode;
8
- footer?: ReactNode;
9
- clickOverlayClosePopup?: boolean;
10
- style?: CSSProperties;
11
- hideButtonClose?: boolean;
12
- }
13
- export declare const showPopup: (props: {
14
- ref: React.MutableRefObject<Popup | undefined>;
15
- heading?: ReactNode;
16
- content?: ReactNode;
17
- body?: ReactNode;
18
- footer?: ReactNode;
19
- clickOverlayClosePopup?: boolean;
20
- style?: CSSProperties;
21
- hideButtonClose?: boolean;
22
- }) => void;
23
- export declare const closePopup: (ref: React.MutableRefObject<Popup>) => void;
24
- export declare class Popup extends React.Component<Object, PopupState> {
25
- private ref;
26
- constructor(props: Object | Readonly<Object>);
27
- state: Readonly<PopupState>;
28
- onOpen(data: PopupState): void;
29
- onClose(): void;
30
- componentDidUpdate(prevProps: Readonly<Object>, prevState: Readonly<PopupState>): void;
31
- render(): React.JSX.Element;
32
- }
33
- export {};
1
+ import React, { CSSProperties, ReactNode } from 'react';
2
+ import './popup.css';
3
+ interface PopupState {
4
+ readonly open?: boolean;
5
+ heading?: ReactNode;
6
+ body?: ReactNode;
7
+ content?: ReactNode;
8
+ footer?: ReactNode;
9
+ clickOverlayClosePopup?: boolean;
10
+ style?: CSSProperties;
11
+ hideButtonClose?: boolean;
12
+ }
13
+ export declare const showPopup: (props: {
14
+ ref: React.MutableRefObject<Popup | undefined>;
15
+ heading?: ReactNode;
16
+ content?: ReactNode;
17
+ body?: ReactNode;
18
+ footer?: ReactNode;
19
+ clickOverlayClosePopup?: boolean;
20
+ style?: CSSProperties;
21
+ hideButtonClose?: boolean;
22
+ }) => void;
23
+ export declare const closePopup: (ref: React.MutableRefObject<Popup>) => void;
24
+ export declare class Popup extends React.Component<Object, PopupState> {
25
+ private ref;
26
+ constructor(props: Object | Readonly<Object>);
27
+ state: Readonly<PopupState>;
28
+ onOpen(data: PopupState): void;
29
+ onClose(): void;
30
+ componentDidUpdate(prevProps: Readonly<Object>, prevState: Readonly<PopupState>): void;
31
+ render(): React.JSX.Element;
32
+ }
33
+ export {};