qidian-vue-ui 1.0.97 → 1.1.1

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.
@@ -12762,8 +12762,8 @@ const QdConfigProvider = vue.defineComponent({
12762
12762
  vue.watchEffect(async () => {
12763
12763
  const localeMap = {
12764
12764
  "zh-CN": () => Promise.resolve().then(() => zhCN$1),
12765
- "zh-TW": () => Promise.resolve().then(() => require("./zh-TW-BL0ZJ55v.js")),
12766
- "en-US": () => Promise.resolve().then(() => require("./en-US-BviPtLaZ.js"))
12765
+ "zh-TW": () => Promise.resolve().then(() => require("./zh-TW-Cl433j3a.js")),
12766
+ "en-US": () => Promise.resolve().then(() => require("./en-US-DLi0cBJj.js"))
12767
12767
  };
12768
12768
  const loadLocale = localeMap[props.locale] || localeMap["zh-CN"];
12769
12769
  const [err, res] = await to(
@@ -13969,8 +13969,10 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
13969
13969
  config: {},
13970
13970
  context: {}
13971
13971
  },
13972
- setup(__props) {
13972
+ emits: ["vIfChange"],
13973
+ setup(__props, { emit: __emit }) {
13973
13974
  const props = __props;
13975
+ const emit = __emit;
13974
13976
  const currentContext = vue.computed(() => props.config.context || props.context || {});
13975
13977
  const vIfValue = vue.computed(() => {
13976
13978
  const vIf = props.config.vIf;
@@ -14063,6 +14065,10 @@ const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
14063
14065
  });
14064
14066
  return componentProps2;
14065
14067
  });
14068
+ vue.watch(shouldRender, (newV, oldV) => {
14069
+ if (newV === oldV) return;
14070
+ emit("vIfChange", newV);
14071
+ }, { immediate: true });
14066
14072
  return (_ctx, _cache) => {
14067
14073
  return shouldRender.value ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(resolvedComponent.value), vue.normalizeProps(vue.mergeProps({ key: 0 }, componentProps.value)), vue.createSlots({ _: 2 }, [
14068
14074
  vue.renderList(__props.config.slots, (slotConfig, slotName) => {
@@ -14335,8 +14341,11 @@ function authRole(role) {
14335
14341
  function hasPermi$1(permission) {
14336
14342
  return authPermission(permission);
14337
14343
  }
14338
- function hasPermiOr(permissions) {
14339
- return permissions.some((item) => {
14344
+ function hasPermiOr(permissions, strict = true) {
14345
+ if (!strict && (!permissions || !permissions.length)) {
14346
+ return true;
14347
+ }
14348
+ return permissions?.some((item) => {
14340
14349
  return authPermission(item);
14341
14350
  });
14342
14351
  }
@@ -14348,8 +14357,11 @@ function hasPermiAnd(permissions) {
14348
14357
  function hasRole$1(role) {
14349
14358
  return authRole(role);
14350
14359
  }
14351
- function hasRoleOr(roles) {
14352
- return roles.some((item) => {
14360
+ function hasRoleOr(roles, strict = true) {
14361
+ if (!strict && (!roles || !roles.length)) {
14362
+ return true;
14363
+ }
14364
+ return roles?.some((item) => {
14353
14365
  return authRole(item);
14354
14366
  });
14355
14367
  }
@@ -14379,8 +14391,7 @@ function checkPermission(el, binding) {
14379
14391
  const { value } = binding;
14380
14392
  if (!value) return;
14381
14393
  if (value instanceof Array) {
14382
- if (!value.length) return;
14383
- const hasPermissions = hasPermiOr(value);
14394
+ const hasPermissions = hasPermiOr(value, false);
14384
14395
  if (hasPermissions) return;
14385
14396
  el.parentNode?.removeChild(el);
14386
14397
  return;
@@ -14403,8 +14414,7 @@ function checkRole(el, binding) {
14403
14414
  const { value } = binding;
14404
14415
  if (!value) return;
14405
14416
  if (value instanceof Array) {
14406
- if (!value.length) return;
14407
- const hasRole2 = hasRoleOr(value);
14417
+ const hasRole2 = hasRoleOr(value, false);
14408
14418
  if (hasRole2) return;
14409
14419
  el.parentNode?.removeChild(el);
14410
14420
  return;
@@ -18160,6 +18170,10 @@ const _hoisted_1$3 = {
18160
18170
  const _hoisted_2$2 = {
18161
18171
  class: "qd-crud-table__toolbar"
18162
18172
  };
18173
+ const _hoisted_3$1 = {
18174
+ key: 0,
18175
+ class: "qd-crud-table__toolbar-separator"
18176
+ };
18163
18177
  const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
18164
18178
  ...{
18165
18179
  name: "QdCrudTable"
@@ -18497,6 +18511,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
18497
18511
  } = useModal();
18498
18512
  const treeIsExpand = vue.computed(() => !!expandedTreeNodes.value?.length);
18499
18513
  const dialogFormMap = vue.reactive({});
18514
+ const rowActionsVIfMap = vue.reactive({});
18500
18515
  const reProps = vue.computed(() => {
18501
18516
  const {
18502
18517
  data: data2,
@@ -18916,6 +18931,41 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
18916
18931
  }
18917
18932
  return res;
18918
18933
  }
18934
+ function setActionVIf(rendererVIf, action, cellIndex) {
18935
+ const vIf = rendererVIf && hasPermiOr(action.permi, false);
18936
+ if (!cellIndex) {
18937
+ action._vIf = vIf;
18938
+ return;
18939
+ }
18940
+ const {
18941
+ colIndex,
18942
+ rowIndex,
18943
+ index: index2
18944
+ } = cellIndex;
18945
+ rowActionsVIfMap[`${colIndex}.${rowIndex}.${index2}`] = vIf;
18946
+ }
18947
+ function getActionSeparator(action, cellIndex) {
18948
+ const {
18949
+ index: index2,
18950
+ colIndex,
18951
+ rowIndex
18952
+ } = cellIndex;
18953
+ if (index2 <= 0) return false;
18954
+ if (isEmpty(colIndex) && isEmpty(rowIndex)) {
18955
+ if (action._vIf === false) return false;
18956
+ for (let i = index2 - 1; i >= 0; i--) {
18957
+ const previousAction = reProps.value.actions[i];
18958
+ if (previousAction._vIf !== false) return true;
18959
+ }
18960
+ return false;
18961
+ }
18962
+ if (rowActionsVIfMap[`${colIndex}.${rowIndex}.${index2}`] === false) return false;
18963
+ for (let i = index2 - 1; i >= 0; i--) {
18964
+ const previousVIf = rowActionsVIfMap[`${colIndex}.${rowIndex}.${i}`];
18965
+ if (previousVIf !== false) return true;
18966
+ }
18967
+ return false;
18968
+ }
18919
18969
  const expose = {};
18920
18970
  vue.onMounted(() => {
18921
18971
  Object.assign(expose, tableRef.value);
@@ -18961,11 +19011,14 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
18961
19011
  }, {
18962
19012
  default: vue.withCtx(() => [vue.createElementVNode("div", _hoisted_2$2, [vue.createVNode(vue.unref(tdesignVueNext.Space), {
18963
19013
  align: "center",
18964
- size: "small"
19014
+ size: 0
18965
19015
  }, {
18966
19016
  default: vue.withCtx(() => [vue.renderSlot(_ctx.$slots, "actions", {}, () => [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(reProps.value.actions, (item, index2) => {
18967
- return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$i), {
18968
- key: item.uid || index2,
19017
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
19018
+ key: item.uid || index2
19019
+ }, [getActionSeparator(item, {
19020
+ index: index2
19021
+ }) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_3$1)) : vue.createCommentVNode("", true), vue.withDirectives(vue.createVNode(vue.unref(_sfc_main$i), {
18969
19022
  context: getConfigRendererCtx(item),
18970
19023
  config: {
18971
19024
  is: vue.unref(tdesignVueNext.Button),
@@ -18973,8 +19026,9 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
18973
19026
  form: void 0,
18974
19027
  onClick: buildActionOnClick(item),
18975
19028
  disabled: buildActionDisabled(item)
18976
- }
18977
- }, null, 8, ["context", "config"])), [[vue.unref(vHasPermi), item.permi]]);
19029
+ },
19030
+ onVIfChange: (vIf) => setActionVIf(vIf, item)
19031
+ }, null, 8, ["context", "config", "onVIfChange"]), [[vue.unref(vHasPermi), item.permi]])], 64);
18978
19032
  }), 128))], true)]),
18979
19033
  _: 3
18980
19034
  }), vue.createVNode(vue.unref(tdesignVueNext.Space), {
@@ -19066,19 +19120,29 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
19066
19120
  onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
19067
19121
  }, ["stop"]))
19068
19122
  }, {
19069
- separator: vue.withCtx(() => [vue.createVNode(vue.unref(tdesignVueNext.Divider), {
19070
- layout: "vertical"
19071
- })]),
19072
19123
  default: vue.withCtx(() => [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(reProps.value.rowActions, (item, index2) => {
19073
- return vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(_sfc_main$i), {
19074
- key: item.uid || index2,
19124
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
19125
+ key: item.uid || index2
19126
+ }, [getActionSeparator(item, {
19127
+ colIndex: slotProps.colIndex,
19128
+ rowIndex: slotProps.rowIndex,
19129
+ index: index2
19130
+ }) ? (vue.openBlock(), vue.createBlock(vue.unref(tdesignVueNext.Divider), {
19131
+ key: 0,
19132
+ layout: "vertical"
19133
+ })) : vue.createCommentVNode("", true), vue.withDirectives(vue.createVNode(vue.unref(_sfc_main$i), {
19075
19134
  context: getConfigRendererCtx(item, slotProps),
19076
19135
  config: {
19077
19136
  is: vue.unref(tdesignVueNext.Link),
19078
19137
  ...item,
19079
19138
  onClick: buildActionOnClick(item, slotProps)
19080
- }
19081
- }, null, 8, ["context", "config"])), [[vue.unref(vHasPermi), item.permi]]);
19139
+ },
19140
+ onVIfChange: (vIf) => setActionVIf(vIf, item, {
19141
+ colIndex: slotProps.colIndex,
19142
+ rowIndex: slotProps.rowIndex,
19143
+ index: index2
19144
+ })
19145
+ }, null, 8, ["context", "config", "onVIfChange"]), [[vue.unref(vHasPermi), item.permi]])], 64);
19082
19146
  }), 128))]),
19083
19147
  _: 2
19084
19148
  }, 1024)) : vue.createCommentVNode("", true)], true)]),
@@ -19106,7 +19170,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
19106
19170
  };
19107
19171
  }
19108
19172
  });
19109
- const table = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-7532ec3d"]]);
19173
+ const table = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-5082b588"]]);
19110
19174
  const _hoisted_1$2 = {
19111
19175
  key: 0,
19112
19176
  class: "qd-crud-list__header"
@@ -28305,7 +28369,7 @@ class NodeFilterFactory extends BaseFilterFactory {
28305
28369
  }
28306
28370
  class NodeCanvasFactory extends BaseCanvasFactory {
28307
28371
  _createCanvas(width, height) {
28308
- const require$1 = process.getBuiltinModule("module").createRequire(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-tSsnJxCl.js", document.baseURI).href);
28372
+ const require$1 = process.getBuiltinModule("module").createRequire(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("index-BCeJc-jC.js", document.baseURI).href);
28309
28373
  const canvas = require$1("@napi-rs/canvas");
28310
28374
  return canvas.createCanvas(width, height);
28311
28375
  }
@@ -55389,4 +55453,4 @@ exports.useDictDynamic = useDictDynamic;
55389
55453
  exports.useDisabled = useDisabled;
55390
55454
  exports.useModal = useModal;
55391
55455
  exports.useReadonly = useReadonly;
55392
- //# sourceMappingURL=index-tSsnJxCl.js.map
55456
+ //# sourceMappingURL=index-BCeJc-jC.js.map