@ailaw/venus 0.3.16 → 0.3.17

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.
Files changed (2) hide show
  1. package/dist/venus.es.js +93 -54
  2. package/package.json +1 -1
package/dist/venus.es.js CHANGED
@@ -17,9 +17,9 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, ref as ref$1, watch, computed, toRefs as toRefs$1, shallowRef, onMounted } from "vue-demi";
20
+ import { defineComponent, ref as ref$1, watch, computed, toRefs as toRefs$1, shallowRef } from "vue-demi";
21
21
  import { Select, Modal, Form, Input, Checkbox, Divider, Button, Tag, Tooltip, Upload, Row, Col, Radio, Table, Badge, Card, message } from "ant-design-vue";
22
- import { useQuery, useResult, useMutation } from "@vue/apollo-composable";
22
+ import { useQuery, useResult, useMutation, useApolloClient } from "@vue/apollo-composable";
23
23
  import gql from "graphql-tag";
24
24
  import { path, uniqBy, prop } from "ramda";
25
25
  import "vue";
@@ -2227,18 +2227,25 @@ var __vue2_script$5 = defineComponent({
2227
2227
  key: "taskName",
2228
2228
  scopedSlots: { customRender: "taskName" }
2229
2229
  },
2230
+ {
2231
+ title: t("message.assignee"),
2232
+ dataIndex: "isEmployee",
2233
+ key: "isEmployee",
2234
+ width: 120,
2235
+ scopedSlots: { customRender: "isEmployee" }
2236
+ },
2230
2237
  {
2231
2238
  title: t("message.tag"),
2232
2239
  dataIndex: "tagList",
2233
2240
  key: "tagList",
2234
- width: 250,
2241
+ width: 120,
2235
2242
  scopedSlots: { customRender: "tagList" }
2236
2243
  },
2237
2244
  {
2238
2245
  title: "Operation",
2239
2246
  dataIndex: "id",
2240
2247
  key: "id",
2241
- width: 225,
2248
+ width: 210,
2242
2249
  scopedSlots: { customRender: "operation" }
2243
2250
  }
2244
2251
  ];
@@ -2256,7 +2263,9 @@ var render$5 = function() {
2256
2263
  return _c("div", [_c("ant-table", { attrs: { "dataSource": _vm.dataSource, "rowKey": "id", "columns": _vm.columns, "pagination": _vm.pagination, "loading": _vm.loading }, on: { "change": function($event) {
2257
2264
  return _vm.$emit("changePagination", $event);
2258
2265
  } }, scopedSlots: _vm._u([{ key: "taskName", fn: function(text, record) {
2259
- return _c("span", {}, [_c("span", { staticStyle: { "display": "inline-block", "width": "250px" } }, [_vm._v(_vm._s(text))]), _c("assignee-tag", { attrs: { "assignee-type": record.isEmployee } })], 1);
2266
+ return _c("span", {}, [_c("span", { staticStyle: { "display": "inline-block", "width": "250px" } }, [_vm._v(_vm._s(text))])]);
2267
+ } }, { key: "isEmployee", fn: function(isEmployee) {
2268
+ return _c("span", {}, [_c("assignee-tag", { attrs: { "assignee-type": isEmployee } })], 1);
2260
2269
  } }, { key: "tagList", fn: function(tags) {
2261
2270
  return [_c("tags-with-tooltip", { attrs: { "tags": tags } })];
2262
2271
  } }, { key: "operation", fn: function(_, record) {
@@ -2272,7 +2281,7 @@ var render$5 = function() {
2272
2281
  var staticRenderFns$5 = [];
2273
2282
  var TaskTablePure_vue_vue_type_style_index_0_scoped_true_lang = "";
2274
2283
  const __cssModules$5 = {};
2275
- var __component__$5 = /* @__PURE__ */ normalizeComponent(__vue2_script$5, render$5, staticRenderFns$5, false, __vue2_injectStyles$5, "4d629a0a", null, null);
2284
+ var __component__$5 = /* @__PURE__ */ normalizeComponent(__vue2_script$5, render$5, staticRenderFns$5, false, __vue2_injectStyles$5, "cbdc9a40", null, null);
2276
2285
  function __vue2_injectStyles$5(context) {
2277
2286
  for (let o in __cssModules$5) {
2278
2287
  this[o] = __cssModules$5[o];
@@ -2284,12 +2293,18 @@ var TaskTablePure = /* @__PURE__ */ function() {
2284
2293
  var useSearchTaskTemplates = (pagination, conditions = ref$1({}), lawFirmId) => {
2285
2294
  const startIndex = computed(() => (pagination.value.current - 1) * pagination.value.pageSize);
2286
2295
  const endIndex = computed(() => startIndex.value + pagination.value.pageSize);
2296
+ watch(() => conditions.value, () => {
2297
+ pagination.value.current = 1;
2298
+ pagination.value.total = 0;
2299
+ });
2287
2300
  return useQuery(SearchTaskTemplatesQuery, () => ({
2288
2301
  query: {
2289
2302
  includeGallery: true,
2290
2303
  keywords: conditions.value.keywords || "",
2291
2304
  isEmployee: conditions.value.isEmployee,
2292
- taskTemplateId: conditions.value.taskTemplateId
2305
+ taskTemplateId: conditions.value.taskTemplateId,
2306
+ sortBy: TaskTemplateSortBy.name,
2307
+ sortOrder: SortOrder.asc
2293
2308
  },
2294
2309
  startIndex: startIndex.value,
2295
2310
  endIndex: endIndex.value,
@@ -2360,11 +2375,11 @@ var useSearchTaskConditions = () => ref$1({
2360
2375
  var useTaskTemplateTableData = (props, emit) => {
2361
2376
  const initialPagination = ref$1({
2362
2377
  current: 1,
2363
- pageSize: props.pageSize || 6,
2378
+ pageSize: props.pageSize || 10,
2364
2379
  total: 0
2365
2380
  });
2366
2381
  const { conditions = useSearchTaskConditions(), addedTasks = ref$1([]) } = toRefs$1(props);
2367
- const { result, loading, refetch } = useSearchTaskTemplates(initialPagination, conditions, props.lawFirmId);
2382
+ const { result, loading, refetch, variables } = useSearchTaskTemplates(initialPagination, conditions, props.lawFirmId);
2368
2383
  const dataSource = computed(() => {
2369
2384
  var _a;
2370
2385
  return ((_a = result.value) == null ? void 0 : _a.taskTemplateSearch.taskTemplateList) || [];
@@ -2391,7 +2406,8 @@ var useTaskTemplateTableData = (props, emit) => {
2391
2406
  loading,
2392
2407
  refetch,
2393
2408
  conditions,
2394
- addedTasks
2409
+ addedTasks,
2410
+ variables
2395
2411
  };
2396
2412
  };
2397
2413
  var __vue2_script$4 = defineComponent({
@@ -2422,6 +2438,7 @@ var __vue2_script$4 = defineComponent({
2422
2438
  refetch,
2423
2439
  dataSource,
2424
2440
  pagination,
2441
+ variables,
2425
2442
  changePagination,
2426
2443
  addTask,
2427
2444
  editTask,
@@ -2436,7 +2453,8 @@ var __vue2_script$4 = defineComponent({
2436
2453
  changePagination,
2437
2454
  addTask,
2438
2455
  editTask,
2439
- removeTask
2456
+ removeTask,
2457
+ variables
2440
2458
  };
2441
2459
  }
2442
2460
  });
@@ -2451,7 +2469,7 @@ var render$4 = function() {
2451
2469
  var staticRenderFns$4 = [];
2452
2470
  var TaskTable_vue_vue_type_style_index_0_scoped_true_lang = "";
2453
2471
  const __cssModules$4 = {};
2454
- var __component__$4 = /* @__PURE__ */ normalizeComponent(__vue2_script$4, render$4, staticRenderFns$4, false, __vue2_injectStyles$4, "1967a3da", null, null);
2472
+ var __component__$4 = /* @__PURE__ */ normalizeComponent(__vue2_script$4, render$4, staticRenderFns$4, false, __vue2_injectStyles$4, "36a91f4e", null, null);
2455
2473
  function __vue2_injectStyles$4(context) {
2456
2474
  for (let o in __cssModules$4) {
2457
2475
  this[o] = __cssModules$4[o];
@@ -2489,17 +2507,23 @@ var __vue2_script$3 = defineComponent({
2489
2507
  },
2490
2508
  pageSize: {
2491
2509
  type: Number
2510
+ },
2511
+ openReviewButtonText: {
2512
+ type: String,
2513
+ default: "Review and add to template"
2492
2514
  }
2493
2515
  },
2494
2516
  setup(props, { emit }) {
2495
- const taskTable = ref$1(null);
2517
+ const taskTable = ref$1();
2496
2518
  const conditions = useSearchTaskConditions();
2497
2519
  const currentComponent = shallowRef(props.showPage ? Card : Modal);
2498
2520
  const editAction = (record) => {
2499
2521
  emit("edit", record);
2500
2522
  };
2523
+ const getVariables = () => taskTable.value.variables;
2501
2524
  return {
2502
2525
  editAction,
2526
+ getVariables,
2503
2527
  taskTable,
2504
2528
  conditions,
2505
2529
  AssigneeTypes,
@@ -2518,7 +2542,7 @@ var render$3 = function() {
2518
2542
  return _vm.$emit("update:visible", false);
2519
2543
  } } }, [_vm._v("Cancel ")]), _c("ant-badge", { attrs: { "count": _vm.addedTasks.length } }, [_c("ant-button", { attrs: { "disabled": _vm.addedTasks.length === 0, "type": "primary" }, on: { "click": function($event) {
2520
2544
  return _vm.$emit("update:reviewModalVisible", true);
2521
- } } }, [_vm._v(" " + _vm._s(_vm.$t("message.reviewTasks")) + " ")])], 1)];
2545
+ } } }, [_vm._v(" " + _vm._s(_vm.openReviewButtonText) + " ")])], 1)];
2522
2546
  }, proxy: true }]) }, [_c("task-template-filter", { attrs: { "show-task-home-page-link": true, "task-setting-page-url": _vm.taskSettingPageUrl, "conditions": _vm.conditions, "inline": !!_vm.showPage }, on: { "update:conditions": function($event) {
2523
2547
  _vm.conditions = $event;
2524
2548
  }, "update:newTaskVisible": function($event) {
@@ -2540,7 +2564,7 @@ var render$3 = function() {
2540
2564
  var staticRenderFns$3 = [];
2541
2565
  var MainModal_vue_vue_type_style_index_0_scoped_true_lang = "";
2542
2566
  const __cssModules$3 = {};
2543
- var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, "361a725f", null, null);
2567
+ var __component__$3 = /* @__PURE__ */ normalizeComponent(__vue2_script$3, render$3, staticRenderFns$3, false, __vue2_injectStyles$3, "08dd7b2c", null, null);
2544
2568
  function __vue2_injectStyles$3(context) {
2545
2569
  for (let o in __cssModules$3) {
2546
2570
  this[o] = __cssModules$3[o];
@@ -2747,6 +2771,10 @@ var __vue2_script$1 = defineComponent({
2747
2771
  type: String,
2748
2772
  default: "Add"
2749
2773
  },
2774
+ openReviewButtonText: {
2775
+ type: String,
2776
+ default: "Review and add to template"
2777
+ },
2750
2778
  showSendEmail: {
2751
2779
  type: Boolean,
2752
2780
  default: false
@@ -2771,6 +2799,7 @@ var __vue2_script$1 = defineComponent({
2771
2799
  }
2772
2800
  },
2773
2801
  setup(props, { emit }) {
2802
+ const { client } = useApolloClient();
2774
2803
  const mainModal = ref$1();
2775
2804
  const reviewModal = ref$1();
2776
2805
  const newTaskVisible = ref$1(false);
@@ -2779,41 +2808,51 @@ var __vue2_script$1 = defineComponent({
2779
2808
  const updateTemplate = useMutateTaskTemplate();
2780
2809
  const createTemplate = useCreateTaskTemplate();
2781
2810
  const addedTasks = ref$1([]);
2782
- onMounted(() => {
2783
- const { value, lawFirmId } = props;
2784
- if (!value.length)
2785
- return;
2786
- const conditions = ref$1({
2787
- taskTemplateId: value
2788
- });
2789
- const { result } = useSearchTaskTemplates(ref$1({ current: 1, pageSize: 1e3, total: 0 }), conditions, lawFirmId);
2790
- watch(() => result.value, () => {
2791
- var _a, _b;
2792
- addedTasks.value = ((_b = (_a = result.value) == null ? void 0 : _a.taskTemplateSearch) == null ? void 0 : _b.taskTemplateList) || [];
2793
- });
2794
- });
2795
2811
  watch(() => newTaskVisible.value, (visible) => {
2796
2812
  if (!visible) {
2797
2813
  tempTask.value = defaultTaskTemplate;
2798
2814
  }
2799
2815
  });
2816
+ const updateReviewModalContent = (record, newRecord) => {
2817
+ if (reviewModalVisible.value) {
2818
+ const newValue = addedTasks.value.map((originTask) => {
2819
+ if (originTask.id === record.taskTemplateId) {
2820
+ return newRecord;
2821
+ }
2822
+ return originTask;
2823
+ });
2824
+ emit("update:value", newValue.map(({ id }) => id));
2825
+ }
2826
+ };
2800
2827
  const _submit = async (record) => {
2828
+ const variables = mainModal.value.getVariables();
2829
+ const existed = client.readQuery({
2830
+ query: SearchTaskTemplatesQuery,
2831
+ variables
2832
+ });
2801
2833
  const {
2802
2834
  newRecord,
2803
2835
  success
2804
2836
  } = await submit(record, updateTemplate, createTemplate);
2805
2837
  if (success) {
2838
+ client.writeQuery({
2839
+ query: SearchTaskTemplatesQuery,
2840
+ data: {
2841
+ taskTemplateSearch: __spreadProps(__spreadValues({}, existed.taskTemplateSearch), {
2842
+ taskTemplateList: existed.taskTemplateSearch.taskTemplateList.map((record2) => {
2843
+ if (record2.id === newRecord.id) {
2844
+ return __spreadProps(__spreadValues({}, newRecord), {
2845
+ isGallery: record2.isGallery
2846
+ });
2847
+ }
2848
+ return record2;
2849
+ })
2850
+ })
2851
+ },
2852
+ variables
2853
+ });
2806
2854
  newTaskVisible.value = false;
2807
- mainModal.value.taskTable.refetch();
2808
- if (reviewModalVisible.value) {
2809
- const newValue = addedTasks.value.map((originTask) => {
2810
- if (originTask.id === record.taskTemplateId) {
2811
- return newRecord;
2812
- }
2813
- return originTask;
2814
- });
2815
- emit("update:value", newValue.map(({ id }) => id));
2816
- }
2855
+ updateReviewModalContent(record, newRecord);
2817
2856
  }
2818
2857
  };
2819
2858
  const submitting = computed(() => updateTemplate.loading.value || createTemplate.loading.value);
@@ -2840,10 +2879,14 @@ var render$1 = function() {
2840
2879
  var _vm = this;
2841
2880
  var _h = _vm.$createElement;
2842
2881
  var _c = _vm._self._c || _h;
2843
- return _c("div", { attrs: { "id": "venus-component-task-cart" } }, [_c("main-modal", { ref: "mainModal", attrs: { "task-setting-page-url": _vm.taskSettingPageUrl, "tempTask": _vm.tempTask, "newTaskVisible": _vm.newTaskVisible, "reviewModalVisible": _vm.reviewModalVisible, "added-tasks": _vm.addedTasks, "law-firm-id": _vm.lawFirmId, "visible": _vm.visible, "show-page": _vm.pageMode, "page-size": _vm.pageSize }, on: { "update:tempTask": function($event) {
2882
+ return _c("div", { attrs: { "id": "venus-component-task-cart" } }, [_c("main-modal", { ref: "mainModal", attrs: { "visible": _vm.visible, "show-page": _vm.pageMode, "page-size": _vm.pageSize, "law-firm-id": _vm.lawFirmId, "tempTask": _vm.tempTask, "added-tasks": _vm.addedTasks, "newTaskVisible": _vm.newTaskVisible, "task-setting-page-url": _vm.taskSettingPageUrl, "reviewModalVisible": _vm.reviewModalVisible, "open-review-button-text": _vm.openReviewButtonText }, on: { "update:tempTask": function($event) {
2844
2883
  _vm.tempTask = $event;
2845
2884
  }, "update:temp-task": function($event) {
2846
2885
  _vm.tempTask = $event;
2886
+ }, "update:addedTasks": function($event) {
2887
+ _vm.addedTasks = $event;
2888
+ }, "update:added-tasks": function($event) {
2889
+ _vm.addedTasks = $event;
2847
2890
  }, "update:newTaskVisible": function($event) {
2848
2891
  _vm.newTaskVisible = $event;
2849
2892
  }, "update:new-task-visible": function($event) {
@@ -2852,37 +2895,33 @@ var render$1 = function() {
2852
2895
  _vm.reviewModalVisible = $event;
2853
2896
  }, "update:review-modal-visible": function($event) {
2854
2897
  _vm.reviewModalVisible = $event;
2855
- }, "update:addedTasks": function($event) {
2856
- _vm.addedTasks = $event;
2857
- }, "update:added-tasks": function($event) {
2858
- _vm.addedTasks = $event;
2859
- }, "update:visible": function($event) {
2898
+ }, "edit": _vm.showEdit, "update:visible": function($event) {
2860
2899
  return _vm.$emit("update:visible", $event);
2861
- }, "edit": _vm.showEdit }, scopedSlots: _vm._u([{ key: "default", fn: function(ref2) {
2900
+ } }, scopedSlots: _vm._u([{ key: "default", fn: function(ref2) {
2862
2901
  var loading = ref2.loading;
2863
2902
  var dataSource = ref2.dataSource;
2864
2903
  var pagination = ref2.pagination;
2865
2904
  var changePagination = ref2.changePagination;
2866
2905
  return [_vm._t("table", null, { "loading": loading, "dataSource": dataSource, "pagination": pagination, "changePagination": changePagination })];
2867
- } }], null, true) }), _c("review-modal", { ref: "reviewModal", attrs: { "tempTask": _vm.tempTask, "visible": _vm.reviewModalVisible, "newTaskVisible": _vm.newTaskVisible, "added-tasks": _vm.addedTasks, "review-text": _vm.reviewText, "showSendEmail": _vm.showSendEmail, "sendEmail": _vm.sendEmail, "allow-clear": _vm.allowClear }, on: { "update:tempTask": function($event) {
2906
+ } }], null, true) }), _c("review-modal", { ref: "reviewModal", attrs: { "sendEmail": _vm.sendEmail, "allow-clear": _vm.allowClear, "tempTask": _vm.tempTask, "review-text": _vm.reviewText, "added-tasks": _vm.addedTasks, "showSendEmail": _vm.showSendEmail, "visible": _vm.reviewModalVisible, "newTaskVisible": _vm.newTaskVisible }, on: { "update:tempTask": function($event) {
2868
2907
  _vm.tempTask = $event;
2869
2908
  }, "update:temp-task": function($event) {
2870
2909
  _vm.tempTask = $event;
2910
+ }, "update:addedTasks": function($event) {
2911
+ _vm.addedTasks = $event;
2912
+ }, "update:added-tasks": function($event) {
2913
+ _vm.addedTasks = $event;
2871
2914
  }, "update:visible": function($event) {
2872
2915
  _vm.reviewModalVisible = $event;
2873
2916
  }, "update:newTaskVisible": function($event) {
2874
2917
  _vm.newTaskVisible = $event;
2875
2918
  }, "update:new-task-visible": function($event) {
2876
2919
  _vm.newTaskVisible = $event;
2877
- }, "update:addedTasks": function($event) {
2878
- _vm.addedTasks = $event;
2879
- }, "update:added-tasks": function($event) {
2880
- _vm.addedTasks = $event;
2881
- }, "update:sendEmail": function($event) {
2882
- return _vm.$emit("update:sendEmail", $event);
2883
2920
  }, "submit": function($event) {
2884
2921
  return _vm.$emit("submit", $event);
2885
- } } }), _c("new-task", { attrs: { "value": _vm.tempTask, "visible": _vm.newTaskVisible, "upload-files-func": _vm.uploadFilesFunc, "law-firm-id": _vm.lawFirmId, "user-id": _vm.userId, "loading": _vm.submitting }, on: { "update:value": function($event) {
2922
+ }, "update:sendEmail": function($event) {
2923
+ return _vm.$emit("update:sendEmail", $event);
2924
+ } } }), _c("new-task", { attrs: { "user-id": _vm.userId, "loading": _vm.submitting, "value": _vm.tempTask, "law-firm-id": _vm.lawFirmId, "visible": _vm.newTaskVisible, "upload-files-func": _vm.uploadFilesFunc }, on: { "update:value": function($event) {
2886
2925
  _vm.tempTask = $event;
2887
2926
  }, "update:visible": function($event) {
2888
2927
  _vm.newTaskVisible = $event;
@@ -2891,7 +2930,7 @@ var render$1 = function() {
2891
2930
  var staticRenderFns$1 = [];
2892
2931
  var index_vue_vue_type_style_index_0_scoped_true_lang = "";
2893
2932
  const __cssModules$1 = {};
2894
- var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, "353be676", null, null);
2933
+ var __component__$1 = /* @__PURE__ */ normalizeComponent(__vue2_script$1, render$1, staticRenderFns$1, false, __vue2_injectStyles$1, "21942322", null, null);
2895
2934
  function __vue2_injectStyles$1(context) {
2896
2935
  for (let o in __cssModules$1) {
2897
2936
  this[o] = __cssModules$1[o];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ailaw/venus",
3
- "version": "0.3.16",
3
+ "version": "0.3.17",
4
4
  "files": [
5
5
  "dist"
6
6
  ],