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.
@@ -222,7 +222,8 @@ type AuthorizationResourceListResult = {
222
222
  };
223
223
  type MenuResource = {
224
224
  resourceId: string;
225
- parentId: string;
225
+ /** 上级菜单 ID;无上级时为 null */
226
+ parentId: string | null;
226
227
  type: MenuResourceType;
227
228
  name: string;
228
229
  identification: string;
@@ -232,7 +233,8 @@ type MenuResource = {
232
233
  status: ResourceStatus;
233
234
  };
234
235
  type MenuResourceFormValues = {
235
- parentId: string;
236
+ /** 上级菜单 ID;选择「无」时为 null */
237
+ parentId: string | null;
236
238
  type: MenuResourceType;
237
239
  name: string;
238
240
  identification: string;
@@ -258,7 +260,11 @@ declare const MENU_TYPE_MENU: MenuResourceType;
258
260
  declare const MENU_TYPE_BUTTON: MenuResourceType;
259
261
  /** 菜单列表查询 type 参数 */
260
262
  declare const MENU_LIST_TYPE_PARAM = "page,menu,button";
261
- declare const ROOT_PARENT_ID = "0";
263
+ /**
264
+ * 上级菜单选择「无」时,表单 select 使用的空值。
265
+ * 提交接口时会转换为 parentId: null。
266
+ */
267
+ declare const ROOT_PARENT_ID = "";
262
268
  declare const RESOURCE_STATUS_ENABLED: ResourceStatus;
263
269
  declare const RESOURCE_STATUS_DISABLED: ResourceStatus;
264
270
  declare const RESOURCE_STATUS_OPTIONS: {
@@ -222,7 +222,8 @@ type AuthorizationResourceListResult = {
222
222
  };
223
223
  type MenuResource = {
224
224
  resourceId: string;
225
- parentId: string;
225
+ /** 上级菜单 ID;无上级时为 null */
226
+ parentId: string | null;
226
227
  type: MenuResourceType;
227
228
  name: string;
228
229
  identification: string;
@@ -232,7 +233,8 @@ type MenuResource = {
232
233
  status: ResourceStatus;
233
234
  };
234
235
  type MenuResourceFormValues = {
235
- parentId: string;
236
+ /** 上级菜单 ID;选择「无」时为 null */
237
+ parentId: string | null;
236
238
  type: MenuResourceType;
237
239
  name: string;
238
240
  identification: string;
@@ -258,7 +260,11 @@ declare const MENU_TYPE_MENU: MenuResourceType;
258
260
  declare const MENU_TYPE_BUTTON: MenuResourceType;
259
261
  /** 菜单列表查询 type 参数 */
260
262
  declare const MENU_LIST_TYPE_PARAM = "page,menu,button";
261
- declare const ROOT_PARENT_ID = "0";
263
+ /**
264
+ * 上级菜单选择「无」时,表单 select 使用的空值。
265
+ * 提交接口时会转换为 parentId: null。
266
+ */
267
+ declare const ROOT_PARENT_ID = "";
262
268
  declare const RESOURCE_STATUS_ENABLED: ResourceStatus;
263
269
  declare const RESOURCE_STATUS_DISABLED: ResourceStatus;
264
270
  declare const RESOURCE_STATUS_OPTIONS: {
package/dist/vue/index.js CHANGED
@@ -314,7 +314,7 @@ var MENU_TYPE_PAGE = "page";
314
314
  var MENU_TYPE_MENU = "menu";
315
315
  var MENU_TYPE_BUTTON = "button";
316
316
  var MENU_LIST_TYPE_PARAM = "page,menu,button";
317
- var ROOT_PARENT_ID = "0";
317
+ var ROOT_PARENT_ID = "";
318
318
  var RESOURCE_STATUS_ENABLED = 1;
319
319
  var RESOURCE_STATUS_DISABLED = 0;
320
320
  var RESOURCE_STATUS_OPTIONS = [
@@ -531,10 +531,11 @@ function mapMenuResource(item) {
531
531
  );
532
532
  const permissionNamesRaw = row.permissionPointNames ?? row.permission_point_names ?? row.permissionNames;
533
533
  const permissionPointNames = Array.isArray(permissionNamesRaw) ? permissionNamesRaw.map((n) => String(n ?? "")).filter(Boolean) : void 0;
534
- const parentId = row.parentId ?? row.parent_id ?? ROOT_PARENT_ID;
534
+ const rawParentId = row.parentId ?? row.parent_id;
535
+ const parentId = rawParentId === void 0 || rawParentId === null || rawParentId === "" || String(rawParentId) === "0" ? null : String(rawParentId);
535
536
  return {
536
537
  resourceId: String(resourceId),
537
- parentId: parentId === void 0 || parentId === null ? ROOT_PARENT_ID : String(parentId),
538
+ parentId,
538
539
  type: toMenuType(row.type),
539
540
  name: String(row.name ?? ""),
540
541
  identification: String(row.identification ?? row.identity ?? row.path ?? ""),
@@ -575,7 +576,7 @@ function buildUpdateBody(values) {
575
576
  function buildCreateMenuBody(values, resourceId = getAppClientId()) {
576
577
  return {
577
578
  resourceId,
578
- parentId: values.parentId || ROOT_PARENT_ID,
579
+ parentId: values.parentId ? values.parentId : null,
579
580
  type: values.type,
580
581
  name: values.name.trim(),
581
582
  identification: values.identification.trim(),
@@ -585,7 +586,7 @@ function buildCreateMenuBody(values, resourceId = getAppClientId()) {
585
586
  }
586
587
  function buildUpdateMenuBody(values) {
587
588
  return {
588
- parentId: values.parentId || ROOT_PARENT_ID,
589
+ parentId: values.parentId ? values.parentId : null,
589
590
  type: values.type,
590
591
  name: values.name.trim(),
591
592
  identification: values.identification.trim(),
@@ -1391,7 +1392,7 @@ import {
1391
1392
  var PAGE_SIZE_OPTIONS2 = ["10", "20", "50", "100"];
1392
1393
  function emptyForm2() {
1393
1394
  return {
1394
- parentId: ROOT_PARENT_ID,
1395
+ parentId: null,
1395
1396
  type: MENU_TYPE_MENU,
1396
1397
  name: "",
1397
1398
  identification: "",
@@ -1712,7 +1713,7 @@ var MenuManager = defineComponent3({
1712
1713
  function openEdit(row) {
1713
1714
  editing.value = row;
1714
1715
  Object.assign(form, {
1715
- parentId: row.parentId || ROOT_PARENT_ID,
1716
+ parentId: row.parentId ?? null,
1716
1717
  type: row.type,
1717
1718
  name: row.name,
1718
1719
  identification: row.identification,
@@ -1957,13 +1958,14 @@ var MenuManager = defineComponent3({
1957
1958
  "select",
1958
1959
  {
1959
1960
  style: s2.input,
1960
- value: form.parentId,
1961
+ value: form.parentId ?? ROOT_PARENT_ID,
1961
1962
  onChange: (e) => {
1962
- form.parentId = e.target.value;
1963
+ const value = e.target.value;
1964
+ form.parentId = value ? value : null;
1963
1965
  }
1964
1966
  },
1965
1967
  [
1966
- h2("option", { value: ROOT_PARENT_ID }, "\u6839\u76EE\u5F55"),
1968
+ h2("option", { value: ROOT_PARENT_ID }, "\u65E0"),
1967
1969
  ...parentOptions.value.map(
1968
1970
  (opt) => h2(
1969
1971
  "option",