asv-hlps 1.2.39 → 1.2.42

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.
@@ -37,5 +37,4 @@ export * from "./react-utils";
37
37
  export * from "./sale";
38
38
  export * from "./user";
39
39
  export * from "./utils";
40
- export * from "./reacts/index";
41
40
  export { AuthService, StorageService, CapacitorStorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
package/lib/cjs/index.js CHANGED
@@ -68,4 +68,3 @@ __exportStar(require("./react-utils"), exports);
68
68
  __exportStar(require("./sale"), exports);
69
69
  __exportStar(require("./user"), exports);
70
70
  __exportStar(require("./utils"), exports);
71
- __exportStar(require("./reacts/index"), exports);
@@ -51,7 +51,7 @@ export declare type HeaderTableColumnType = {
51
51
  tooltipB?: any;
52
52
  };
53
53
  export declare type ReactTableColumnType = {
54
- Header: string;
54
+ Header: any;
55
55
  accessor: string;
56
56
  sort?: boolean;
57
57
  Cell?: any;
@@ -1,3 +1,4 @@
1
1
  import useReadonlyFetchTobs from "./hooks/useReadonlyFetchTobs";
2
2
  import BtnToggle from "./minton/btns/BtnToggle";
3
- export { useReadonlyFetchTobs, BtnToggle };
3
+ import BtnAction from "./minton/btns/BtnAction";
4
+ export { useReadonlyFetchTobs, BtnToggle, BtnAction };
@@ -3,8 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BtnToggle = exports.useReadonlyFetchTobs = void 0;
6
+ exports.BtnAction = exports.BtnToggle = exports.useReadonlyFetchTobs = void 0;
7
7
  const useReadonlyFetchTobs_1 = __importDefault(require("./hooks/useReadonlyFetchTobs"));
8
8
  exports.useReadonlyFetchTobs = useReadonlyFetchTobs_1.default;
9
9
  const BtnToggle_1 = __importDefault(require("./minton/btns/BtnToggle"));
10
10
  exports.BtnToggle = BtnToggle_1.default;
11
+ const BtnAction_1 = __importDefault(require("./minton/btns/BtnAction"));
12
+ exports.BtnAction = BtnAction_1.default;
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ export interface BtnType {
3
+ id: number | string;
4
+ label: any;
5
+ icon?: string;
6
+ size?: "sm" | "lg";
7
+ variant?: "danger" | "success" | "primary" | "secondary" | "light" | "white" | "link" | string;
8
+ disabled?: boolean;
9
+ textColor?: "text-danger" | "text-success" | "text-primary" | "text-secondary";
10
+ color?: "danger" | "success" | "primary" | "secondary" | string;
11
+ divider?: boolean;
12
+ btnClass?: string;
13
+ }
14
+ export interface DropMenuType {
15
+ label: string;
16
+ icon?: string;
17
+ color?: "primary" | "success" | "info" | "danger";
18
+ ellipsis?: "v" | "h";
19
+ drops: BtnType[];
20
+ }
21
+ export declare type IfBtnType = "elpDropMenu" | "btnDropMenu" | "btns" | "btnLinks" | "none";
22
+ declare type BtnActionProps = {
23
+ tob?: any;
24
+ onDrop?: any;
25
+ onBtn?: any;
26
+ ifBtn?: IfBtnType;
27
+ dropMenu?: DropMenuType;
28
+ btns?: BtnType[];
29
+ };
30
+ declare const BtnAction: ({ dropMenu, btns, onDrop, onBtn, tob, ifBtn }: BtnActionProps) => JSX.Element;
31
+ export default BtnAction;
@@ -0,0 +1,87 @@
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
+ const jsx_runtime_1 = require("react/jsx-runtime");
7
+ const classnames_1 = __importDefault(require("classnames"));
8
+ const react_1 = __importDefault(require("react"));
9
+ const react_bootstrap_1 = require("react-bootstrap");
10
+ // const BtnDrop: React.FC<BtnActionProps> = ({ drops, btns, ellipsis, onDrop, onBtn, tob, ifBtn, btnDrop }) => {
11
+ const BtnAction = ({ dropMenu, btns, onDrop, onBtn, tob, ifBtn }) => {
12
+ // --------------------
13
+ const iconClass = (icon) => {
14
+ return icon ? `${icon} me-1` : "me-1";
15
+ };
16
+ const textColorClass = (textColor) => {
17
+ const format = textColor ? `${textColor} ` : "";
18
+ return "text-capitalize" + format;
19
+ };
20
+ const colorClass = (color) => {
21
+ return color ? `btn btn-${color} ms-1 ` : "btn btn-primary ms-1";
22
+ };
23
+ const sizeClass = (size) => {
24
+ return size ? `btn-${size}` : "btn-sm";
25
+ };
26
+ const ellispsisDirection = (ellipsis) => {
27
+ let ellipsisDirection = "uil uil-ellipsis-";
28
+ return (ellipsisDirection += ellipsis ? ellipsis : "h");
29
+ };
30
+ const elpDropMenu = () => (
31
+ // <ButtonGroup>
32
+ (0, jsx_runtime_1.jsxs)(react_bootstrap_1.Dropdown, Object.assign({ as: react_bootstrap_1.ButtonGroup, className: "d-inline-block ms-2" }, { children: [(0, jsx_runtime_1.jsx)(react_bootstrap_1.Dropdown.Toggle, Object.assign({ as: "a", className: "cursor-pointer arrow-none text-muted" }, { children: (0, jsx_runtime_1.jsx)("i", { className: ellispsisDirection(dropMenu.ellipsis) }) })), (0, jsx_runtime_1.jsx)(react_bootstrap_1.Dropdown.Menu, { children: react_1.default.Children.toArray(dropMenu.drops.map((drop) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(react_bootstrap_1.Dropdown.Item, Object.assign({ as: "button",
33
+ // onClick={(e) => onDrop(e, { id: +drop.id, tob })}
34
+ onClick: (e) => {
35
+ e.stopPropagation();
36
+ e.preventDefault();
37
+ onDrop({ id: +drop.id, tob });
38
+ },
39
+ // onClick={(e) => handleDrop(e)}
40
+ // eventKey={drop.id}
41
+ // key={drop.id}
42
+ // key={index}
43
+ className: textColorClass(drop.textColor) }, { children: [(0, jsx_runtime_1.jsx)("i", { className: iconClass(drop.icon) }), drop.label] })), drop.divider ? (0, jsx_runtime_1.jsx)(react_bootstrap_1.Dropdown.Divider, {}) : ""] })))) })] }))
44
+ // </ButtonGroup>
45
+ );
46
+ const handleDrop = (props) => {
47
+ console.log(props);
48
+ // console.log(props.target.current.value);
49
+ };
50
+ const btnDropMenu = () => (
51
+ // <ButtonGroup>
52
+ (0, jsx_runtime_1.jsxs)(react_bootstrap_1.Dropdown, Object.assign({ as: react_bootstrap_1.ButtonGroup, align: "end", size: "sm" }, { children: [(0, jsx_runtime_1.jsxs)(react_bootstrap_1.Dropdown.Toggle, Object.assign({ variant: "primary", id: "dropdown-basic", className: "cursor-pointer" }, { children: [dropMenu.icon && (0, jsx_runtime_1.jsx)("i", { className: iconClass(dropMenu.icon) }), (0, jsx_runtime_1.jsx)("small", Object.assign({ className: "text-uppercase" }, { children: dropMenu === null || dropMenu === void 0 ? void 0 : dropMenu.label })), (0, jsx_runtime_1.jsx)("i", { className: "mdi mdi-chevron-down ms-1" })] })), (0, jsx_runtime_1.jsx)(react_bootstrap_1.Dropdown.Menu, { children: dropMenu.drops.map((drop) => ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("span", { children: [(0, jsx_runtime_1.jsx)(react_bootstrap_1.Dropdown.Item, Object.assign({ className: "notify-item", onClick: () => onDrop(drop.id), eventKey: drop.id }, { children: (0, jsx_runtime_1.jsx)("span", Object.assign({ className: textColorClass(drop.textColor) }, { children: drop.label })) })), drop.divider ? (0, jsx_runtime_1.jsx)(react_bootstrap_1.Dropdown.Divider, {}) : ""] }, drop.id) }))) })] }))
53
+ // </ButtonGroup>
54
+ );
55
+ const btnActions = () => {
56
+ return btns.map((btn) => ((0, jsx_runtime_1.jsx)(react_bootstrap_1.ButtonGroup, Object.assign({ className: "ms-1 p-0 text-uppercase", size: "sm" }, { children: (0, jsx_runtime_1.jsxs)(react_bootstrap_1.Button
57
+ // className={classNames(colorClass(btn.color), "text-uppercase fs-6 p-0")}
58
+ , Object.assign({
59
+ // className={classNames(colorClass(btn.color), "text-uppercase fs-6 p-0")}
60
+ className: (0, classnames_1.default)(btn.btnClass, "text-uppercase fs-6"), disabled: btn.disabled, variant: btn.variant ? btn.variant : "primary", onClick: (e) => {
61
+ e.preventDefault();
62
+ e.stopPropagation();
63
+ onBtn(btn.id);
64
+ }, size: "sm" }, { children: [btn.icon && (0, jsx_runtime_1.jsx)("i", { className: iconClass(btn.icon) }), btn.label] })) }), btn === null || btn === void 0 ? void 0 : btn.id)));
65
+ };
66
+ const btnLinks = () => {
67
+ return btns.map((btn) => ((0, jsx_runtime_1.jsxs)(react_bootstrap_1.Button, Object.assign({ as: "a", className: `${colorClass(btn.color)} ${sizeClass(btn.size)} float-end`, onClick: (e) => {
68
+ e.preventDefault();
69
+ e.stopPropagation();
70
+ onBtn(btn.id);
71
+ } }, { children: [btn.icon && (0, jsx_runtime_1.jsx)("i", { className: iconClass(btn.icon) }), btn.label] }), btn === null || btn === void 0 ? void 0 : btn.id)));
72
+ };
73
+ /* const renderDrop = () => {
74
+ switch (ifBtn) {
75
+ case "btns":
76
+ return dropMenuBtn();
77
+ case "elpMenu":
78
+ return dropMenu();
79
+ case "btn":
80
+ return btnActions();
81
+ default:
82
+ return dropMenu();
83
+ }
84
+ }; */
85
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [ifBtn === "btnDropMenu" && btnDropMenu(), ifBtn === "elpDropMenu" && elpDropMenu(), ifBtn === "btns" && btnActions(), ifBtn === "btnLinks" && btnLinks()] }));
86
+ };
87
+ exports.default = BtnAction;
@@ -37,5 +37,4 @@ export * from "./react-utils";
37
37
  export * from "./sale";
38
38
  export * from "./user";
39
39
  export * from "./utils";
40
- export * from "./reacts/index";
41
40
  export { AuthService, StorageService, CapacitorStorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
package/lib/esm/index.js CHANGED
@@ -40,6 +40,5 @@ export * from "./react-utils";
40
40
  export * from "./sale";
41
41
  export * from "./user";
42
42
  export * from "./utils";
43
- export * from "./reacts/index";
44
43
  // export * from "./helpers/hlpProduct";
45
44
  export { AuthService, StorageService, CapacitorStorageService, HlpProduct, HlpEntry, StockPipe, AmountOnListBillPipe, AmountOnBillPipe };
@@ -51,7 +51,7 @@ export declare type HeaderTableColumnType = {
51
51
  tooltipB?: any;
52
52
  };
53
53
  export declare type ReactTableColumnType = {
54
- Header: string;
54
+ Header: any;
55
55
  accessor: string;
56
56
  sort?: boolean;
57
57
  Cell?: any;
@@ -1,3 +1,4 @@
1
1
  import useReadonlyFetchTobs from "./hooks/useReadonlyFetchTobs";
2
2
  import BtnToggle from "./minton/btns/BtnToggle";
3
- export { useReadonlyFetchTobs, BtnToggle };
3
+ import BtnAction from "./minton/btns/BtnAction";
4
+ export { useReadonlyFetchTobs, BtnToggle, BtnAction };
@@ -1,3 +1,4 @@
1
1
  import useReadonlyFetchTobs from "./hooks/useReadonlyFetchTobs";
2
2
  import BtnToggle from "./minton/btns/BtnToggle";
3
- export { useReadonlyFetchTobs, BtnToggle };
3
+ import BtnAction from "./minton/btns/BtnAction";
4
+ export { useReadonlyFetchTobs, BtnToggle, BtnAction };
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ export interface BtnType {
3
+ id: number | string;
4
+ label: any;
5
+ icon?: string;
6
+ size?: "sm" | "lg";
7
+ variant?: "danger" | "success" | "primary" | "secondary" | "light" | "white" | "link" | string;
8
+ disabled?: boolean;
9
+ textColor?: "text-danger" | "text-success" | "text-primary" | "text-secondary";
10
+ color?: "danger" | "success" | "primary" | "secondary" | string;
11
+ divider?: boolean;
12
+ btnClass?: string;
13
+ }
14
+ export interface DropMenuType {
15
+ label: string;
16
+ icon?: string;
17
+ color?: "primary" | "success" | "info" | "danger";
18
+ ellipsis?: "v" | "h";
19
+ drops: BtnType[];
20
+ }
21
+ export declare type IfBtnType = "elpDropMenu" | "btnDropMenu" | "btns" | "btnLinks" | "none";
22
+ declare type BtnActionProps = {
23
+ tob?: any;
24
+ onDrop?: any;
25
+ onBtn?: any;
26
+ ifBtn?: IfBtnType;
27
+ dropMenu?: DropMenuType;
28
+ btns?: BtnType[];
29
+ };
30
+ declare const BtnAction: ({ dropMenu, btns, onDrop, onBtn, tob, ifBtn }: BtnActionProps) => JSX.Element;
31
+ export default BtnAction;
@@ -0,0 +1,82 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import classNames from "classnames";
3
+ import React from "react";
4
+ import { Button, ButtonGroup, Dropdown } from "react-bootstrap";
5
+ // const BtnDrop: React.FC<BtnActionProps> = ({ drops, btns, ellipsis, onDrop, onBtn, tob, ifBtn, btnDrop }) => {
6
+ const BtnAction = ({ dropMenu, btns, onDrop, onBtn, tob, ifBtn }) => {
7
+ // --------------------
8
+ const iconClass = (icon) => {
9
+ return icon ? `${icon} me-1` : "me-1";
10
+ };
11
+ const textColorClass = (textColor) => {
12
+ const format = textColor ? `${textColor} ` : "";
13
+ return "text-capitalize" + format;
14
+ };
15
+ const colorClass = (color) => {
16
+ return color ? `btn btn-${color} ms-1 ` : "btn btn-primary ms-1";
17
+ };
18
+ const sizeClass = (size) => {
19
+ return size ? `btn-${size}` : "btn-sm";
20
+ };
21
+ const ellispsisDirection = (ellipsis) => {
22
+ let ellipsisDirection = "uil uil-ellipsis-";
23
+ return (ellipsisDirection += ellipsis ? ellipsis : "h");
24
+ };
25
+ const elpDropMenu = () => (
26
+ // <ButtonGroup>
27
+ _jsxs(Dropdown, Object.assign({ as: ButtonGroup, className: "d-inline-block ms-2" }, { children: [_jsx(Dropdown.Toggle, Object.assign({ as: "a", className: "cursor-pointer arrow-none text-muted" }, { children: _jsx("i", { className: ellispsisDirection(dropMenu.ellipsis) }) })), _jsx(Dropdown.Menu, { children: React.Children.toArray(dropMenu.drops.map((drop) => (_jsxs(_Fragment, { children: [_jsxs(Dropdown.Item, Object.assign({ as: "button",
28
+ // onClick={(e) => onDrop(e, { id: +drop.id, tob })}
29
+ onClick: (e) => {
30
+ e.stopPropagation();
31
+ e.preventDefault();
32
+ onDrop({ id: +drop.id, tob });
33
+ },
34
+ // onClick={(e) => handleDrop(e)}
35
+ // eventKey={drop.id}
36
+ // key={drop.id}
37
+ // key={index}
38
+ className: textColorClass(drop.textColor) }, { children: [_jsx("i", { className: iconClass(drop.icon) }), drop.label] })), drop.divider ? _jsx(Dropdown.Divider, {}) : ""] })))) })] }))
39
+ // </ButtonGroup>
40
+ );
41
+ const handleDrop = (props) => {
42
+ console.log(props);
43
+ // console.log(props.target.current.value);
44
+ };
45
+ const btnDropMenu = () => (
46
+ // <ButtonGroup>
47
+ _jsxs(Dropdown, Object.assign({ as: ButtonGroup, align: "end", size: "sm" }, { children: [_jsxs(Dropdown.Toggle, Object.assign({ variant: "primary", id: "dropdown-basic", className: "cursor-pointer" }, { children: [dropMenu.icon && _jsx("i", { className: iconClass(dropMenu.icon) }), _jsx("small", Object.assign({ className: "text-uppercase" }, { children: dropMenu === null || dropMenu === void 0 ? void 0 : dropMenu.label })), _jsx("i", { className: "mdi mdi-chevron-down ms-1" })] })), _jsx(Dropdown.Menu, { children: dropMenu.drops.map((drop) => (_jsx(_Fragment, { children: _jsxs("span", { children: [_jsx(Dropdown.Item, Object.assign({ className: "notify-item", onClick: () => onDrop(drop.id), eventKey: drop.id }, { children: _jsx("span", Object.assign({ className: textColorClass(drop.textColor) }, { children: drop.label })) })), drop.divider ? _jsx(Dropdown.Divider, {}) : ""] }, drop.id) }))) })] }))
48
+ // </ButtonGroup>
49
+ );
50
+ const btnActions = () => {
51
+ return btns.map((btn) => (_jsx(ButtonGroup, Object.assign({ className: "ms-1 p-0 text-uppercase", size: "sm" }, { children: _jsxs(Button
52
+ // className={classNames(colorClass(btn.color), "text-uppercase fs-6 p-0")}
53
+ , Object.assign({
54
+ // className={classNames(colorClass(btn.color), "text-uppercase fs-6 p-0")}
55
+ className: classNames(btn.btnClass, "text-uppercase fs-6"), disabled: btn.disabled, variant: btn.variant ? btn.variant : "primary", onClick: (e) => {
56
+ e.preventDefault();
57
+ e.stopPropagation();
58
+ onBtn(btn.id);
59
+ }, size: "sm" }, { children: [btn.icon && _jsx("i", { className: iconClass(btn.icon) }), btn.label] })) }), btn === null || btn === void 0 ? void 0 : btn.id)));
60
+ };
61
+ const btnLinks = () => {
62
+ return btns.map((btn) => (_jsxs(Button, Object.assign({ as: "a", className: `${colorClass(btn.color)} ${sizeClass(btn.size)} float-end`, onClick: (e) => {
63
+ e.preventDefault();
64
+ e.stopPropagation();
65
+ onBtn(btn.id);
66
+ } }, { children: [btn.icon && _jsx("i", { className: iconClass(btn.icon) }), btn.label] }), btn === null || btn === void 0 ? void 0 : btn.id)));
67
+ };
68
+ /* const renderDrop = () => {
69
+ switch (ifBtn) {
70
+ case "btns":
71
+ return dropMenuBtn();
72
+ case "elpMenu":
73
+ return dropMenu();
74
+ case "btn":
75
+ return btnActions();
76
+ default:
77
+ return dropMenu();
78
+ }
79
+ }; */
80
+ return (_jsxs(_Fragment, { children: [ifBtn === "btnDropMenu" && btnDropMenu(), ifBtn === "elpDropMenu" && elpDropMenu(), ifBtn === "btns" && btnActions(), ifBtn === "btnLinks" && btnLinks()] }));
81
+ };
82
+ export default BtnAction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "asv-hlps",
3
- "version": "1.2.39",
3
+ "version": "1.2.42",
4
4
  "description": "helpers",
5
5
  "main": "./lib/cjs/index.js",
6
6
  "module": "./lib/esm/index.js",
@@ -25,9 +25,9 @@
25
25
  "@capacitor/preferences": "^4.0.1",
26
26
  "axios": "^0.27.2",
27
27
  "bcryptjs": "^2.4.3",
28
+ "classnames": "^2.3.1",
28
29
  "jwt-decode": "^3.1.2",
29
30
  "randomatic": "^3.1.1",
30
- "react": "^18.2.0",
31
31
  "yup": "^0.32.11"
32
32
  }
33
33
  }