farm-react 1.0.3 → 1.0.6
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/README.md +3 -68
- package/dist/cjs/assets/data/header.d.ts +6 -0
- package/dist/cjs/assets/data/header.js +17 -0
- package/dist/cjs/assets/data/header.js.map +1 -0
- package/dist/cjs/assets/data/home.d.ts +0 -0
- package/dist/cjs/assets/data/home.js +2 -0
- package/dist/cjs/assets/data/home.js.map +1 -0
- package/dist/cjs/assets/data/icons.d.ts +0 -0
- package/dist/cjs/assets/data/icons.js +2 -0
- package/dist/cjs/assets/data/icons.js.map +1 -0
- package/dist/cjs/components/Button.d.ts +2 -0
- package/dist/cjs/components/Button.js +9 -0
- package/dist/cjs/components/Button.js.map +1 -0
- package/dist/cjs/components/Label.d.ts +14 -0
- package/dist/cjs/components/Label.js +23 -0
- package/dist/cjs/components/Label.js.map +1 -0
- package/dist/cjs/components/Layout/Footer.d.ts +3 -0
- package/dist/cjs/components/Layout/Footer.js +20 -0
- package/dist/cjs/components/Layout/Footer.js.map +1 -0
- package/dist/cjs/components/Layout/Header.d.ts +3 -0
- package/dist/cjs/components/Layout/Header.js +28 -0
- package/dist/cjs/components/Layout/Header.js.map +1 -0
- package/dist/cjs/components/Layout/Sidebar.d.ts +3 -0
- package/dist/cjs/components/Layout/Sidebar.js +11 -0
- package/dist/cjs/components/Layout/Sidebar.js.map +1 -0
- package/dist/cjs/components/TextInput.d.ts +10 -0
- package/dist/cjs/components/TextInput.js +26 -0
- package/dist/cjs/components/TextInput.js.map +1 -0
- package/dist/cjs/components/app.d.ts +6 -0
- package/dist/cjs/components/app.js +22 -0
- package/dist/cjs/components/app.js.map +1 -0
- package/dist/cjs/constants/app.d.ts +1 -0
- package/dist/cjs/constants/app.js +5 -0
- package/dist/cjs/constants/app.js.map +1 -0
- package/dist/cjs/constants/images.d.ts +0 -0
- package/dist/cjs/constants/images.js +2 -0
- package/dist/cjs/constants/images.js.map +1 -0
- package/dist/cjs/constants/routes.d.ts +0 -0
- package/dist/cjs/constants/routes.js +2 -0
- package/dist/cjs/constants/routes.js.map +1 -0
- package/dist/cjs/container/index.d.ts +0 -0
- package/dist/cjs/container/index.js +2 -0
- package/dist/cjs/container/index.js.map +1 -0
- package/dist/cjs/helpers/app.d.ts +81 -0
- package/dist/cjs/helpers/app.js +151 -0
- package/dist/cjs/helpers/app.js.map +1 -0
- package/dist/cjs/helpers/index.d.ts +0 -0
- package/dist/cjs/helpers/index.js +2 -0
- package/dist/cjs/helpers/index.js.map +1 -0
- package/dist/cjs/hooks/index.d.ts +0 -0
- package/dist/cjs/hooks/index.js +2 -0
- package/dist/cjs/hooks/index.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +11 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/strings/en.d.ts +3 -0
- package/dist/cjs/strings/en.js +8 -0
- package/dist/cjs/strings/en.js.map +1 -0
- package/dist/cjs/strings/index.d.ts +0 -0
- package/dist/cjs/strings/index.js +2 -0
- package/dist/cjs/strings/index.js.map +1 -0
- package/dist/esm/assets/data/header.d.ts +6 -0
- package/dist/esm/assets/data/header.js +14 -0
- package/dist/esm/assets/data/header.js.map +1 -0
- package/dist/esm/assets/data/home.d.ts +0 -0
- package/dist/esm/assets/data/home.js +2 -0
- package/dist/esm/assets/data/home.js.map +1 -0
- package/dist/esm/assets/data/icons.d.ts +0 -0
- package/dist/esm/assets/data/icons.js +2 -0
- package/dist/esm/assets/data/icons.js.map +1 -0
- package/dist/esm/components/Button.d.ts +2 -0
- package/dist/esm/components/Button.js +5 -0
- package/dist/esm/components/Button.js.map +1 -0
- package/dist/esm/components/Label.d.ts +14 -0
- package/dist/esm/components/Label.js +20 -0
- package/dist/esm/components/Label.js.map +1 -0
- package/dist/esm/components/Layout/Footer.d.ts +3 -0
- package/dist/esm/components/Layout/Footer.js +17 -0
- package/dist/esm/components/Layout/Footer.js.map +1 -0
- package/dist/esm/components/Layout/Header.d.ts +3 -0
- package/dist/esm/components/Layout/Header.js +25 -0
- package/dist/esm/components/Layout/Header.js.map +1 -0
- package/dist/esm/components/Layout/Sidebar.d.ts +3 -0
- package/dist/esm/components/Layout/Sidebar.js +8 -0
- package/dist/esm/components/Layout/Sidebar.js.map +1 -0
- package/dist/esm/components/Notification.d.ts +1 -0
- package/dist/esm/components/Notification.js +46 -0
- package/dist/esm/components/Notification.js.map +1 -0
- package/dist/esm/components/SwitchItem.d.ts +8 -0
- package/dist/esm/components/SwitchItem.js +7 -0
- package/dist/esm/components/SwitchItem.js.map +1 -0
- package/dist/esm/components/TextInput.d.ts +10 -0
- package/dist/esm/components/TextInput.js +23 -0
- package/dist/esm/components/TextInput.js.map +1 -0
- package/dist/esm/components/app.d.ts +6 -0
- package/dist/esm/components/app.js +19 -0
- package/dist/esm/components/app.js.map +1 -0
- package/dist/esm/constants/aap.d.ts +1 -0
- package/dist/esm/constants/aap.js +2 -0
- package/dist/esm/constants/aap.js.map +1 -0
- package/dist/esm/constants/app.d.ts +1 -0
- package/dist/esm/constants/app.js +2 -0
- package/dist/esm/constants/app.js.map +1 -0
- package/dist/esm/constants/images.d.ts +0 -0
- package/dist/esm/constants/images.js +2 -0
- package/dist/esm/constants/images.js.map +1 -0
- package/dist/esm/constants/routes.d.ts +0 -0
- package/dist/esm/constants/routes.js +2 -0
- package/dist/esm/constants/routes.js.map +1 -0
- package/dist/esm/container/index.d.ts +0 -0
- package/dist/esm/container/index.js +2 -0
- package/dist/esm/container/index.js.map +1 -0
- package/dist/esm/helpers/app.d.ts +81 -0
- package/dist/esm/helpers/app.js +136 -0
- package/dist/esm/helpers/app.js.map +1 -0
- package/dist/esm/helpers/index.d.ts +0 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/index.js.map +1 -0
- package/dist/esm/hooks/index.d.ts +0 -0
- package/dist/esm/hooks/index.js +2 -0
- package/dist/esm/hooks/index.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/strings/en.d.ts +3 -0
- package/dist/esm/strings/en.js +5 -0
- package/dist/esm/strings/en.js.map +1 -0
- package/dist/esm/strings/index.d.ts +0 -0
- package/dist/esm/strings/index.js +2 -0
- package/dist/esm/strings/index.js.map +1 -0
- package/package.json +50 -41
package/README.md
CHANGED
|
@@ -1,69 +1,4 @@
|
|
|
1
|
-
# React
|
|
1
|
+
# publish-packages for (React Package, Node JS, Nest JS)
|
|
2
|
+
This is Demo Repo to showcase publishing packages related to Node JS, React UI & Nest JS Packages
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Currently, two official plugins are available:
|
|
6
|
-
|
|
7
|
-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
-
|
|
10
|
-
## Expanding the ESLint configuration
|
|
11
|
-
|
|
12
|
-
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
13
|
-
|
|
14
|
-
```js
|
|
15
|
-
export default tseslint.config([
|
|
16
|
-
globalIgnores(['dist']),
|
|
17
|
-
{
|
|
18
|
-
files: ['**/*.{ts,tsx}'],
|
|
19
|
-
extends: [
|
|
20
|
-
// Other configs...
|
|
21
|
-
|
|
22
|
-
// Remove tseslint.configs.recommended and replace with this
|
|
23
|
-
...tseslint.configs.recommendedTypeChecked,
|
|
24
|
-
// Alternatively, use this for stricter rules
|
|
25
|
-
...tseslint.configs.strictTypeChecked,
|
|
26
|
-
// Optionally, add this for stylistic rules
|
|
27
|
-
...tseslint.configs.stylisticTypeChecked,
|
|
28
|
-
|
|
29
|
-
// Other configs...
|
|
30
|
-
],
|
|
31
|
-
languageOptions: {
|
|
32
|
-
parserOptions: {
|
|
33
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
34
|
-
tsconfigRootDir: import.meta.dirname,
|
|
35
|
-
},
|
|
36
|
-
// other options...
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
])
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
43
|
-
|
|
44
|
-
```js
|
|
45
|
-
// eslint.config.js
|
|
46
|
-
import reactX from 'eslint-plugin-react-x'
|
|
47
|
-
import reactDom from 'eslint-plugin-react-dom'
|
|
48
|
-
|
|
49
|
-
export default tseslint.config([
|
|
50
|
-
globalIgnores(['dist']),
|
|
51
|
-
{
|
|
52
|
-
files: ['**/*.{ts,tsx}'],
|
|
53
|
-
extends: [
|
|
54
|
-
// Other configs...
|
|
55
|
-
// Enable lint rules for React
|
|
56
|
-
reactX.configs['recommended-typescript'],
|
|
57
|
-
// Enable lint rules for React DOM
|
|
58
|
-
reactDom.configs.recommended,
|
|
59
|
-
],
|
|
60
|
-
languageOptions: {
|
|
61
|
-
parserOptions: {
|
|
62
|
-
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
63
|
-
tsconfigRootDir: import.meta.dirname,
|
|
64
|
-
},
|
|
65
|
-
// other options...
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
])
|
|
69
|
-
```
|
|
4
|
+

|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.headerItem = void 0;
|
|
4
|
+
var headerItem = [
|
|
5
|
+
{ id: 1, label: 'Bootstrap 5', link: 'https://getbootstrap.com/docs/5.3/getting-started/introduction/' },
|
|
6
|
+
{ id: 2, label: 'React bootstrap', link: 'https://react-bootstrap.netlify.app/' },
|
|
7
|
+
{ id: 4, label: 'Seed App', link: 'https://seed-app' },
|
|
8
|
+
{ id: 3, label: 'Updates group', link: 'https://chat.whatsapp.com/ISQ2i9zTTvr2dGPzyvE5FV?mode=ac_t' },
|
|
9
|
+
// { id: 6, label: 'home', link: '' },
|
|
10
|
+
// { id: 7, label: 'home', link: '' },
|
|
11
|
+
// { id: 8, label: 'home', link: '' },
|
|
12
|
+
// { id: 9, label: 'home', link: '' },
|
|
13
|
+
// { id: 10, label: 'home', link: '' },
|
|
14
|
+
// { id: 11, label: 'home', link: '' },
|
|
15
|
+
];
|
|
16
|
+
exports.headerItem = headerItem;
|
|
17
|
+
//# sourceMappingURL=header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"header.js","sourceRoot":"","sources":["../../../../src/assets/data/header.ts"],"names":[],"mappings":";;;AAAA,IAAM,UAAU,GAAG;IACjB,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,iEAAiE,EAAE;IACxG,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,sCAAsC,EAAE;IACjF,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,kBAAkB,EAAE;IACtD,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,4DAA4D,EAAE;IACrG,sCAAsC;IACtC,sCAAsC;IACtC,sCAAsC;IACtC,sCAAsC;IACtC,uCAAuC;IACvC,uCAAuC;CACxC,CAAA;AACQ,gCAAU"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"home.js","sourceRoot":"","sources":["../../../../src/assets/data/home.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../../../src/assets/data/icons.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = Button;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
6
|
+
function Button() {
|
|
7
|
+
return react_1.default.createElement("div", null);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button.tsx"],"names":[],"mappings":";;AAEA,yBAEC;;AAJD,wDAAgD;AAEhD,SAAwB,MAAM;IAC5B,OAAO,0CAAW,CAAA;AACpB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
interface Classnames {
|
|
3
|
+
label?: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface LabelProps {
|
|
7
|
+
id?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
icon?: string;
|
|
10
|
+
tooltip?: string | ReactElement;
|
|
11
|
+
classnames?: Classnames;
|
|
12
|
+
}
|
|
13
|
+
declare function Label({ id, label, icon, tooltip, classnames }: LabelProps): ReactElement | null;
|
|
14
|
+
export default Label;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
var clsx_1 = tslib_1.__importDefault(require("clsx"));
|
|
6
|
+
var react_bootstrap_1 = require("react-bootstrap");
|
|
7
|
+
var app_1 = require("../helpers/app");
|
|
8
|
+
function Label(_a) {
|
|
9
|
+
var id = _a.id, label = _a.label, _b = _a.icon, icon = _b === void 0 ? 'bi bi-info-circle' : _b, tooltip = _a.tooltip, classnames = _a.classnames;
|
|
10
|
+
// Destructure classnames safely
|
|
11
|
+
var _c = (0, app_1.destructObj)(classnames), labelClass = _c.label, iconClass = _c.icon;
|
|
12
|
+
/** Renders the label icon */
|
|
13
|
+
var renderLabelIcon = function () { return react_1.default.createElement("i", { className: (0, clsx_1.default)(icon, iconClass, { 'ms-2': tooltip }) }); };
|
|
14
|
+
if (!label)
|
|
15
|
+
return null;
|
|
16
|
+
return (react_1.default.createElement("label", { htmlFor: id, className: (0, clsx_1.default)(labelClass, 'form-label', {
|
|
17
|
+
'd-flex align-items-center': !!icon,
|
|
18
|
+
}) },
|
|
19
|
+
label,
|
|
20
|
+
tooltip ? (react_1.default.createElement(react_bootstrap_1.OverlayTrigger, { placement: 'top', overlay: react_1.default.createElement(react_bootstrap_1.Tooltip, { className: 'bg-white rounded' }, tooltip) }, renderLabelIcon())) : (renderLabelIcon())));
|
|
21
|
+
}
|
|
22
|
+
exports.default = Label;
|
|
23
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../src/components/Label.tsx"],"names":[],"mappings":";;;AAAA,wDAAgD;AAChD,sDAAuB;AACvB,mDAAyD;AACzD,sCAA4C;AAe5C,SAAS,KAAK,CAAC,EAA0E;QAAxE,EAAE,QAAA,EAAE,KAAK,WAAA,EAAE,YAA0B,EAA1B,IAAI,mBAAG,mBAAmB,KAAA,EAAE,OAAO,aAAA,EAAE,UAAU,gBAAA;IACzE,gCAAgC;IAC1B,IAAA,KAAyC,IAAA,iBAAW,EAAC,UAAU,CAAC,EAAvD,UAAU,WAAA,EAAQ,SAAS,UAA4B,CAAA;IAEtE,6BAA6B;IAC7B,IAAM,eAAe,GAAG,cAAoB,OAAA,qCAAG,SAAS,EAAE,IAAA,cAAI,EAAC,IAAI,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAI,EAA5D,CAA4D,CAAA;IAExG,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IAEvB,OAAO,CACL,yCACE,OAAO,EAAE,EAAE,EACX,SAAS,EAAE,IAAA,cAAI,EAAC,UAAU,EAAE,YAAY,EAAE;YACxC,2BAA2B,EAAE,CAAC,CAAC,IAAI;SACpC,CAAC;QAED,KAAK;QACL,OAAO,CAAC,CAAC,CAAC,CACT,8BAAC,gCAAc,IAAC,SAAS,EAAC,KAAK,EAAC,OAAO,EAAE,8BAAC,yBAAO,IAAC,SAAS,EAAC,kBAAkB,IAAE,OAAO,CAAW,IAC/F,eAAe,EAAE,CACH,CAClB,CAAC,CAAC,CAAC,CACF,eAAe,EAAE,CAClB,CACK,CACT,CAAA;AACH,CAAC;AAED,kBAAe,KAAK,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
var header_1 = require("../../assets/data/header");
|
|
6
|
+
var react_bootstrap_1 = require("react-bootstrap");
|
|
7
|
+
var app_1 = require("../../constants/app");
|
|
8
|
+
function Footer() {
|
|
9
|
+
return (react_1.default.createElement("footer", null,
|
|
10
|
+
react_1.default.createElement(react_bootstrap_1.Container, null,
|
|
11
|
+
react_1.default.createElement(react_bootstrap_1.Row, null,
|
|
12
|
+
react_1.default.createElement(react_bootstrap_1.Col, { lg: 2 },
|
|
13
|
+
react_1.default.createElement(react_bootstrap_1.Image, { src: app_1.LOGO_IMG, alt: 'farm-react logo', height: 40, width: 40 }),
|
|
14
|
+
' '),
|
|
15
|
+
react_1.default.createElement(react_bootstrap_1.Col, { lg: 4 }),
|
|
16
|
+
react_1.default.createElement(react_bootstrap_1.Col, { lg: 6 },
|
|
17
|
+
react_1.default.createElement(react_bootstrap_1.Nav, { className: 'd-flex' }, header_1.headerItem.map(function (item) { return (react_1.default.createElement(react_bootstrap_1.Nav.Link, { key: item.id, href: item.link, className: 'text-dark' }, item.label)); })))))));
|
|
18
|
+
}
|
|
19
|
+
exports.default = Footer;
|
|
20
|
+
//# sourceMappingURL=Footer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Footer.js","sourceRoot":"","sources":["../../../../src/components/Layout/Footer.tsx"],"names":[],"mappings":";;;AAAA,wDAAyB;AAEzB,mDAAqD;AACrD,mDAAiE;AACjE,2CAA8C;AAE9C,SAAS,MAAM;IACb,OAAO,CACL;QACE,8BAAC,2BAAS;YACR,8BAAC,qBAAG;gBACF,8BAAC,qBAAG,IAAC,EAAE,EAAE,CAAC;oBACR,8BAAC,uBAAK,IAAC,GAAG,EAAE,cAAQ,EAAE,GAAG,EAAC,iBAAiB,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,GAAI;oBAAC,GAAG,CACrE;gBACN,8BAAC,qBAAG,IAAC,EAAE,EAAE,CAAC,GAAI;gBACd,8BAAC,qBAAG,IAAC,EAAE,EAAE,CAAC;oBACR,8BAAC,qBAAG,IAAC,SAAS,EAAC,QAAQ,IACpB,mBAAU,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CACxB,8BAAC,qBAAG,CAAC,IAAI,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,SAAS,EAAC,WAAW,IAC3D,IAAI,CAAC,KAAK,CACF,CACZ,EAJyB,CAIzB,CAAC,CACE,CACF,CACF,CACI,CACL,CACV,CAAA;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
var Container_1 = tslib_1.__importDefault(require("react-bootstrap/Container"));
|
|
6
|
+
var Nav_1 = tslib_1.__importDefault(require("react-bootstrap/Nav"));
|
|
7
|
+
var Navbar_1 = tslib_1.__importDefault(require("react-bootstrap/Navbar"));
|
|
8
|
+
var NavDropdown_1 = tslib_1.__importDefault(require("react-bootstrap/NavDropdown"));
|
|
9
|
+
var header_1 = require("../../assets/data/header");
|
|
10
|
+
var react_router_1 = require("react-router");
|
|
11
|
+
var react_bootstrap_1 = require("react-bootstrap");
|
|
12
|
+
var app_1 = require("../../constants/app");
|
|
13
|
+
function Header() {
|
|
14
|
+
return (react_1.default.createElement("header", { className: 'position-sticky top-0' },
|
|
15
|
+
react_1.default.createElement(Navbar_1.default, { expand: 'lg', className: 'bg-body-tertiary' },
|
|
16
|
+
react_1.default.createElement(Container_1.default, null,
|
|
17
|
+
react_1.default.createElement(Navbar_1.default.Brand, { href: '#' },
|
|
18
|
+
react_1.default.createElement(react_bootstrap_1.Image, { src: app_1.LOGO_IMG, alt: 'logo image', height: 30, width: 30 })),
|
|
19
|
+
react_1.default.createElement(Navbar_1.default.Toggle, { "aria-controls": 'basic-navbar-nav' }),
|
|
20
|
+
react_1.default.createElement(Navbar_1.default.Collapse, { id: 'basic-navbar-nav' },
|
|
21
|
+
react_1.default.createElement(Nav_1.default, { className: 'me-auto' },
|
|
22
|
+
header_1.headerItem.map(function (item) { return (react_1.default.createElement(Nav_1.default.Link, { key: item.id, to: item.link, as: react_router_1.Link }, item.label)); }),
|
|
23
|
+
react_1.default.createElement(NavDropdown_1.default, { title: 'Version', id: 'basic-nav-dropdown' },
|
|
24
|
+
react_1.default.createElement(NavDropdown_1.default.Item, { href: '#' }, "farm-react 1.0.0"),
|
|
25
|
+
react_1.default.createElement(NavDropdown_1.default.Item, { href: '#' }, "farm-react 2.0.0"))))))));
|
|
26
|
+
}
|
|
27
|
+
exports.default = Header;
|
|
28
|
+
//# sourceMappingURL=Header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Header.js","sourceRoot":"","sources":["../../../../src/components/Layout/Header.tsx"],"names":[],"mappings":";;;AAAA,wDAAyB;AACzB,gFAAiD;AACjD,oEAAqC;AACrC,0EAA2C;AAC3C,oFAAqD;AACrD,mDAAqD;AACrD,6CAAmC;AACnC,mDAAuC;AACvC,2CAA8C;AAE9C,SAAS,MAAM;IACb,OAAO,CACL,0CAAQ,SAAS,EAAC,uBAAuB;QACvC,8BAAC,gBAAM,IAAC,MAAM,EAAC,IAAI,EAAC,SAAS,EAAC,kBAAkB;YAC9C,8BAAC,mBAAS;gBACR,8BAAC,gBAAM,CAAC,KAAK,IAAC,IAAI,EAAC,GAAG;oBACpB,8BAAC,uBAAK,IAAC,GAAG,EAAE,cAAQ,EAAE,GAAG,EAAC,YAAY,EAAC,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,GAAI,CACnD;gBACf,8BAAC,gBAAM,CAAC,MAAM,qBAAe,kBAAkB,GAAG;gBAClD,8BAAC,gBAAM,CAAC,QAAQ,IAAC,EAAE,EAAC,kBAAkB;oBACpC,8BAAC,aAAG,IAAC,SAAS,EAAC,SAAS;wBACrB,mBAAU,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CACxB,8BAAC,aAAG,CAAC,IAAI,IAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,mBAAI,IAC5C,IAAI,CAAC,KAAK,CACF,CACZ,EAJyB,CAIzB,CAAC;wBACF,8BAAC,qBAAW,IAAC,KAAK,EAAC,SAAS,EAAC,EAAE,EAAC,oBAAoB;4BAClD,8BAAC,qBAAW,CAAC,IAAI,IAAC,IAAI,EAAC,GAAG,uBAAoC;4BAC9D,8BAAC,qBAAW,CAAC,IAAI,IAAC,IAAI,EAAC,GAAG,uBAAoC,CAClD,CACV,CACU,CACR,CACL,CACF,CACV,CAAA;AACH,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var react_1 = tslib_1.__importDefault(require("react"));
|
|
5
|
+
var Offcanvas_1 = tslib_1.__importDefault(require("react-bootstrap/Offcanvas"));
|
|
6
|
+
function Sidebar() {
|
|
7
|
+
return (react_1.default.createElement(Offcanvas_1.default, { show: true, className: 'top-60', backdrop: false, scroll: true },
|
|
8
|
+
react_1.default.createElement(Offcanvas_1.default.Body, null, "Some text as placeholder. In real life you can have the elements you have chosen. Like, text, images, lists, etc.")));
|
|
9
|
+
}
|
|
10
|
+
exports.default = Sidebar;
|
|
11
|
+
//# sourceMappingURL=Sidebar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sidebar.js","sourceRoot":"","sources":["../../../../src/components/Layout/Sidebar.tsx"],"names":[],"mappings":";;;AAAA,wDAAyB;AACzB,gFAAiD;AAEjD,SAAS,OAAO;IACd,OAAO,CACL,8BAAC,mBAAS,IAAC,IAAI,QAAC,SAAS,EAAC,QAAQ,EAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI;QAC9D,8BAAC,mBAAS,CAAC,IAAI,4HAGE,CACP,CACb,CAAA;AACH,CAAC;AAED,kBAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LabelProps } from './Label';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface TextInputProps {
|
|
4
|
+
labelProps?: LabelProps;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
type?: string;
|
|
7
|
+
variant?: string;
|
|
8
|
+
id?: string;
|
|
9
|
+
}
|
|
10
|
+
export default function TextInput({ labelProps, placeholder, type, variant, id }: TextInputProps): React.JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = TextInput;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
5
|
+
var clsx_1 = tslib_1.__importDefault(require("clsx"));
|
|
6
|
+
var Label_1 = tslib_1.__importDefault(require("./Label"));
|
|
7
|
+
var react_1 = require("react");
|
|
8
|
+
var react_bootstrap_1 = require("react-bootstrap");
|
|
9
|
+
var react_2 = tslib_1.__importDefault(require("react"));
|
|
10
|
+
function TextInput(_a) {
|
|
11
|
+
var labelProps = _a.labelProps, placeholder = _a.placeholder, _b = _a.type, type = _b === void 0 ? 'text' : _b, _c = _a.variant, variant = _c === void 0 ? 'sm' : _c, id = _a.id;
|
|
12
|
+
var _d = (0, react_1.useState)(false), showPassword = _d[0], setShowPassword = _d[1];
|
|
13
|
+
var handleToggle = function () {
|
|
14
|
+
setShowPassword(function (prev) { return !prev; });
|
|
15
|
+
};
|
|
16
|
+
function renderInput() {
|
|
17
|
+
return (react_2.default.createElement(react_bootstrap_1.Form.Control, { placeholder: placeholder, id: id, type: type === 'password' && showPassword ? 'text' : type, className: (0, clsx_1.default)("form-control-".concat(variant)) }));
|
|
18
|
+
}
|
|
19
|
+
return (react_2.default.createElement("div", { className: (0, clsx_1.default)('text-input-wrapper') },
|
|
20
|
+
react_2.default.createElement(Label_1.default, tslib_1.__assign({}, labelProps, { id: id })),
|
|
21
|
+
type === 'password' ? (react_2.default.createElement("div", { className: 'position-relative' },
|
|
22
|
+
renderInput(),
|
|
23
|
+
react_2.default.createElement(react_bootstrap_1.Button, { variant: 'transparent', className: 'form-control-icon text-dark', onClick: handleToggle },
|
|
24
|
+
react_2.default.createElement("i", { className: (0, clsx_1.default)(showPassword ? 'bi bi-eye bi' : 'bi-eye-slash') })))) : (renderInput())));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=TextInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../../src/components/TextInput.tsx"],"names":[],"mappings":";;AAeA,4BAiCC;;AAhDD,sDAAuB;AAEvB,0DAA2B;AAC3B,+BAAmD;AACnD,mDAA8C;AAC9C,wDAAyB;AAUzB,SAAwB,SAAS,CAAC,EAA8E;QAA5E,UAAU,gBAAA,EAAE,WAAW,iBAAA,EAAE,YAAa,EAAb,IAAI,mBAAG,MAAM,KAAA,EAAE,eAAc,EAAd,OAAO,mBAAG,IAAI,KAAA,EAAE,EAAE,QAAA;IACtF,IAAA,KAAkC,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAhD,YAAY,QAAA,EAAE,eAAe,QAAmB,CAAA;IAEvD,IAAM,YAAY,GAAG;QACnB,eAAe,CAAC,UAAC,IAAI,IAAK,OAAA,CAAC,IAAI,EAAL,CAAK,CAAC,CAAA;IAClC,CAAC,CAAA;IAED,SAAS,WAAW;QAClB,OAAO,CACL,8BAAC,sBAAI,CAAC,OAAO,IACX,WAAW,EAAE,WAAW,EACxB,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,IAAI,KAAK,UAAU,IAAI,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,EACzD,SAAS,EAAE,IAAA,cAAI,EAAC,uBAAgB,OAAO,CAAE,CAAC,GAC1C,CACH,CAAA;IACH,CAAC;IAED,OAAO,CACL,uCAAK,SAAS,EAAE,IAAA,cAAI,EAAC,oBAAoB,CAAC;QACxC,8BAAC,eAAK,uBAAK,UAAU,IAAE,EAAE,EAAE,EAAE,IAAI;QAChC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,CACrB,uCAAK,SAAS,EAAC,mBAAmB;YAC/B,WAAW,EAAE;YACd,8BAAC,wBAAM,IAAC,OAAO,EAAC,aAAa,EAAC,SAAS,EAAC,6BAA6B,EAAC,OAAO,EAAE,YAAY;gBACzF,qCAAG,SAAS,EAAE,IAAA,cAAI,EAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,GAAI,CAC/D,CACL,CACP,CAAC,CAAC,CAAC,CACF,WAAW,EAAE,CACd,CACG,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
var MyCounter = function (_a) {
|
|
6
|
+
var _b = _a.value, value = _b === void 0 ? 0 : _b;
|
|
7
|
+
var _c = (0, react_1.useState)(value), counter = _c[0], setCounter = _c[1];
|
|
8
|
+
var onMinus = function () {
|
|
9
|
+
setCounter(function (val) { return val - 1; });
|
|
10
|
+
};
|
|
11
|
+
var onPlus = function () {
|
|
12
|
+
setCounter(function (prev) { return prev + 1; });
|
|
13
|
+
};
|
|
14
|
+
return (react_1.default.createElement("div", null,
|
|
15
|
+
react_1.default.createElement("h1", null,
|
|
16
|
+
"Counter: ",
|
|
17
|
+
counter),
|
|
18
|
+
react_1.default.createElement("button", { onClick: onMinus }, "-"),
|
|
19
|
+
react_1.default.createElement("button", { onClick: onPlus }, "+")));
|
|
20
|
+
};
|
|
21
|
+
exports.default = MyCounter;
|
|
22
|
+
//# sourceMappingURL=app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/components/app.tsx"],"names":[],"mappings":";;;AAAA,qDAAuC;AAMvC,IAAM,SAAS,GAAG,UAAC,EAAoB;QAAlB,aAAS,EAAT,KAAK,mBAAG,CAAC,KAAA;IACtB,IAAA,KAAwB,IAAA,gBAAQ,EAAC,KAAK,CAAC,EAAtC,OAAO,QAAA,EAAE,UAAU,QAAmB,CAAA;IAE7C,IAAM,OAAO,GAAG;QACd,UAAU,CAAC,UAAC,GAAG,IAAK,OAAA,GAAG,GAAG,CAAC,EAAP,CAAO,CAAC,CAAA;IAC9B,CAAC,CAAA;IACD,IAAM,MAAM,GAAG;QACb,UAAU,CAAC,UAAC,IAAI,IAAK,OAAA,IAAI,GAAG,CAAC,EAAR,CAAQ,CAAC,CAAA;IAChC,CAAC,CAAA;IAED,OAAO,CACL;QACE;;YAAc,OAAO,CAAM;QAC3B,0CAAQ,OAAO,EAAE,OAAO,QAAY;QACpC,0CAAQ,OAAO,EAAE,MAAM,QAAY,CAC/B,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const LOGO_IMG = "app/assets/images/logo.png";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../src/constants/app.ts"],"names":[],"mappings":";;;AAAa,QAAA,QAAQ,GAAG,4BAA4B,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"images.js","sourceRoot":"","sources":["../../../src/constants/images.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/constants/routes.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/container/index.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Safely returns the provided object or an empty object as fallback.
|
|
3
|
+
* @param value - The object to check.
|
|
4
|
+
* @returns The original object if defined, otherwise an empty object of type T.
|
|
5
|
+
*/
|
|
6
|
+
export declare function destructObj<T extends object>(value?: T): T;
|
|
7
|
+
/**
|
|
8
|
+
* Checks if the given value is an empty string (after trimming).
|
|
9
|
+
* @param value - The string to check.
|
|
10
|
+
* @returns true if the value is not a valid string or is empty after trimming, false otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare function isEmptyString(value?: string | null): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Checks if the given value is a non-empty string.
|
|
15
|
+
* @param value - The string to check.
|
|
16
|
+
* @returns true if the value is a string with at least one character, false otherwise.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isStringNotEmpty(value?: string | null): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Checks if the given value is a non-empty array.
|
|
21
|
+
* @param value - The array to check.
|
|
22
|
+
* @returns true if the value is an array with at least one element, false otherwise.
|
|
23
|
+
*/
|
|
24
|
+
export declare function isArrayNotEmpty<T>(value?: T[] | null): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if the given value is an empty array.
|
|
27
|
+
* @param value - The array to check.
|
|
28
|
+
* @returns true if the value is an array with no elements, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isArrayEmpty<T>(value?: T[] | null): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Safely returns the length of the given array.
|
|
33
|
+
* @param value - The array to check.
|
|
34
|
+
* @returns The number of elements in the array, or 0 if the array is null/undefined.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getArrayLength<T>(value?: T[] | null): number;
|
|
37
|
+
/**
|
|
38
|
+
* Safely checks if the given array includes a specific value.
|
|
39
|
+
* @param array - The array to check.
|
|
40
|
+
* @param item - The item to search for.
|
|
41
|
+
* @returns true if the array includes the item, false otherwise.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isArrayIncludes<T>(array: T[] | null | undefined, item: T): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the given value is an empty object.
|
|
46
|
+
* @param value - The object to check.
|
|
47
|
+
* @returns true if the value is an object with no own enumerable keys, false otherwise.
|
|
48
|
+
*/
|
|
49
|
+
export declare function isObjEmpty(value?: object | null): boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if the given value is a non-empty plain object.
|
|
52
|
+
* @param value - The object to check.
|
|
53
|
+
* @returns true if the value is a plain object with at least one own key, false otherwise.
|
|
54
|
+
*/
|
|
55
|
+
export declare function isObjNotEmpty(value?: object | null): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Checks if the given value is empty.
|
|
58
|
+
* Supports: string, array, object.
|
|
59
|
+
* @param value - The value to check.
|
|
60
|
+
* @returns true if the value is empty, false otherwise.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isEmpty(value: any): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Generates an array of dates between two dates (inclusive).
|
|
65
|
+
* @param start - The start date.
|
|
66
|
+
* @param end - The end date.
|
|
67
|
+
* @returns An array of Date objects from start to end.
|
|
68
|
+
*/
|
|
69
|
+
export declare function getDates(start: Date, end: Date): Date[];
|
|
70
|
+
/**
|
|
71
|
+
* Formats a given date into a string.
|
|
72
|
+
* @param date - The date to format.
|
|
73
|
+
* @param format - The format string (default: "YYYY-MM-DD").
|
|
74
|
+
* Supported tokens: YYYY, MM, DD, HH, mm, ss
|
|
75
|
+
* @returns The formatted date string.
|
|
76
|
+
*/
|
|
77
|
+
export declare function getFormattedDate(date: Date, format?: string): string;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the current logged-in user from localStorage.
|
|
80
|
+
*/
|
|
81
|
+
export declare function getCurrentUser(): any | null;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.destructObj = destructObj;
|
|
4
|
+
exports.isEmptyString = isEmptyString;
|
|
5
|
+
exports.isStringNotEmpty = isStringNotEmpty;
|
|
6
|
+
exports.isArrayNotEmpty = isArrayNotEmpty;
|
|
7
|
+
exports.isArrayEmpty = isArrayEmpty;
|
|
8
|
+
exports.getArrayLength = getArrayLength;
|
|
9
|
+
exports.isArrayIncludes = isArrayIncludes;
|
|
10
|
+
exports.isObjEmpty = isObjEmpty;
|
|
11
|
+
exports.isObjNotEmpty = isObjNotEmpty;
|
|
12
|
+
exports.isEmpty = isEmpty;
|
|
13
|
+
exports.getDates = getDates;
|
|
14
|
+
exports.getFormattedDate = getFormattedDate;
|
|
15
|
+
exports.getCurrentUser = getCurrentUser;
|
|
16
|
+
/**
|
|
17
|
+
* Safely returns the provided object or an empty object as fallback.
|
|
18
|
+
* @param value - The object to check.
|
|
19
|
+
* @returns The original object if defined, otherwise an empty object of type T.
|
|
20
|
+
*/
|
|
21
|
+
function destructObj(value) {
|
|
22
|
+
return (value !== null && value !== void 0 ? value : {});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Checks if the given value is an empty string (after trimming).
|
|
26
|
+
* @param value - The string to check.
|
|
27
|
+
* @returns true if the value is not a valid string or is empty after trimming, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
function isEmptyString(value) {
|
|
30
|
+
return !(typeof value === 'string' && value.trim().length > 0);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the given value is a non-empty string.
|
|
34
|
+
* @param value - The string to check.
|
|
35
|
+
* @returns true if the value is a string with at least one character, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
function isStringNotEmpty(value) {
|
|
38
|
+
return typeof value === 'string' && value.trim().length > 0;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Checks if the given value is a non-empty array.
|
|
42
|
+
* @param value - The array to check.
|
|
43
|
+
* @returns true if the value is an array with at least one element, false otherwise.
|
|
44
|
+
*/
|
|
45
|
+
function isArrayNotEmpty(value) {
|
|
46
|
+
return Array.isArray(value) && value.length > 0;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Checks if the given value is an empty array.
|
|
50
|
+
* @param value - The array to check.
|
|
51
|
+
* @returns true if the value is an array with no elements, false otherwise.
|
|
52
|
+
*/
|
|
53
|
+
function isArrayEmpty(value) {
|
|
54
|
+
return Array.isArray(value) && value.length === 0;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Safely returns the length of the given array.
|
|
58
|
+
* @param value - The array to check.
|
|
59
|
+
* @returns The number of elements in the array, or 0 if the array is null/undefined.
|
|
60
|
+
*/
|
|
61
|
+
function getArrayLength(value) {
|
|
62
|
+
return Array.isArray(value) ? value.length : 0;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Safely checks if the given array includes a specific value.
|
|
66
|
+
* @param array - The array to check.
|
|
67
|
+
* @param item - The item to search for.
|
|
68
|
+
* @returns true if the array includes the item, false otherwise.
|
|
69
|
+
*/
|
|
70
|
+
function isArrayIncludes(array, item) {
|
|
71
|
+
return Array.isArray(array) && array.includes(item);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Checks if the given value is an empty object.
|
|
75
|
+
* @param value - The object to check.
|
|
76
|
+
* @returns true if the value is an object with no own enumerable keys, false otherwise.
|
|
77
|
+
*/
|
|
78
|
+
function isObjEmpty(value) {
|
|
79
|
+
return !!value && Object.keys(value).length === 0 && value.constructor === Object;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Checks if the given value is a non-empty plain object.
|
|
83
|
+
* @param value - The object to check.
|
|
84
|
+
* @returns true if the value is a plain object with at least one own key, false otherwise.
|
|
85
|
+
*/
|
|
86
|
+
function isObjNotEmpty(value) {
|
|
87
|
+
return !!value && value.constructor === Object && Object.keys(value).length > 0;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Checks if the given value is empty.
|
|
91
|
+
* Supports: string, array, object.
|
|
92
|
+
* @param value - The value to check.
|
|
93
|
+
* @returns true if the value is empty, false otherwise.
|
|
94
|
+
*/
|
|
95
|
+
function isEmpty(value) {
|
|
96
|
+
if (value == null)
|
|
97
|
+
return true; // null or undefined
|
|
98
|
+
if (typeof value === 'string') {
|
|
99
|
+
return value.trim().length === 0;
|
|
100
|
+
}
|
|
101
|
+
if (Array.isArray(value)) {
|
|
102
|
+
return value.length === 0;
|
|
103
|
+
}
|
|
104
|
+
if (typeof value === 'object') {
|
|
105
|
+
return Object.keys(value).length === 0 && value.constructor === Object;
|
|
106
|
+
}
|
|
107
|
+
return false; // for numbers, booleans, functions, etc.
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Generates an array of dates between two dates (inclusive).
|
|
111
|
+
* @param start - The start date.
|
|
112
|
+
* @param end - The end date.
|
|
113
|
+
* @returns An array of Date objects from start to end.
|
|
114
|
+
*/
|
|
115
|
+
function getDates(start, end) {
|
|
116
|
+
var dates = [];
|
|
117
|
+
var current = new Date(start);
|
|
118
|
+
while (current <= end) {
|
|
119
|
+
dates.push(new Date(current)); // push a copy
|
|
120
|
+
current.setDate(current.getDate() + 1); // move to next day
|
|
121
|
+
}
|
|
122
|
+
return dates;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Formats a given date into a string.
|
|
126
|
+
* @param date - The date to format.
|
|
127
|
+
* @param format - The format string (default: "YYYY-MM-DD").
|
|
128
|
+
* Supported tokens: YYYY, MM, DD, HH, mm, ss
|
|
129
|
+
* @returns The formatted date string.
|
|
130
|
+
*/
|
|
131
|
+
function getFormattedDate(date, format) {
|
|
132
|
+
if (format === void 0) { format = 'YYYY-MM-DD'; }
|
|
133
|
+
var pad = function (n) { return n.toString().padStart(2, '0'); };
|
|
134
|
+
var map = {
|
|
135
|
+
YYYY: date.getFullYear().toString(),
|
|
136
|
+
MM: pad(date.getMonth() + 1),
|
|
137
|
+
DD: pad(date.getDate()),
|
|
138
|
+
HH: pad(date.getHours()),
|
|
139
|
+
mm: pad(date.getMinutes()),
|
|
140
|
+
ss: pad(date.getSeconds()),
|
|
141
|
+
};
|
|
142
|
+
return format.replace(/YYYY|MM|DD|HH|mm|ss/g, function (match) { return map[match]; });
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Returns the current logged-in user from localStorage.
|
|
146
|
+
*/
|
|
147
|
+
function getCurrentUser() {
|
|
148
|
+
var user = localStorage.getItem('currentUser');
|
|
149
|
+
return user ? JSON.parse(user) : null;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=app.js.map
|