@akanjs/ui 0.9.50 → 0.9.52
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/cjs/Data/ListContainer.js +26 -7
- package/esm/Data/ListContainer.js +27 -8
- package/package.json +1 -1
|
@@ -34,9 +34,9 @@ module.exports = __toCommonJS(ListContainer_exports);
|
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var import_client = require("@akanjs/client");
|
|
36
36
|
var import_common = require("@akanjs/common");
|
|
37
|
-
var import_constant = require("@akanjs/constant");
|
|
38
37
|
var import_store = require("@akanjs/store");
|
|
39
38
|
var import_file_saver = require("file-saver");
|
|
39
|
+
var import_react = require("react");
|
|
40
40
|
var import_ai = require("react-icons/ai");
|
|
41
41
|
var import_Dropdown = require("../Dropdown");
|
|
42
42
|
var import_Loading = require("../Loading");
|
|
@@ -84,7 +84,8 @@ function ListContainer({
|
|
|
84
84
|
newModel: `new${modelClassName}`,
|
|
85
85
|
refreshModel: `refresh${modelClassName}`,
|
|
86
86
|
setSortOfModel: `setSortOf${modelClassName}`,
|
|
87
|
-
setLimitOfModel: `setLimitOf${modelClassName}
|
|
87
|
+
setLimitOfModel: `setLimitOf${modelClassName}`,
|
|
88
|
+
modelSortKeys: `${modelName}SortKeys`
|
|
88
89
|
};
|
|
89
90
|
const namesOfSlice = {
|
|
90
91
|
modelList: sliceName.replace(names.model, names.modelList),
|
|
@@ -98,9 +99,12 @@ function ListContainer({
|
|
|
98
99
|
setSortOfModel: sliceName.replace(names.model, names.setSortOfModel),
|
|
99
100
|
setLimitOfModel: sliceName.replace(names.model, names.setLimitOfModel)
|
|
100
101
|
};
|
|
101
|
-
const cnstInfo = import_constant.constantInfo.getDatabase(sliceName);
|
|
102
102
|
const limitOfModel = storeUse[namesOfSlice.limitOfModel]();
|
|
103
103
|
const sortOfModel = storeUse[namesOfSlice.sortOfModel]();
|
|
104
|
+
const modelInsight = storeUse[namesOfSlice.modelInsight]();
|
|
105
|
+
(0, import_react.useEffect)(() => {
|
|
106
|
+
void storeDo[namesOfSlice.initModel]();
|
|
107
|
+
}, []);
|
|
104
108
|
const RenderTitle = renderTitle ?? ((model) => `${l(`${refName}.modelName`)} - ${model.id ? model.id : "New"}`);
|
|
105
109
|
const ModelDashboard = () => {
|
|
106
110
|
const summary = storeUse.summary();
|
|
@@ -112,8 +116,8 @@ function ListContainer({
|
|
|
112
116
|
};
|
|
113
117
|
const RenderQueryMaker = renderQueryMaker;
|
|
114
118
|
const RenderInsight = () => {
|
|
115
|
-
const
|
|
116
|
-
return renderInsight ? renderInsight({ insight:
|
|
119
|
+
const modelInsight2 = storeUse[namesOfSlice.modelInsight]();
|
|
120
|
+
return renderInsight ? renderInsight({ insight: modelInsight2 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
117
121
|
};
|
|
118
122
|
const RenderTemplate = renderTemplate;
|
|
119
123
|
const RenderTools = () => {
|
|
@@ -187,12 +191,27 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
187
191
|
);
|
|
188
192
|
};
|
|
189
193
|
const RenderSort = () => {
|
|
190
|
-
return
|
|
194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
+
import_Select.Select,
|
|
196
|
+
{
|
|
197
|
+
value: sortOfModel,
|
|
198
|
+
options: import_client.fetch[names.modelSortKeys]?.map((sortKey) => ({
|
|
199
|
+
label: l.field(refName, sortKey),
|
|
200
|
+
value: sortKey
|
|
201
|
+
})) ?? [],
|
|
202
|
+
onChange: (sortKey) => void storeDo[namesOfSlice.setSortOfModel](sortKey)
|
|
203
|
+
}
|
|
204
|
+
);
|
|
191
205
|
};
|
|
192
206
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_client.clsx)("m-4", className), children: [
|
|
193
207
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mb-3 flex flex-wrap justify-between", children: [
|
|
194
208
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex pb-1", children: [
|
|
195
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "prose text-lg", children: [
|
|
210
|
+
title ?? l.field(sliceName, "modelName"),
|
|
211
|
+
"(",
|
|
212
|
+
modelInsight.count,
|
|
213
|
+
")"
|
|
214
|
+
] }),
|
|
196
215
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "ml-3 flex items-center", children: [
|
|
197
216
|
renderTemplate && create ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
198
217
|
"button",
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { clsx, usePage } from "@akanjs/client";
|
|
3
|
+
import { clsx, fetch, usePage } from "@akanjs/client";
|
|
4
4
|
import { capitalize, deepObjectify } from "@akanjs/common";
|
|
5
|
-
import { constantInfo } from "@akanjs/constant";
|
|
6
5
|
import { st } from "@akanjs/store";
|
|
7
6
|
import { saveAs } from "file-saver";
|
|
7
|
+
import { useEffect } from "react";
|
|
8
8
|
import {
|
|
9
9
|
AiOutlineEllipsis,
|
|
10
10
|
AiOutlineFileExcel,
|
|
@@ -58,7 +58,8 @@ function ListContainer({
|
|
|
58
58
|
newModel: `new${modelClassName}`,
|
|
59
59
|
refreshModel: `refresh${modelClassName}`,
|
|
60
60
|
setSortOfModel: `setSortOf${modelClassName}`,
|
|
61
|
-
setLimitOfModel: `setLimitOf${modelClassName}
|
|
61
|
+
setLimitOfModel: `setLimitOf${modelClassName}`,
|
|
62
|
+
modelSortKeys: `${modelName}SortKeys`
|
|
62
63
|
};
|
|
63
64
|
const namesOfSlice = {
|
|
64
65
|
modelList: sliceName.replace(names.model, names.modelList),
|
|
@@ -72,9 +73,12 @@ function ListContainer({
|
|
|
72
73
|
setSortOfModel: sliceName.replace(names.model, names.setSortOfModel),
|
|
73
74
|
setLimitOfModel: sliceName.replace(names.model, names.setLimitOfModel)
|
|
74
75
|
};
|
|
75
|
-
const cnstInfo = constantInfo.getDatabase(sliceName);
|
|
76
76
|
const limitOfModel = storeUse[namesOfSlice.limitOfModel]();
|
|
77
77
|
const sortOfModel = storeUse[namesOfSlice.sortOfModel]();
|
|
78
|
+
const modelInsight = storeUse[namesOfSlice.modelInsight]();
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
void storeDo[namesOfSlice.initModel]();
|
|
81
|
+
}, []);
|
|
78
82
|
const RenderTitle = renderTitle ?? ((model) => `${l(`${refName}.modelName`)} - ${model.id ? model.id : "New"}`);
|
|
79
83
|
const ModelDashboard = () => {
|
|
80
84
|
const summary = storeUse.summary();
|
|
@@ -86,8 +90,8 @@ function ListContainer({
|
|
|
86
90
|
};
|
|
87
91
|
const RenderQueryMaker = renderQueryMaker;
|
|
88
92
|
const RenderInsight = () => {
|
|
89
|
-
const
|
|
90
|
-
return renderInsight ? renderInsight({ insight:
|
|
93
|
+
const modelInsight2 = storeUse[namesOfSlice.modelInsight]();
|
|
94
|
+
return renderInsight ? renderInsight({ insight: modelInsight2 }) : /* @__PURE__ */ jsx(Fragment, {});
|
|
91
95
|
};
|
|
92
96
|
const RenderTemplate = renderTemplate;
|
|
93
97
|
const RenderTools = () => {
|
|
@@ -161,12 +165,27 @@ ${body}`], { type: "text/csv;charset=utf-8" });
|
|
|
161
165
|
);
|
|
162
166
|
};
|
|
163
167
|
const RenderSort = () => {
|
|
164
|
-
return
|
|
168
|
+
return /* @__PURE__ */ jsx(
|
|
169
|
+
Select,
|
|
170
|
+
{
|
|
171
|
+
value: sortOfModel,
|
|
172
|
+
options: fetch[names.modelSortKeys]?.map((sortKey) => ({
|
|
173
|
+
label: l.field(refName, sortKey),
|
|
174
|
+
value: sortKey
|
|
175
|
+
})) ?? [],
|
|
176
|
+
onChange: (sortKey) => void storeDo[namesOfSlice.setSortOfModel](sortKey)
|
|
177
|
+
}
|
|
178
|
+
);
|
|
165
179
|
};
|
|
166
180
|
return /* @__PURE__ */ jsxs("div", { className: clsx("m-4", className), children: [
|
|
167
181
|
/* @__PURE__ */ jsxs("div", { className: "mb-3 flex flex-wrap justify-between", children: [
|
|
168
182
|
/* @__PURE__ */ jsxs("div", { className: "flex pb-1", children: [
|
|
169
|
-
/* @__PURE__ */
|
|
183
|
+
/* @__PURE__ */ jsxs("p", { className: "prose text-lg", children: [
|
|
184
|
+
title ?? l.field(sliceName, "modelName"),
|
|
185
|
+
"(",
|
|
186
|
+
modelInsight.count,
|
|
187
|
+
")"
|
|
188
|
+
] }),
|
|
170
189
|
/* @__PURE__ */ jsxs("div", { className: "ml-3 flex items-center", children: [
|
|
171
190
|
renderTemplate && create ? /* @__PURE__ */ jsxs(
|
|
172
191
|
"button",
|