@ailaw/venus 0.8.0 → 0.8.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.
@@ -0,0 +1 @@
1
+ export default function useVm(): any;
@@ -27,6 +27,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
27
27
  loading: import("@vue/composition-api").Ref<boolean>;
28
28
  canSubmit: import("@vue/composition-api").ComputedRef<boolean>;
29
29
  handleSubmit: () => Promise<void>;
30
+ handleValidate: (_: string, result: boolean) => void;
30
31
  }> & import("@vue/composition-api").Data, {}, {}, {
31
32
  enabledTypes: {
32
33
  type: PropType<RoleType[]>;
@@ -63,6 +64,7 @@ declare const _default: import("vue").ComponentOptions<import("vue").default, im
63
64
  loading: import("@vue/composition-api").Ref<boolean>;
64
65
  canSubmit: import("@vue/composition-api").ComputedRef<boolean>;
65
66
  handleSubmit: () => Promise<void>;
67
+ handleValidate: (_: string, result: boolean) => void;
66
68
  }>, import("@vue/composition-api").Data, {}, {}, {}, {}, {}, {
67
69
  enabledTypes: RoleType[];
68
70
  } & {}, {
package/dist/venus.es.js CHANGED
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { defineComponent, ref, watch, reactive, computed, toRefs, getCurrentScope, shallowRef } from "vue-demi";
21
- import { Select, Modal, Form, Input, Checkbox, Divider, Button, Upload, Tag, Tooltip, Row, Col, Radio, Popconfirm, Table, Badge, Card, message } from "ant-design-vue";
21
+ import { Select, Modal, FormModel, Input, Checkbox, Divider, Button, Upload, Tag, Tooltip, Form, 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";
24
24
  import { path, uniqBy, prop, sort } from "ramda";
@@ -292,8 +292,8 @@ var __vue2_script$h = defineComponent({
292
292
  },
293
293
  components: {
294
294
  Modal,
295
- Form,
296
- FormItem: Form.Item,
295
+ Form: FormModel,
296
+ FormItem: FormModel.Item,
297
297
  ProfileTypeSelect,
298
298
  Input,
299
299
  Checkbox
@@ -305,10 +305,9 @@ var __vue2_script$h = defineComponent({
305
305
  email: "",
306
306
  sendEmail: false
307
307
  });
308
+ const hasValidationError = ref(false);
308
309
  const canSubmit = computed(() => {
309
- if (value.name === "" || value.profileType == null)
310
- return false;
311
- if (value.email !== "" && !value.email.includes("@"))
310
+ if (value.name === "" || value.profileType == null || hasValidationError.value)
312
311
  return false;
313
312
  return true;
314
313
  });
@@ -317,6 +316,9 @@ var __vue2_script$h = defineComponent({
317
316
  name: { required: true },
318
317
  email: { type: "email" }
319
318
  };
319
+ const handleValidate = (_2, result) => {
320
+ hasValidationError.value = !result;
321
+ };
320
322
  const clearValue = () => Object.assign(value, {});
321
323
  const { createProfile, loading } = useCreateProfile();
322
324
  const hide = () => emit("cancel");
@@ -331,7 +333,8 @@ var __vue2_script$h = defineComponent({
331
333
  clearValue,
332
334
  loading,
333
335
  canSubmit,
334
- handleSubmit
336
+ handleSubmit,
337
+ handleValidate
335
338
  };
336
339
  }
337
340
  });
@@ -339,7 +342,7 @@ var render$h = function() {
339
342
  var _vm = this;
340
343
  var _h = _vm.$createElement;
341
344
  var _c = _vm._self._c || _h;
342
- 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": _vm.enabledTypes }, model: { value: _vm.value.profileType, callback: function($$v) {
345
+ 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 }, on: { "validate": _vm.handleValidate } }, [_c("form-item", { attrs: { "label": "Profile type", "prop": "profileType" } }, [_c("profile-type-select", { attrs: { "enabledTypes": _vm.enabledTypes }, model: { value: _vm.value.profileType, callback: function($$v) {
343
346
  _vm.$set(_vm.value, "profileType", $$v);
344
347
  }, expression: "value.profileType" } })], 1), _c("form-item", { attrs: { "label": "Name", "prop": "name" } }, [_c("Input", { model: { value: _vm.value.name, callback: function($$v) {
345
348
  _vm.$set(_vm.value, "name", $$v);
@@ -1479,9 +1482,13 @@ function __vue2_injectStyles$6(context) {
1479
1482
  var TaskTemplateFilter = /* @__PURE__ */ function() {
1480
1483
  return __component__$6.exports;
1481
1484
  }();
1482
- function useT() {
1485
+ function useVm() {
1483
1486
  const scope = getCurrentScope();
1484
- return (key) => scope.vm.$i18n.t(key);
1487
+ return scope.vm;
1488
+ }
1489
+ function useT() {
1490
+ const vm = useVm();
1491
+ return (key) => vm.$i18n.t(key);
1485
1492
  }
1486
1493
  var __vue2_script$5 = defineComponent({
1487
1494
  name: "TaskTablePure",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ailaw/venus",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "files": [
5
5
  "dist"
6
6
  ],