@akanjs/ui 0.9.47 → 0.9.49
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/Data/CardList.d.ts +1 -1
- package/Data/ListContainer.d.ts +4 -5
- package/Data/QueryMaker.d.ts +1 -1
- package/Data/TableList.d.ts +1 -1
- package/Data/index.d.ts +0 -1
- package/Field.d.ts +1 -1
- package/Layout/Navbar.d.ts +1 -1
- package/Model/AdminPanel.d.ts +2 -3
- package/System/CSR.d.ts +2 -2
- package/System/Client.d.ts +5 -2
- package/System/Common.d.ts +11 -10
- package/System/SSR.d.ts +2 -2
- package/cjs/Button.js +3 -4
- package/cjs/Data/Dashboard.js +1 -2
- package/cjs/Data/Insight.js +1 -2
- package/cjs/Data/Item.js +3 -4
- package/cjs/Data/ListContainer.js +5 -19
- package/cjs/Data/QueryMaker.js +1 -292
- package/cjs/Data/TableList.js +3 -3
- package/cjs/Data/index.js +2 -2
- package/cjs/DatePicker.js +4 -5
- package/cjs/Dialog/Modal.js +2 -3
- package/cjs/Empty.js +2 -3
- package/cjs/Field.js +42 -46
- package/cjs/Input.js +11 -12
- package/cjs/Layout/BottomTab.js +1 -2
- package/cjs/Link/CsrLink.js +1 -2
- package/cjs/Link/NextLink.js +1 -2
- package/cjs/Load/Page.js +1 -2
- package/cjs/Load/Units.js +4 -3
- package/cjs/Load/View.js +3 -2
- package/cjs/Model/Edit.js +2 -3
- package/cjs/Model/EditModal.js +5 -4
- package/cjs/Model/New.js +2 -3
- package/cjs/Model/NewWrapper_Client.js +3 -2
- package/cjs/Model/Remove.js +6 -8
- package/cjs/Model/RemoveWrapper.js +3 -4
- package/cjs/Model/SureToRemove.js +8 -10
- package/cjs/Model/ViewEditModal.js +4 -4
- package/cjs/Popconfirm.js +3 -4
- package/cjs/RecentTime.js +1 -2
- package/cjs/Select.js +2 -2
- package/cjs/Signal/Arg.js +2 -2
- package/cjs/Signal/Doc.js +2 -2
- package/cjs/Signal/GraphQL.js +4 -4
- package/cjs/Signal/Message.js +2 -4
- package/cjs/Signal/Object.js +12 -17
- package/cjs/Signal/PubSub.js +2 -4
- package/cjs/Signal/RestApi.js +2 -2
- package/cjs/System/CSR.js +4 -7
- package/cjs/System/Client.js +26 -9
- package/cjs/System/Common.js +2 -2
- package/cjs/System/Messages.js +2 -4
- package/cjs/System/Reconnect.js +16 -21
- package/cjs/System/Root.js +0 -4
- package/cjs/System/SSR.js +31 -24
- package/cjs/System/SelectLanguage.js +1 -2
- package/cjs/ToggleSelect.js +4 -5
- package/cjs/Unauthorized.js +2 -3
- package/esm/Button.js +3 -4
- package/esm/Data/Dashboard.js +1 -2
- package/esm/Data/Insight.js +1 -2
- package/esm/Data/Item.js +2 -3
- package/esm/Data/ListContainer.js +6 -20
- package/esm/Data/QueryMaker.js +1 -299
- package/esm/Data/TableList.js +2 -2
- package/esm/Data/index.js +3 -3
- package/esm/DatePicker.js +5 -6
- package/esm/Dialog/Modal.js +2 -3
- package/esm/Empty.js +2 -3
- package/esm/Field.js +30 -34
- package/esm/Input.js +7 -8
- package/esm/Layout/BottomTab.js +1 -2
- package/esm/Link/CsrLink.js +1 -2
- package/esm/Link/NextLink.js +1 -2
- package/esm/Load/Page.js +1 -2
- package/esm/Load/Units.js +4 -3
- package/esm/Load/View.js +3 -2
- package/esm/Model/Edit.js +2 -3
- package/esm/Model/EditModal.js +8 -7
- package/esm/Model/New.js +2 -3
- package/esm/Model/NewWrapper_Client.js +3 -2
- package/esm/Model/Remove.js +6 -8
- package/esm/Model/RemoveWrapper.js +3 -4
- package/esm/Model/SureToRemove.js +8 -10
- package/esm/Model/ViewEditModal.js +3 -3
- package/esm/Popconfirm.js +3 -4
- package/esm/RecentTime.js +1 -2
- package/esm/Select.js +3 -3
- package/esm/Signal/Arg.js +1 -1
- package/esm/Signal/Doc.js +1 -1
- package/esm/Signal/GraphQL.js +4 -4
- package/esm/Signal/Message.js +1 -3
- package/esm/Signal/Object.js +13 -18
- package/esm/Signal/PubSub.js +1 -3
- package/esm/Signal/RestApi.js +1 -1
- package/esm/System/CSR.js +4 -7
- package/esm/System/Client.js +30 -14
- package/esm/System/Common.js +2 -2
- package/esm/System/Messages.js +1 -3
- package/esm/System/Reconnect.js +15 -10
- package/esm/System/Root.js +0 -4
- package/esm/System/SSR.js +31 -24
- package/esm/System/SelectLanguage.js +1 -2
- package/esm/ToggleSelect.js +3 -4
- package/esm/Unauthorized.js +2 -3
- package/package.json +1 -1
package/cjs/Data/QueryMaker.js
CHANGED
|
@@ -21,299 +21,8 @@ __export(QueryMaker_exports, {
|
|
|
21
21
|
default: () => QueryMaker
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(QueryMaker_exports);
|
|
24
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
|
-
var import_base = require("@akanjs/base");
|
|
26
|
-
var import_client = require("@akanjs/client");
|
|
27
|
-
var import_common = require("@akanjs/common");
|
|
28
|
-
var import_constant = require("@akanjs/constant");
|
|
29
|
-
var import_next = require("@akanjs/next");
|
|
30
|
-
var import_store = require("@akanjs/store");
|
|
31
|
-
var import_react = require("react");
|
|
32
|
-
var import_bi = require("react-icons/bi");
|
|
33
|
-
var import_DatePicker = require("../DatePicker");
|
|
34
|
-
var import_Input = require("../Input");
|
|
35
|
-
var import_Modal = require("../Modal");
|
|
36
|
-
var import_Select = require("../Select");
|
|
37
24
|
const searchQuerySetting = { queryKey: "search", arg: { $search: void 0 } };
|
|
38
25
|
const byStatusQuerySetting = { queryKey: "byStatuses", arg: { statuses: null } };
|
|
39
26
|
function QueryMaker({ className, sliceName, query }) {
|
|
40
|
-
|
|
41
|
-
const storeDo = import_store.st.do;
|
|
42
|
-
const cnst = (0, import_constant.getCnstMeta)(sliceName);
|
|
43
|
-
const isModelSearchable = (0, import_constant.hasTextField)(cnst.Full);
|
|
44
|
-
const { subMenu, filter } = import_store.st.use.searchParams();
|
|
45
|
-
const filterRef = cnst.Filter;
|
|
46
|
-
const filterQueryMap = (0, import_constant.getFilterQueryMap)(filterRef);
|
|
47
|
-
const defaultQuerySetting = { ...isModelSearchable ? searchQuerySetting : byStatusQuerySetting, ...query ?? {} };
|
|
48
|
-
const isInitialized = (0, import_react.useRef)(false);
|
|
49
|
-
const [querySetting, setQuerySetting] = (0, import_react.useState)(defaultQuerySetting);
|
|
50
|
-
const getQuery = (0, import_react.useCallback)(
|
|
51
|
-
(querySetting2) => {
|
|
52
|
-
if (querySetting2.queryKey === "search") {
|
|
53
|
-
const query2 = querySetting2.arg;
|
|
54
|
-
return query2;
|
|
55
|
-
} else {
|
|
56
|
-
const queryFn = (0, import_constant.getFilterQuery)(filterRef, querySetting2.queryKey);
|
|
57
|
-
const filterQueryArgMetas = (0, import_constant.getFilterArgMetas)(filterRef, querySetting2.queryKey);
|
|
58
|
-
const queryArgs = filterQueryArgMetas.map((queryArgMeta) => querySetting2.arg[queryArgMeta.name]);
|
|
59
|
-
const query2 = queryFn(...queryArgs);
|
|
60
|
-
return query2;
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
[filter]
|
|
64
|
-
);
|
|
65
|
-
const setQueryOfModel = (0, import_next.useDebounce)((querySetting2) => {
|
|
66
|
-
const query2 = getQuery(querySetting2);
|
|
67
|
-
if (!isInitialized.current) {
|
|
68
|
-
void storeDo[`init${(0, import_common.capitalize)(sliceName)}`](query2);
|
|
69
|
-
isInitialized.current = true;
|
|
70
|
-
} else
|
|
71
|
-
void storeDo[`setQueryArgsOf${(0, import_common.capitalize)(sliceName)}`](query2);
|
|
72
|
-
});
|
|
73
|
-
(0, import_react.useEffect)(() => {
|
|
74
|
-
if (filter && subMenu === sliceName)
|
|
75
|
-
setQuerySetting({ queryKey: filter, arg: {} });
|
|
76
|
-
}, [filter, subMenu]);
|
|
77
|
-
(0, import_react.useEffect)(() => {
|
|
78
|
-
setQueryOfModel(querySetting);
|
|
79
|
-
}, [querySetting]);
|
|
80
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_client.clsx)("flex w-full items-center gap-4", className), children: [
|
|
81
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
82
|
-
"Query",
|
|
83
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
-
import_Select.Select,
|
|
85
|
-
{
|
|
86
|
-
value: querySetting.queryKey,
|
|
87
|
-
options: Object.keys(filterQueryMap).map((queryKey) => ({
|
|
88
|
-
label: l.field("summary", queryKey),
|
|
89
|
-
value: queryKey
|
|
90
|
-
})),
|
|
91
|
-
onChange: (queryKey) => {
|
|
92
|
-
const filterQueryArgMetas = (0, import_constant.getFilterArgMetas)(filterRef, queryKey);
|
|
93
|
-
const defaultArg = Object.fromEntries(
|
|
94
|
-
filterQueryArgMetas.map((queryArgMeta) => [
|
|
95
|
-
queryArgMeta.name,
|
|
96
|
-
queryArgMeta.nullable ? null : queryArgMeta.arrDepth ? { $in: [] } : queryArgMeta.default ? typeof queryArgMeta.default === "function" ? queryArgMeta.default() : queryArgMeta.default : import_base.scalarDefaultMap.get(queryArgMeta.modelRef) ?? null
|
|
97
|
-
])
|
|
98
|
-
);
|
|
99
|
-
setQuerySetting({ queryKey, arg: defaultArg });
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
)
|
|
103
|
-
] }),
|
|
104
|
-
querySetting.queryKey === "search" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full flex-col gap-2", children: [
|
|
105
|
-
"Search",
|
|
106
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { className: "input flex w-full items-center gap-2", children: [
|
|
107
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
|
-
"input",
|
|
109
|
-
{
|
|
110
|
-
type: "text",
|
|
111
|
-
className: "grow",
|
|
112
|
-
placeholder: "Type to search...",
|
|
113
|
-
value: querySetting.arg.$search ?? "",
|
|
114
|
-
onChange: (e) => {
|
|
115
|
-
setQuerySetting({ ...querySetting, arg: e.target.value ? { $search: e.target.value } : {} });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_bi.BiSearch, { className: "size-4 opacity-70" })
|
|
120
|
-
] })
|
|
121
|
-
] }) : (0, import_constant.getFilterArgMetas)(filterRef, querySetting.queryKey).map((queryArgMeta, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
122
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "text-sm text-gray-500", children: l.qarg(sliceName, querySetting.queryKey, queryArgMeta.name) }),
|
|
123
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
124
|
-
QueryArg,
|
|
125
|
-
{
|
|
126
|
-
queryArgMeta,
|
|
127
|
-
value: querySetting.arg[queryArgMeta.name],
|
|
128
|
-
onChange: (value) => {
|
|
129
|
-
setQuerySetting({
|
|
130
|
-
...querySetting,
|
|
131
|
-
arg: { ...querySetting.arg, [queryArgMeta.name]: value }
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
] }, idx))
|
|
137
|
-
] });
|
|
27
|
+
return null;
|
|
138
28
|
}
|
|
139
|
-
function QueryArg({ queryArgMeta, value, onChange }) {
|
|
140
|
-
const argType = (0, import_constant.getGqlTypeStr)(queryArgMeta.modelRef);
|
|
141
|
-
if (queryArgMeta.enum && queryArgMeta.arrDepth && queryArgMeta.arrDepth < 2)
|
|
142
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
143
|
-
QueryArg.Enum,
|
|
144
|
-
{
|
|
145
|
-
options: queryArgMeta.enum.values,
|
|
146
|
-
value,
|
|
147
|
-
onChange,
|
|
148
|
-
nullable: queryArgMeta.nullable,
|
|
149
|
-
multiple: queryArgMeta.arrDepth ? queryArgMeta.arrDepth >= 1 : false
|
|
150
|
-
}
|
|
151
|
-
);
|
|
152
|
-
return argType === "ID" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryArg.ID, { queryArgMeta, value, onChange }) : argType === "Int" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryArg.Int, { value, onChange }) : argType === "Float" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryArg.Float, { value, onChange }) : argType === "String" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryArg.String, { value, onChange }) : argType === "Boolean" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryArg.Boolean, { value, onChange }) : argType === "Date" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryArg.Date, { value, onChange }) : argType === "JSON" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryArg.Json, { value, onChange }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
153
|
-
}
|
|
154
|
-
const ArgEnum = ({ options, value, onChange, nullable, multiple }) => {
|
|
155
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
-
import_Select.Select,
|
|
157
|
-
{
|
|
158
|
-
options: options.map((option) => ({
|
|
159
|
-
label: option.toString(),
|
|
160
|
-
value: option
|
|
161
|
-
})),
|
|
162
|
-
value: value ?? [],
|
|
163
|
-
onChange: (val) => {
|
|
164
|
-
onChange(val);
|
|
165
|
-
},
|
|
166
|
-
multiple
|
|
167
|
-
}
|
|
168
|
-
);
|
|
169
|
-
};
|
|
170
|
-
QueryArg.Enum = ArgEnum;
|
|
171
|
-
const ArgID = ({ queryArgMeta, value, onChange }) => {
|
|
172
|
-
if (!queryArgMeta.ref)
|
|
173
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
174
|
-
import_Input.Input,
|
|
175
|
-
{
|
|
176
|
-
inputClassName: "w-full",
|
|
177
|
-
value: value ?? "",
|
|
178
|
-
onChange: (value2) => {
|
|
179
|
-
onChange(value2 ? value2 : null);
|
|
180
|
-
},
|
|
181
|
-
validate: (e) => true
|
|
182
|
-
}
|
|
183
|
-
);
|
|
184
|
-
else
|
|
185
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectIDWithRef, { queryArgMeta, value, onChange });
|
|
186
|
-
};
|
|
187
|
-
QueryArg.ID = ArgID;
|
|
188
|
-
const SelectIDWithRef = ({ queryArgMeta, value, onChange }) => {
|
|
189
|
-
if (!queryArgMeta.ref)
|
|
190
|
-
throw new Error("No ref in queryArgMeta");
|
|
191
|
-
const [modalOpen, setModalOpen] = (0, import_react.useState)(false);
|
|
192
|
-
const storeUse = import_store.st.use;
|
|
193
|
-
const modelList = storeUse[`${queryArgMeta.ref}List`]();
|
|
194
|
-
const renderOption = queryArgMeta.renderOption ?? ((value2) => value2.id);
|
|
195
|
-
const selectedModel = value ? modelList.get(value) : null;
|
|
196
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
197
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
198
|
-
"button",
|
|
199
|
-
{
|
|
200
|
-
className: "btn",
|
|
201
|
-
onClick: () => {
|
|
202
|
-
setModalOpen(true);
|
|
203
|
-
},
|
|
204
|
-
children: selectedModel ? renderOption(selectedModel) : `Select ${queryArgMeta.ref}`
|
|
205
|
-
}
|
|
206
|
-
),
|
|
207
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
208
|
-
import_Modal.Modal,
|
|
209
|
-
{
|
|
210
|
-
open: modalOpen,
|
|
211
|
-
onCancel: () => {
|
|
212
|
-
setModalOpen(false);
|
|
213
|
-
},
|
|
214
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex w-full flex-col gap-4 pb-[256px]", children: [
|
|
215
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(QueryMaker, { sliceName: queryArgMeta.ref }),
|
|
216
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
217
|
-
import_Select.Select,
|
|
218
|
-
{
|
|
219
|
-
value,
|
|
220
|
-
options: modelList.map((model) => ({
|
|
221
|
-
label: renderOption(model),
|
|
222
|
-
value: model.id
|
|
223
|
-
})),
|
|
224
|
-
onChange: (value2) => {
|
|
225
|
-
onChange(value2);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
)
|
|
229
|
-
] })
|
|
230
|
-
}
|
|
231
|
-
)
|
|
232
|
-
] });
|
|
233
|
-
};
|
|
234
|
-
const ArgInt = ({ value, onChange }) => {
|
|
235
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
236
|
-
import_Input.Input.Number,
|
|
237
|
-
{
|
|
238
|
-
inputClassName: "w-full",
|
|
239
|
-
value,
|
|
240
|
-
onChange: (value2) => {
|
|
241
|
-
onChange(value2 ?? 0);
|
|
242
|
-
},
|
|
243
|
-
validate: (e) => true
|
|
244
|
-
}
|
|
245
|
-
);
|
|
246
|
-
};
|
|
247
|
-
QueryArg.Int = ArgInt;
|
|
248
|
-
const ArgFloat = ({ value, onChange }) => {
|
|
249
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
250
|
-
import_Input.Input.Number,
|
|
251
|
-
{
|
|
252
|
-
inputClassName: "w-full",
|
|
253
|
-
value,
|
|
254
|
-
onChange: (value2) => {
|
|
255
|
-
onChange(value2 ?? 0);
|
|
256
|
-
},
|
|
257
|
-
validate: (e) => true
|
|
258
|
-
}
|
|
259
|
-
);
|
|
260
|
-
};
|
|
261
|
-
QueryArg.Float = ArgFloat;
|
|
262
|
-
const ArgString = ({ value, onChange }) => {
|
|
263
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
264
|
-
import_Input.Input,
|
|
265
|
-
{
|
|
266
|
-
inputClassName: "w-full",
|
|
267
|
-
value: value ?? "",
|
|
268
|
-
onChange: (value2) => {
|
|
269
|
-
onChange(value2 ? value2 : null);
|
|
270
|
-
},
|
|
271
|
-
validate: (e) => true
|
|
272
|
-
}
|
|
273
|
-
);
|
|
274
|
-
};
|
|
275
|
-
QueryArg.String = ArgString;
|
|
276
|
-
const ArgBoolean = ({ value, onChange }) => {
|
|
277
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
278
|
-
import_Input.Input.Checkbox,
|
|
279
|
-
{
|
|
280
|
-
className: "w-full",
|
|
281
|
-
checked: value,
|
|
282
|
-
onChange: (value2) => {
|
|
283
|
-
onChange(value2);
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
);
|
|
287
|
-
};
|
|
288
|
-
QueryArg.Boolean = ArgBoolean;
|
|
289
|
-
const ArgDate = ({ value, onChange }) => {
|
|
290
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
291
|
-
import_DatePicker.DatePicker,
|
|
292
|
-
{
|
|
293
|
-
className: "w-full",
|
|
294
|
-
value,
|
|
295
|
-
onChange: (value2) => {
|
|
296
|
-
onChange(value2);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
};
|
|
301
|
-
QueryArg.Date = ArgDate;
|
|
302
|
-
const ArgJson = ({ value, onChange }) => {
|
|
303
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
304
|
-
import_Input.Input.TextArea,
|
|
305
|
-
{
|
|
306
|
-
validate: (e) => true,
|
|
307
|
-
className: "w-full",
|
|
308
|
-
inputClassName: "w-full min-h-[300px]",
|
|
309
|
-
value,
|
|
310
|
-
onPressEnter: (value2) => {
|
|
311
|
-
onChange(value2);
|
|
312
|
-
},
|
|
313
|
-
onChange: (value2) => {
|
|
314
|
-
onChange(value2);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
);
|
|
318
|
-
};
|
|
319
|
-
QueryArg.Json = ArgJson;
|
package/cjs/Data/TableList.js
CHANGED
|
@@ -32,8 +32,8 @@ __export(TableList_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(TableList_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
+
var import_client = require("@akanjs/client");
|
|
35
36
|
var import_common = require("@akanjs/common");
|
|
36
|
-
var import_next = require("@akanjs/next");
|
|
37
37
|
var import_store = require("@akanjs/store");
|
|
38
38
|
var import_react = require("react");
|
|
39
39
|
var import_Model = require("../Model");
|
|
@@ -52,7 +52,7 @@ function TableList({
|
|
|
52
52
|
renderView,
|
|
53
53
|
onItemClick
|
|
54
54
|
}) {
|
|
55
|
-
const { l } = (0,
|
|
55
|
+
const { l } = (0, import_client.usePage)();
|
|
56
56
|
const storeUse = import_store.st.use;
|
|
57
57
|
const storeDo = import_store.st.do;
|
|
58
58
|
const storeGet = import_store.st.get;
|
|
@@ -112,7 +112,7 @@ function TableList({
|
|
|
112
112
|
{
|
|
113
113
|
key: "actions",
|
|
114
114
|
dataIndex: "id",
|
|
115
|
-
title: l("
|
|
115
|
+
title: l("base.actions"),
|
|
116
116
|
render: (_, model, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex gap-1", children: (typeof actions === "function" ? actions(model, idx) : actions).filter((action) => typeof action !== "string").map((action, idx2) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Item.Action, { model, action, sliceName }, `${model.id}-${idx2}`)) })
|
|
117
117
|
}
|
|
118
118
|
] : []
|
package/cjs/Data/index.js
CHANGED
|
@@ -28,6 +28,6 @@ const Data = {
|
|
|
28
28
|
Item: import_index.Item,
|
|
29
29
|
ListContainer: import_index.ListContainer,
|
|
30
30
|
Pagination: import_index.Pagination,
|
|
31
|
-
TableList: import_index.TableList
|
|
32
|
-
|
|
31
|
+
TableList: import_index.TableList
|
|
32
|
+
// QueryMaker,
|
|
33
33
|
};
|
package/cjs/DatePicker.js
CHANGED
|
@@ -35,7 +35,6 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
35
35
|
var import_react_datepicker = require("react-datepicker/dist/react-datepicker.css");
|
|
36
36
|
var import_base = require("@akanjs/base");
|
|
37
37
|
var import_client = require("@akanjs/client");
|
|
38
|
-
var import_dictionary = require("@akanjs/dictionary");
|
|
39
38
|
var import_next = require("@akanjs/next");
|
|
40
39
|
var import_react = require("react");
|
|
41
40
|
var import_ai = require("react-icons/ai");
|
|
@@ -59,7 +58,7 @@ const DatePicker = ({
|
|
|
59
58
|
}, [defaultValue]);
|
|
60
59
|
const handleDateChange = (date) => {
|
|
61
60
|
if (!date) {
|
|
62
|
-
|
|
61
|
+
import_client.msg.warning("base.selectDateError");
|
|
63
62
|
return;
|
|
64
63
|
}
|
|
65
64
|
onChange((0, import_base.dayjs)(date));
|
|
@@ -95,14 +94,14 @@ const RangePicker = ({
|
|
|
95
94
|
}) => {
|
|
96
95
|
const handleStartDateChange = (date) => {
|
|
97
96
|
if (!date) {
|
|
98
|
-
|
|
97
|
+
import_client.msg.warning("base.selectDateError");
|
|
99
98
|
return;
|
|
100
99
|
}
|
|
101
100
|
onChange([(0, import_base.dayjs)(date), value[1] ?? (0, import_base.dayjs)()]);
|
|
102
101
|
};
|
|
103
102
|
const handleEndDateChange = (date) => {
|
|
104
103
|
if (!date) {
|
|
105
|
-
|
|
104
|
+
import_client.msg.warning("base.selectDateError");
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
108
107
|
onChange([value[0] ?? (0, import_base.dayjs)(), (0, import_base.dayjs)(date)]);
|
|
@@ -154,7 +153,7 @@ const TimePicker = ({
|
|
|
154
153
|
}) => {
|
|
155
154
|
const handleDateChange = (date) => {
|
|
156
155
|
if (!date) {
|
|
157
|
-
|
|
156
|
+
import_client.msg.warning("base.selectDateError");
|
|
158
157
|
return;
|
|
159
158
|
}
|
|
160
159
|
onChange((0, import_base.dayjs)(date));
|
package/cjs/Dialog/Modal.js
CHANGED
|
@@ -33,7 +33,6 @@ __export(Modal_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(Modal_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var import_client = require("@akanjs/client");
|
|
36
|
-
var import_next = require("@akanjs/next");
|
|
37
36
|
var import_ui = require("@akanjs/ui");
|
|
38
37
|
var Dialog = __toESM(require("@radix-ui/react-dialog"));
|
|
39
38
|
var import_react = require("@use-gesture/react");
|
|
@@ -49,7 +48,7 @@ const interpolate = (o, i, t) => {
|
|
|
49
48
|
const Modal = ({ className, bodyClassName, confirmClose, children, onCancel }) => {
|
|
50
49
|
const { open, setOpen, title, action } = (0, import_react2.useContext)(import_context.DialogContext);
|
|
51
50
|
const openRef = (0, import_react2.useRef)(open);
|
|
52
|
-
const { l } = (0,
|
|
51
|
+
const { l } = (0, import_client.usePage)();
|
|
53
52
|
const ref = (0, import_react2.useRef)(null);
|
|
54
53
|
const [{ translate }, api] = (0, import_react_spring.useSpring)(() => ({ translate: 1 }));
|
|
55
54
|
const [showBackground, setShowBackground] = (0, import_react2.useState)(false);
|
|
@@ -60,7 +59,7 @@ const Modal = ({ className, bodyClassName, confirmClose, children, onCancel }) =
|
|
|
60
59
|
await Promise.all(api.start({ translate: 0, immediate: false, config: canceled ? import_react_spring.config.wobbly : import_react_spring.config.stiff }));
|
|
61
60
|
};
|
|
62
61
|
const closeModal = async ({ velocity = 0, confirmClose: confirmClose2 }) => {
|
|
63
|
-
if (confirmClose2 && !window.confirm(l("
|
|
62
|
+
if (confirmClose2 && !window.confirm(l("base.confirmClose"))) {
|
|
64
63
|
return;
|
|
65
64
|
}
|
|
66
65
|
setTimeout(() => {
|
package/cjs/Empty.js
CHANGED
|
@@ -22,10 +22,9 @@ __export(Empty_exports, {
|
|
|
22
22
|
module.exports = __toCommonJS(Empty_exports);
|
|
23
23
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
24
|
var import_client = require("@akanjs/client");
|
|
25
|
-
var import_next = require("@akanjs/next");
|
|
26
25
|
var import_ai = require("react-icons/ai");
|
|
27
26
|
const Empty = ({ className = "", description, children, minHeight = 300 }) => {
|
|
28
|
-
const { l } = (0,
|
|
27
|
+
const { l } = (0, import_client.usePage)();
|
|
29
28
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
30
29
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
31
30
|
"div",
|
|
@@ -36,7 +35,7 @@ const Empty = ({ className = "", description, children, minHeight = 300 }) => {
|
|
|
36
35
|
),
|
|
37
36
|
children: [
|
|
38
37
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ai.AiOutlineMeh, { className: "scale-150 text-4xl" }),
|
|
39
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: description ?? l("
|
|
38
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: description ?? l("base.noData") })
|
|
40
39
|
]
|
|
41
40
|
}
|
|
42
41
|
),
|