com-angel-authorization 1.0.7 → 1.0.8

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.
@@ -288,7 +288,7 @@ var MENU_TYPE_PAGE = "page";
288
288
  var MENU_TYPE_MENU = "menu";
289
289
  var MENU_TYPE_BUTTON = "button";
290
290
  var MENU_LIST_TYPE_PARAM = "page,menu,button";
291
- var ROOT_PARENT_ID = "0";
291
+ var ROOT_PARENT_ID = "";
292
292
  var RESOURCE_STATUS_ENABLED = 1;
293
293
  var RESOURCE_STATUS_DISABLED = 0;
294
294
  var RESOURCE_STATUS_OPTIONS = [
@@ -505,10 +505,11 @@ function mapMenuResource(item) {
505
505
  );
506
506
  const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
507
507
  const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : void 0;
508
- const parentId = row.parentId ?? row.parent_id ?? ROOT_PARENT_ID;
508
+ const rawParentId = row.parentId ?? row.parent_id;
509
+ const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
509
510
  return {
510
511
  resourceId: String(resourceId),
511
- parentId: parentId === void 0 || parentId === null ? ROOT_PARENT_ID : String(parentId),
512
+ parentId,
512
513
  type: toMenuType(row.type),
513
514
  name: String(row.name ?? ""),
514
515
  identification: String(row.identification ?? row.identity ?? row.path ?? ""),
@@ -549,7 +550,7 @@ function buildUpdateBody(values) {
549
550
  function buildCreateMenuBody(values, resourceId = getAppClientId()) {
550
551
  return {
551
552
  resourceId,
552
- parentId: values.parentId || ROOT_PARENT_ID,
553
+ parentId: values.parentId ? values.parentId : null,
553
554
  type: values.type,
554
555
  name: values.name.trim(),
555
556
  identification: values.identification.trim(),
@@ -559,7 +560,7 @@ function buildCreateMenuBody(values, resourceId = getAppClientId()) {
559
560
  }
560
561
  function buildUpdateMenuBody(values) {
561
562
  return {
562
- parentId: values.parentId || ROOT_PARENT_ID,
563
+ parentId: values.parentId ? values.parentId : null,
563
564
  type: values.type,
564
565
  name: values.name.trim(),
565
566
  identification: values.identification.trim(),
@@ -1223,7 +1224,7 @@ var import_react3 = require("react");
1223
1224
  var import_jsx_runtime3 = require("react/jsx-runtime");
1224
1225
  var PAGE_SIZE_OPTIONS2 = ["10", "20", "50", "100"];
1225
1226
  var emptyForm2 = () => ({
1226
- parentId: ROOT_PARENT_ID,
1227
+ parentId: null,
1227
1228
  type: MENU_TYPE_MENU,
1228
1229
  name: "",
1229
1230
  identification: "",
@@ -1307,7 +1308,7 @@ function MenuManager({
1307
1308
  const openEdit = (row) => {
1308
1309
  setEditing(row);
1309
1310
  setForm({
1310
- parentId: row.parentId || ROOT_PARENT_ID,
1311
+ parentId: row.parentId ?? null,
1311
1312
  type: row.type,
1312
1313
  name: row.name,
1313
1314
  identification: row.identification,
@@ -1483,10 +1484,13 @@ function MenuManager({
1483
1484
  "select",
1484
1485
  {
1485
1486
  style: styles2.input,
1486
- value: form.parentId,
1487
- onChange: (e) => setForm((prev) => ({ ...prev, parentId: e.target.value })),
1487
+ value: form.parentId ?? ROOT_PARENT_ID,
1488
+ onChange: (e) => setForm((prev) => ({
1489
+ ...prev,
1490
+ parentId: e.target.value ? e.target.value : null
1491
+ })),
1488
1492
  children: [
1489
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: ROOT_PARENT_ID, children: "\u6839\u76EE\u5F55" }),
1493
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: ROOT_PARENT_ID, children: "\u65E0" }),
1490
1494
  parentOptions.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
1491
1495
  ]
1492
1496
  }