com-angel-authorization 1.0.31 → 1.0.33

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.
@@ -676,6 +676,7 @@ function buildListUrl(type, params) {
676
676
  if (params?.depth !== void 0 && params?.depth !== null && String(params.depth) !== "") {
677
677
  appendQueryParam(parts, "depth", String(params.depth));
678
678
  }
679
+ appendQueryParam(parts, "keyword", params?.keyword ?? "");
679
680
  appendQueryParam(parts, "page-token", params?.pagination?.pageToken ?? "");
680
681
  appendQueryParam(parts, "page-size", params?.pagination?.pageSize ?? "20");
681
682
  appendQueryParam(parts, "page-direction", params?.pagination?.pageDirection ?? "current");
@@ -1857,6 +1858,7 @@ var MenuManager = (0, import_vue4.defineComponent)({
1857
1858
  const deletingRow = (0, import_vue4.ref)(null);
1858
1859
  const deleting = (0, import_vue4.ref)(false);
1859
1860
  const permissionKeyword = (0, import_vue4.ref)("");
1861
+ const permissionLoading = (0, import_vue4.ref)(false);
1860
1862
  const permissionNameMap = (0, import_vue4.computed)(() => {
1861
1863
  const map = /* @__PURE__ */ new Map();
1862
1864
  permissionPoints.value.forEach(
@@ -1864,13 +1866,6 @@ var MenuManager = (0, import_vue4.defineComponent)({
1864
1866
  );
1865
1867
  return map;
1866
1868
  });
1867
- const filteredPermissionPoints = (0, import_vue4.computed)(() => {
1868
- const kw = permissionKeyword.value.trim().toLowerCase();
1869
- if (!kw) return permissionPoints.value;
1870
- return permissionPoints.value.filter(
1871
- (p) => p.name.toLowerCase().includes(kw) || p.identification.toLowerCase().includes(kw)
1872
- );
1873
- });
1874
1869
  const allKnownMenus = (0, import_vue4.computed)(() => {
1875
1870
  const map = /* @__PURE__ */ new Map();
1876
1871
  records.value.forEach((row) => map.set(row.resourceId, row));
@@ -1942,13 +1937,23 @@ var MenuManager = (0, import_vue4.defineComponent)({
1942
1937
  loading.value = false;
1943
1938
  }
1944
1939
  }
1945
- async function loadPermissionPoints() {
1940
+ async function loadPermissionPoints(keyword = "", signal) {
1941
+ permissionLoading.value = true;
1946
1942
  try {
1947
- const result = await props.api.listPermissionPoints({
1948
- pagination: { pageSize: "200", pageDirection: "current" }
1949
- });
1950
- permissionPoints.value = result.records;
1943
+ const result = await props.api.listPermissionPoints(
1944
+ {
1945
+ keyword: keyword.trim() || void 0,
1946
+ pagination: { pageSize: "200", pageDirection: "current" }
1947
+ },
1948
+ signal
1949
+ );
1950
+ if (!signal?.aborted) {
1951
+ permissionPoints.value = result.records;
1952
+ }
1951
1953
  } catch {
1954
+ if (signal?.aborted) return;
1955
+ } finally {
1956
+ if (!signal?.aborted) permissionLoading.value = false;
1952
1957
  }
1953
1958
  }
1954
1959
  async function toggleExpand(row) {
@@ -1987,7 +1992,6 @@ var MenuManager = (0, import_vue4.defineComponent)({
1987
1992
  Object.assign(form, emptyForm2());
1988
1993
  }
1989
1994
  dialogOpen.value = true;
1990
- void loadPermissionPoints();
1991
1995
  }
1992
1996
  function openEdit(row) {
1993
1997
  const parentId = resolveRowParentId(row);
@@ -2004,7 +2008,6 @@ var MenuManager = (0, import_vue4.defineComponent)({
2004
2008
  sort: Number.isFinite(row.sort) ? row.sort : 0
2005
2009
  });
2006
2010
  dialogOpen.value = true;
2007
- void loadPermissionPoints();
2008
2011
  }
2009
2012
  function closeDialog() {
2010
2013
  if (!saving.value) {
@@ -2070,7 +2073,6 @@ var MenuManager = (0, import_vue4.defineComponent)({
2070
2073
  }
2071
2074
  (0, import_vue4.onMounted)(() => {
2072
2075
  void loadList("current", "");
2073
- void loadPermissionPoints();
2074
2076
  });
2075
2077
  (0, import_vue4.watch)(
2076
2078
  () => [props.api, pageSize.value],
@@ -2079,6 +2081,20 @@ var MenuManager = (0, import_vue4.defineComponent)({
2079
2081
  void loadList("current", "");
2080
2082
  }
2081
2083
  );
2084
+ let permissionSearchTimer = null;
2085
+ let permissionAbort = null;
2086
+ (0, import_vue4.watch)(
2087
+ () => [dialogOpen.value, permissionKeyword.value],
2088
+ ([open, keyword]) => {
2089
+ if (permissionSearchTimer) clearTimeout(permissionSearchTimer);
2090
+ permissionAbort?.abort();
2091
+ if (!open) return;
2092
+ permissionSearchTimer = setTimeout(() => {
2093
+ permissionAbort = new AbortController();
2094
+ void loadPermissionPoints(keyword, permissionAbort.signal);
2095
+ }, 300);
2096
+ }
2097
+ );
2082
2098
  return () => (0, import_vue4.h)("div", { style: s2.root }, [
2083
2099
  (0, import_vue4.h)("div", { style: s2.toolbar }, [
2084
2100
  (0, import_vue4.h)("h2", { style: s2.title }, props.title),
@@ -2360,31 +2376,29 @@ var MenuManager = (0, import_vue4.defineComponent)({
2360
2376
  ]),
2361
2377
  (0, import_vue4.h)("fieldset", { style: s2.fieldset }, [
2362
2378
  (0, import_vue4.h)("legend", { style: s2.label }, "\u6743\u9650\u6807\u8BC6"),
2363
- permissionPoints.value.length > 0 ? [
2364
- (0, import_vue4.h)("input", {
2365
- style: { ...s2.input, marginBottom: "8px" },
2366
- value: permissionKeyword.value,
2367
- placeholder: "\u641C\u7D22\u6743\u9650\u540D\u79F0 / \u6807\u8BC6",
2368
- onInput: (e) => {
2369
- permissionKeyword.value = e.target.value;
2370
- }
2371
- }),
2372
- (0, import_vue4.h)(
2373
- "div",
2374
- { style: s2.hint },
2375
- permissionKeyword.value.trim() ? `\u5DF2\u9009 ${form.permissionPointIds.length} \u9879 \xB7 \u5339\u914D ${filteredPermissionPoints.value.length} / ${permissionPoints.value.length}` : `\u5DF2\u9009 ${form.permissionPointIds.length} \u9879 \xB7 \u5171 ${permissionPoints.value.length} \u9879`
2376
- )
2377
- ] : null,
2379
+ (0, import_vue4.h)("input", {
2380
+ style: { ...s2.input, marginBottom: "8px" },
2381
+ value: permissionKeyword.value,
2382
+ placeholder: "\u641C\u7D22\u6743\u9650\u540D\u79F0 / \u6807\u8BC6",
2383
+ onInput: (e) => {
2384
+ permissionKeyword.value = e.target.value;
2385
+ }
2386
+ }),
2387
+ (0, import_vue4.h)(
2388
+ "div",
2389
+ { style: s2.hint },
2390
+ permissionLoading.value ? `\u5DF2\u9009 ${form.permissionPointIds.length} \u9879 \xB7 \u641C\u7D22\u4E2D\u2026` : permissionKeyword.value.trim() ? `\u5DF2\u9009 ${form.permissionPointIds.length} \u9879 \xB7 \u8FD4\u56DE ${permissionPoints.value.length} \u9879` : `\u5DF2\u9009 ${form.permissionPointIds.length} \u9879 \xB7 \u5171 ${permissionPoints.value.length} \u9879`
2391
+ ),
2378
2392
  (0, import_vue4.h)(
2379
2393
  "div",
2380
2394
  { style: s2.multiSelect },
2381
- permissionPoints.value.length === 0 ? [
2395
+ permissionLoading.value && permissionPoints.value.length === 0 ? [(0, import_vue4.h)("div", { style: s2.hint }, "\u52A0\u8F7D\u4E2D\u2026")] : permissionPoints.value.length === 0 ? [
2382
2396
  (0, import_vue4.h)(
2383
2397
  "div",
2384
2398
  { style: s2.hint },
2385
- "\u6682\u65E0\u6743\u9650\u70B9\uFF0C\u8BF7\u5148\u5728\u6743\u9650\u70B9\u7BA1\u7406\u4E2D\u65B0\u589E"
2399
+ permissionKeyword.value.trim() ? "\u65E0\u5339\u914D\u6743\u9650\u70B9" : "\u6682\u65E0\u6743\u9650\u70B9\uFF0C\u8BF7\u5148\u5728\u6743\u9650\u70B9\u7BA1\u7406\u4E2D\u65B0\u589E"
2386
2400
  )
2387
- ] : filteredPermissionPoints.value.length === 0 ? [(0, import_vue4.h)("div", { style: s2.hint }, "\u65E0\u5339\u914D\u6743\u9650\u70B9")] : filteredPermissionPoints.value.map(
2401
+ ] : permissionPoints.value.map(
2388
2402
  (p) => (0, import_vue4.h)(
2389
2403
  "label",
2390
2404
  { key: p.resourceId, style: s2.checkItem },
@@ -4502,7 +4516,10 @@ var UserManager = (0, import_vue6.defineComponent)({
4502
4516
  [
4503
4517
  formError.value ? (0, import_vue6.h)("div", { style: s4.error }, formError.value) : null,
4504
4518
  (0, import_vue6.h)("label", { style: s4.field }, [
4505
- (0, import_vue6.h)("span", { style: s4.label }, "\u8D26\u53F7"),
4519
+ (0, import_vue6.h)("span", { style: s4.label }, [
4520
+ "\u8D26\u53F7 ",
4521
+ (0, import_vue6.h)("span", { style: s4.required }, "*")
4522
+ ]),
4506
4523
  (0, import_vue6.h)("input", {
4507
4524
  style: s4.input,
4508
4525
  value: form.username,
@@ -4514,7 +4531,10 @@ var UserManager = (0, import_vue6.defineComponent)({
4514
4531
  })
4515
4532
  ]),
4516
4533
  (0, import_vue6.h)("label", { style: s4.field }, [
4517
- (0, import_vue6.h)("span", { style: s4.label }, "\u7528\u6237\u540D"),
4534
+ (0, import_vue6.h)("span", { style: s4.label }, [
4535
+ "\u7528\u6237\u540D ",
4536
+ (0, import_vue6.h)("span", { style: s4.required }, "*")
4537
+ ]),
4518
4538
  (0, import_vue6.h)("input", {
4519
4539
  style: s4.input,
4520
4540
  value: form.name,
@@ -4525,24 +4545,23 @@ var UserManager = (0, import_vue6.defineComponent)({
4525
4545
  }
4526
4546
  })
4527
4547
  ]),
4528
- (0, import_vue6.h)("label", { style: s4.field }, [
4529
- (0, import_vue6.h)(
4530
- "span",
4531
- { style: s4.label },
4532
- editing.value ? "\u5BC6\u7801\uFF08\u7559\u7A7A\u5219\u4E0D\u4FEE\u6539\uFF09" : "\u521D\u59CB\u5BC6\u7801"
4533
- ),
4548
+ !editing.value ? (0, import_vue6.h)("label", { style: s4.field }, [
4549
+ (0, import_vue6.h)("span", { style: s4.label }, [
4550
+ "\u521D\u59CB\u5BC6\u7801 ",
4551
+ (0, import_vue6.h)("span", { style: s4.required }, "*")
4552
+ ]),
4534
4553
  (0, import_vue6.h)("input", {
4535
4554
  style: s4.input,
4536
4555
  type: "password",
4537
4556
  value: form.password,
4538
- placeholder: editing.value ? "\u7559\u7A7A\u8868\u793A\u4E0D\u4FEE\u6539\u5BC6\u7801" : "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
4539
- required: !editing.value,
4557
+ placeholder: "\u8BF7\u8F93\u5165\u521D\u59CB\u5BC6\u7801",
4558
+ required: true,
4540
4559
  autocomplete: "new-password",
4541
4560
  onInput: (e) => {
4542
4561
  form.password = e.target.value;
4543
4562
  }
4544
4563
  })
4545
- ]),
4564
+ ]) : null,
4546
4565
  (0, import_vue6.h)("fieldset", { style: s4.fieldset }, [
4547
4566
  (0, import_vue6.h)("legend", { style: s4.label }, [
4548
4567
  "\u5F52\u5C5E\u90E8\u95E8 ",