@yugu-ui/flow-ui 0.1.25 → 0.1.27

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.
@@ -217,6 +217,8 @@ export interface WflowTodoDetail {
217
217
  nodes?: WflowTodoNode[];
218
218
  /** 当前用户能否处理 */
219
219
  can_handle?: boolean;
220
+ /** 当前用户能否撤回(false 无撤回权限) */
221
+ can_recall?: boolean;
220
222
  /** 当前用户是否发起人 */
221
223
  is_initor?: boolean;
222
224
  /** 当前用户在本实例当前任务上的待办审批记录 ID(同意/驳回接口入参,非处理人时为 null) */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { NAvatar, NButton, NCard, NCheckbox, NCheckboxGroup, NCollapse, NCollapseItem, NDrawer, NDrawerContent, NEllipsis, NEmpty, NForm, NFormItem, NImage, NInput, NInputGroup, NInputGroupLabel, NInputNumber, NModal, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpace, NSpin, NSwitch, NTab, NTabs, NTag, NTooltip, useThemeVars } from "naive-ui";
1
+ import { NAvatar, NButton, NCard, NCheckbox, NCheckboxGroup, NCollapse, NCollapseItem, NDrawer, NDrawerContent, NDropdown, NEllipsis, NEmpty, NForm, NFormItem, NImage, NInput, NInputGroup, NInputGroupLabel, NInputNumber, NModal, NPopover, NRadio, NRadioButton, NRadioGroup, NSelect, NSpace, NSpin, NSwitch, NTab, NTabs, NTag, NTooltip, useThemeVars } from "naive-ui";
2
2
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, h, inject, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onMounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toRef, unref, useModel, useSlots, vModelText, vShow, watch, withCtx, withDirectives, withModifiers } from "vue";
3
3
  import { Graph } from "@antv/x6";
4
4
  import { VueShapeView, getTeleport, register } from "@antv/x6-vue-shape";
@@ -6523,8 +6523,16 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6523
6523
  const props = __props;
6524
6524
  /** 审批处理成功(同意/驳回接口调用成功) */
6525
6525
  const emit = __emit;
6526
- /** 是否展示操作按钮:审批模式且 undo_finished=0(未处理)才展示 */
6527
- const visible = computed(() => props.approval !== false && props.data?.undo_finished === 0);
6526
+ /** 是否展示同意/驳回:审批模式 + 可处理(can_handle 不为 false)+ 未处理(undo_finished=0) */
6527
+ const canApprove = computed(() => props.approval !== false && props.data?.can_handle !== false && props.data?.undo_finished === 0);
6528
+ /** 是否展示撤回:审批模式 + 未关闭撤回开关 + 可撤回(can_recall 不为 false;字段缺失时回落 undo_finished=0 保持旧接入行为) */
6529
+ const canRecall = computed(() => {
6530
+ if (props.approval === false || props.showWithdraw === false || !props.data) return false;
6531
+ if (props.data.can_recall !== void 0) return props.data.can_recall === true;
6532
+ return props.data.undo_finished === 0;
6533
+ });
6534
+ /** 是否展示操作按钮组:同意/驳回或撤回任一可见即展示 */
6535
+ const visible = computed(() => canApprove.value || canRecall.value);
6528
6536
  /** 驳回弹窗候选节点链:由 data 映射所得审批时间线(不含 END 结束节点) */
6529
6537
  const timelineNodes = computed(() => mapTimelineNodes(props.data));
6530
6538
  /** 审批弹窗显示状态 */
@@ -6591,7 +6599,7 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6591
6599
  align: "center"
6592
6600
  }, {
6593
6601
  default: withCtx(() => [
6594
- __props.showWithdraw ? (openBlock(), createBlock(unref(NButton), {
6602
+ canRecall.value ? (openBlock(), createBlock(unref(NButton), {
6595
6603
  key: 0,
6596
6604
  type: "warning",
6597
6605
  onClick: handleWithdraw
@@ -6599,23 +6607,25 @@ var FlowActions_default = /* @__PURE__ */ defineComponent({
6599
6607
  default: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("撤回", -1)])]),
6600
6608
  _: 1
6601
6609
  })) : createCommentVNode("", true),
6602
- createVNode(unref(NButton), {
6610
+ canApprove.value ? (openBlock(), createBlock(unref(NButton), {
6611
+ key: 1,
6603
6612
  type: "error",
6604
6613
  onClick: _cache[0] || (_cache[0] = ($event) => openApproval("reject"))
6605
6614
  }, {
6606
6615
  default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("驳回", -1)])]),
6607
6616
  _: 1
6608
- }),
6609
- createVNode(unref(NButton), {
6617
+ })) : createCommentVNode("", true),
6618
+ canApprove.value ? (openBlock(), createBlock(unref(NButton), {
6619
+ key: 2,
6610
6620
  type: "primary",
6611
6621
  onClick: _cache[1] || (_cache[1] = ($event) => openApproval("approve"))
6612
6622
  }, {
6613
6623
  default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("同意", -1)])]),
6614
6624
  _: 1
6615
- })
6625
+ })) : createCommentVNode("", true)
6616
6626
  ]),
6617
6627
  _: 1
6618
- })) : createCommentVNode("", true), visible.value ? (openBlock(), createBlock(ApprovalModal_default, {
6628
+ })) : createCommentVNode("", true), canApprove.value ? (openBlock(), createBlock(ApprovalModal_default, {
6619
6629
  key: 1,
6620
6630
  visible: approvalVisible.value,
6621
6631
  "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => approvalVisible.value = $event),
@@ -6674,6 +6684,38 @@ var FlowListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
6674
6684
  setup(__props, { emit: __emit }) {
6675
6685
  const props = __props;
6676
6686
  const emit = __emit;
6687
+ /** 卡片操作项 */
6688
+ const cardActions = computed(() => {
6689
+ const actions = [];
6690
+ if (props.showEdit) actions.push({
6691
+ key: "edit",
6692
+ label: "编辑"
6693
+ });
6694
+ if (props.showDelete) actions.push({
6695
+ key: "delete",
6696
+ label: "删除"
6697
+ });
6698
+ actions.push({
6699
+ key: "design",
6700
+ label: "配置"
6701
+ });
6702
+ return actions;
6703
+ });
6704
+ /** 唯一启用的操作(仅 1 个时直接展示按钮,不收下拉) */
6705
+ const soloAction = computed(() => cardActions.value.length === 1 ? cardActions.value[0] : void 0);
6706
+ const themeVars = useThemeVars();
6707
+ /** 「···」下拉选项(删除项用主题 error 色警示) */
6708
+ const dropdownOptions = computed(() => cardActions.value.map((action) => ({
6709
+ key: action.key,
6710
+ label: action.label,
6711
+ props: action.key === "delete" ? { style: { color: themeVars.value.errorColor } } : void 0
6712
+ })));
6713
+ /** 操作分发(编辑=卡片点击同链路,删除/配置各自上报,确认与接口由使用方处理) */
6714
+ function handleActionSelect(key) {
6715
+ if (key === "edit") emit("itemClick", props.item);
6716
+ else if (key === "delete") emit("delete", props.item);
6717
+ else emit("design", props.item);
6718
+ }
6677
6719
  /** 图标加载失败标记 */
6678
6720
  const imgFailed = ref(false);
6679
6721
  watch(() => props.item.icon, () => {
@@ -6686,9 +6728,10 @@ var FlowListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
6686
6728
  return (_ctx, _cache) => {
6687
6729
  const _component_NAvatar = NAvatar;
6688
6730
  const _component_NButton = NButton;
6731
+ const _component_NDropdown = NDropdown;
6689
6732
  return openBlock(), createElementBlock("div", {
6690
6733
  class: normalizeClass(["flow-item", { "flow-item--clickable": __props.clickable }]),
6691
- onClick: _cache[4] || (_cache[4] = ($event) => __props.clickable && emit("itemClick", __props.item))
6734
+ onClick: _cache[3] || (_cache[3] = ($event) => __props.clickable && emit("itemClick", __props.item))
6692
6735
  }, [
6693
6736
  createVNode(_component_NAvatar, {
6694
6737
  class: "flow-item__avatar",
@@ -6706,44 +6749,65 @@ var FlowListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/*
6706
6749
  class: "flow-item__label",
6707
6750
  title: __props.item.name
6708
6751
  }, toDisplayString(__props.item.name), 9, _hoisted_3$1),
6709
- __props.showActions ? (openBlock(), createElementBlock("div", _hoisted_4$1, [
6710
- __props.showEdit ? (openBlock(), createBlock(_component_NButton, {
6711
- key: 0,
6712
- class: "flow-item__btn",
6713
- size: "small",
6714
- quaternary: "",
6715
- type: "primary",
6716
- onClick: _cache[1] || (_cache[1] = ($event) => emit("itemClick", __props.item))
6717
- }, {
6718
- default: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode(" 编辑 ", -1)])]),
6719
- _: 1
6720
- })) : createCommentVNode("", true),
6721
- __props.showDelete ? (openBlock(), createBlock(_component_NButton, {
6722
- key: 1,
6723
- class: "flow-item__btn",
6752
+ __props.showActions ? (openBlock(), createElementBlock("div", _hoisted_4$1, [soloAction.value ? (openBlock(), createBlock(_component_NButton, {
6753
+ key: 0,
6754
+ class: "flow-item__btn",
6755
+ size: "small",
6756
+ type: soloAction.value.key === "delete" ? "error" : "primary",
6757
+ quaternary: soloAction.value.key !== "design",
6758
+ secondary: soloAction.value.key === "design",
6759
+ onClick: _cache[1] || (_cache[1] = ($event) => handleActionSelect(soloAction.value.key))
6760
+ }, {
6761
+ default: withCtx(() => [createTextVNode(toDisplayString(soloAction.value.label), 1)]),
6762
+ _: 1
6763
+ }, 8, [
6764
+ "type",
6765
+ "quaternary",
6766
+ "secondary"
6767
+ ])) : (openBlock(), createBlock(_component_NDropdown, {
6768
+ key: 1,
6769
+ trigger: "click",
6770
+ options: dropdownOptions.value,
6771
+ onSelect: handleActionSelect
6772
+ }, {
6773
+ default: withCtx(() => [createVNode(_component_NButton, {
6774
+ class: "flow-item__btn flow-item__more",
6724
6775
  size: "small",
6725
6776
  quaternary: "",
6726
- type: "error",
6727
- onClick: _cache[2] || (_cache[2] = ($event) => emit("delete", __props.item))
6728
- }, {
6729
- default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode(" 删除 ", -1)])]),
6730
- _: 1
6731
- })) : createCommentVNode("", true),
6732
- createVNode(_component_NButton, {
6733
- class: "flow-item__btn",
6734
- size: "small",
6735
- secondary: "",
6736
- type: "primary",
6737
- onClick: _cache[3] || (_cache[3] = ($event) => emit("design", __props.item))
6777
+ onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"]))
6738
6778
  }, {
6739
- default: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("配置", -1)])]),
6779
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [createElementVNode("svg", {
6780
+ "aria-hidden": "true",
6781
+ viewBox: "0 0 16 16",
6782
+ class: "flow-item__more-icon"
6783
+ }, [
6784
+ createElementVNode("circle", {
6785
+ cx: "3",
6786
+ cy: "8",
6787
+ r: "1.6",
6788
+ fill: "currentColor"
6789
+ }),
6790
+ createElementVNode("circle", {
6791
+ cx: "8",
6792
+ cy: "8",
6793
+ r: "1.6",
6794
+ fill: "currentColor"
6795
+ }),
6796
+ createElementVNode("circle", {
6797
+ cx: "13",
6798
+ cy: "8",
6799
+ r: "1.6",
6800
+ fill: "currentColor"
6801
+ })
6802
+ ], -1)])]),
6740
6803
  _: 1
6741
- })
6742
- ])) : createCommentVNode("", true)
6804
+ })]),
6805
+ _: 1
6806
+ }, 8, ["options"]))])) : createCommentVNode("", true)
6743
6807
  ], 2);
6744
6808
  };
6745
6809
  }
6746
- }), [["__scopeId", "data-v-0c9de524"]]);
6810
+ }), [["__scopeId", "data-v-c6d34e6e"]]);
6747
6811
  //#endregion
6748
6812
  //#region src/flow-list/modules/FlowListGroup.vue?vue&type=script&setup=true&lang.ts
6749
6813
  var _hoisted_1 = { class: "flow-group" };
package/dist/style.css CHANGED
@@ -2302,7 +2302,7 @@ to {
2302
2302
  width: 100%;
2303
2303
  }
2304
2304
 
2305
- .flow-item[data-v-0c9de524] {
2305
+ .flow-item[data-v-c6d34e6e] {
2306
2306
  display: flex;
2307
2307
  align-items: center;
2308
2308
  gap: 12px;
@@ -2316,32 +2316,32 @@ to {
2316
2316
  user-select: none;
2317
2317
  transition: transform 0.2s ease, box-shadow 0.2s ease;
2318
2318
  }
2319
- .flow-item[data-v-0c9de524]:hover {
2319
+ .flow-item[data-v-c6d34e6e]:hover {
2320
2320
  transform: translateY(-2px);
2321
2321
  /* Developed collaboratively with vscode - 改动代码行数: 1行(阴影色改用全局文本色变量) */
2322
2322
  box-shadow: rgb(var(--base-text-color)/0.25) 0 12px 28px;
2323
2323
  }
2324
- .flow-item[data-v-0c9de524]:active {
2324
+ .flow-item[data-v-c6d34e6e]:active {
2325
2325
  transform: translateY(0);
2326
2326
  /* Developed collaboratively with vscode - 改动代码行数: 1行(阴影色改用全局文本色变量) */
2327
2327
  box-shadow: rgb(var(--base-text-color)/0.15) 0 4px 12px;
2328
2328
  transition-duration: 0.08s;
2329
2329
  }
2330
- .flow-item[data-v-0c9de524] {
2330
+ .flow-item[data-v-c6d34e6e] {
2331
2331
  /* Developed collaboratively with vscode - 改动代码行数: 1行(clickable 卡片:pointer 光标明示可点击,hover 上浮动效沿用通用样式) */
2332
2332
  }
2333
- .flow-item--clickable[data-v-0c9de524] {
2333
+ .flow-item--clickable[data-v-c6d34e6e] {
2334
2334
  cursor: pointer;
2335
2335
  }
2336
- .flow-item__avatar[data-v-0c9de524] {
2336
+ .flow-item__avatar[data-v-c6d34e6e] {
2337
2337
  flex-shrink: 0;
2338
2338
  }
2339
- .flow-item__avatar-text[data-v-0c9de524] {
2339
+ .flow-item__avatar-text[data-v-c6d34e6e] {
2340
2340
  font-size: 15px;
2341
2341
  font-weight: 600;
2342
2342
  color: var(--fl-primary);
2343
2343
  }
2344
- .flow-item__label[data-v-0c9de524] {
2344
+ .flow-item__label[data-v-c6d34e6e] {
2345
2345
  display: -webkit-box;
2346
2346
  flex-grow: 1;
2347
2347
  /* Developed collaboratively with vscode - 改动代码行数: 3行(中英混排按字符接排换行:不整体掉词填满行宽,防止收缩被内容撑破) */
@@ -2355,11 +2355,22 @@ to {
2355
2355
  -webkit-box-orient: vertical;
2356
2356
  -webkit-line-clamp: 2;
2357
2357
  }
2358
- .flow-item__actions[data-v-0c9de524] {
2358
+ .flow-item__actions[data-v-c6d34e6e] {
2359
2359
  display: flex;
2360
2360
  flex-shrink: 0;
2361
2361
  gap: 6px;
2362
2362
  }
2363
+ .flow-item[data-v-c6d34e6e] {
2364
+ /* Developed collaboratively with vscode - 新增9行(「···」更多按钮:收窄内边距成紧凑方钮,三点图标居中) */
2365
+ }
2366
+ .flow-item__more[data-v-c6d34e6e] {
2367
+ padding: 0 8px;
2368
+ }
2369
+ .flow-item__more-icon[data-v-c6d34e6e] {
2370
+ display: block;
2371
+ width: 16px;
2372
+ height: 16px;
2373
+ }
2363
2374
  .flow-group[data-v-0587937e] {
2364
2375
  padding: 0 20px;
2365
2376
  background: var(--fl-card-color);
@@ -3,7 +3,7 @@ import { WflowTodoDetail, WflowTodoRecord } from '../adapter/wflow';
3
3
  /** display 模式原始详情数据:节点快照自带任务状态与每人处理结果 + status/finished 实例状态 */
4
4
  export type FlowTimelineData = Pick<WflowTodoDetail, 'nodes' | 'finished' | 'status'>;
5
5
  /** FlowActions 审批操作数据:FlowTimelineData 基础上补充 undo_id(同意/驳回接口入参)与 undo_finished(操作按钮显隐)——待办详情接口整份数据可直接传入 */
6
- export type FlowApprovalData = FlowTimelineData & Pick<WflowTodoDetail, 'undo_id' | 'undo_finished'>;
6
+ export type FlowApprovalData = FlowTimelineData & Pick<WflowTodoDetail, 'undo_id' | 'undo_finished' | 'can_handle' | 'can_recall'>;
7
7
  /** 流程状态枚举(接口 status:-1 已驳回 / 0 已撤销 / 1 审批中 / 2 已通过) */
8
8
  export declare enum FlowStatus {
9
9
  Rejected = -1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yugu-ui/flow-ui",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "堉古商城流程组件库:流程设计器(config)/ 审批时间线(timeline)/ 流程列表(FlowList)",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",