@cgboiler/biz-mobile 1.1.2 → 1.3.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 (39) hide show
  1. package/es/index.d.ts +4 -2
  2. package/es/index.js +5 -1
  3. package/es/org-picker/OrgPicker.d.ts +49 -0
  4. package/es/org-picker/OrgPicker.js +111 -0
  5. package/es/org-picker/_atomic.css +32 -0
  6. package/es/org-picker/index.css +1 -0
  7. package/es/org-picker/index.d.ts +3 -0
  8. package/es/org-picker/index.js +6 -0
  9. package/es/org-picker/index.less +96 -0
  10. package/es/org-picker/style/index.d.ts +1 -0
  11. package/es/org-picker/style/index.js +1 -0
  12. package/es/org-picker/style/less.d.ts +1 -0
  13. package/es/org-picker/style/less.js +1 -0
  14. package/es/org-picker/types.d.ts +27 -0
  15. package/es/org-picker/types.js +23 -0
  16. package/es/org-picker/useApi.d.ts +13 -0
  17. package/es/org-picker/useApi.js +792 -0
  18. package/es/project-select/index.css +1 -1
  19. package/es/project-select/index.less +4 -1
  20. package/lib/index.d.ts +4 -2
  21. package/lib/index.js +5 -1
  22. package/lib/org-picker/OrgPicker.d.ts +49 -0
  23. package/lib/org-picker/OrgPicker.js +130 -0
  24. package/lib/org-picker/_atomic.css +32 -0
  25. package/lib/org-picker/index.css +1 -0
  26. package/lib/org-picker/index.d.ts +3 -0
  27. package/lib/org-picker/index.js +36 -0
  28. package/lib/org-picker/index.less +96 -0
  29. package/lib/org-picker/style/index.d.ts +1 -0
  30. package/lib/org-picker/style/index.js +1 -0
  31. package/lib/org-picker/style/less.d.ts +1 -0
  32. package/lib/org-picker/style/less.js +1 -0
  33. package/lib/org-picker/types.d.ts +27 -0
  34. package/lib/org-picker/types.js +42 -0
  35. package/lib/org-picker/useApi.d.ts +13 -0
  36. package/lib/org-picker/useApi.js +811 -0
  37. package/lib/project-select/index.css +1 -1
  38. package/lib/project-select/index.less +4 -1
  39. package/package.json +2 -2
@@ -1 +1 @@
1
- .project-list{height:70vh;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:90vh;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,5 +1,8 @@
1
+ :root:root {
2
+ --van-action-sheet-max-height: 100%;
3
+ }
1
4
  .project-list {
2
- height: 70vh;
5
+ height: 90vh;
3
6
  display: flex;
4
7
  flex-direction: column;
5
8
 
package/lib/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./org-picker";
1
2
  export * from "./project-select";
2
3
  declare namespace _default {
3
4
  export { install };
@@ -5,6 +6,7 @@ declare namespace _default {
5
6
  }
6
7
  export default _default;
7
8
  export function install(app: any): void;
8
- export const version: "1.1.1";
9
+ export const version: "1.2.0";
10
+ import OrgPicker from './org-picker';
9
11
  import ProjectSelect from './project-select';
10
- export { ProjectSelect };
12
+ export { OrgPicker, ProjectSelect };
package/lib/index.js CHANGED
@@ -28,17 +28,21 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var stdin_exports = {};
30
30
  __export(stdin_exports, {
31
+ OrgPicker: () => import_org_picker.default,
31
32
  ProjectSelect: () => import_project_select.default,
32
33
  default: () => stdin_default,
33
34
  install: () => install,
34
35
  version: () => version
35
36
  });
36
37
  module.exports = __toCommonJS(stdin_exports);
38
+ var import_org_picker = __toESM(require("./org-picker"));
37
39
  var import_project_select = __toESM(require("./project-select"));
40
+ __reExport(stdin_exports, require("./org-picker"), module.exports);
38
41
  __reExport(stdin_exports, require("./project-select"), module.exports);
39
- const version = "1.1.1";
42
+ const version = "1.2.0";
40
43
  function install(app) {
41
44
  const components = [
45
+ import_org_picker.default,
42
46
  import_project_select.default
43
47
  ];
44
48
  components.forEach((item) => {
@@ -0,0 +1,49 @@
1
+ import { type OrgItem } from './types';
2
+ import './index.less';
3
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
4
+ modelValue: {
5
+ type: import("vue").PropType<OrgItem | OrgItem[] | null>;
6
+ default: () => null;
7
+ };
8
+ show: {
9
+ type: BooleanConstructor;
10
+ default: boolean;
11
+ };
12
+ multiple: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ 'onUpdate:modelValue': {
17
+ type: import("vue").PropType<(val: OrgItem | OrgItem[] | null) => void>;
18
+ };
19
+ 'onUpdate:show': {
20
+ type: import("vue").PropType<(val: boolean) => void>;
21
+ };
22
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:show" | "update:modelValue")[], "update:show" | "update:modelValue", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
23
+ modelValue: {
24
+ type: import("vue").PropType<OrgItem | OrgItem[] | null>;
25
+ default: () => null;
26
+ };
27
+ show: {
28
+ type: BooleanConstructor;
29
+ default: boolean;
30
+ };
31
+ multiple: {
32
+ type: BooleanConstructor;
33
+ default: boolean;
34
+ };
35
+ 'onUpdate:modelValue': {
36
+ type: import("vue").PropType<(val: OrgItem | OrgItem[] | null) => void>;
37
+ };
38
+ 'onUpdate:show': {
39
+ type: import("vue").PropType<(val: boolean) => void>;
40
+ };
41
+ }>> & Readonly<{
42
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
43
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
44
+ }>, {
45
+ modelValue: OrgItem | OrgItem[] | null;
46
+ show: boolean;
47
+ multiple: boolean;
48
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
49
+ export default _default;
@@ -0,0 +1,130 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ default: () => stdin_default
21
+ });
22
+ module.exports = __toCommonJS(stdin_exports);
23
+ var import_vue = require("vue");
24
+ var import_atomic = require("./_atomic.css");
25
+ var import_vue2 = require("vue");
26
+ var import_vant = require("vant");
27
+ var import_types = require("./types");
28
+ var import_useApi = require("./useApi");
29
+ var import_index = require("./index.css");
30
+ var stdin_default = (0, import_vue2.defineComponent)({
31
+ name: "OrgPicker",
32
+ props: import_types.orgPickerProps,
33
+ emits: ["update:show", "update:modelValue"],
34
+ setup(props, {
35
+ emit
36
+ }) {
37
+ const {
38
+ orgList,
39
+ getOrgList
40
+ } = (0, import_useApi.useApi)();
41
+ getOrgList();
42
+ const handleSelect = (item) => {
43
+ if (props.multiple) {
44
+ const currentValue = props.modelValue ? [...Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue]] : [];
45
+ const index = currentValue.findIndex((selected) => selected.id === item.id);
46
+ if (index > -1) {
47
+ currentValue.splice(index, 1);
48
+ } else {
49
+ currentValue.push(item);
50
+ }
51
+ emit("update:modelValue", currentValue);
52
+ } else {
53
+ emit("update:modelValue", item);
54
+ emit("update:show", false);
55
+ }
56
+ };
57
+ const handleConfirm = () => {
58
+ emit("update:show", false);
59
+ };
60
+ const keyword = (0, import_vue2.ref)("");
61
+ const loading = (0, import_vue2.ref)(false);
62
+ const finished = (0, import_vue2.ref)(true);
63
+ const filteredOrgList = (0, import_vue2.computed)(() => {
64
+ return orgList.value.filter((item) => {
65
+ return item.name.toLowerCase().includes(keyword.value.toLowerCase());
66
+ }).slice(0, 300);
67
+ });
68
+ const isSelected = (item) => {
69
+ var _a;
70
+ if (!props.modelValue)
71
+ return false;
72
+ if (props.multiple) {
73
+ const selectedItems = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
74
+ return selectedItems.some((selected) => selected.id === item.id);
75
+ } else {
76
+ return ((_a = props.modelValue) == null ? void 0 : _a.id) === item.id;
77
+ }
78
+ };
79
+ const onLoad = () => {
80
+ finished.value = true;
81
+ };
82
+ return () => (0, import_vue.createVNode)(import_vant.ActionSheet, {
83
+ "show": props.show,
84
+ "onUpdate:show": (val) => emit("update:show", val),
85
+ "title": "\u9009\u62E9\u4EBA\u5458",
86
+ "closeOnClickAction": !props.multiple
87
+ }, {
88
+ default: () => [(0, import_vue.createVNode)("div", {
89
+ "class": "org-list"
90
+ }, [(0, import_vue.createVNode)(import_vant.Search, {
91
+ "modelValue": keyword.value,
92
+ "onUpdate:modelValue": ($event) => keyword.value = $event,
93
+ "placeholder": "\u641C\u7D22\u4EBA\u5458",
94
+ "class": "search-bar"
95
+ }, null), (0, import_vue.createVNode)(import_vant.List, {
96
+ "loading": loading.value,
97
+ "finished": finished.value,
98
+ "onLoad": onLoad
99
+ }, {
100
+ default: () => [filteredOrgList.value.map((item) => (0, import_vue.createVNode)("div", {
101
+ "class": ["org-item", isSelected(item) ? "selected" : ""],
102
+ "onClick": () => handleSelect(item)
103
+ }, [(0, import_vue.createVNode)(import_vant.Image, {
104
+ "class": "org-avatar",
105
+ "width": "40",
106
+ "height": "40",
107
+ "src": item.avatar
108
+ }, null), (0, import_vue.createVNode)("div", {
109
+ "class": "org-name"
110
+ }, [item.name])]))]
111
+ }), props.multiple && (0, import_vue.createVNode)("div", {
112
+ "class": "bottom-section"
113
+ }, [Array.isArray(props.modelValue) && props.modelValue.length > 0 && (0, import_vue.createVNode)("div", {
114
+ "class": "selected-items"
115
+ }, [props.modelValue.map((item) => (0, import_vue.createVNode)("div", {
116
+ "key": item.id,
117
+ "class": "selected-tag",
118
+ "onClick": () => handleSelect(item)
119
+ }, [(0, import_vue.createVNode)(import_vant.Image, {
120
+ "class": "tag-avatar",
121
+ "src": item.avatar
122
+ }, null)]))]), (0, import_vue.createVNode)("div", {
123
+ "class": "action-buttons"
124
+ }, [(0, import_vue.createVNode)("div", {
125
+ "class": "confirm-button",
126
+ "onClick": handleConfirm
127
+ }, [(0, import_vue.createTextVNode)("\u786E\u8BA4")])])])])]
128
+ });
129
+ }
130
+ });
@@ -0,0 +1,32 @@
1
+
2
+ .cgx-atm .flex {
3
+ align-items: initial;
4
+ flex-direction: initial;
5
+ justify-content: initial;
6
+ flex-wrap: initial;
7
+ }
8
+ .cgx-atm .flex-row {
9
+ flex-direction: row;
10
+ }
11
+ .cgx-atm .flex-col {
12
+ flex-direction: column;
13
+ }
14
+ .cgx-atm .justify-center {
15
+ justify-content: center;
16
+ }
17
+ .cgx-atm .justify-between {
18
+ justify-content: space-between;
19
+ }
20
+ .cgx-atm .justify-around {
21
+ justify-content: space-around;
22
+ }
23
+ .cgx-atm .justify-end {
24
+ justify-content: flex-end;
25
+ }
26
+ .cgx-atm .items-center {
27
+ align-items: center;
28
+ }
29
+ .cgx-atm .flex-wrap {
30
+ flex-wrap: wrap;
31
+ }
32
+
@@ -0,0 +1 @@
1
+ :root:root{--van-action-sheet-max-height: 100%}.org-list{height:90vh;display:flex;flex-direction:column}.org-list .search-bar{position:-webkit-sticky;position:-webkit-sticky;position:sticky;top:0;z-index:1}.org-list .bottom-section{border-top:1px solid #eee;background-color:#fff}.org-list .bottom-section .selected-items{display:flex;flex-wrap:nowrap;padding:12px 16px;gap:12px;background-color:#fff;overflow-x:auto;height:35px}.org-list .bottom-section .selected-items .selected-tag{flex-shrink:0;background:none;border:none;padding:0;margin:0}.org-list .bottom-section .selected-items .selected-tag .tag-avatar{width:32px;height:32px;cursor:pointer;border-radius:4px;overflow:hidden}.org-list .van-list{flex:1;overflow-y:auto;padding:0 16px}.org-list .org-item{padding:12px 0;border-bottom:1px solid #eee;cursor:pointer;display:flex;align-items:center;gap:12px}.org-list .org-item.selected{color:var(--van-primary-color)}.org-list .org-item .org-avatar{flex-shrink:0;border-radius:4px;overflow:hidden}.org-list .org-item .org-name{font-size:14px;flex:1}.org-list .org-item:last-child{border-bottom:none}.org-list .action-buttons{padding:16px;display:flex;justify-content:center;border-top:1px solid #eee}.org-list .action-buttons .confirm-button{background-color:var(--van-primary-color);color:#fff;padding:10px 0;border-radius:4px;text-align:center;width:100%;font-size:14px}
@@ -0,0 +1,3 @@
1
+ import OrgPicker from './OrgPicker';
2
+ export default OrgPicker;
3
+ export * from './types';
@@ -0,0 +1,36 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var stdin_exports = {};
30
+ __export(stdin_exports, {
31
+ default: () => stdin_default
32
+ });
33
+ module.exports = __toCommonJS(stdin_exports);
34
+ var import_OrgPicker = __toESM(require("./OrgPicker"));
35
+ __reExport(stdin_exports, require("./types"), module.exports);
36
+ var stdin_default = import_OrgPicker.default;
@@ -0,0 +1,96 @@
1
+ :root:root {
2
+ --van-action-sheet-max-height: 100%;
3
+ }
4
+ .org-list {
5
+ height: 90vh;
6
+ display: flex;
7
+ flex-direction: column;
8
+
9
+ .search-bar {
10
+ position: sticky;
11
+ top: 0;
12
+ z-index: 1;
13
+ }
14
+
15
+ .bottom-section {
16
+ border-top: 1px solid #eee;
17
+ background-color: #fff;
18
+
19
+ .selected-items {
20
+ display: flex;
21
+ flex-wrap: nowrap;
22
+ padding: 12px 16px;
23
+ gap: 12px;
24
+ background-color: #fff;
25
+ overflow-x: auto;
26
+ height: 35px;
27
+
28
+ .selected-tag {
29
+ flex-shrink: 0;
30
+ background: none;
31
+ border: none;
32
+ padding: 0;
33
+ margin: 0;
34
+
35
+ .tag-avatar {
36
+ width: 32px;
37
+ height: 32px;
38
+ cursor: pointer;
39
+ border-radius: 4px;
40
+ overflow: hidden;
41
+ }
42
+ }
43
+ }
44
+ }
45
+
46
+ .van-list {
47
+ flex: 1;
48
+ overflow-y: auto;
49
+ padding: 0 16px;
50
+ }
51
+
52
+ .org-item {
53
+ padding: 12px 0;
54
+ border-bottom: 1px solid #eee;
55
+ cursor: pointer;
56
+ display: flex;
57
+ align-items: center;
58
+ gap: 12px;
59
+
60
+ &.selected {
61
+ color: var(--van-primary-color);
62
+ }
63
+
64
+ .org-avatar {
65
+ flex-shrink: 0;
66
+ border-radius: 4px;
67
+ overflow: hidden;
68
+ }
69
+
70
+ .org-name {
71
+ font-size: 14px;
72
+ flex: 1;
73
+ }
74
+
75
+ &:last-child {
76
+ border-bottom: none;
77
+ }
78
+ }
79
+
80
+ .action-buttons {
81
+ padding: 16px;
82
+ display: flex;
83
+ justify-content: center;
84
+ border-top: 1px solid #eee;
85
+
86
+ .confirm-button {
87
+ background-color: var(--van-primary-color);
88
+ color: white;
89
+ padding: 10px 0;
90
+ border-radius: 4px;
91
+ text-align: center;
92
+ width: 100%;
93
+ font-size: 14px;
94
+ }
95
+ }
96
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ require("../index.css");
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ require("../index.less");
@@ -0,0 +1,27 @@
1
+ import { ExtractPropTypes, PropType } from 'vue';
2
+ export interface OrgItem {
3
+ id: string | number;
4
+ name: string;
5
+ avatar?: string;
6
+ }
7
+ export declare const orgPickerProps: {
8
+ modelValue: {
9
+ type: PropType<OrgItem | OrgItem[] | null>;
10
+ default: () => null;
11
+ };
12
+ show: {
13
+ type: BooleanConstructor;
14
+ default: boolean;
15
+ };
16
+ multiple: {
17
+ type: BooleanConstructor;
18
+ default: boolean;
19
+ };
20
+ 'onUpdate:modelValue': {
21
+ type: PropType<(val: OrgItem | OrgItem[] | null) => void>;
22
+ };
23
+ 'onUpdate:show': {
24
+ type: PropType<(val: boolean) => void>;
25
+ };
26
+ };
27
+ export type OrgPickerProps = ExtractPropTypes<typeof orgPickerProps>;
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ orgPickerProps: () => orgPickerProps
21
+ });
22
+ module.exports = __toCommonJS(stdin_exports);
23
+ const orgPickerProps = {
24
+ modelValue: {
25
+ type: [Object, Array],
26
+ default: () => null
27
+ },
28
+ show: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ multiple: {
33
+ type: Boolean,
34
+ default: false
35
+ },
36
+ "onUpdate:modelValue": {
37
+ type: Function
38
+ },
39
+ "onUpdate:show": {
40
+ type: Function
41
+ }
42
+ };
@@ -0,0 +1,13 @@
1
+ import { type OrgItem } from './types';
2
+ export declare const useApi: () => {
3
+ orgList: import("vue").Ref<{
4
+ id: string | number;
5
+ name: string;
6
+ avatar?: string | undefined;
7
+ }[], OrgItem[] | {
8
+ id: string | number;
9
+ name: string;
10
+ avatar?: string | undefined;
11
+ }[]>;
12
+ getOrgList: () => Promise<void>;
13
+ };