@akanjs/ui 0.9.4 → 0.9.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/DraggableList.d.ts +3 -2
- package/Input.d.ts +1 -1
- package/Link/CsrLink.d.ts +1 -1
- package/Link/types.d.ts +1 -0
- package/Select.d.ts +7 -4
- package/System/Client.d.ts +1 -1
- package/System/Common.d.ts +2 -2
- package/cjs/DraggableList.js +30 -3
- package/cjs/Field.js +71 -65
- package/cjs/Input.js +2 -2
- package/cjs/Layout/Template.js +1 -1
- package/cjs/Link/CsrLink.js +15 -5
- package/cjs/Link/NextLink.js +8 -5
- package/cjs/Model/SureToRemove.js +73 -67
- package/cjs/Select.js +6 -4
- package/cjs/System/Client.js +5 -2
- package/cjs/System/Common.js +4 -4
- package/esm/DraggableList.js +31 -4
- package/esm/Field.js +71 -65
- package/esm/Input.js +2 -2
- package/esm/Layout/Template.js +1 -1
- package/esm/Link/CsrLink.js +15 -5
- package/esm/Link/NextLink.js +8 -5
- package/esm/Model/SureToRemove.js +73 -67
- package/esm/Select.js +6 -4
- package/esm/System/Client.js +5 -2
- package/esm/System/Common.js +4 -4
- package/package.json +1 -1
package/DraggableList.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ interface DragListProps<V> {
|
|
|
8
8
|
newIdx: number;
|
|
9
9
|
idxChanged: boolean;
|
|
10
10
|
}) => void;
|
|
11
|
+
onRemove: (value: V, idx: number) => void;
|
|
11
12
|
}
|
|
12
13
|
interface Cursor {
|
|
13
14
|
className?: string;
|
|
@@ -18,8 +19,8 @@ interface ItemProps {
|
|
|
18
19
|
children: ReactNode;
|
|
19
20
|
}
|
|
20
21
|
export declare const DraggableList: {
|
|
21
|
-
<V>({ className, mode, children, onChange }: DragListProps<V>): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
<V>({ className, mode, children, onChange, onRemove }: DragListProps<V>): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
Cursor({ className, children }: Cursor): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
Item: ({ value, children }: ItemProps) =>
|
|
24
|
+
Item: ({ value, children }: ItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
};
|
|
25
26
|
export {};
|
package/Input.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export type InputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "
|
|
|
10
10
|
inputClassName?: string;
|
|
11
11
|
inputWrapperClassName?: string;
|
|
12
12
|
onPressEnter?: (value: any, event: KeyboardEvent<HTMLInputElement>) => void;
|
|
13
|
-
validate
|
|
13
|
+
validate?: (value: string) => boolean | string;
|
|
14
14
|
onChange?: (value: string, e?: ChangeEvent<HTMLInputElement>) => void;
|
|
15
15
|
onPressEscape?: (e: KeyboardEvent<HTMLInputElement>) => void;
|
|
16
16
|
};
|
package/Link/CsrLink.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { CsrLinkProps } from "./types";
|
|
2
|
-
export default function CsrLink({ className, children, href, replace, activeClassName, ...props }: CsrLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export default function CsrLink({ className, children, href, replace, activeClassName, scrollToTop, ...props }: CsrLinkProps): import("react/jsx-runtime").JSX.Element;
|
package/Link/types.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface CsrLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
replace?: boolean;
|
|
14
14
|
activeClassName?: string;
|
|
15
|
+
scrollToTop?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export interface NextLinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps | "href">, LinkProps {
|
|
17
18
|
href: string;
|
package/Select.d.ts
CHANGED
|
@@ -4,15 +4,18 @@ type Options<T> = T[] | {
|
|
|
4
4
|
label: string | boolean | number;
|
|
5
5
|
value: T;
|
|
6
6
|
}[] | Enum<T>;
|
|
7
|
-
interface SelectProps<T, Multiple extends boolean = false> {
|
|
7
|
+
interface SelectProps<T, Multiple extends boolean = false, Searchable extends boolean = false> {
|
|
8
8
|
label?: string;
|
|
9
9
|
desc?: string;
|
|
10
10
|
labelClassName?: string;
|
|
11
11
|
className?: string;
|
|
12
12
|
value: Multiple extends true ? T[] : T | null;
|
|
13
|
-
options: Options<T
|
|
13
|
+
options: Searchable extends true ? T extends string ? Options<T> : {
|
|
14
|
+
label: string | boolean | number;
|
|
15
|
+
value: T;
|
|
16
|
+
}[] : Options<T>;
|
|
14
17
|
multiple?: Multiple;
|
|
15
|
-
searchable?:
|
|
18
|
+
searchable?: Searchable;
|
|
16
19
|
placeholder?: string;
|
|
17
20
|
selectClassName?: string;
|
|
18
21
|
selectorClassName?: string;
|
|
@@ -25,5 +28,5 @@ interface SelectProps<T, Multiple extends boolean = false> {
|
|
|
25
28
|
renderOption?: (value: T) => ReactNode;
|
|
26
29
|
renderSelected?: (value: T) => ReactNode;
|
|
27
30
|
}
|
|
28
|
-
export declare const Select: <T, Multiple extends boolean = false>({ label, desc, labelClassName, className, value, options, nullable, disabled, multiple, searchable, placeholder, selectClassName, selectorClassName, selectedClassName, onOpen, onChange, onSearch, renderOption, renderSelected, }: SelectProps<T, Multiple>) => import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare const Select: <T, Multiple extends boolean = false, Searchable extends boolean = false>({ label, desc, labelClassName, className, value, options, nullable, disabled, multiple, searchable, placeholder, selectClassName, selectorClassName, selectedClassName, onOpen, onChange, onSearch, renderOption, renderSelected, }: SelectProps<T, Multiple, Searchable>) => import("react/jsx-runtime").JSX.Element;
|
|
29
32
|
export {};
|
package/System/Client.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ interface ClientPathWrapperProps extends Omit<HTMLAttributes<HTMLDivElement>, "s
|
|
|
24
24
|
children?: any;
|
|
25
25
|
layoutStyle?: "web" | "mobile";
|
|
26
26
|
}
|
|
27
|
-
export declare const ClientPathWrapper: ({ bind, wrapperRef, pageType, location, prefix, children, layoutStyle, ...props }: ClientPathWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const ClientPathWrapper: ({ className, bind, wrapperRef, pageType, location, prefix, children, layoutStyle, ...props }: ClientPathWrapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
28
|
interface ClientBridgeProps {
|
|
29
29
|
env: BaseClientEnv;
|
|
30
30
|
lang?: string;
|
package/System/Common.d.ts
CHANGED
package/cjs/DraggableList.js
CHANGED
|
@@ -38,9 +38,11 @@ var import_react = require("@use-gesture/react");
|
|
|
38
38
|
var import_lodash = __toESM(require("lodash.clamp"));
|
|
39
39
|
var import_lodash_move = __toESM(require("lodash-move"));
|
|
40
40
|
var import_react2 = require("react");
|
|
41
|
+
var import_bi = require("react-icons/bi");
|
|
42
|
+
var import_md = require("react-icons/md");
|
|
41
43
|
const dragListContext = (0, import_react2.createContext)({});
|
|
42
44
|
const useDragList = () => (0, import_react2.useContext)(dragListContext);
|
|
43
|
-
const DragList = ({ className, mode = "vertical", children, onChange }) => {
|
|
45
|
+
const DragList = ({ className, mode = "vertical", children, onChange, onRemove }) => {
|
|
44
46
|
const refs = (0, import_react2.useRef)([]);
|
|
45
47
|
const order = (0, import_react2.useRef)(children.map((_, index) => index));
|
|
46
48
|
const clientLengths = (0, import_react2.useRef)(children.map((_, index) => 0));
|
|
@@ -103,7 +105,18 @@ const DragList = ({ className, mode = "vertical", children, onChange }) => {
|
|
|
103
105
|
...mode === "vertical" ? { y: movement } : { x: movement }
|
|
104
106
|
// cursor: "grab",
|
|
105
107
|
},
|
|
106
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
109
|
+
dragListContext.Provider,
|
|
110
|
+
{
|
|
111
|
+
value: {
|
|
112
|
+
bind: () => bind(i),
|
|
113
|
+
onRemove: () => {
|
|
114
|
+
onRemove(children[i].props.value, i);
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
children: children[i]
|
|
118
|
+
}
|
|
119
|
+
)
|
|
107
120
|
},
|
|
108
121
|
i
|
|
109
122
|
)) });
|
|
@@ -120,7 +133,21 @@ DragList.Cursor = ({ className, children }) => {
|
|
|
120
133
|
);
|
|
121
134
|
};
|
|
122
135
|
const Item = ({ value, children }) => {
|
|
123
|
-
|
|
136
|
+
const { onRemove } = useDragList();
|
|
137
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DraggableList.Cursor, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_md.MdDragIndicator, { className: "text-xl" }) }),
|
|
139
|
+
children,
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
141
|
+
"button",
|
|
142
|
+
{
|
|
143
|
+
className: "btn btn-xs btn-error btn-square btn-outline",
|
|
144
|
+
onClick: () => {
|
|
145
|
+
onRemove(value);
|
|
146
|
+
},
|
|
147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_bi.BiTrash, {})
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] }) });
|
|
124
151
|
};
|
|
125
152
|
DragList.Item = Item;
|
|
126
153
|
const fn = (order, heights, newHeights, active = false, originalIndex = 0, movement = 0, finished = false) => (index) => {
|
package/cjs/Field.js
CHANGED
|
@@ -401,45 +401,55 @@ const TextList = ({
|
|
|
401
401
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_client.clsx)("flex flex-col", className), children: [
|
|
402
402
|
label ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Label, { className: labelClassName, nullable: !minlength, label, desc }) : null,
|
|
403
403
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-5 h-full gap-2 rounded-md border border-gray-300 p-2", children: [
|
|
404
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
404
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
405
|
+
import_DraggableList.DraggableList,
|
|
406
|
+
{
|
|
407
|
+
className: "h-full gap-2",
|
|
408
|
+
onChange,
|
|
409
|
+
onRemove: (_, idx) => {
|
|
410
|
+
onChange(value.filter((_2, i) => i !== idx));
|
|
411
|
+
},
|
|
412
|
+
children: value.map((text, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DraggableList.DraggableList.Item, { value: text, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full items-center", children: [
|
|
413
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DraggableList.DraggableList.Cursor, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_md.MdDragIndicator, { className: "text-xl" }) }),
|
|
414
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full items-center justify-center gap-5", children: [
|
|
415
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
416
|
+
import_Input.Input,
|
|
417
|
+
{
|
|
418
|
+
value: text,
|
|
419
|
+
cacheKey: cache ? `${label}-${desc}-textList-[${idx}]` : void 0,
|
|
420
|
+
onChange: (text2) => {
|
|
421
|
+
const newValue = [...value];
|
|
422
|
+
newValue[idx] = transform(text2);
|
|
423
|
+
onChange(newValue);
|
|
424
|
+
},
|
|
425
|
+
validate: (text2) => {
|
|
426
|
+
if (text2.length < minlength)
|
|
427
|
+
return l("shared.textTooShortError", { minlength: minTextlength });
|
|
428
|
+
else if (text2.length > maxlength)
|
|
429
|
+
return l("shared.textTooLongError", { maxlength: maxTextlength });
|
|
430
|
+
else
|
|
431
|
+
return validate?.(text2) ?? true;
|
|
432
|
+
},
|
|
433
|
+
className: (0, import_client.clsx)("w-full", inputClassName),
|
|
434
|
+
inputClassName: "w-full input-sm",
|
|
435
|
+
placeholder,
|
|
436
|
+
disabled
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
440
|
+
"button",
|
|
441
|
+
{
|
|
442
|
+
className: "btn btn-xs btn-error btn-square btn-outline",
|
|
443
|
+
onClick: () => {
|
|
444
|
+
onChange(value.filter((_, i) => i !== idx));
|
|
445
|
+
},
|
|
446
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_bi.BiTrash, {})
|
|
447
|
+
}
|
|
448
|
+
)
|
|
449
|
+
] })
|
|
450
|
+
] }) }, idx))
|
|
451
|
+
}
|
|
452
|
+
),
|
|
443
453
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bg-base-content/20 my-5 h-[0.5px]" }),
|
|
444
454
|
value.length <= maxTextlength ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
445
455
|
"button",
|
|
@@ -982,7 +992,10 @@ const Parent = ({
|
|
|
982
992
|
selectClassName,
|
|
983
993
|
value: value?.id,
|
|
984
994
|
searchable: true,
|
|
985
|
-
options: modelList.map((model) =>
|
|
995
|
+
options: modelList.map((model) => {
|
|
996
|
+
const render = renderOption(model);
|
|
997
|
+
return { label: typeof render === "string" ? render : model.id, value: model.id };
|
|
998
|
+
}),
|
|
986
999
|
renderOption: (modelId) => {
|
|
987
1000
|
const model = modelList.get(modelId);
|
|
988
1001
|
if (!model)
|
|
@@ -1002,11 +1015,7 @@ const Parent = ({
|
|
|
1002
1015
|
if (!disabled)
|
|
1003
1016
|
void storeDo[namesOfSlice.initModel](...initArgs ?? []);
|
|
1004
1017
|
},
|
|
1005
|
-
onSearch
|
|
1006
|
-
if (text) {
|
|
1007
|
-
onSearch?.(text);
|
|
1008
|
-
}
|
|
1009
|
-
}
|
|
1018
|
+
onSearch
|
|
1010
1019
|
}
|
|
1011
1020
|
)
|
|
1012
1021
|
] });
|
|
@@ -1058,18 +1067,21 @@ const ParentId = ({
|
|
|
1058
1067
|
labelClassName,
|
|
1059
1068
|
selectClassName,
|
|
1060
1069
|
value,
|
|
1061
|
-
options: modelList.map((model) =>
|
|
1070
|
+
options: modelList.map((model) => {
|
|
1071
|
+
const label2 = renderOption?.(model) ?? model.id;
|
|
1072
|
+
return { label: typeof label2 === "string" ? label2 : model.id, value: model.id };
|
|
1073
|
+
}),
|
|
1062
1074
|
renderOption: (renderId) => {
|
|
1063
1075
|
const model = modelList.get(renderId);
|
|
1064
1076
|
if (!model)
|
|
1065
1077
|
return null;
|
|
1066
|
-
return renderOption?.(model);
|
|
1078
|
+
return renderOption?.(model) ?? null;
|
|
1067
1079
|
},
|
|
1068
1080
|
renderSelected: (renderId) => {
|
|
1069
1081
|
const model = modelList.get(renderId);
|
|
1070
1082
|
if (!model)
|
|
1071
1083
|
return null;
|
|
1072
|
-
return renderSelected?.(model);
|
|
1084
|
+
return renderSelected?.(model) ?? null;
|
|
1073
1085
|
},
|
|
1074
1086
|
onOpen: () => {
|
|
1075
1087
|
if (!disabled)
|
|
@@ -1078,11 +1090,7 @@ const ParentId = ({
|
|
|
1078
1090
|
onChange: (modelId) => {
|
|
1079
1091
|
onChange(modelId, modelList.get(modelId));
|
|
1080
1092
|
},
|
|
1081
|
-
onSearch
|
|
1082
|
-
if (text) {
|
|
1083
|
-
onSearch?.(text);
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1093
|
+
onSearch
|
|
1086
1094
|
}
|
|
1087
1095
|
)
|
|
1088
1096
|
] });
|
|
@@ -1139,7 +1147,10 @@ const Children = ({
|
|
|
1139
1147
|
selectClassName,
|
|
1140
1148
|
multiple: true,
|
|
1141
1149
|
value: value.map((model) => model.id),
|
|
1142
|
-
options: modelList.map((model) =>
|
|
1150
|
+
options: modelList.map((model) => {
|
|
1151
|
+
const label2 = renderOption(model);
|
|
1152
|
+
return { label: typeof label2 === "string" ? label2 : model.id, value: model.id };
|
|
1153
|
+
}),
|
|
1143
1154
|
renderOption: (modelId) => {
|
|
1144
1155
|
const model = modelList.get(modelId);
|
|
1145
1156
|
if (!model)
|
|
@@ -1155,11 +1166,7 @@ const Children = ({
|
|
|
1155
1166
|
onChange: (modelIds) => {
|
|
1156
1167
|
onChange(modelIds.map((id) => modelList.get(id)).filter((model) => model !== void 0));
|
|
1157
1168
|
},
|
|
1158
|
-
onSearch
|
|
1159
|
-
if (text) {
|
|
1160
|
-
onSearch?.(text);
|
|
1161
|
-
}
|
|
1162
|
-
}
|
|
1169
|
+
onSearch
|
|
1163
1170
|
}
|
|
1164
1171
|
)
|
|
1165
1172
|
] });
|
|
@@ -1209,7 +1216,10 @@ const ChildrenId = ({
|
|
|
1209
1216
|
labelClassName,
|
|
1210
1217
|
multiple: true,
|
|
1211
1218
|
value,
|
|
1212
|
-
options: modelList.map((model) =>
|
|
1219
|
+
options: modelList.map((model) => {
|
|
1220
|
+
const label2 = renderOption(model);
|
|
1221
|
+
return { label: typeof label2 === "string" ? label2 : model.id, value: model.id };
|
|
1222
|
+
}),
|
|
1213
1223
|
renderOption: (renderId) => {
|
|
1214
1224
|
const model = modelList.get(renderId);
|
|
1215
1225
|
if (!model)
|
|
@@ -1219,11 +1229,7 @@ const ChildrenId = ({
|
|
|
1219
1229
|
onChange: (modelIds) => {
|
|
1220
1230
|
onChange(modelIds);
|
|
1221
1231
|
},
|
|
1222
|
-
onSearch
|
|
1223
|
-
if (text) {
|
|
1224
|
-
onSearch?.(text);
|
|
1225
|
-
}
|
|
1226
|
-
}
|
|
1232
|
+
onSearch
|
|
1227
1233
|
}
|
|
1228
1234
|
)
|
|
1229
1235
|
] });
|
package/cjs/Input.js
CHANGED
|
@@ -46,7 +46,7 @@ const Input = ({
|
|
|
46
46
|
}) => {
|
|
47
47
|
const { l } = (0, import_next.usePage)();
|
|
48
48
|
const [firstFocus, setFirstFocus] = (0, import_react.useState)(true);
|
|
49
|
-
const validateResult = validate(value);
|
|
49
|
+
const validateResult = validate ? validate(value) : void 0;
|
|
50
50
|
const status = !nullable && !value ? null : !value.length ? "warning" : validateResult === true ? "success" : "error";
|
|
51
51
|
const invalidMessage = value && !value.length || validateResult === true || firstFocus ? null : validateResult === false ? l("util.invalidValueError") : validateResult;
|
|
52
52
|
const statusClass = inputStyleType === "bordered" ? status === "error" ? "input-error" : !firstFocus && status === "warning" ? "input-warning" : status === "success" ? "input-success" : "" : "";
|
|
@@ -407,7 +407,7 @@ const Number = ({
|
|
|
407
407
|
(0, import_react.useEffect)(() => {
|
|
408
408
|
setFormatValue(generateFormat());
|
|
409
409
|
}, [value]);
|
|
410
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_client.clsx)("relative isolate
|
|
410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_client.clsx)("relative isolate", className), children: [
|
|
411
411
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_client.clsx)("flex items-center", inputWrapperClassName), children: [
|
|
412
412
|
icon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_client.clsx)("absolute inset-y-0 left-4 z-10 flex items-center justify-center", iconClassName), children: icon }) : null,
|
|
413
413
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
package/cjs/Layout/Template.js
CHANGED
|
@@ -23,5 +23,5 @@ module.exports = __toCommonJS(Template_exports);
|
|
|
23
23
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
24
|
var import_client = require("@akanjs/client");
|
|
25
25
|
const Template = ({ className, children }) => {
|
|
26
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_client.clsx)("flex w-full max-w-[100vw] flex-col gap-6 p-2
|
|
26
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_client.clsx)("flex w-full max-w-[100vw] flex-col gap-6 p-2", className), children });
|
|
27
27
|
};
|
package/cjs/Link/CsrLink.js
CHANGED
|
@@ -26,23 +26,33 @@ var import_client = require("@akanjs/client");
|
|
|
26
26
|
var import_next = require("@akanjs/next");
|
|
27
27
|
var import_store = require("@akanjs/store");
|
|
28
28
|
var import_browser = require("@capacitor/browser");
|
|
29
|
-
function CsrLink({
|
|
29
|
+
function CsrLink({
|
|
30
|
+
className,
|
|
31
|
+
children,
|
|
32
|
+
href,
|
|
33
|
+
replace,
|
|
34
|
+
activeClassName,
|
|
35
|
+
scrollToTop,
|
|
36
|
+
...props
|
|
37
|
+
}) {
|
|
30
38
|
const prefix = import_store.st.use.prefix();
|
|
31
39
|
const currentPath = import_store.st.use.path();
|
|
32
40
|
const { lang } = (0, import_next.usePage)();
|
|
33
|
-
const
|
|
34
|
-
const { path } = (0, import_client.getPathInfo)(href, lang, prefix ?? "");
|
|
41
|
+
const { path, hash } = (0, import_client.getPathInfo)(href, lang, prefix ?? "");
|
|
35
42
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
36
43
|
"a",
|
|
37
44
|
{
|
|
38
45
|
className: (0, import_client.clsx)("cursor-pointer", className, { [activeClassName ?? ""]: currentPath === path }),
|
|
39
46
|
onClick: () => {
|
|
47
|
+
const isExternal = href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("tel:");
|
|
48
|
+
const isHash = href.startsWith("#");
|
|
49
|
+
const url = isHash ? `${window.location.pathname}#${hash}` : href;
|
|
40
50
|
if (isExternal)
|
|
41
51
|
void import_browser.Browser.open({ url: href, presentationStyle: "popover" });
|
|
42
52
|
else if (replace)
|
|
43
|
-
import_client.router.replace(
|
|
53
|
+
import_client.router.replace(url, { scrollToTop });
|
|
44
54
|
else
|
|
45
|
-
import_client.router.push(
|
|
55
|
+
import_client.router.push(url, { scrollToTop });
|
|
46
56
|
},
|
|
47
57
|
children
|
|
48
58
|
}
|
package/cjs/Link/NextLink.js
CHANGED
|
@@ -49,19 +49,22 @@ function NextLink({
|
|
|
49
49
|
}) {
|
|
50
50
|
const prefix = import_store.st.use.prefix();
|
|
51
51
|
const { lang } = (0, import_next.usePage)();
|
|
52
|
-
const isExternal = href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("tel:");
|
|
53
|
-
const { path, pathname } = (0, import_client.getPathInfo)(href, lang, prefix ?? "");
|
|
54
52
|
const currentPath = import_store.st.use.path();
|
|
53
|
+
const isExternal = href.startsWith("http") || href.startsWith("mailto:") || href.startsWith("tel:");
|
|
54
|
+
const { href: requestHref, path } = (0, import_client.getPathInfo)(href, lang, prefix ?? "");
|
|
55
|
+
if (href.startsWith("#")) {
|
|
56
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { className: (0, import_client.clsx)(className, { [activeClassName ?? ""]: currentPath === path }), href, children });
|
|
57
|
+
}
|
|
55
58
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
59
|
import_link.default,
|
|
57
60
|
{
|
|
58
61
|
className: (0, import_client.clsx)(className, { [activeClassName ?? ""]: currentPath === path }),
|
|
59
|
-
href: isExternal ? href :
|
|
62
|
+
href: isExternal ? href : href.startsWith("#") ? href : requestHref,
|
|
60
63
|
passHref: true,
|
|
61
64
|
replace,
|
|
62
65
|
onClick: () => {
|
|
63
|
-
import_common.Logger.log(`pathChange-start:${
|
|
64
|
-
window.parent.postMessage({ type: "pathChange",
|
|
66
|
+
import_common.Logger.log(`pathChange-start:${requestHref}`);
|
|
67
|
+
window.parent.postMessage({ type: "pathChange", href: requestHref }, "*");
|
|
65
68
|
if (scrollToTop)
|
|
66
69
|
window.scrollTo(0, 0);
|
|
67
70
|
},
|
|
@@ -50,76 +50,82 @@ function SureToRemove({
|
|
|
50
50
|
}),
|
|
51
51
|
[]
|
|
52
52
|
);
|
|
53
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
54
|
+
"div",
|
|
55
|
+
{
|
|
56
|
+
className: "inline size-full",
|
|
57
|
+
onClick: (e) => {
|
|
58
|
+
e.stopPropagation();
|
|
59
|
+
setModalOpen(true);
|
|
60
|
+
},
|
|
61
|
+
children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: (0, import_client.clsx)(
|
|
66
|
+
"text-error flex size-full cursor-pointer flex-nowrap items-center justify-center gap-2 whitespace-nowrap",
|
|
67
|
+
className
|
|
68
|
+
),
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ai.AiOutlineDelete, {}),
|
|
71
|
+
" ",
|
|
72
|
+
l("shared.remove")
|
|
73
|
+
]
|
|
74
|
+
}
|
|
60
75
|
),
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
setModalOpen(true);
|
|
64
|
-
},
|
|
65
|
-
children: [
|
|
66
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ai.AiOutlineDelete, {}),
|
|
67
|
-
" ",
|
|
68
|
-
l("shared.remove")
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
73
|
-
import_Modal.Modal,
|
|
74
|
-
{
|
|
75
|
-
open: modalOpen,
|
|
76
|
-
onCancel: () => {
|
|
77
|
-
setModalOpen(false);
|
|
78
|
-
},
|
|
79
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-error text-lg font-bold", children: l("shared.removeModel", { model: l(`${modelName}.modelName`) }) }),
|
|
80
|
-
bodyClassName: "border-error",
|
|
81
|
-
action: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
82
|
-
"button",
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
77
|
+
import_Modal.Modal,
|
|
83
78
|
{
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
onClick: async () => {
|
|
87
|
-
await storeDo[names.removeModel](modelId);
|
|
88
|
-
import_dictionary.msg.success("shared.removeSuccess", { data: { model: l(`${modelName}.modelName`) } });
|
|
79
|
+
open: modalOpen,
|
|
80
|
+
onCancel: () => {
|
|
89
81
|
setModalOpen(false);
|
|
90
|
-
if (!redirect)
|
|
91
|
-
return;
|
|
92
|
-
if (redirect === "back")
|
|
93
|
-
import_client.router.back();
|
|
94
|
-
else
|
|
95
|
-
import_client.router.push(redirect);
|
|
96
82
|
},
|
|
97
|
-
children: l("shared.removeModel", { model: l(`${modelName}.modelName`) })
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
onChange: (e) => {
|
|
117
|
-
setRepeatName(e.target.value);
|
|
83
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-error text-lg font-bold", children: l("shared.removeModel", { model: l(`${modelName}.modelName`) }) }),
|
|
84
|
+
bodyClassName: "border-error",
|
|
85
|
+
action: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
"button",
|
|
87
|
+
{
|
|
88
|
+
className: "btn btn-error w-full",
|
|
89
|
+
disabled: typeNameToRemove && repeatName !== name,
|
|
90
|
+
onClick: async () => {
|
|
91
|
+
await storeDo[names.removeModel](modelId);
|
|
92
|
+
import_dictionary.msg.success("shared.removeSuccess", { data: { model: l(`${modelName}.modelName`) } });
|
|
93
|
+
setModalOpen(false);
|
|
94
|
+
if (!redirect)
|
|
95
|
+
return;
|
|
96
|
+
if (redirect === "back")
|
|
97
|
+
import_client.router.back();
|
|
98
|
+
else
|
|
99
|
+
import_client.router.push(redirect);
|
|
100
|
+
},
|
|
101
|
+
children: l("shared.removeModel", { model: l(`${modelName}.modelName`) })
|
|
118
102
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
103
|
+
),
|
|
104
|
+
children: [
|
|
105
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "py-4", children: [
|
|
106
|
+
l("shared.sureToRemove", { model: l(`${modelName}.modelName`), name }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
108
|
+
l("shared.irreversibleOps"),
|
|
109
|
+
typeNameToRemove ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
110
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
|
|
111
|
+
l("shared.typeNameToRemove", { model: l(`${modelName}.modelName`), name })
|
|
112
|
+
] }) : null
|
|
113
|
+
] }),
|
|
114
|
+
typeNameToRemove ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
115
|
+
"input",
|
|
116
|
+
{
|
|
117
|
+
className: "input w-full text-center",
|
|
118
|
+
placeholder: `${l(`${modelName}.modelName`)} name`,
|
|
119
|
+
value: repeatName,
|
|
120
|
+
onChange: (e) => {
|
|
121
|
+
setRepeatName(e.target.value);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
) : null
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
)
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
);
|
|
125
131
|
}
|
package/cjs/Select.js
CHANGED
|
@@ -90,7 +90,8 @@ const Select = ({
|
|
|
90
90
|
};
|
|
91
91
|
const debouncedOnSearch = (0, import_next.useDebounce)(
|
|
92
92
|
(text) => {
|
|
93
|
-
|
|
93
|
+
if (text)
|
|
94
|
+
onSearch?.(text);
|
|
94
95
|
},
|
|
95
96
|
[searchText],
|
|
96
97
|
300
|
|
@@ -166,7 +167,7 @@ const Select = ({
|
|
|
166
167
|
return null;
|
|
167
168
|
return renderSelected ? renderSelected(optionValue.value) : optionValue.label;
|
|
168
169
|
})() }) : "" }),
|
|
169
|
-
searchable
|
|
170
|
+
searchable ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
170
171
|
"input",
|
|
171
172
|
{
|
|
172
173
|
type: "text",
|
|
@@ -176,12 +177,13 @@ const Select = ({
|
|
|
176
177
|
onChange: (e) => {
|
|
177
178
|
if (!isOpen)
|
|
178
179
|
setIsOpen(true);
|
|
179
|
-
if (!onSearch)
|
|
180
|
+
if (!onSearch) {
|
|
180
181
|
setSearchOptions(
|
|
181
182
|
labeledOptions.filter(
|
|
182
183
|
(option) => option.label.toString().toLowerCase().includes(e.target.value.toLowerCase())
|
|
183
184
|
)
|
|
184
185
|
);
|
|
186
|
+
}
|
|
185
187
|
setSearchText(e.target.value);
|
|
186
188
|
debouncedOnSearch(e.target.value);
|
|
187
189
|
},
|
|
@@ -191,7 +193,7 @@ const Select = ({
|
|
|
191
193
|
setIsOpen(!isOpen);
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
|
-
)
|
|
196
|
+
) : null
|
|
195
197
|
] }),
|
|
196
198
|
multiple && selectedValues.length || !multiple && selectedValues[0] !== void 0 && selectedValues[0] !== null ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
197
199
|
import_ti.TiDelete,
|