react-toolkits 2.13.4 → 2.13.5
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/CHANGELOG.md +6 -0
- package/lib/index.js +38 -8
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/lib/index.js
CHANGED
|
@@ -1868,7 +1868,7 @@ function useRemoveUser() {
|
|
|
1868
1868
|
}) => axios2.post(url4, arg)
|
|
1869
1869
|
);
|
|
1870
1870
|
}
|
|
1871
|
-
var Text2, useCreateRoleModal, useUpdateRoleModal, useCreateUserModal, useUpdateUserModal, GameSelect2, UserModalContentV2, useCreateUserModalV2, useUpdateUserModalV2;
|
|
1871
|
+
var Text2, useCreateRoleModal, useUpdateRoleModal, useCreateUserModal, useUpdateUserModal, GroupSelect, GameSelect2, UserModalContentV2, useCreateUserModalV2, useUpdateUserModalV2;
|
|
1872
1872
|
var init_hooks5 = __esm({
|
|
1873
1873
|
"src/features/permission/hooks/index.tsx"() {
|
|
1874
1874
|
init_locale();
|
|
@@ -1985,6 +1985,39 @@ var init_hooks5 = __esm({
|
|
|
1985
1985
|
}
|
|
1986
1986
|
});
|
|
1987
1987
|
};
|
|
1988
|
+
GroupSelect = (props) => {
|
|
1989
|
+
const { onChange, ...rest } = props;
|
|
1990
|
+
const { axios: axios2 } = useToolkitsStore((s) => s);
|
|
1991
|
+
const { data, isLoading } = useSWR5(
|
|
1992
|
+
"/api/enum/get?enum=game_group&type=all",
|
|
1993
|
+
(path) => axios2.get(path).then((response) => response.data.data)
|
|
1994
|
+
);
|
|
1995
|
+
const options = [{ label: "\u901A\u7528", value: WILDCARD }].concat(
|
|
1996
|
+
data?.map((group) => ({ label: group, value: group })) ?? []
|
|
1997
|
+
);
|
|
1998
|
+
const onValueChange = (value) => {
|
|
1999
|
+
if (last(value) === WILDCARD) {
|
|
2000
|
+
onChange?.([WILDCARD]);
|
|
2001
|
+
} else if (first(value) === WILDCARD) {
|
|
2002
|
+
onChange?.(value.slice(1));
|
|
2003
|
+
} else {
|
|
2004
|
+
onChange?.(value);
|
|
2005
|
+
}
|
|
2006
|
+
};
|
|
2007
|
+
return /* @__PURE__ */ jsx(
|
|
2008
|
+
Select,
|
|
2009
|
+
{
|
|
2010
|
+
...rest,
|
|
2011
|
+
allowClear: true,
|
|
2012
|
+
showSearch: true,
|
|
2013
|
+
mode: "tags",
|
|
2014
|
+
optionFilterProp: "label",
|
|
2015
|
+
loading: isLoading,
|
|
2016
|
+
options,
|
|
2017
|
+
onChange: onValueChange
|
|
2018
|
+
}
|
|
2019
|
+
);
|
|
2020
|
+
};
|
|
1988
2021
|
GameSelect2 = (props) => {
|
|
1989
2022
|
const { groups, onChange, ...rest } = props;
|
|
1990
2023
|
const { axios: axios2 } = useToolkitsStore((s) => s);
|
|
@@ -2024,6 +2057,9 @@ var init_hooks5 = __esm({
|
|
|
2024
2057
|
"/api/enum/get?enum=game_group&type=all",
|
|
2025
2058
|
(path) => axios2.get(path).then((response) => response.data.data)
|
|
2026
2059
|
);
|
|
2060
|
+
[{ label: "\u901A\u7528", value: WILDCARD }].concat(
|
|
2061
|
+
groups?.map((group) => ({ label: group, value: group })) ?? []
|
|
2062
|
+
);
|
|
2027
2063
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2028
2064
|
/* @__PURE__ */ jsx(Form.Item, { label: t("global.name"), name: "name", rules: [{ required: true }], children: /* @__PURE__ */ jsx(Input, { disabled: !isCreate }) }),
|
|
2029
2065
|
/* @__PURE__ */ jsx(Form.List, { name: "permissions", children: (fields, { add, remove }) => /* @__PURE__ */ jsxs(Row, { gutter: 8, children: [
|
|
@@ -2032,14 +2068,8 @@ var init_hooks5 = __esm({
|
|
|
2032
2068
|
/* @__PURE__ */ jsx(Col, { span: 6, className: "text-center mb-4", children: /* @__PURE__ */ jsx(Text2, { strong: true, children: t("global.role") }) }),
|
|
2033
2069
|
fields.map((field) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2034
2070
|
/* @__PURE__ */ jsx(Col, { span: 8, children: /* @__PURE__ */ jsx(Form.Item, { noStyle: true, shouldUpdate: true, children: ({ setFieldValue }) => /* @__PURE__ */ jsx(Form.Item, { name: [field.name, "game_group"], children: /* @__PURE__ */ jsx(
|
|
2035
|
-
|
|
2071
|
+
GroupSelect,
|
|
2036
2072
|
{
|
|
2037
|
-
allowClear: true,
|
|
2038
|
-
showSearch: true,
|
|
2039
|
-
mode: "tags",
|
|
2040
|
-
optionFilterProp: "label",
|
|
2041
|
-
loading: isGroupsLoading,
|
|
2042
|
-
options: groups?.map((group) => ({ label: group, value: group })),
|
|
2043
2073
|
onChange: () => {
|
|
2044
2074
|
setFieldValue(["permissions", field.name, "game_ids"], []);
|
|
2045
2075
|
}
|