wini-web-components 2.7.0 → 2.7.1
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.
- package/dist/types/index.d.ts +1 -0
- package/dist/vite.svg +1 -0
- package/dist/wini-web-components.css +4 -0
- package/dist/wini-web-components.js +32 -0
- package/dist/wini-web-components.mjs +6753 -0
- package/package.json +44 -82
- package/README.md +0 -21
- package/dist/component/button/button.d.ts +0 -21
- package/dist/component/button/button.js +0 -73
- package/dist/component/calendar/calendar.d.ts +0 -30
- package/dist/component/calendar/calendar.js +0 -357
- package/dist/component/card/card-info.d.ts +0 -15
- package/dist/component/card/card-info.js +0 -51
- package/dist/component/card/card.d.ts +0 -13
- package/dist/component/card/card.js +0 -33
- package/dist/component/checkbox/checkbox.d.ts +0 -24
- package/dist/component/checkbox/checkbox.js +0 -90
- package/dist/component/ck-editor/ckeditor.d.ts +0 -36
- package/dist/component/ck-editor/ckeditor.js +0 -392
- package/dist/component/component-status.d.ts +0 -8
- package/dist/component/component-status.js +0 -39
- package/dist/component/date-picker/date-picker.d.ts +0 -25
- package/dist/component/date-picker/date-picker.js +0 -329
- package/dist/component/date-time-picker/date-time-picker.d.ts +0 -36
- package/dist/component/date-time-picker/date-time-picker.js +0 -528
- package/dist/component/dialog/dialog.d.ts +0 -18
- package/dist/component/dialog/dialog.js +0 -113
- package/dist/component/import-file/import-file.d.ts +0 -33
- package/dist/component/import-file/import-file.js +0 -151
- package/dist/component/infinite-scroll/infinite-scroll.d.ts +0 -17
- package/dist/component/infinite-scroll/infinite-scroll.js +0 -37
- package/dist/component/input-multi-select/input-multi-select.d.ts +0 -21
- package/dist/component/input-multi-select/input-multi-select.js +0 -260
- package/dist/component/input-opt/input-opt.d.ts +0 -21
- package/dist/component/input-opt/input-opt.js +0 -157
- package/dist/component/input-otp/input-otp.d.ts +0 -22
- package/dist/component/input-otp/input-otp.js +0 -131
- package/dist/component/number-picker/number-picker.d.ts +0 -23
- package/dist/component/number-picker/number-picker.js +0 -125
- package/dist/component/pagination/pagination.d.ts +0 -13
- package/dist/component/pagination/pagination.js +0 -90
- package/dist/component/popup/popup.d.ts +0 -40
- package/dist/component/popup/popup.js +0 -125
- package/dist/component/progress-bar/progress-bar.d.ts +0 -16
- package/dist/component/progress-bar/progress-bar.js +0 -23
- package/dist/component/progress-circle/progress-circle.d.ts +0 -14
- package/dist/component/progress-circle/progress-circle.js +0 -19
- package/dist/component/radio-button/radio-button.d.ts +0 -20
- package/dist/component/radio-button/radio-button.js +0 -33
- package/dist/component/rating/rating.d.ts +0 -23
- package/dist/component/rating/rating.js +0 -54
- package/dist/component/select1/select1.d.ts +0 -31
- package/dist/component/select1/select1.js +0 -249
- package/dist/component/slider/slider.d.ts +0 -31
- package/dist/component/slider/slider.js +0 -64
- package/dist/component/switch/switch.d.ts +0 -23
- package/dist/component/switch/switch.js +0 -50
- package/dist/component/table/table.d.ts +0 -51
- package/dist/component/table/table.js +0 -66
- package/dist/component/tag/tag.d.ts +0 -22
- package/dist/component/tag/tag.js +0 -19
- package/dist/component/text/text.d.ts +0 -16
- package/dist/component/text/text.js +0 -20
- package/dist/component/text-area/text-area.d.ts +0 -27
- package/dist/component/text-area/text-area.js +0 -57
- package/dist/component/text-field/text-field.d.ts +0 -36
- package/dist/component/text-field/text-field.js +0 -80
- package/dist/component/toast-noti/toast-noti.d.ts +0 -5
- package/dist/component/toast-noti/toast-noti.js +0 -25
- package/dist/component/wini-icon/winicon.d.ts +0 -20
- package/dist/component/wini-icon/winicon.js +0 -176
- package/dist/form/login/view.d.ts +0 -40
- package/dist/form/login/view.js +0 -66
- package/dist/i18n.d.ts +0 -2
- package/dist/i18n.js +0 -125
- package/dist/index.d.ts +0 -33
- package/dist/index.js +0 -2
- package/dist/index.js.LICENSE.txt +0 -18
- package/dist/language/i18n.d.ts +0 -2
- package/dist/language/i18n.js +0 -146
- package/global.d.ts +0 -4
- /package/{public → dist}/favicon.ico +0 -0
- /package/{public → dist}/index.html +0 -0
- /package/{public → dist}/logo192.png +0 -0
- /package/{public → dist}/logo512.png +0 -0
- /package/{public → dist}/manifest.json +0 -0
- /package/{public → dist}/robots.txt +0 -0
package/package.json
CHANGED
|
@@ -1,82 +1,44 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "wini-web-components",
|
|
3
|
-
"version": "2.7.
|
|
4
|
-
"main": "dist/
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"react
|
|
15
|
-
"react-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"react
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
"react": "^18.3.1",
|
|
46
|
-
"react-dom": "^18.3.1"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@babel/core": "^7.0.0",
|
|
50
|
-
"@babel/preset-env": "^7.0.0",
|
|
51
|
-
"@babel/preset-react": "^7.0.0",
|
|
52
|
-
"@babel/preset-typescript": "^7.0.0",
|
|
53
|
-
"@types/css-modules": "^1.0.5",
|
|
54
|
-
"@types/react": "^19.0.1",
|
|
55
|
-
"@types/react-dom": "^18.3.1",
|
|
56
|
-
"babel-loader": "^8.0.0",
|
|
57
|
-
"css-loader": "^5.2.7",
|
|
58
|
-
"postcss-loader": "^8.1.1",
|
|
59
|
-
"postcss-preset-env": "^10.1.3",
|
|
60
|
-
"style-loader": "^2.0.0",
|
|
61
|
-
"ts-loader": "^9.5.1",
|
|
62
|
-
"typescript": "^5.7.2",
|
|
63
|
-
"webpack": "^5.0.0",
|
|
64
|
-
"webpack-cli": "^4.0.0"
|
|
65
|
-
},
|
|
66
|
-
"publishConfig": {
|
|
67
|
-
"registry": "https://registry.npmjs.org/"
|
|
68
|
-
},
|
|
69
|
-
"repository": {
|
|
70
|
-
"type": "git",
|
|
71
|
-
"url": "git+https://github.com/WiniGit/web-component.git"
|
|
72
|
-
},
|
|
73
|
-
"keywords": [
|
|
74
|
-
"wini"
|
|
75
|
-
],
|
|
76
|
-
"author": "thunt",
|
|
77
|
-
"license": "ISC",
|
|
78
|
-
"bugs": {
|
|
79
|
-
"url": "https://github.com/WiniGit/web-component/issues"
|
|
80
|
-
},
|
|
81
|
-
"homepage": "https://github.com/WiniGit/web-component#readme"
|
|
82
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "wini-web-components",
|
|
3
|
+
"version": "2.7.1",
|
|
4
|
+
"main": "dist/wini-web-components.umd.js",
|
|
5
|
+
"module": "dist/wini-web-components.es.js",
|
|
6
|
+
"types": "dist/types/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "vite build"
|
|
12
|
+
},
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"react": "^18.0.0",
|
|
15
|
+
"react-dom": "^18.0.0"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@ckeditor/ckeditor5-react": "^9.5.0",
|
|
19
|
+
"ckeditor5": "^44.3.0",
|
|
20
|
+
"date-fns": "^4.1.0",
|
|
21
|
+
"react": "^18.0.0",
|
|
22
|
+
"react-awesome-slider": "^4.1.0",
|
|
23
|
+
"react-dom": "^18.0.0",
|
|
24
|
+
"react-hook-form": "^7.54.2",
|
|
25
|
+
"react-i18next": "^15.4.1",
|
|
26
|
+
"react-paginate": "^8.3.0",
|
|
27
|
+
"react-toastify": "^11.0.5"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@eslint/js": "^9.21.0",
|
|
31
|
+
"@types/react": "^19.0.10",
|
|
32
|
+
"@types/react-dom": "^19.0.4",
|
|
33
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
34
|
+
"eslint": "^9.21.0",
|
|
35
|
+
"eslint-plugin-react-hooks": "^5.1.0",
|
|
36
|
+
"eslint-plugin-react-refresh": "^0.4.19",
|
|
37
|
+
"globals": "^15.15.0",
|
|
38
|
+
"sass": "^1.85.1",
|
|
39
|
+
"typescript": "~5.7.2",
|
|
40
|
+
"typescript-eslint": "^8.24.1",
|
|
41
|
+
"vite": "^6.2.0",
|
|
42
|
+
"vite-plugin-dts": "^4.5.3"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/README.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Getting Started with Create React App
|
|
2
|
-
|
|
3
|
-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
|
4
|
-
|
|
5
|
-
## Available Scripts
|
|
6
|
-
|
|
7
|
-
In the project directory, you can run:
|
|
8
|
-
|
|
9
|
-
### `npm i wini-web-components`
|
|
10
|
-
|
|
11
|
-
### Using Skin
|
|
12
|
-
add this cdn link into your App.css file. \
|
|
13
|
-
@import url(https://cdn.jsdelivr.net/gh/WiniGit/web-component@latest/src/skin/root.css); \
|
|
14
|
-
@import url(https://cdn.jsdelivr.net/gh/WiniGit/web-component@latest/src/skin/typography.css); \
|
|
15
|
-
@import url(https://cdn.jsdelivr.net/gh/WiniGit/web-component@latest/src/skin/layout.css);
|
|
16
|
-
|
|
17
|
-
add this import css into your App.js \
|
|
18
|
-
import 'ckeditor5/ckeditor5.css';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from 'react';
|
|
2
|
-
interface ButtonProps {
|
|
3
|
-
id?: string;
|
|
4
|
-
label: string;
|
|
5
|
-
prefix?: ReactNode;
|
|
6
|
-
suffix?: ReactNode;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
linkTo?: string;
|
|
9
|
-
target?: string;
|
|
10
|
-
style?: CSSProperties;
|
|
11
|
-
type?: "button" | "reset" | "submit";
|
|
12
|
-
/**
|
|
13
|
-
* default: size32: button-text-3 \
|
|
14
|
-
* recommend: size64: button-text-1 | size56: button-text-1 | size48: button-text-1 | size40: button-text-3 | size32: button-text-3 | size24: button-text-5 \
|
|
15
|
-
* status button: button-primary | button-infor | button-warning | button-error | button-success | button-grey | button-neutral | button-infor-main | button-warning-main | button-error-main | button-success-main
|
|
16
|
-
* */
|
|
17
|
-
className?: string;
|
|
18
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement | HTMLAnchorElement>;
|
|
19
|
-
}
|
|
20
|
-
export declare function Button(props: ButtonProps): React.JSX.Element;
|
|
21
|
-
export {};
|
|
@@ -1,73 +0,0 @@
|
|
|
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.Button = Button;
|
|
40
|
-
const react_1 = __importStar(require("react"));
|
|
41
|
-
const text_1 = require("../text/text");
|
|
42
|
-
const button_module_css_1 = __importDefault(require("./button.module.css"));
|
|
43
|
-
function Button(props) {
|
|
44
|
-
var _a, _b, _c;
|
|
45
|
-
const btnRef = (0, react_1.useRef)(null);
|
|
46
|
-
(0, react_1.useEffect)(() => {
|
|
47
|
-
if (btnRef.current) {
|
|
48
|
-
switch (props.type) {
|
|
49
|
-
case "submit":
|
|
50
|
-
function handleSubmit(ev) {
|
|
51
|
-
switch (ev.key.toLowerCase()) {
|
|
52
|
-
case "enter":
|
|
53
|
-
btnRef.current.click();
|
|
54
|
-
break;
|
|
55
|
-
default:
|
|
56
|
-
break;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
window.addEventListener("keydown", handleSubmit);
|
|
60
|
-
return () => { window.removeEventListener("keydown", handleSubmit); };
|
|
61
|
-
default:
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}, [props.type, btnRef.current]);
|
|
66
|
-
return props.linkTo ? react_1.default.createElement("a", { id: props.id, href: props.disabled ? undefined : props.linkTo, target: props.target, className: `${button_module_css_1.default['button-container']} row ${(_a = props.className) !== null && _a !== void 0 ? _a : "button-text-3"}`, style: props.style, onClick: props.onClick },
|
|
67
|
-
props.prefix,
|
|
68
|
-
react_1.default.createElement(text_1.Text, { maxLine: 1, className: button_module_css_1.default['button-label'] }, props.label),
|
|
69
|
-
props.suffix) : react_1.default.createElement("button", { ref: btnRef, id: props.id, type: (_b = props.type) !== null && _b !== void 0 ? _b : "button", disabled: props.disabled, className: `${button_module_css_1.default['button-container']} row ${(_c = props.className) !== null && _c !== void 0 ? _c : "button-text-3"}`, style: props.style, onClick: props.onClick },
|
|
70
|
-
props.prefix,
|
|
71
|
-
react_1.default.createElement(text_1.Text, { maxLine: 1, className: button_module_css_1.default['button-label'] }, props.label),
|
|
72
|
-
props.suffix);
|
|
73
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import { WithTranslation } from 'react-i18next';
|
|
3
|
-
export declare const today: Date;
|
|
4
|
-
export declare const startDate: Date;
|
|
5
|
-
export declare const endDate: Date;
|
|
6
|
-
export declare const inRangeTime: (date: Date, startDate: Date, endDate: Date) => boolean;
|
|
7
|
-
interface CalendarProps extends WithTranslation {
|
|
8
|
-
id?: string;
|
|
9
|
-
value?: Date | {
|
|
10
|
-
sTime: Date;
|
|
11
|
-
eTime: Date;
|
|
12
|
-
};
|
|
13
|
-
range?: boolean;
|
|
14
|
-
min?: Date;
|
|
15
|
-
max?: Date;
|
|
16
|
-
onSelect?: (props: Date | {
|
|
17
|
-
sTime: Date;
|
|
18
|
-
eTime: Date;
|
|
19
|
-
}) => void;
|
|
20
|
-
disabled?: boolean;
|
|
21
|
-
helperText?: string;
|
|
22
|
-
helperTextColor?: string;
|
|
23
|
-
placeholder?: string;
|
|
24
|
-
className?: string;
|
|
25
|
-
style?: CSSProperties;
|
|
26
|
-
header?: ReactNode;
|
|
27
|
-
footer?: ReactNode;
|
|
28
|
-
}
|
|
29
|
-
export declare const Calendar: React.ComponentType<Omit<import("react-i18next/helpers").$Subtract<CalendarProps, import("react-i18next").WithTranslationProps>, keyof WithTranslation<Ns, undefined>> & import("react-i18next").WithTranslationProps>;
|
|
30
|
-
export {};
|
|
@@ -1,357 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Calendar = exports.inRangeTime = exports.endDate = exports.startDate = exports.today = void 0;
|
|
7
|
-
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const calendar_module_css_1 = __importDefault(require("./calendar.module.css"));
|
|
9
|
-
const date_fns_1 = require("date-fns");
|
|
10
|
-
const react_i18next_1 = require("react-i18next");
|
|
11
|
-
const winicon_1 = require("../wini-icon/winicon");
|
|
12
|
-
exports.today = new Date();
|
|
13
|
-
exports.startDate = new Date(exports.today.getFullYear() - 100, exports.today.getMonth(), exports.today.getDate());
|
|
14
|
-
exports.endDate = new Date(exports.today.getFullYear() + 100, exports.today.getMonth(), exports.today.getDate());
|
|
15
|
-
const inRangeTime = (date, startDate, endDate) => ((0, date_fns_1.differenceInCalendarDays)(date, startDate) > -1 && (0, date_fns_1.differenceInCalendarDays)(endDate, date) > -1);
|
|
16
|
-
exports.inRangeTime = inRangeTime;
|
|
17
|
-
var CalendarTab;
|
|
18
|
-
(function (CalendarTab) {
|
|
19
|
-
CalendarTab[CalendarTab["DATE"] = 0] = "DATE";
|
|
20
|
-
CalendarTab[CalendarTab["MONTH"] = 1] = "MONTH";
|
|
21
|
-
CalendarTab[CalendarTab["YEAR"] = 2] = "YEAR";
|
|
22
|
-
})(CalendarTab || (CalendarTab = {}));
|
|
23
|
-
const stateValue = (minDate, maxDate, value, range) => {
|
|
24
|
-
let defaultValue;
|
|
25
|
-
if (value) {
|
|
26
|
-
if (range) {
|
|
27
|
-
if (value instanceof Date)
|
|
28
|
-
defaultValue = { sTime: value, eTime: value };
|
|
29
|
-
else
|
|
30
|
-
defaultValue = value;
|
|
31
|
-
if (defaultValue.sTime.getTime() < minDate.getTime())
|
|
32
|
-
defaultValue.sTime = minDate;
|
|
33
|
-
if (defaultValue.eTime.getTime() > maxDate.getTime())
|
|
34
|
-
defaultValue.eTime = maxDate;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
if (value instanceof Date)
|
|
38
|
-
defaultValue = value;
|
|
39
|
-
else
|
|
40
|
-
defaultValue = value.sTime;
|
|
41
|
-
if (defaultValue.getTime() < minDate.getTime())
|
|
42
|
-
defaultValue = minDate;
|
|
43
|
-
if (defaultValue.getTime() > maxDate.getTime())
|
|
44
|
-
defaultValue = maxDate;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
defaultValue = range ? { sTime: exports.today, eTime: exports.today } : exports.today;
|
|
49
|
-
}
|
|
50
|
-
const defaultMonth = defaultValue instanceof Date ? defaultValue.getMonth() : defaultValue.sTime.getMonth();
|
|
51
|
-
const defaultYear = defaultValue instanceof Date ? defaultValue.getFullYear() : defaultValue.sTime.getFullYear();
|
|
52
|
-
return {
|
|
53
|
-
value: value ? defaultValue : undefined,
|
|
54
|
-
selectMonth: defaultMonth,
|
|
55
|
-
selectYear: defaultYear,
|
|
56
|
-
tab: CalendarTab.DATE,
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
class TCalendar extends react_1.default.Component {
|
|
60
|
-
constructor(props) {
|
|
61
|
-
super(props);
|
|
62
|
-
this.minDate = !this.props.min || this.props.min.getTime() < exports.startDate.getTime() ? exports.startDate : this.props.min;
|
|
63
|
-
this.maxDate = !this.props.max || this.props.max.getTime() > exports.endDate.getTime() ? exports.endDate : this.props.max;
|
|
64
|
-
this.state = stateValue(this.minDate, this.maxDate, this.props.value, this.props.range);
|
|
65
|
-
this.showDateInMonth = this.showDateInMonth.bind(this);
|
|
66
|
-
this.showMonthInYear = this.showMonthInYear.bind(this);
|
|
67
|
-
this.showYearInRange = this.showYearInRange.bind(this);
|
|
68
|
-
this.getTitle = this.getTitle.bind(this);
|
|
69
|
-
}
|
|
70
|
-
componentDidUpdate(prevProps, prevState, snapshot) {
|
|
71
|
-
if (prevProps.value !== this.props.value) {
|
|
72
|
-
this.setState(stateValue(this.minDate, this.maxDate, this.props.value, this.props.range));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
showDateInMonth() {
|
|
76
|
-
let firstDayOfMonth = new Date(this.state.selectYear, this.state.selectMonth, 1);
|
|
77
|
-
return react_1.default.createElement(react_1.default.Fragment, null,
|
|
78
|
-
Array.from({ length: 7 }).map((_, i) => {
|
|
79
|
-
switch (i) {
|
|
80
|
-
case 0:
|
|
81
|
-
var weekdayTitle = this.props.t("su");
|
|
82
|
-
break;
|
|
83
|
-
case 1:
|
|
84
|
-
weekdayTitle = this.props.t("mo");
|
|
85
|
-
break;
|
|
86
|
-
case 2:
|
|
87
|
-
weekdayTitle = this.props.t("tu");
|
|
88
|
-
break;
|
|
89
|
-
case 3:
|
|
90
|
-
weekdayTitle = this.props.t("we");
|
|
91
|
-
break;
|
|
92
|
-
case 4:
|
|
93
|
-
weekdayTitle = this.props.t("th");
|
|
94
|
-
break;
|
|
95
|
-
case 5:
|
|
96
|
-
weekdayTitle = this.props.t("fr");
|
|
97
|
-
break;
|
|
98
|
-
case 6:
|
|
99
|
-
weekdayTitle = this.props.t("sa");
|
|
100
|
-
break;
|
|
101
|
-
default:
|
|
102
|
-
weekdayTitle = '';
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
return react_1.default.createElement("div", { key: 'dtwk-' + i, className: `${calendar_module_css_1.default['date-picker-circle']} date-picker-circle` },
|
|
106
|
-
react_1.default.createElement("span", { className: "label-4 row" }, weekdayTitle));
|
|
107
|
-
}),
|
|
108
|
-
Array.from({ length: 42 }).map((_, i) => {
|
|
109
|
-
var _a, _b, _c;
|
|
110
|
-
let dateNumber = (i % 7) + (Math.floor(i / 7) * 7) - firstDayOfMonth.getDay();
|
|
111
|
-
const timeValue = new Date(this.state.selectYear, this.state.selectMonth, dateNumber + 1);
|
|
112
|
-
let className = `${calendar_module_css_1.default['date-picker-circle']} date-picker-circle`;
|
|
113
|
-
let typoClassName = "body-3";
|
|
114
|
-
if (dateNumber + 1 === exports.today.getDate() && this.state.selectMonth === exports.today.getMonth() && this.state.selectYear === exports.today.getFullYear()) {
|
|
115
|
-
className += ` ${calendar_module_css_1.default['today']}`;
|
|
116
|
-
}
|
|
117
|
-
let style;
|
|
118
|
-
if (!(0, exports.inRangeTime)(timeValue, this.minDate, this.maxDate)) {
|
|
119
|
-
className += ` ${calendar_module_css_1.default['invalid']}`;
|
|
120
|
-
}
|
|
121
|
-
else if (this.state.value instanceof Date) {
|
|
122
|
-
if (this.state.value.getTime() === timeValue.getTime())
|
|
123
|
-
className += ` ${calendar_module_css_1.default['selected']}`;
|
|
124
|
-
}
|
|
125
|
-
else if ((((_a = this.state.value) === null || _a === void 0 ? void 0 : _a.sTime.getDate()) === timeValue.getDate() && (Math.abs((0, date_fns_1.differenceInCalendarDays)(timeValue, this.state.value.sTime))) < 1) || (((_b = this.state.value) === null || _b === void 0 ? void 0 : _b.eTime.getDate()) === timeValue.getDate() && (Math.abs((0, date_fns_1.differenceInCalendarDays)(timeValue, this.state.value.eTime))) < 1)) {
|
|
126
|
-
className += ` ${calendar_module_css_1.default['selected']} ${calendar_module_css_1.default[`${((_c = this.state.value) === null || _c === void 0 ? void 0 : _c.sTime.getDate()) === timeValue.getDate() && (Math.abs((0, date_fns_1.differenceInCalendarDays)(timeValue, this.state.value.sTime))) < 1 ? "start" : "end"}-range`]}`;
|
|
127
|
-
}
|
|
128
|
-
else if (this.state.value && (0, exports.inRangeTime)(timeValue, this.state.value.sTime, this.state.value.eTime)) {
|
|
129
|
-
className += ` ${calendar_module_css_1.default['in-range']}`;
|
|
130
|
-
}
|
|
131
|
-
if (timeValue.getMonth() !== this.state.selectMonth) {
|
|
132
|
-
typoClassName = "placeholder-2";
|
|
133
|
-
}
|
|
134
|
-
return react_1.default.createElement("div", { key: timeValue.toString(), className: className, style: style },
|
|
135
|
-
react_1.default.createElement("button", { type: "button", className: `${typoClassName} row`, onClick: () => {
|
|
136
|
-
const currentValue = this.state.value;
|
|
137
|
-
if (this.props.range) {
|
|
138
|
-
const newValue = (!currentValue || timeValue.getTime() < currentValue.sTime.getTime()) ? { sTime: timeValue, eTime: timeValue } : { sTime: currentValue.sTime, eTime: timeValue };
|
|
139
|
-
this.setState(Object.assign(Object.assign({}, this.state), { value: newValue }));
|
|
140
|
-
if (this.props.onSelect)
|
|
141
|
-
this.props.onSelect(newValue);
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
this.setState(Object.assign(Object.assign({}, this.state), { value: timeValue }));
|
|
145
|
-
if (this.props.onSelect)
|
|
146
|
-
this.props.onSelect(timeValue);
|
|
147
|
-
}
|
|
148
|
-
} }, timeValue.getDate()));
|
|
149
|
-
}));
|
|
150
|
-
}
|
|
151
|
-
showMonthInYear() {
|
|
152
|
-
return react_1.default.createElement(react_1.default.Fragment, null, Array.from({ length: 12 }).map((_, i) => {
|
|
153
|
-
switch (i) {
|
|
154
|
-
case 0:
|
|
155
|
-
var monthTitle = this.props.i18n.language === "en" ? "Jan" : this.props.t('january');
|
|
156
|
-
break;
|
|
157
|
-
case 1:
|
|
158
|
-
monthTitle = this.props.i18n.language === "en" ? "Feb" : this.props.t('february');
|
|
159
|
-
break;
|
|
160
|
-
case 2:
|
|
161
|
-
monthTitle = this.props.i18n.language === "en" ? "Mar" : this.props.t('march');
|
|
162
|
-
break;
|
|
163
|
-
case 3:
|
|
164
|
-
monthTitle = this.props.i18n.language === "en" ? "Apr" : this.props.t('april');
|
|
165
|
-
break;
|
|
166
|
-
case 4:
|
|
167
|
-
monthTitle = this.props.i18n.language === "en" ? "May" : this.props.t('may');
|
|
168
|
-
break;
|
|
169
|
-
case 5:
|
|
170
|
-
monthTitle = this.props.i18n.language === "en" ? "Jun" : this.props.t('june');
|
|
171
|
-
break;
|
|
172
|
-
case 6:
|
|
173
|
-
monthTitle = this.props.i18n.language === "en" ? "Jul" : this.props.t('july');
|
|
174
|
-
break;
|
|
175
|
-
case 7:
|
|
176
|
-
monthTitle = this.props.i18n.language === "en" ? "Aug" : this.props.t('august');
|
|
177
|
-
break;
|
|
178
|
-
case 8:
|
|
179
|
-
monthTitle = this.props.i18n.language === "en" ? "Sep" : this.props.t('september');
|
|
180
|
-
break;
|
|
181
|
-
case 9:
|
|
182
|
-
monthTitle = this.props.i18n.language === "en" ? "Oct" : this.props.t('october');
|
|
183
|
-
break;
|
|
184
|
-
case 10:
|
|
185
|
-
monthTitle = this.props.i18n.language === "en" ? "Nov" : this.props.t('november');
|
|
186
|
-
break;
|
|
187
|
-
case 11:
|
|
188
|
-
monthTitle = this.props.i18n.language === "en" ? "Dec" : this.props.t('december');
|
|
189
|
-
break;
|
|
190
|
-
default:
|
|
191
|
-
monthTitle = '';
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
const timeValue = new Date(this.state.selectYear, i);
|
|
195
|
-
let className = `${calendar_module_css_1.default['month-picker-circle']} month-picker-circle`;
|
|
196
|
-
if (this.state.selectYear === exports.today.getFullYear() && exports.today.getMonth() === i) {
|
|
197
|
-
className += ` ${calendar_module_css_1.default['today']}`;
|
|
198
|
-
}
|
|
199
|
-
if (!(0, exports.inRangeTime)(timeValue, this.minDate, this.maxDate)) {
|
|
200
|
-
className += ` ${calendar_module_css_1.default['invalid']}`;
|
|
201
|
-
}
|
|
202
|
-
else if (this.state.value instanceof Date) {
|
|
203
|
-
if (this.state.selectYear === this.state.value.getFullYear() && i === this.state.value.getMonth())
|
|
204
|
-
className += ` ${calendar_module_css_1.default['selected']}`;
|
|
205
|
-
}
|
|
206
|
-
else if (this.state.value && ((i === this.state.value.sTime.getMonth() && this.state.value.sTime.getFullYear() === this.state.selectYear) || (i === this.state.value.eTime.getMonth() && this.state.value.eTime.getFullYear() === this.state.selectYear))) {
|
|
207
|
-
className += ` ${calendar_module_css_1.default['selected']} ${calendar_module_css_1.default[`${i === this.state.value.sTime.getMonth() && this.state.value.sTime.getFullYear() === this.state.selectYear ? "start" : "end"}-range`]}`;
|
|
208
|
-
}
|
|
209
|
-
else if (this.state.value && (0, exports.inRangeTime)(timeValue, this.state.value.sTime, this.state.value.eTime)) {
|
|
210
|
-
className += ` ${calendar_module_css_1.default['in-range']}`;
|
|
211
|
-
}
|
|
212
|
-
return react_1.default.createElement("div", { key: timeValue.toString(), className: className },
|
|
213
|
-
react_1.default.createElement("button", { type: "button", className: "body-3 row", onClick: () => { this.setState(Object.assign(Object.assign({}, this.state), { selectMonth: i, tab: CalendarTab.DATE })); } }, monthTitle));
|
|
214
|
-
}));
|
|
215
|
-
}
|
|
216
|
-
showYearInRange() {
|
|
217
|
-
return Array.from({ length: 12 }).map((_, i) => {
|
|
218
|
-
var _a, _b, _c;
|
|
219
|
-
let firstYearInTable = this.state.selectYear - ((this.state.selectYear - exports.startDate.getFullYear()) % 12);
|
|
220
|
-
let yearNumber = i + firstYearInTable;
|
|
221
|
-
let className = `${calendar_module_css_1.default['year-picker-circle']} year-picker-circle`;
|
|
222
|
-
if (yearNumber === exports.today.getFullYear()) {
|
|
223
|
-
className += ` ${calendar_module_css_1.default['today']}`;
|
|
224
|
-
}
|
|
225
|
-
if (yearNumber < this.minDate.getFullYear() || yearNumber > this.maxDate.getFullYear()) {
|
|
226
|
-
className += ` ${calendar_module_css_1.default['invalid']}`;
|
|
227
|
-
}
|
|
228
|
-
else if (this.state.value instanceof Date) {
|
|
229
|
-
if (yearNumber === this.state.value.getFullYear())
|
|
230
|
-
className += ` ${calendar_module_css_1.default['selected']}`;
|
|
231
|
-
}
|
|
232
|
-
else if (yearNumber === ((_a = this.state.value) === null || _a === void 0 ? void 0 : _a.sTime.getFullYear()) || yearNumber === ((_b = this.state.value) === null || _b === void 0 ? void 0 : _b.eTime.getFullYear())) {
|
|
233
|
-
className += ` ${calendar_module_css_1.default['selected']} ${calendar_module_css_1.default[`${yearNumber === ((_c = this.state.value) === null || _c === void 0 ? void 0 : _c.sTime.getFullYear()) ? "start" : "end"}-range`]}`;
|
|
234
|
-
}
|
|
235
|
-
else if (this.state.value && yearNumber > this.state.value.sTime.getFullYear() && yearNumber < this.state.value.eTime.getFullYear()) {
|
|
236
|
-
className += ` ${calendar_module_css_1.default['in-range']}`;
|
|
237
|
-
}
|
|
238
|
-
return react_1.default.createElement("div", { key: yearNumber.toString(), className: className },
|
|
239
|
-
react_1.default.createElement("button", { type: "button", className: "body-3 row", onClick: () => { this.setState(Object.assign(Object.assign({}, this.state), { tab: CalendarTab.MONTH, selectYear: yearNumber })); } }, yearNumber));
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
getTitle() {
|
|
243
|
-
switch (this.state.tab) {
|
|
244
|
-
case CalendarTab.YEAR:
|
|
245
|
-
let firstYearInTable = this.state.selectYear - ((this.state.selectYear - exports.startDate.getFullYear()) % 12);
|
|
246
|
-
return `${firstYearInTable}-${firstYearInTable + 11}`;
|
|
247
|
-
case CalendarTab.MONTH:
|
|
248
|
-
return this.state.selectYear;
|
|
249
|
-
default:
|
|
250
|
-
switch (this.state.selectMonth) {
|
|
251
|
-
case 0:
|
|
252
|
-
var monthName = this.props.t('january');
|
|
253
|
-
break;
|
|
254
|
-
case 1:
|
|
255
|
-
monthName = this.props.t('february');
|
|
256
|
-
break;
|
|
257
|
-
case 2:
|
|
258
|
-
monthName = this.props.t('march');
|
|
259
|
-
break;
|
|
260
|
-
case 3:
|
|
261
|
-
monthName = this.props.t('april');
|
|
262
|
-
break;
|
|
263
|
-
case 4:
|
|
264
|
-
monthName = this.props.t('may');
|
|
265
|
-
break;
|
|
266
|
-
case 5:
|
|
267
|
-
monthName = this.props.t('june');
|
|
268
|
-
break;
|
|
269
|
-
case 6:
|
|
270
|
-
monthName = this.props.t('july');
|
|
271
|
-
break;
|
|
272
|
-
case 7:
|
|
273
|
-
monthName = this.props.t('august');
|
|
274
|
-
break;
|
|
275
|
-
case 8:
|
|
276
|
-
monthName = this.props.t('september');
|
|
277
|
-
break;
|
|
278
|
-
case 9:
|
|
279
|
-
monthName = this.props.t('october');
|
|
280
|
-
break;
|
|
281
|
-
case 10:
|
|
282
|
-
monthName = this.props.t('november');
|
|
283
|
-
break;
|
|
284
|
-
case 11:
|
|
285
|
-
monthName = this.props.t('december');
|
|
286
|
-
break;
|
|
287
|
-
default:
|
|
288
|
-
monthName = '';
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
return `${monthName}${this.props.i18n.language === 'en' ? ' ' : '/'}${this.state.selectYear}`;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
render() {
|
|
295
|
-
var _a;
|
|
296
|
-
return react_1.default.createElement("div", { className: `${calendar_module_css_1.default['calendar-container']} col ${(_a = this.props.className) !== null && _a !== void 0 ? _a : ""}`, style: this.props.style },
|
|
297
|
-
this.props.header,
|
|
298
|
-
react_1.default.createElement("div", { className: `${calendar_module_css_1.default['picker-date-header']} row` },
|
|
299
|
-
react_1.default.createElement("button", { type: 'button', onClick: () => {
|
|
300
|
-
switch (this.state.tab) {
|
|
301
|
-
case CalendarTab.YEAR:
|
|
302
|
-
if (this.state.selectYear - 10 < exports.startDate.getFullYear()) {
|
|
303
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectYear: exports.startDate.getFullYear() }));
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectYear: this.state.selectYear - 10 }));
|
|
307
|
-
}
|
|
308
|
-
break;
|
|
309
|
-
case CalendarTab.MONTH:
|
|
310
|
-
const newTime = new Date(this.state.selectYear, this.state.selectMonth - 1);
|
|
311
|
-
if (newTime.getTime() >= exports.startDate.getTime()) {
|
|
312
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectYear: this.state.selectYear - 1 }));
|
|
313
|
-
}
|
|
314
|
-
break;
|
|
315
|
-
default:
|
|
316
|
-
const newDataVl = new Date(this.state.selectYear, this.state.selectMonth - 1);
|
|
317
|
-
if (newDataVl.getTime() >= exports.startDate.getTime()) {
|
|
318
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectMonth: newDataVl.getMonth(), selectYear: newDataVl.getFullYear() }));
|
|
319
|
-
}
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
} },
|
|
323
|
-
react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/left-arrow", size: '1.4rem' })),
|
|
324
|
-
react_1.default.createElement("span", { className: "heading-7", onClick: () => {
|
|
325
|
-
if (this.state.tab !== CalendarTab.YEAR)
|
|
326
|
-
this.setState(Object.assign(Object.assign({}, this.state), { tab: this.state.tab === CalendarTab.DATE ? CalendarTab.MONTH : CalendarTab.YEAR }));
|
|
327
|
-
} }, this.getTitle()),
|
|
328
|
-
react_1.default.createElement("button", { type: 'button', onClick: () => {
|
|
329
|
-
switch (this.state.tab) {
|
|
330
|
-
case CalendarTab.YEAR:
|
|
331
|
-
if (this.state.selectYear + 10 > exports.endDate.getFullYear()) {
|
|
332
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectYear: exports.endDate.getFullYear() }));
|
|
333
|
-
}
|
|
334
|
-
else {
|
|
335
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectYear: this.state.selectYear + 10 }));
|
|
336
|
-
}
|
|
337
|
-
break;
|
|
338
|
-
case CalendarTab.MONTH:
|
|
339
|
-
const newTime = new Date(this.state.selectYear, this.state.selectMonth + 1);
|
|
340
|
-
if (newTime.getTime() <= exports.endDate.getTime()) {
|
|
341
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectYear: this.state.selectYear + 1 }));
|
|
342
|
-
}
|
|
343
|
-
break;
|
|
344
|
-
default:
|
|
345
|
-
const newDataVl = new Date(this.state.selectYear, this.state.selectMonth + 1);
|
|
346
|
-
if (newDataVl.getTime() <= exports.endDate.getTime()) {
|
|
347
|
-
this.setState(Object.assign(Object.assign({}, this.state), { selectMonth: newDataVl.getMonth(), selectYear: newDataVl.getFullYear() }));
|
|
348
|
-
}
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
} },
|
|
352
|
-
react_1.default.createElement(winicon_1.Winicon, { src: "fill/arrows/right-arrow", size: '1.4rem' }))),
|
|
353
|
-
react_1.default.createElement("div", { className: `${calendar_module_css_1.default['picker-date-body']} row` }, this.state.tab === CalendarTab.YEAR ? this.showYearInRange() : this.state.tab === CalendarTab.MONTH ? this.showMonthInYear() : this.showDateInMonth()),
|
|
354
|
-
this.props.footer);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
exports.Calendar = (0, react_i18next_1.withTranslation)()(TCalendar);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React, { CSSProperties } from 'react';
|
|
2
|
-
import './card-info.css';
|
|
3
|
-
interface CardData {
|
|
4
|
-
Name: string;
|
|
5
|
-
Image: string;
|
|
6
|
-
Subtitle: string;
|
|
7
|
-
DateCreated: string;
|
|
8
|
-
Content: string;
|
|
9
|
-
style?: CSSProperties;
|
|
10
|
-
className?: string;
|
|
11
|
-
direction?: "col" | "row";
|
|
12
|
-
mediaType?: "contain" | "cover" | "hug";
|
|
13
|
-
}
|
|
14
|
-
export declare function CardInfo({ Name, Subtitle, Image, Content, className, style, direction }: CardData): React.JSX.Element;
|
|
15
|
-
export {};
|