@fecp/mobile 1.0.15 → 1.0.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.
@@ -3,17 +3,22 @@
3
3
  /* empty css */
4
4
  /* empty css */
5
5
  /* empty css */
6
- import { useAttrs, createBlock, openBlock, mergeProps, unref, createSlots, renderList, withCtx, renderSlot } from "vue";
6
+ import { useAttrs, computed, createBlock, openBlock, mergeProps, createSlots, renderList, withCtx, renderSlot } from "vue";
7
7
  import { parseRule } from "../../../utils/formRule.mjs";
8
8
  import { Field } from "../../../../../../node_modules/.pnpm/vant@4.9.17_vue@3.5.13_typescript@5.7.3_/node_modules/vant/es/field/index.mjs";
9
9
  const _sfc_main = {
10
10
  __name: "Field",
11
11
  setup(__props) {
12
12
  const attrs = useAttrs();
13
- const { rules } = parseRule(attrs);
13
+ const rules = computed(() => {
14
+ return parseRule(attrs);
15
+ });
14
16
  return (_ctx, _cache) => {
15
17
  const _component_van_field = Field;
16
- return openBlock(), createBlock(_component_van_field, mergeProps(_ctx.$attrs, { rules: unref(rules) }), createSlots({ _: 2 }, [
18
+ return openBlock(), createBlock(_component_van_field, mergeProps(_ctx.$attrs, {
19
+ rules: rules.value,
20
+ required: "auto"
21
+ }), createSlots({ _: 2 }, [
17
22
  renderList(_ctx.$slots, (item, key) => {
18
23
  return {
19
24
  name: key,
@@ -132,6 +132,7 @@ const _sfc_main = {
132
132
  "is-link": "",
133
133
  readonly: "",
134
134
  name: "picker",
135
+ required: "auto",
135
136
  onClick: _cache[1] || (_cache[1] = ($event) => showCalendar.value = true)
136
137
  }), createSlots({ _: 2 }, [
137
138
  renderList(_ctx.$slots, (item, key) => {
@@ -102,6 +102,7 @@ const _sfc_main = {
102
102
  "is-link": "",
103
103
  readonly: "",
104
104
  name: "picker",
105
+ required: "auto",
105
106
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
106
107
  }), createSlots({ _: 2 }, [
107
108
  renderList(_ctx.$slots, (item, key) => {
@@ -80,6 +80,7 @@ const _sfc_main = {
80
80
  "is-link": "",
81
81
  readonly: "",
82
82
  name: "picker",
83
+ required: "auto",
83
84
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
84
85
  }), createSlots({ _: 2 }, [
85
86
  renderList(_ctx.$slots, (item, key) => {
@@ -79,6 +79,7 @@ const _sfc_main = {
79
79
  "is-link": "",
80
80
  readonly: "",
81
81
  name: "picker",
82
+ required: "auto",
82
83
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
83
84
  }), createSlots({ _: 2 }, [
84
85
  renderList(_ctx.$slots, (item, key) => {
@@ -80,6 +80,7 @@ const _sfc_main = {
80
80
  "is-link": "",
81
81
  readonly: "",
82
82
  name: "picker",
83
+ required: "auto",
83
84
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
84
85
  }), createSlots({ _: 2 }, [
85
86
  renderList(_ctx.$slots, (item, key) => {
@@ -17,7 +17,7 @@ const parseRule = ({ label, isRequired, ruleType }) => {
17
17
  ruleList.push({ pattern, message: `请填写正确的${label}` });
18
18
  break;
19
19
  case "mobilephone":
20
- let validator = function(value) {
20
+ let validatorMobilephone = function(value) {
21
21
  var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
22
22
  var isMob = /^((\+?86)|(\(\+86\)))?(1[3-9]\d{9})$/;
23
23
  if (isMob.test(value) || isPhone.test(value)) {
@@ -26,11 +26,19 @@ const parseRule = ({ label, isRequired, ruleType }) => {
26
26
  return `请填写正确的${label}`;
27
27
  }
28
28
  };
29
- ruleList.push({ validator });
29
+ ruleList.push({ validator: validatorMobilephone });
30
30
  break;
31
31
  case "idNo":
32
- var pattern = /^(1[1-5]|2[1-3]|3[1-7]|4[1-6]|5[0-4]|6[1-5]|7[1-8]|8[1-3])\d{4}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
33
- ruleList.push({ pattern, message: `请填写正确的${label}` });
32
+ let validatorIdNo = function(value) {
33
+ const reg15 = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$/;
34
+ const reg18 = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
35
+ if (reg15.test(value) || reg18.test(value)) {
36
+ return true;
37
+ } else {
38
+ return `请填写正确的${label}`;
39
+ }
40
+ };
41
+ ruleList.push({ validator: validatorIdNo });
34
42
  break;
35
43
  case "usci":
36
44
  var pattern = /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/;
@@ -12,10 +12,15 @@ const _sfc_main = {
12
12
  __name: "Field",
13
13
  setup(__props) {
14
14
  const attrs = vue.useAttrs();
15
- const { rules } = formRule.parseRule(attrs);
15
+ const rules = vue.computed(() => {
16
+ return formRule.parseRule(attrs);
17
+ });
16
18
  return (_ctx, _cache) => {
17
19
  const _component_van_field = index.Field;
18
- return vue.openBlock(), vue.createBlock(_component_van_field, vue.mergeProps(_ctx.$attrs, { rules: vue.unref(rules) }), vue.createSlots({ _: 2 }, [
20
+ return vue.openBlock(), vue.createBlock(_component_van_field, vue.mergeProps(_ctx.$attrs, {
21
+ rules: rules.value,
22
+ required: "auto"
23
+ }), vue.createSlots({ _: 2 }, [
19
24
  vue.renderList(_ctx.$slots, (item, key) => {
20
25
  return {
21
26
  name: key,
@@ -134,6 +134,7 @@ const _sfc_main = {
134
134
  "is-link": "",
135
135
  readonly: "",
136
136
  name: "picker",
137
+ required: "auto",
137
138
  onClick: _cache[1] || (_cache[1] = ($event) => showCalendar.value = true)
138
139
  }), vue.createSlots({ _: 2 }, [
139
140
  vue.renderList(_ctx.$slots, (item, key) => {
@@ -104,6 +104,7 @@ const _sfc_main = {
104
104
  "is-link": "",
105
105
  readonly: "",
106
106
  name: "picker",
107
+ required: "auto",
107
108
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
108
109
  }), vue.createSlots({ _: 2 }, [
109
110
  vue.renderList(_ctx.$slots, (item, key) => {
@@ -82,6 +82,7 @@ const _sfc_main = {
82
82
  "is-link": "",
83
83
  readonly: "",
84
84
  name: "picker",
85
+ required: "auto",
85
86
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
86
87
  }), vue.createSlots({ _: 2 }, [
87
88
  vue.renderList(_ctx.$slots, (item, key) => {
@@ -81,6 +81,7 @@ const _sfc_main = {
81
81
  "is-link": "",
82
82
  readonly: "",
83
83
  name: "picker",
84
+ required: "auto",
84
85
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
85
86
  }), vue.createSlots({ _: 2 }, [
86
87
  vue.renderList(_ctx.$slots, (item, key) => {
@@ -82,6 +82,7 @@ const _sfc_main = {
82
82
  "is-link": "",
83
83
  readonly: "",
84
84
  name: "picker",
85
+ required: "auto",
85
86
  onClick: _cache[1] || (_cache[1] = ($event) => showPicker.value = true)
86
87
  }), vue.createSlots({ _: 2 }, [
87
88
  vue.renderList(_ctx.$slots, (item, key) => {
@@ -19,7 +19,7 @@ const parseRule = ({ label, isRequired, ruleType }) => {
19
19
  ruleList.push({ pattern, message: `请填写正确的${label}` });
20
20
  break;
21
21
  case "mobilephone":
22
- let validator = function(value) {
22
+ let validatorMobilephone = function(value) {
23
23
  var isPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
24
24
  var isMob = /^((\+?86)|(\(\+86\)))?(1[3-9]\d{9})$/;
25
25
  if (isMob.test(value) || isPhone.test(value)) {
@@ -28,11 +28,19 @@ const parseRule = ({ label, isRequired, ruleType }) => {
28
28
  return `请填写正确的${label}`;
29
29
  }
30
30
  };
31
- ruleList.push({ validator });
31
+ ruleList.push({ validator: validatorMobilephone });
32
32
  break;
33
33
  case "idNo":
34
- var pattern = /^(1[1-5]|2[1-3]|3[1-7]|4[1-6]|5[0-4]|6[1-5]|7[1-8]|8[1-3])\d{4}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
35
- ruleList.push({ pattern, message: `请填写正确的${label}` });
34
+ let validatorIdNo = function(value) {
35
+ const reg15 = /^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}$/;
36
+ const reg18 = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
37
+ if (reg15.test(value) || reg18.test(value)) {
38
+ return true;
39
+ } else {
40
+ return `请填写正确的${label}`;
41
+ }
42
+ };
43
+ ruleList.push({ validator: validatorIdNo });
36
44
  break;
37
45
  case "usci":
38
46
  var pattern = /^([0-9A-HJ-NPQRTUWXY]{2}\d{6}[0-9A-HJ-NPQRTUWXY]{10}|[1-9]\d{14})$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fecp/mobile",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "main": "lib/packages/mobile/index.js",
5
5
  "module": "es/packages/mobile/index.mjs",
6
6
  "files": [