@cgboiler/biz-mobile 1.8.1 → 1.10.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.
package/es/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare namespace _default {
6
6
  }
7
7
  export default _default;
8
8
  export function install(app: any): void;
9
- export const version: "1.8.1";
9
+ export const version: "1.9.0";
10
10
  import OrgPicker from './org-picker';
11
11
  import ProjectSelect from './project-select';
12
12
  export { OrgPicker, ProjectSelect };
package/es/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import OrgPicker from "./org-picker";
2
2
  import ProjectSelect from "./project-select";
3
- const version = "1.8.1";
3
+ const version = "1.9.0";
4
4
  function install(app) {
5
5
  const components = [
6
6
  OrgPicker,
@@ -12,6 +12,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
12
12
  type: BooleanConstructor;
13
13
  default: boolean;
14
14
  };
15
+ autoFocus: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
15
19
  'onUpdate:modelValue': {
16
20
  type: import("vue").PropType<(val: (string | number)[] | null) => void>;
17
21
  };
@@ -31,6 +35,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
31
35
  type: BooleanConstructor;
32
36
  default: boolean;
33
37
  };
38
+ autoFocus: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
34
42
  'onUpdate:modelValue': {
35
43
  type: import("vue").PropType<(val: (string | number)[] | null) => void>;
36
44
  };
@@ -44,5 +52,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
44
52
  modelValue: (string | number)[] | null;
45
53
  show: boolean;
46
54
  multiple: boolean;
55
+ autoFocus: boolean;
47
56
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
48
57
  export default _default;
@@ -1,6 +1,26 @@
1
+ var __async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value));
6
+ } catch (e) {
7
+ reject(e);
8
+ }
9
+ };
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ };
17
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
+ step((generator = generator.apply(__this, __arguments)).next());
19
+ });
20
+ };
1
21
  import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
2
22
  import "./_atomic.css";
3
- import { defineComponent, ref, computed, watch } from "vue";
23
+ import { defineComponent, ref, computed, watch, nextTick } from "vue";
4
24
  import { ActionSheet, Search, List, Image, Empty } from "vant";
5
25
  import DeptImg from "./components/deptImg";
6
26
  import { orgPickerProps } from "./types";
@@ -67,6 +87,16 @@ var stdin_default = defineComponent({
67
87
  const keyword = ref("");
68
88
  const loading = ref(false);
69
89
  const finished = ref(true);
90
+ const searchRef = ref();
91
+ watch(() => props.show, (newVal) => __async(this, null, function* () {
92
+ if (newVal && props.autoFocus) {
93
+ yield nextTick();
94
+ setTimeout(() => {
95
+ var _a;
96
+ (_a = searchRef.value) == null ? void 0 : _a.focus();
97
+ }, 300);
98
+ }
99
+ }));
70
100
  watch(keyword, (newKeyword) => {
71
101
  if (newKeyword) {
72
102
  searchOrgList(newKeyword);
@@ -99,6 +129,7 @@ var stdin_default = defineComponent({
99
129
  default: () => [_createVNode("div", {
100
130
  "class": "org-list"
101
131
  }, [_createVNode(Search, {
132
+ "ref": searchRef,
102
133
  "modelValue": keyword.value,
103
134
  "onUpdate:modelValue": ($event) => keyword.value = $event,
104
135
  "placeholder": "\u641C\u7D22\u4EBA\u5458",
@@ -18,6 +18,10 @@ export declare const orgPickerProps: {
18
18
  type: BooleanConstructor;
19
19
  default: boolean;
20
20
  };
21
+ autoFocus: {
22
+ type: BooleanConstructor;
23
+ default: boolean;
24
+ };
21
25
  'onUpdate:modelValue': {
22
26
  type: PropType<(val: (string | number)[] | null) => void>;
23
27
  };
@@ -11,6 +11,10 @@ const orgPickerProps = {
11
11
  type: Boolean,
12
12
  default: false
13
13
  },
14
+ autoFocus: {
15
+ type: Boolean,
16
+ default: false
17
+ },
14
18
  "onUpdate:modelValue": {
15
19
  type: Function
16
20
  },
@@ -29,6 +29,12 @@ var stdin_default = defineComponent({
29
29
  return item.name.toLowerCase().includes(keyword.value.toLowerCase());
30
30
  }).slice(0, 150);
31
31
  });
32
+ const highlightText = (text, keyword2) => {
33
+ if (!keyword2)
34
+ return text;
35
+ const regex = new RegExp(`(${keyword2})`, "gi");
36
+ return text.replace(regex, '<span class="highlight">$1</span>');
37
+ };
32
38
  const onLoad = () => {
33
39
  finished.value = true;
34
40
  };
@@ -57,8 +63,9 @@ var stdin_default = defineComponent({
57
63
  "class": `project-item ${((_a = props.modelValue) == null ? void 0 : _a.id) === item.id ? "selected" : ""}`,
58
64
  "onClick": () => handleSelect(item)
59
65
  }, [_createVNode("div", {
60
- "class": "project-name"
61
- }, [item.name])]);
66
+ "class": "project-name",
67
+ "innerHTML": highlightText(item.name, keyword.value)
68
+ }, null)]);
62
69
  })]
63
70
  })])]
64
71
  });
@@ -1 +1 @@
1
- :root:root{--van-action-sheet-max-height: 100%}.project-list{height:85vh;display:flex;flex-direction:column}.project-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.project-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.project-list .project-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer}.project-list .project-item.selected{color:var(--van-primary-color)}.project-list .project-item .project-name{font-size:14px}.project-list .project-item:last-child{border-bottom:none}
1
+ :root:root{--van-action-sheet-max-height: 100%}.project-list{height:85vh;display:flex;flex-direction:column}.project-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.project-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.project-list .project-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer}.project-list .project-item.selected{color:var(--van-primary-color)}.project-list .project-item .project-name{font-size:14px}.project-list .project-item .project-name .highlight{color:var(--van-primary-color);font-weight:700;padding:0 2px;border-radius:2px}.project-list .project-item:last-child{border-bottom:none}
@@ -29,6 +29,13 @@
29
29
 
30
30
  .project-name {
31
31
  font-size: 14px;
32
+
33
+ .highlight {
34
+ color: var(--van-primary-color);
35
+ font-weight: bold;
36
+ padding: 0 2px;
37
+ border-radius: 2px;
38
+ }
32
39
  }
33
40
 
34
41
  &:last-child {
package/lib/index.d.ts CHANGED
@@ -6,7 +6,7 @@ declare namespace _default {
6
6
  }
7
7
  export default _default;
8
8
  export function install(app: any): void;
9
- export const version: "1.8.1";
9
+ export const version: "1.9.0";
10
10
  import OrgPicker from './org-picker';
11
11
  import ProjectSelect from './project-select';
12
12
  export { OrgPicker, ProjectSelect };
package/lib/index.js CHANGED
@@ -39,7 +39,7 @@ var import_org_picker = __toESM(require("./org-picker"));
39
39
  var import_project_select = __toESM(require("./project-select"));
40
40
  __reExport(stdin_exports, require("./org-picker"), module.exports);
41
41
  __reExport(stdin_exports, require("./project-select"), module.exports);
42
- const version = "1.8.1";
42
+ const version = "1.9.0";
43
43
  function install(app) {
44
44
  const components = [
45
45
  import_org_picker.default,
@@ -12,6 +12,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
12
12
  type: BooleanConstructor;
13
13
  default: boolean;
14
14
  };
15
+ autoFocus: {
16
+ type: BooleanConstructor;
17
+ default: boolean;
18
+ };
15
19
  'onUpdate:modelValue': {
16
20
  type: import("vue").PropType<(val: (string | number)[] | null) => void>;
17
21
  };
@@ -31,6 +35,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
31
35
  type: BooleanConstructor;
32
36
  default: boolean;
33
37
  };
38
+ autoFocus: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
34
42
  'onUpdate:modelValue': {
35
43
  type: import("vue").PropType<(val: (string | number)[] | null) => void>;
36
44
  };
@@ -44,5 +52,6 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
44
52
  modelValue: (string | number)[] | null;
45
53
  show: boolean;
46
54
  multiple: boolean;
55
+ autoFocus: boolean;
47
56
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
48
57
  export default _default;
@@ -25,6 +25,26 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __async = (__this, __arguments, generator) => {
29
+ return new Promise((resolve, reject) => {
30
+ var fulfilled = (value) => {
31
+ try {
32
+ step(generator.next(value));
33
+ } catch (e) {
34
+ reject(e);
35
+ }
36
+ };
37
+ var rejected = (value) => {
38
+ try {
39
+ step(generator.throw(value));
40
+ } catch (e) {
41
+ reject(e);
42
+ }
43
+ };
44
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
+ step((generator = generator.apply(__this, __arguments)).next());
46
+ });
47
+ };
28
48
  var stdin_exports = {};
29
49
  __export(stdin_exports, {
30
50
  default: () => stdin_default
@@ -99,6 +119,16 @@ var stdin_default = (0, import_vue2.defineComponent)({
99
119
  const keyword = (0, import_vue2.ref)("");
100
120
  const loading = (0, import_vue2.ref)(false);
101
121
  const finished = (0, import_vue2.ref)(true);
122
+ const searchRef = (0, import_vue2.ref)();
123
+ (0, import_vue2.watch)(() => props.show, (newVal) => __async(this, null, function* () {
124
+ if (newVal && props.autoFocus) {
125
+ yield (0, import_vue2.nextTick)();
126
+ setTimeout(() => {
127
+ var _a;
128
+ (_a = searchRef.value) == null ? void 0 : _a.focus();
129
+ }, 300);
130
+ }
131
+ }));
102
132
  (0, import_vue2.watch)(keyword, (newKeyword) => {
103
133
  if (newKeyword) {
104
134
  searchOrgList(newKeyword);
@@ -131,6 +161,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
131
161
  default: () => [(0, import_vue.createVNode)("div", {
132
162
  "class": "org-list"
133
163
  }, [(0, import_vue.createVNode)(import_vant.Search, {
164
+ "ref": searchRef,
134
165
  "modelValue": keyword.value,
135
166
  "onUpdate:modelValue": ($event) => keyword.value = $event,
136
167
  "placeholder": "\u641C\u7D22\u4EBA\u5458",
@@ -18,6 +18,10 @@ export declare const orgPickerProps: {
18
18
  type: BooleanConstructor;
19
19
  default: boolean;
20
20
  };
21
+ autoFocus: {
22
+ type: BooleanConstructor;
23
+ default: boolean;
24
+ };
21
25
  'onUpdate:modelValue': {
22
26
  type: PropType<(val: (string | number)[] | null) => void>;
23
27
  };
@@ -33,6 +33,10 @@ const orgPickerProps = {
33
33
  type: Boolean,
34
34
  default: false
35
35
  },
36
+ autoFocus: {
37
+ type: Boolean,
38
+ default: false
39
+ },
36
40
  "onUpdate:modelValue": {
37
41
  type: Function
38
42
  },
@@ -51,6 +51,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
51
51
  return item.name.toLowerCase().includes(keyword.value.toLowerCase());
52
52
  }).slice(0, 150);
53
53
  });
54
+ const highlightText = (text, keyword2) => {
55
+ if (!keyword2)
56
+ return text;
57
+ const regex = new RegExp(`(${keyword2})`, "gi");
58
+ return text.replace(regex, '<span class="highlight">$1</span>');
59
+ };
54
60
  const onLoad = () => {
55
61
  finished.value = true;
56
62
  };
@@ -79,8 +85,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
79
85
  "class": `project-item ${((_a = props.modelValue) == null ? void 0 : _a.id) === item.id ? "selected" : ""}`,
80
86
  "onClick": () => handleSelect(item)
81
87
  }, [(0, import_vue.createVNode)("div", {
82
- "class": "project-name"
83
- }, [item.name])]);
88
+ "class": "project-name",
89
+ "innerHTML": highlightText(item.name, keyword.value)
90
+ }, null)]);
84
91
  })]
85
92
  })])]
86
93
  });
@@ -1 +1 @@
1
- :root:root{--van-action-sheet-max-height: 100%}.project-list{height:85vh;display:flex;flex-direction:column}.project-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.project-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.project-list .project-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer}.project-list .project-item.selected{color:var(--van-primary-color)}.project-list .project-item .project-name{font-size:14px}.project-list .project-item:last-child{border-bottom:none}
1
+ :root:root{--van-action-sheet-max-height: 100%}.project-list{height:85vh;display:flex;flex-direction:column}.project-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.project-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.project-list .project-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer}.project-list .project-item.selected{color:var(--van-primary-color)}.project-list .project-item .project-name{font-size:14px}.project-list .project-item .project-name .highlight{color:var(--van-primary-color);font-weight:700;padding:0 2px;border-radius:2px}.project-list .project-item:last-child{border-bottom:none}
@@ -29,6 +29,13 @@
29
29
 
30
30
  .project-name {
31
31
  font-size: 14px;
32
+
33
+ .highlight {
34
+ color: var(--van-primary-color);
35
+ font-weight: bold;
36
+ padding: 0 2px;
37
+ border-radius: 2px;
38
+ }
32
39
  }
33
40
 
34
41
  &:last-child {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cgboiler/biz-mobile",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",