@cgboiler/biz-mobile 1.1.2 → 1.2.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
package/es/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.1.2";
10
+ import OrgPicker from './org-picker';
9
11
  import ProjectSelect from './project-select';
10
- export { ProjectSelect };
12
+ export { OrgPicker, ProjectSelect };
package/es/index.js CHANGED
@@ -1,7 +1,9 @@
1
+ import OrgPicker from "./org-picker";
1
2
  import ProjectSelect from "./project-select";
2
- const version = "1.1.1";
3
+ const version = "1.1.2";
3
4
  function install(app) {
4
5
  const components = [
6
+ OrgPicker,
5
7
  ProjectSelect
6
8
  ];
7
9
  components.forEach((item) => {
@@ -12,12 +14,14 @@ function install(app) {
12
14
  }
13
15
  });
14
16
  }
17
+ export * from "./org-picker";
15
18
  export * from "./project-select";
16
19
  var stdin_default = {
17
20
  install,
18
21
  version
19
22
  };
20
23
  export {
24
+ OrgPicker,
21
25
  ProjectSelect,
22
26
  stdin_default as default,
23
27
  install,
@@ -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,111 @@
1
+ import { createVNode as _createVNode, createTextVNode as _createTextVNode } from "vue";
2
+ import "./_atomic.css";
3
+ import { defineComponent, ref, computed } from "vue";
4
+ import { ActionSheet, Search, List, Image } from "vant";
5
+ import { orgPickerProps } from "./types";
6
+ import { useApi } from "./useApi";
7
+ import "./index.css";
8
+ var stdin_default = defineComponent({
9
+ name: "OrgPicker",
10
+ props: orgPickerProps,
11
+ emits: ["update:show", "update:modelValue"],
12
+ setup(props, {
13
+ emit
14
+ }) {
15
+ const {
16
+ orgList,
17
+ getOrgList
18
+ } = useApi();
19
+ getOrgList();
20
+ const handleSelect = (item) => {
21
+ if (props.multiple) {
22
+ const currentValue = props.modelValue ? [...Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue]] : [];
23
+ const index = currentValue.findIndex((selected) => selected.id === item.id);
24
+ if (index > -1) {
25
+ currentValue.splice(index, 1);
26
+ } else {
27
+ currentValue.push(item);
28
+ }
29
+ emit("update:modelValue", currentValue);
30
+ } else {
31
+ emit("update:modelValue", item);
32
+ emit("update:show", false);
33
+ }
34
+ };
35
+ const handleConfirm = () => {
36
+ emit("update:show", false);
37
+ };
38
+ const keyword = ref("");
39
+ const loading = ref(false);
40
+ const finished = ref(true);
41
+ const filteredOrgList = computed(() => {
42
+ return orgList.value.filter((item) => {
43
+ return item.name.toLowerCase().includes(keyword.value.toLowerCase());
44
+ }).slice(0, 300);
45
+ });
46
+ const isSelected = (item) => {
47
+ var _a;
48
+ if (!props.modelValue)
49
+ return false;
50
+ if (props.multiple) {
51
+ const selectedItems = Array.isArray(props.modelValue) ? props.modelValue : [props.modelValue];
52
+ return selectedItems.some((selected) => selected.id === item.id);
53
+ } else {
54
+ return ((_a = props.modelValue) == null ? void 0 : _a.id) === item.id;
55
+ }
56
+ };
57
+ const onLoad = () => {
58
+ finished.value = true;
59
+ };
60
+ return () => _createVNode(ActionSheet, {
61
+ "show": props.show,
62
+ "onUpdate:show": (val) => emit("update:show", val),
63
+ "title": "\u9009\u62E9\u4EBA\u5458",
64
+ "closeOnClickAction": !props.multiple
65
+ }, {
66
+ default: () => [_createVNode("div", {
67
+ "class": "org-list"
68
+ }, [_createVNode(Search, {
69
+ "modelValue": keyword.value,
70
+ "onUpdate:modelValue": ($event) => keyword.value = $event,
71
+ "placeholder": "\u641C\u7D22\u4EBA\u5458",
72
+ "class": "search-bar"
73
+ }, null), _createVNode(List, {
74
+ "loading": loading.value,
75
+ "finished": finished.value,
76
+ "onLoad": onLoad
77
+ }, {
78
+ default: () => [filteredOrgList.value.map((item) => _createVNode("div", {
79
+ "class": ["org-item", isSelected(item) ? "selected" : ""],
80
+ "onClick": () => handleSelect(item)
81
+ }, [_createVNode(Image, {
82
+ "class": "org-avatar",
83
+ "width": "40",
84
+ "height": "40",
85
+ "src": item.avatar
86
+ }, null), _createVNode("div", {
87
+ "class": "org-name"
88
+ }, [item.name])]))]
89
+ }), props.multiple && _createVNode("div", {
90
+ "class": "bottom-section"
91
+ }, [Array.isArray(props.modelValue) && props.modelValue.length > 0 && _createVNode("div", {
92
+ "class": "selected-items"
93
+ }, [props.modelValue.map((item) => _createVNode("div", {
94
+ "key": item.id,
95
+ "class": "selected-tag",
96
+ "onClick": () => handleSelect(item)
97
+ }, [_createVNode(Image, {
98
+ "class": "tag-avatar",
99
+ "src": item.avatar
100
+ }, null)]))]), _createVNode("div", {
101
+ "class": "action-buttons"
102
+ }, [_createVNode("div", {
103
+ "class": "confirm-button",
104
+ "onClick": handleConfirm
105
+ }, [_createTextVNode("\u786E\u8BA4")])])])])]
106
+ });
107
+ }
108
+ });
109
+ export {
110
+ stdin_default as default
111
+ };
@@ -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,6 @@
1
+ import OrgPicker from "./OrgPicker";
2
+ var stdin_default = OrgPicker;
3
+ export * from "./types";
4
+ export {
5
+ stdin_default as default
6
+ };
@@ -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
+ import "../index.css";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ import "../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,23 @@
1
+ const orgPickerProps = {
2
+ modelValue: {
3
+ type: [Object, Array],
4
+ default: () => null
5
+ },
6
+ show: {
7
+ type: Boolean,
8
+ default: false
9
+ },
10
+ multiple: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ "onUpdate:modelValue": {
15
+ type: Function
16
+ },
17
+ "onUpdate:show": {
18
+ type: Function
19
+ }
20
+ };
21
+ export {
22
+ orgPickerProps
23
+ };
@@ -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
+ };