qidian-vue-ui 1.0.97 → 1.1.0

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.
@@ -12760,8 +12760,8 @@ const QdConfigProvider = defineComponent({
12760
12760
  watchEffect(async () => {
12761
12761
  const localeMap = {
12762
12762
  "zh-CN": () => Promise.resolve().then(() => zhCN$1),
12763
- "zh-TW": () => import("./zh-TW-B5gRlJNh.mjs"),
12764
- "en-US": () => import("./en-US-BQOTGMYj.mjs")
12763
+ "zh-TW": () => import("./zh-TW-CFh--7Lf.mjs"),
12764
+ "en-US": () => import("./en-US-BR6k1E6q.mjs")
12765
12765
  };
12766
12766
  const loadLocale = localeMap[props.locale] || localeMap["zh-CN"];
12767
12767
  const [err, res] = await to(
@@ -13967,7 +13967,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
13967
13967
  config: {},
13968
13968
  context: {}
13969
13969
  },
13970
- setup(__props) {
13970
+ setup(__props, { expose: __expose }) {
13971
13971
  const props = __props;
13972
13972
  const currentContext = computed(() => props.config.context || props.context || {});
13973
13973
  const vIfValue = computed(() => {
@@ -14061,6 +14061,8 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
14061
14061
  });
14062
14062
  return componentProps2;
14063
14063
  });
14064
+ const expose = { vIf: shouldRender };
14065
+ __expose(expose);
14064
14066
  return (_ctx, _cache) => {
14065
14067
  return shouldRender.value ? withDirectives((openBlock(), createBlock(resolveDynamicComponent(resolvedComponent.value), normalizeProps(mergeProps({ key: 0 }, componentProps.value)), createSlots({ _: 2 }, [
14066
14068
  renderList(__props.config.slots, (slotConfig, slotName) => {
@@ -14333,8 +14335,11 @@ function authRole(role) {
14333
14335
  function hasPermi$1(permission) {
14334
14336
  return authPermission(permission);
14335
14337
  }
14336
- function hasPermiOr(permissions) {
14337
- return permissions.some((item) => {
14338
+ function hasPermiOr(permissions, strict = true) {
14339
+ if (!strict && (!permissions || !permissions.length)) {
14340
+ return true;
14341
+ }
14342
+ return permissions?.some((item) => {
14338
14343
  return authPermission(item);
14339
14344
  });
14340
14345
  }
@@ -14346,8 +14351,11 @@ function hasPermiAnd(permissions) {
14346
14351
  function hasRole$1(role) {
14347
14352
  return authRole(role);
14348
14353
  }
14349
- function hasRoleOr(roles) {
14350
- return roles.some((item) => {
14354
+ function hasRoleOr(roles, strict = true) {
14355
+ if (!strict && (!roles || !roles.length)) {
14356
+ return true;
14357
+ }
14358
+ return roles?.some((item) => {
14351
14359
  return authRole(item);
14352
14360
  });
14353
14361
  }
@@ -14377,8 +14385,7 @@ function checkPermission(el, binding) {
14377
14385
  const { value } = binding;
14378
14386
  if (!value) return;
14379
14387
  if (value instanceof Array) {
14380
- if (!value.length) return;
14381
- const hasPermissions = hasPermiOr(value);
14388
+ const hasPermissions = hasPermiOr(value, false);
14382
14389
  if (hasPermissions) return;
14383
14390
  el.parentNode?.removeChild(el);
14384
14391
  return;
@@ -14401,8 +14408,7 @@ function checkRole(el, binding) {
14401
14408
  const { value } = binding;
14402
14409
  if (!value) return;
14403
14410
  if (value instanceof Array) {
14404
- if (!value.length) return;
14405
- const hasRole2 = hasRoleOr(value);
14411
+ const hasRole2 = hasRoleOr(value, false);
14406
14412
  if (hasRole2) return;
14407
14413
  el.parentNode?.removeChild(el);
14408
14414
  return;
@@ -18467,7 +18473,6 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
18467
18473
  expose: __expose,
18468
18474
  emit: __emit
18469
18475
  }) {
18470
- const vHasPermi = hasPermiDirective;
18471
18476
  const props = __props;
18472
18477
  const emit = __emit;
18473
18478
  const {
@@ -18914,6 +18919,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
18914
18919
  }
18915
18920
  return res;
18916
18921
  }
18922
+ function setActionVIf(el, action) {
18923
+ if (!el) return;
18924
+ const crVIf = el.vIf;
18925
+ action._vIf = crVIf && hasPermiOr(action.permi);
18926
+ }
18917
18927
  const expose = {};
18918
18928
  onMounted(() => {
18919
18929
  Object.assign(expose, tableRef.value);
@@ -18962,8 +18972,10 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
18962
18972
  size: "small"
18963
18973
  }, {
18964
18974
  default: withCtx(() => [renderSlot(_ctx.$slots, "actions", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.actions, (item, index2) => {
18965
- return withDirectives((openBlock(), createBlock(unref(_sfc_main$i), {
18975
+ return openBlock(), createElementBlock(Fragment, null, [item._vIf !== false ? (openBlock(), createBlock(unref(_sfc_main$i), {
18966
18976
  key: item.uid || index2,
18977
+ ref_for: true,
18978
+ ref: (el) => setActionVIf(el, item),
18967
18979
  context: getConfigRendererCtx(item),
18968
18980
  config: {
18969
18981
  is: unref(Button),
@@ -18972,8 +18984,8 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
18972
18984
  onClick: buildActionOnClick(item),
18973
18985
  disabled: buildActionDisabled(item)
18974
18986
  }
18975
- }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
18976
- }), 128))], true)]),
18987
+ }, null, 8, ["context", "config"])) : createCommentVNode("", true)], 64);
18988
+ }), 256))], true)]),
18977
18989
  _: 3
18978
18990
  }), createVNode(unref(Space), {
18979
18991
  align: "center",
@@ -19068,16 +19080,18 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
19068
19080
  layout: "vertical"
19069
19081
  })]),
19070
19082
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(reProps.value.rowActions, (item, index2) => {
19071
- return withDirectives((openBlock(), createBlock(unref(_sfc_main$i), {
19083
+ return openBlock(), createElementBlock(Fragment, null, [item._vIf !== false ? (openBlock(), createBlock(unref(_sfc_main$i), {
19072
19084
  key: item.uid || index2,
19085
+ ref_for: true,
19086
+ ref: (el) => setActionVIf(el, item),
19073
19087
  context: getConfigRendererCtx(item, slotProps),
19074
19088
  config: {
19075
19089
  is: unref(Link),
19076
19090
  ...item,
19077
19091
  onClick: buildActionOnClick(item, slotProps)
19078
19092
  }
19079
- }, null, 8, ["context", "config"])), [[unref(vHasPermi), item.permi]]);
19080
- }), 128))]),
19093
+ }, null, 8, ["context", "config"])) : createCommentVNode("", true)], 64);
19094
+ }), 256))]),
19081
19095
  _: 2
19082
19096
  }, 1024)) : createCommentVNode("", true)], true)]),
19083
19097
  _: 2
@@ -19104,7 +19118,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
19104
19118
  };
19105
19119
  }
19106
19120
  });
19107
- const table = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-7532ec3d"]]);
19121
+ const table = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-c40b7121"]]);
19108
19122
  const _hoisted_1$2 = {
19109
19123
  key: 0,
19110
19124
  class: "qd-crud-list__header"
@@ -55389,4 +55403,4 @@ export {
55389
55403
  _sfc_main$a as y,
55390
55404
  QdFormItem as z
55391
55405
  };
55392
- //# sourceMappingURL=index-Xd1gOuQf.mjs.map
55406
+ //# sourceMappingURL=index-OP442pVF.mjs.map