@ailaw/venus 0.4.7 → 0.5.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.
Files changed (2) hide show
  1. package/dist/venus.es.js +50 -42
  2. package/package.json +1 -9
package/dist/venus.es.js CHANGED
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { defineComponent, ref, watch, computed, toRefs, getCurrentScope, shallowRef } from "vue-demi";
20
+ import { defineComponent, ref, watch, reactive, computed, toRefs, getCurrentScope, shallowRef } from "vue-demi";
21
21
  import { Select, Modal, Form, Input, Checkbox, Divider, Button, Upload, Tag, Tooltip, Row, Col, Radio, Popconfirm, Table, Badge, Card, message } from "ant-design-vue";
22
22
  import { useQuery, useResult, useMutation, useApolloClient } from "@vue/apollo-composable";
23
23
  import gql from "graphql-tag";
@@ -192,27 +192,37 @@ const profilesQuery = gql`
192
192
  id
193
193
  profileType
194
194
  profileName
195
+ accountList {
196
+ id
197
+ email
198
+ }
195
199
  }
196
200
  }
197
201
  }
198
202
  `;
199
203
  const addProfileUserMutation = gql`
200
- mutation addProfileUser(
201
- $email: String
202
- $name: String
203
- $petitionerProfileName: String
204
+ mutation AddProfileUser(
204
205
  $lawFirmId: Int!
206
+ $name: String!
207
+ $profileType: ProfileType
208
+ $email: String!
209
+ $sendEmail: Boolean!
205
210
  ) {
206
- addProfileUserNoNotify(
207
- email: $email
208
- name: $name
209
- petitionerProfileName: $petitionerProfileName
211
+ addProfileUser(
210
212
  selfLawFirmId: $lawFirmId
213
+ name: $name
214
+ profileType: $profileType
215
+ email: $email
216
+ sendEmail: $sendEmail
211
217
  ) {
212
218
  profile {
213
219
  id
214
220
  profileName
215
221
  profileType
222
+ accountList {
223
+ id
224
+ email
225
+ }
216
226
  }
217
227
  }
218
228
  }
@@ -220,19 +230,12 @@ const addProfileUserMutation = gql`
220
230
  function useCreateProfile() {
221
231
  const me = useMe();
222
232
  const { mutate, loading } = useMutation(addProfileUserMutation);
223
- const createProfile = async (profile) => {
233
+ const createProfile = async (variables) => {
224
234
  var _a;
225
- const variables = {
226
- email: profile.email,
235
+ const result = await mutate(__spreadProps(__spreadValues({}, variables), {
227
236
  lawFirmId: (_a = me.value) == null ? void 0 : _a.lawFirmId
228
- };
229
- if (profile.profileType === "USERPROFILE") {
230
- variables.name = profile.profileName;
231
- } else {
232
- variables.petitionerProfileName = profile.profileName;
233
- }
234
- const result = await mutate(variables);
235
- return path(["data", "addProfileUserNoNotify", "profile"], result);
237
+ }));
238
+ return path(["data", "addProfileUser", "profile"], result);
236
239
  };
237
240
  return { createProfile, loading };
238
241
  }
@@ -290,26 +293,35 @@ var __vue2_script$h = defineComponent({
290
293
  Checkbox
291
294
  },
292
295
  setup(_, { emit }) {
293
- const value = ref({});
294
- const shouldSendPassword = ref(false);
295
- const canSubmit = computed(() => value.value.profileName && value.value.profileType);
296
+ const value = reactive({
297
+ profileType: void 0,
298
+ name: "",
299
+ email: "",
300
+ sendEmail: false
301
+ });
302
+ const canSubmit = computed(() => {
303
+ if (value.name === "" || value.profileType == null)
304
+ return false;
305
+ if (value.email !== "" && !value.email.includes("@"))
306
+ return false;
307
+ return true;
308
+ });
296
309
  const rules = {
297
310
  profileType: { required: true },
298
- profileName: { required: true },
311
+ name: { required: true },
299
312
  email: { type: "email" }
300
313
  };
301
- const clearValue = () => value.value = {};
314
+ const clearValue = () => Object.assign(value, {});
302
315
  const { createProfile, loading } = useCreateProfile();
303
316
  const hide = () => emit("cancel");
304
317
  const handleSubmit = async () => {
305
- const profile = await createProfile(value.value);
318
+ const profile = await createProfile(value);
306
319
  hide();
307
320
  emit("profile-created", profile);
308
321
  };
309
322
  return {
310
323
  value,
311
324
  rules,
312
- shouldSendPassword,
313
325
  clearValue,
314
326
  loading,
315
327
  canSubmit,
@@ -321,15 +333,15 @@ var render$h = function() {
321
333
  var _vm = this;
322
334
  var _h = _vm.$createElement;
323
335
  var _c = _vm._self._c || _h;
324
- return _c("modal", _vm._g(_vm._b({ attrs: { "closable": false, "ok-text": "Create", "width": 320, "okButtonProps": { props: { disabled: !_vm.canSubmit, loading: _vm.loading } } }, on: { "cancel": _vm.clearValue, "ok": _vm.handleSubmit } }, "modal", _vm.$attrs, false), _vm.$listeners), [_c("Form", { attrs: { "layout": "vertical", "validate-trigger": "blur", "model": _vm.value, "rules": _vm.rules } }, [_c("form-item", { attrs: { "label": "Profile type", "name": "profileType" } }, [_c("profile-type-select", { attrs: { "enabledTypes": ["USERPROFILE", "CLIENTPROFILE"] }, model: { value: _vm.value.profileType, callback: function($$v) {
336
+ return _c("modal", _vm._g(_vm._b({ attrs: { "closable": false, "ok-text": "Create", "width": 320, "okButtonProps": { props: { disabled: !_vm.canSubmit, loading: _vm.loading } } }, on: { "cancel": _vm.clearValue, "ok": _vm.handleSubmit } }, "modal", _vm.$attrs, false), _vm.$listeners), [_c("Form", { attrs: { "layout": "vertical", "validate-trigger": "blur", "model": _vm.value, "rules": _vm.rules } }, [_c("form-item", { attrs: { "label": "Profile type", "prop": "profileType" } }, [_c("profile-type-select", { attrs: { "enabledTypes": ["USERPROFILE", "CLIENTPROFILE"] }, model: { value: _vm.value.profileType, callback: function($$v) {
325
337
  _vm.$set(_vm.value, "profileType", $$v);
326
- }, expression: "value.profileType" } })], 1), _c("form-item", { attrs: { "label": "Name", "name": "profileName" } }, [_c("Input", { model: { value: _vm.value.profileName, callback: function($$v) {
327
- _vm.$set(_vm.value, "profileName", $$v);
328
- }, expression: "value.profileName" } })], 1), _c("form-item", { attrs: { "label": "Email" } }, [_c("Input", { model: { value: _vm.value.email, callback: function($$v) {
338
+ }, expression: "value.profileType" } })], 1), _c("form-item", { attrs: { "label": "Name", "prop": "name" } }, [_c("Input", { model: { value: _vm.value.name, callback: function($$v) {
339
+ _vm.$set(_vm.value, "name", $$v);
340
+ }, expression: "value.name" } })], 1), _c("form-item", { attrs: { "label": "Email", "prop": "email" } }, [_c("Input", { model: { value: _vm.value.email, callback: function($$v) {
329
341
  _vm.$set(_vm.value, "email", $$v);
330
- }, expression: "value.email" } })], 1), _c("form-item", [_c("checkbox", { model: { value: _vm.shouldSendPassword, callback: function($$v) {
331
- _vm.shouldSendPassword = $$v;
332
- }, expression: "shouldSendPassword" } }, [_vm._v("Send client portal login password (System will email client a login password)")])], 1)], 1)], 1);
342
+ }, expression: "value.email" } })], 1), _c("form-item", [_c("checkbox", { model: { value: _vm.value.sendEmail, callback: function($$v) {
343
+ _vm.$set(_vm.value, "sendEmail", $$v);
344
+ }, expression: "value.sendEmail" } }, [_vm._v("Send client portal login password (System will email client a login password)")])], 1)], 1)], 1);
333
345
  };
334
346
  var staticRenderFns$h = [];
335
347
  const __cssModules$h = {};
@@ -347,10 +359,6 @@ var __vue2_script$g = defineComponent({
347
359
  value: {
348
360
  type: Object
349
361
  },
350
- keywords: {
351
- type: String,
352
- required: true
353
- },
354
362
  source: {
355
363
  type: Array,
356
364
  required: true
@@ -377,11 +385,11 @@ var __vue2_script$g = defineComponent({
377
385
  var _a;
378
386
  return (_a = props.value) == null ? void 0 : _a.id;
379
387
  });
380
- const handleSelect = (value) => emit("input", props.source.find((v) => String(v.id) == value));
388
+ const handleChange = (value) => emit("input", props.source.find((v) => String(v.id) == value));
381
389
  const handleProfileCreate = () => emit("create-profile");
382
390
  return {
383
391
  selectedId,
384
- handleSelect,
392
+ handleChange,
385
393
  handleProfileCreate,
386
394
  menu: {}
387
395
  };
@@ -391,7 +399,7 @@ var render$g = function() {
391
399
  var _vm = this;
392
400
  var _h = _vm.$createElement;
393
401
  var _c = _vm._self._c || _h;
394
- return _c("Select", _vm._g(_vm._b({ staticClass: "w-72", attrs: { "allowClear": "", "showSearch": "", "optionFilterProp": "name", "value": _vm.selectedId }, on: { "select": _vm.handleSelect }, scopedSlots: _vm._u([{ key: "dropdownRender", fn: function(menu) {
402
+ return _c("Select", _vm._g(_vm._b({ staticClass: "w-72", attrs: { "allowClear": "", "showSearch": "", "optionFilterProp": "name", "value": _vm.selectedId }, on: { "change": _vm.handleChange }, scopedSlots: _vm._u([{ key: "dropdownRender", fn: function(menu) {
395
403
  return _c("div", {}, [_c("v-nodes", { attrs: { "vnodes": menu } }), _vm.creatable ? _c("Divider", { staticClass: "my-1" }) : _vm._e(), _vm.creatable ? _c("div", { staticClass: "flex justify-end px-3 py-1" }, [_c("Button", { attrs: { "size": "small" }, on: { "click": _vm.handleProfileCreate } }, [_vm._v("Create new profile")])], 1) : _vm._e()], 1);
396
404
  } }]) }, "Select", _vm.$attrs, false), _vm.$listeners), _vm._l(_vm.source, function(v) {
397
405
  return _c("Option", { key: v.id, attrs: { "value": v.id } }, [_c("ProfileSelectItem", { attrs: { "source": v } })], 1);
@@ -480,7 +488,7 @@ var render$f = function() {
480
488
  var _vm = this;
481
489
  var _h = _vm.$createElement;
482
490
  var _c = _vm._self._c || _h;
483
- return _c("div", [_c("profile-selector", _vm._g(_vm._b({ attrs: { "source": _vm.profiles, "value": _vm.value, "keywords": _vm.keywords, "creatable": _vm.creatable }, on: { "search": _vm.handleSearch, "create-profile": function($event) {
491
+ return _c("div", [_c("profile-selector", _vm._g(_vm._b({ attrs: { "source": _vm.profiles, "value": _vm.value, "creatable": _vm.creatable }, on: { "search": _vm.handleSearch, "create-profile": function($event) {
484
492
  return _vm.toggleModal(true);
485
493
  }, "input": _vm.updateValue } }, "profile-selector", _vm.$attrs, false), _vm.$listeners)), _vm.creatable ? _c("profile-create-modal", { attrs: { "visible": _vm.isModalVisible }, on: { "cancel": function($event) {
486
494
  return _vm.toggleModal(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ailaw/venus",
3
- "version": "0.4.7",
3
+ "version": "0.5.0",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -30,7 +30,6 @@
30
30
  "@types/ramda": "^0.27.62",
31
31
  "@vitejs/plugin-vue-jsx": "^1.3.3",
32
32
  "@vue/compiler-sfc": "^3.2.26",
33
- "@vue/composition-api": "^1.4.3",
34
33
  "autoprefixer": "^10.4.2",
35
34
  "js-cookie": "^3.0.1",
36
35
  "less": "^4.1.2",
@@ -41,19 +40,12 @@
41
40
  "typescript": "~4.1.5",
42
41
  "vite": "^2.7.12",
43
42
  "vite-plugin-vue2": "^1.9.2",
44
- "vue": "^2.6.14",
45
43
  "vue-template-compiler": "^2.6.14",
46
44
  "vue-tsc": "^0.30.2"
47
45
  },
48
46
  "peerDependencies": {
49
- "@vue/composition-api": "^1.0.0-rc.1",
50
47
  "vue": "^2.0.0 || >=3.0.0"
51
48
  },
52
- "peerDependenciesMeta": {
53
- "@vue/composition-api": {
54
- "optional": true
55
- }
56
- },
57
49
  "browserslist": [
58
50
  "> 1%",
59
51
  "last 2 versions",