zartui 3.1.3 → 3.1.5

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 (58) hide show
  1. package/README.md +25 -0
  2. package/es/date-time-picker/DateTimePickerWrapper.mjs +6 -4
  3. package/es/date-time-picker/utils.d.ts +1 -0
  4. package/es/date-time-picker/utils.mjs +11 -1
  5. package/es/index.d.ts +2 -1
  6. package/es/index.mjs +4 -1
  7. package/es/lazyload/vue-lazyload/index.d.ts +55 -55
  8. package/es/radio-picker/RadioPicker.d.ts +207 -0
  9. package/es/radio-picker/RadioPicker.mjs +290 -0
  10. package/es/radio-picker/RadioPickerColumn.d.ts +70 -0
  11. package/es/radio-picker/RadioPickerColumn.mjs +237 -0
  12. package/es/radio-picker/RadioPickerToolbar.d.ts +18 -0
  13. package/es/radio-picker/RadioPickerToolbar.mjs +54 -0
  14. package/es/radio-picker/index.css +1 -0
  15. package/es/radio-picker/index.d.ts +136 -0
  16. package/es/radio-picker/index.mjs +10 -0
  17. package/es/radio-picker/style/index.d.ts +1 -0
  18. package/es/radio-picker/style/index.mjs +16 -0
  19. package/es/radio-picker/types.d.ts +44 -0
  20. package/es/radio-picker/types.mjs +0 -0
  21. package/es/radio-picker/utils.d.ts +13 -0
  22. package/es/radio-picker/utils.mjs +80 -0
  23. package/es/utils/debounce.d.ts +46 -0
  24. package/es/utils/debounce.mjs +65 -0
  25. package/es/vue-sfc-shim.d.ts +6 -6
  26. package/es/vue-tsx-shim.d.ts +23 -23
  27. package/lib/date-time-picker/DateTimePickerWrapper.js +5 -3
  28. package/lib/date-time-picker/utils.d.ts +1 -0
  29. package/lib/date-time-picker/utils.js +10 -0
  30. package/lib/index.css +1 -1
  31. package/lib/index.d.ts +2 -1
  32. package/lib/index.js +4 -1
  33. package/lib/lazyload/vue-lazyload/index.d.ts +55 -55
  34. package/lib/radio-picker/RadioPicker.d.ts +207 -0
  35. package/lib/radio-picker/RadioPicker.js +319 -0
  36. package/lib/radio-picker/RadioPickerColumn.d.ts +70 -0
  37. package/lib/radio-picker/RadioPickerColumn.js +266 -0
  38. package/lib/radio-picker/RadioPickerToolbar.d.ts +18 -0
  39. package/lib/radio-picker/RadioPickerToolbar.js +73 -0
  40. package/lib/radio-picker/index.css +1 -0
  41. package/lib/radio-picker/index.d.ts +136 -0
  42. package/lib/radio-picker/index.js +39 -0
  43. package/lib/radio-picker/style/index.d.ts +1 -0
  44. package/lib/radio-picker/style/index.js +16 -0
  45. package/lib/radio-picker/types.d.ts +44 -0
  46. package/lib/radio-picker/types.js +15 -0
  47. package/lib/radio-picker/utils.d.ts +13 -0
  48. package/lib/radio-picker/utils.js +99 -0
  49. package/lib/utils/debounce.d.ts +46 -0
  50. package/lib/utils/debounce.js +84 -0
  51. package/lib/vue-sfc-shim.d.ts +6 -6
  52. package/lib/vue-tsx-shim.d.ts +23 -23
  53. package/lib/web-types.json +1 -1
  54. package/lib/zartui.cjs.js +1676 -999
  55. package/lib/zartui.es.js +1676 -999
  56. package/lib/zartui.js +1682 -1005
  57. package/lib/zartui.min.js +1 -1
  58. package/package.json +67 -67
package/lib/index.d.ts CHANGED
@@ -47,6 +47,7 @@ export * from "./popup";
47
47
  export * from "./pull-refresh";
48
48
  export * from "./radio";
49
49
  export * from "./radio-group";
50
+ export * from "./radio-picker";
50
51
  export * from "./rate";
51
52
  export * from "./row";
52
53
  export * from "./search";
@@ -77,4 +78,4 @@ declare namespace _default {
77
78
  }
78
79
  export default _default;
79
80
  export function install(app: any): void;
80
- export const version: "3.1.3";
81
+ export const version: "3.1.5";
package/lib/index.js CHANGED
@@ -71,6 +71,7 @@ var import_popup = require("./popup");
71
71
  var import_pull_refresh = require("./pull-refresh");
72
72
  var import_radio = require("./radio");
73
73
  var import_radio_group = require("./radio-group");
74
+ var import_radio_picker = require("./radio-picker");
74
75
  var import_rate = require("./rate");
75
76
  var import_row = require("./row");
76
77
  var import_search = require("./search");
@@ -144,6 +145,7 @@ __reExport(stdin_exports, require("./popup"), module.exports);
144
145
  __reExport(stdin_exports, require("./pull-refresh"), module.exports);
145
146
  __reExport(stdin_exports, require("./radio"), module.exports);
146
147
  __reExport(stdin_exports, require("./radio-group"), module.exports);
148
+ __reExport(stdin_exports, require("./radio-picker"), module.exports);
147
149
  __reExport(stdin_exports, require("./rate"), module.exports);
148
150
  __reExport(stdin_exports, require("./row"), module.exports);
149
151
  __reExport(stdin_exports, require("./search"), module.exports);
@@ -168,7 +170,7 @@ __reExport(stdin_exports, require("./time-picker"), module.exports);
168
170
  __reExport(stdin_exports, require("./timeline"), module.exports);
169
171
  __reExport(stdin_exports, require("./toast"), module.exports);
170
172
  __reExport(stdin_exports, require("./uploader"), module.exports);
171
- const version = "3.1.3";
173
+ const version = "3.1.5";
172
174
  function install(app) {
173
175
  const components = [
174
176
  import_action_sheet.ActionSheet,
@@ -219,6 +221,7 @@ function install(app) {
219
221
  import_pull_refresh.PullRefresh,
220
222
  import_radio.Radio,
221
223
  import_radio_group.RadioGroup,
224
+ import_radio_picker.RadioPicker,
222
225
  import_rate.Rate,
223
226
  import_row.Row,
224
227
  import_search.Search,
@@ -1,55 +1,55 @@
1
- import type { App } from 'vue';
2
-
3
- declare type ListenEvent =
4
- | 'scroll'
5
- | 'wheel'
6
- | 'mousewheel'
7
- | 'resize'
8
- | 'animationend'
9
- | 'transitionend'
10
- | 'touchmove';
11
-
12
- // eslint-disable-next-line
13
- declare type Callback = (listener: any, options: LazyloadOptions) => void;
14
-
15
- declare type Filter = {
16
- webp?: Callback;
17
- progressive?: Callback;
18
- };
19
-
20
- declare type Adapter = {
21
- error?: Callback;
22
- loaded?: Callback;
23
- loading?: Callback;
24
- };
25
-
26
- export declare type LazyloadOptions = {
27
- error?: string;
28
- filter?: Filter;
29
- silent?: boolean;
30
- adapter?: Adapter;
31
- loading?: string;
32
- attempt?: number;
33
- preLoad?: number;
34
- observer?: boolean;
35
- lazyImage?: boolean;
36
- throttleWait?: number;
37
- listenEvents?: ListenEvent[];
38
- dispatchEvent?: boolean;
39
- lazyComponent?: boolean;
40
- observerOptions?: IntersectionObserverInit;
41
- };
42
-
43
- export declare const Lazyload: {
44
- install(app: App, options?: LazyloadOptions): void;
45
- };
46
-
47
- declare module '@vue/runtime-core' {
48
- interface ComponentCustomProperties {
49
- $Lazyload: {
50
- $on: (event: string, handler: Callback) => void;
51
- $off: (event: string, handler?: Callback) => void;
52
- $once: (event: string, handler: Callback) => void;
53
- };
54
- }
55
- }
1
+ import type { App } from 'vue';
2
+
3
+ declare type ListenEvent =
4
+ | 'scroll'
5
+ | 'wheel'
6
+ | 'mousewheel'
7
+ | 'resize'
8
+ | 'animationend'
9
+ | 'transitionend'
10
+ | 'touchmove';
11
+
12
+ // eslint-disable-next-line
13
+ declare type Callback = (listener: any, options: LazyloadOptions) => void;
14
+
15
+ declare type Filter = {
16
+ webp?: Callback;
17
+ progressive?: Callback;
18
+ };
19
+
20
+ declare type Adapter = {
21
+ error?: Callback;
22
+ loaded?: Callback;
23
+ loading?: Callback;
24
+ };
25
+
26
+ export declare type LazyloadOptions = {
27
+ error?: string;
28
+ filter?: Filter;
29
+ silent?: boolean;
30
+ adapter?: Adapter;
31
+ loading?: string;
32
+ attempt?: number;
33
+ preLoad?: number;
34
+ observer?: boolean;
35
+ lazyImage?: boolean;
36
+ throttleWait?: number;
37
+ listenEvents?: ListenEvent[];
38
+ dispatchEvent?: boolean;
39
+ lazyComponent?: boolean;
40
+ observerOptions?: IntersectionObserverInit;
41
+ };
42
+
43
+ export declare const Lazyload: {
44
+ install(app: App, options?: LazyloadOptions): void;
45
+ };
46
+
47
+ declare module '@vue/runtime-core' {
48
+ interface ComponentCustomProperties {
49
+ $Lazyload: {
50
+ $on: (event: string, handler: Callback) => void;
51
+ $off: (event: string, handler?: Callback) => void;
52
+ $once: (event: string, handler: Callback) => void;
53
+ };
54
+ }
55
+ }
@@ -0,0 +1,207 @@
1
+ import type { ExtractPropTypes, PropType } from 'vue';
2
+ import { Numeric } from '../utils';
3
+ import type { PickerColumn, PickerFieldNames, RadioPickerOption } from './types';
4
+ export declare const pickerSharedProps: {
5
+ loading: BooleanConstructor;
6
+ readonly: BooleanConstructor;
7
+ allowHtml: BooleanConstructor;
8
+ showToolbar: {
9
+ type: BooleanConstructor;
10
+ default: true;
11
+ };
12
+ showTitle: {
13
+ type: BooleanConstructor;
14
+ default: true;
15
+ };
16
+ swipeDuration: {
17
+ type: (NumberConstructor | StringConstructor)[];
18
+ default: number;
19
+ };
20
+ title: {
21
+ type: PropType<string>;
22
+ default: string;
23
+ };
24
+ } & {
25
+ cancelButtonText: StringConstructor;
26
+ confirmButtonText: StringConstructor;
27
+ };
28
+ export declare const radioPickerProps: {
29
+ loading: BooleanConstructor;
30
+ readonly: BooleanConstructor;
31
+ allowHtml: BooleanConstructor;
32
+ showToolbar: {
33
+ type: BooleanConstructor;
34
+ default: true;
35
+ };
36
+ showTitle: {
37
+ type: BooleanConstructor;
38
+ default: true;
39
+ };
40
+ swipeDuration: {
41
+ type: (NumberConstructor | StringConstructor)[];
42
+ default: number;
43
+ };
44
+ title: {
45
+ type: PropType<string>;
46
+ default: string;
47
+ };
48
+ } & {
49
+ cancelButtonText: StringConstructor;
50
+ confirmButtonText: StringConstructor;
51
+ } & {
52
+ columns: {
53
+ type: PropType<(PickerColumn | RadioPickerOption)[]>;
54
+ default: () => (PickerColumn | RadioPickerOption)[];
55
+ };
56
+ modelValue: {
57
+ type: PropType<Numeric[]>;
58
+ default: () => Numeric[];
59
+ };
60
+ columnsFieldNames: PropType<PickerFieldNames>;
61
+ wrapHeight: {
62
+ type: (NumberConstructor | StringConstructor)[];
63
+ default: string;
64
+ };
65
+ showPicker: BooleanConstructor;
66
+ popup: {
67
+ type: BooleanConstructor;
68
+ default: true;
69
+ };
70
+ searchable: BooleanConstructor;
71
+ autoSearch: {
72
+ type: BooleanConstructor;
73
+ default: true;
74
+ };
75
+ searchPlaceholder: {
76
+ type: PropType<string>;
77
+ default: string;
78
+ };
79
+ };
80
+ export type RadioPickerProps = ExtractPropTypes<typeof radioPickerProps>;
81
+ declare const _default: import("vue").DefineComponent<{
82
+ loading: BooleanConstructor;
83
+ readonly: BooleanConstructor;
84
+ allowHtml: BooleanConstructor;
85
+ showToolbar: {
86
+ type: BooleanConstructor;
87
+ default: true;
88
+ };
89
+ showTitle: {
90
+ type: BooleanConstructor;
91
+ default: true;
92
+ };
93
+ swipeDuration: {
94
+ type: (NumberConstructor | StringConstructor)[];
95
+ default: number;
96
+ };
97
+ title: {
98
+ type: PropType<string>;
99
+ default: string;
100
+ };
101
+ } & {
102
+ cancelButtonText: StringConstructor;
103
+ confirmButtonText: StringConstructor;
104
+ } & {
105
+ columns: {
106
+ type: PropType<(PickerColumn | RadioPickerOption)[]>;
107
+ default: () => (PickerColumn | RadioPickerOption)[];
108
+ };
109
+ modelValue: {
110
+ type: PropType<Numeric[]>;
111
+ default: () => Numeric[];
112
+ };
113
+ columnsFieldNames: PropType<PickerFieldNames>;
114
+ wrapHeight: {
115
+ type: (NumberConstructor | StringConstructor)[];
116
+ default: string;
117
+ };
118
+ showPicker: BooleanConstructor;
119
+ popup: {
120
+ type: BooleanConstructor;
121
+ default: true;
122
+ };
123
+ searchable: BooleanConstructor;
124
+ autoSearch: {
125
+ type: BooleanConstructor;
126
+ default: true;
127
+ };
128
+ searchPlaceholder: {
129
+ type: PropType<string>;
130
+ default: string;
131
+ };
132
+ }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "cancel" | "change" | "confirm" | "clickOption" | "update:showPicker")[], "update:modelValue" | "cancel" | "change" | "confirm" | "clickOption" | "update:showPicker", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
133
+ loading: BooleanConstructor;
134
+ readonly: BooleanConstructor;
135
+ allowHtml: BooleanConstructor;
136
+ showToolbar: {
137
+ type: BooleanConstructor;
138
+ default: true;
139
+ };
140
+ showTitle: {
141
+ type: BooleanConstructor;
142
+ default: true;
143
+ };
144
+ swipeDuration: {
145
+ type: (NumberConstructor | StringConstructor)[];
146
+ default: number;
147
+ };
148
+ title: {
149
+ type: PropType<string>;
150
+ default: string;
151
+ };
152
+ } & {
153
+ cancelButtonText: StringConstructor;
154
+ confirmButtonText: StringConstructor;
155
+ } & {
156
+ columns: {
157
+ type: PropType<(PickerColumn | RadioPickerOption)[]>;
158
+ default: () => (PickerColumn | RadioPickerOption)[];
159
+ };
160
+ modelValue: {
161
+ type: PropType<Numeric[]>;
162
+ default: () => Numeric[];
163
+ };
164
+ columnsFieldNames: PropType<PickerFieldNames>;
165
+ wrapHeight: {
166
+ type: (NumberConstructor | StringConstructor)[];
167
+ default: string;
168
+ };
169
+ showPicker: BooleanConstructor;
170
+ popup: {
171
+ type: BooleanConstructor;
172
+ default: true;
173
+ };
174
+ searchable: BooleanConstructor;
175
+ autoSearch: {
176
+ type: BooleanConstructor;
177
+ default: true;
178
+ };
179
+ searchPlaceholder: {
180
+ type: PropType<string>;
181
+ default: string;
182
+ };
183
+ }>> & {
184
+ onChange?: ((...args: any[]) => any) | undefined;
185
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
186
+ onCancel?: ((...args: any[]) => any) | undefined;
187
+ onConfirm?: ((...args: any[]) => any) | undefined;
188
+ onClickOption?: ((...args: any[]) => any) | undefined;
189
+ "onUpdate:showPicker"?: ((...args: any[]) => any) | undefined;
190
+ }, {
191
+ title: string;
192
+ modelValue: Numeric[];
193
+ readonly: boolean;
194
+ popup: boolean;
195
+ loading: boolean;
196
+ showTitle: boolean;
197
+ columns: (PickerColumn | RadioPickerOption)[];
198
+ allowHtml: boolean;
199
+ showToolbar: boolean;
200
+ swipeDuration: string | number;
201
+ showPicker: boolean;
202
+ wrapHeight: string | number;
203
+ searchable: boolean;
204
+ autoSearch: boolean;
205
+ searchPlaceholder: string;
206
+ }, {}>;
207
+ export default _default;
@@ -0,0 +1,319 @@
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 name2 in all)
9
+ __defProp(target, name2, { get: all[name2], 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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var stdin_exports = {};
29
+ __export(stdin_exports, {
30
+ default: () => stdin_default,
31
+ pickerSharedProps: () => pickerSharedProps,
32
+ radioPickerProps: () => radioPickerProps
33
+ });
34
+ module.exports = __toCommonJS(stdin_exports);
35
+ var import_vue = require("vue");
36
+ var import_vue2 = require("vue");
37
+ var import_utils = require("../utils");
38
+ var import_utils2 = require("./utils");
39
+ var import_use = require("@zartui/use");
40
+ var import_use_expose = require("../composables/use-expose");
41
+ var import_divider = require("../divider");
42
+ var import_loading = require("../loading");
43
+ var import_search = __toESM(require("../search"));
44
+ var import_RadioPickerColumn = __toESM(require("./RadioPickerColumn"));
45
+ var import_RadioPickerToolbar = __toESM(require("./RadioPickerToolbar"));
46
+ var import_popup = __toESM(require("../popup"));
47
+ var import_debounce = require("../utils/debounce");
48
+ const RADIO_PICKER_TITLE_HEIGHT = 44;
49
+ const RADIO_PICKER_SEARCH_HEIGHT = 60;
50
+ const pickerSharedProps = (0, import_utils.extend)({
51
+ loading: Boolean,
52
+ readonly: Boolean,
53
+ allowHtml: Boolean,
54
+ showToolbar: import_utils.truthProp,
55
+ showTitle: import_utils.truthProp,
56
+ swipeDuration: (0, import_utils.makeNumericProp)(1e3),
57
+ title: (0, import_utils.makeStringProp)("\u8BF7\u9009\u62E9")
58
+ }, import_RadioPickerToolbar.pickerToolbarProps);
59
+ const radioPickerProps = (0, import_utils.extend)({}, pickerSharedProps, {
60
+ columns: (0, import_utils.makeArrayProp)(),
61
+ modelValue: (0, import_utils.makeArrayProp)(),
62
+ columnsFieldNames: Object,
63
+ // 占满半屏,这里的高度是减去了title与底部按钮的内容高度
64
+ wrapHeight: (0, import_utils.makeNumericProp)("40vh"),
65
+ showPicker: Boolean,
66
+ popup: import_utils.truthProp,
67
+ searchable: Boolean,
68
+ autoSearch: import_utils.truthProp,
69
+ searchPlaceholder: (0, import_utils.makeStringProp)("\u8BF7\u641C\u7D22")
70
+ });
71
+ var stdin_default = (0, import_vue2.defineComponent)({
72
+ name: import_utils2.name,
73
+ props: radioPickerProps,
74
+ emits: ["confirm", "cancel", "change", "clickOption", "update:modelValue", "update:showPicker"],
75
+ setup(props, {
76
+ emit,
77
+ slots
78
+ }) {
79
+ const columnsRef = (0, import_vue2.ref)();
80
+ const selectedValues = (0, import_vue2.ref)(props.modelValue.slice(0));
81
+ const showPicker = (0, import_vue2.ref)(props.showPicker);
82
+ const {
83
+ children,
84
+ linkChildren
85
+ } = (0, import_use.useChildren)(import_RadioPickerColumn.PICKER_KEY);
86
+ const searchVal = (0, import_vue2.ref)("");
87
+ const autoSearchVal = (0, import_vue2.ref)("");
88
+ linkChildren();
89
+ const fields = (0, import_vue2.computed)(() => (0, import_utils2.assignDefaultFields)(props.columnsFieldNames));
90
+ const wrapHeight = (0, import_vue2.computed)(() => {
91
+ const basicContentHeight = (0, import_utils.unitToPx)(props.wrapHeight);
92
+ let contentHeight = basicContentHeight;
93
+ if (props.showTitle) {
94
+ if (props.searchable) {
95
+ contentHeight = basicContentHeight - RADIO_PICKER_SEARCH_HEIGHT;
96
+ }
97
+ } else {
98
+ contentHeight = basicContentHeight + RADIO_PICKER_TITLE_HEIGHT;
99
+ if (props.searchable) {
100
+ contentHeight -= RADIO_PICKER_SEARCH_HEIGHT;
101
+ }
102
+ }
103
+ return contentHeight;
104
+ });
105
+ const columnsType = (0, import_vue2.computed)(() => (0, import_utils2.getColumnsType)(props.columns, fields.value));
106
+ const currentColumns = (0, import_vue2.computed)(() => {
107
+ const {
108
+ columns
109
+ } = props;
110
+ switch (columnsType.value) {
111
+ case "multiple":
112
+ return columns;
113
+ case "cascade":
114
+ return (0, import_utils2.formatCascadeColumns)(columns, fields.value, selectedValues);
115
+ default:
116
+ return [columns];
117
+ }
118
+ });
119
+ const hasOptions = (0, import_vue2.computed)(() => currentColumns.value.some((options) => options.length));
120
+ const selectedOptions = (0, import_vue2.computed)(() => currentColumns.value.map((options, index) => (0, import_utils2.findOptionByValue)(options, selectedValues.value[index], fields.value)));
121
+ (0, import_vue2.watch)(showPicker, (newValue) => {
122
+ if (newValue !== props.showPicker) {
123
+ emit("update:showPicker", newValue);
124
+ }
125
+ });
126
+ (0, import_vue2.watch)(() => props.showPicker, (newValue) => {
127
+ if (newValue !== showPicker.value) {
128
+ showPicker.value = newValue;
129
+ }
130
+ });
131
+ const setValue = (index, value) => {
132
+ if (selectedValues.value[index] !== value) {
133
+ const newValues = selectedValues.value.slice(0);
134
+ newValues[index] = value;
135
+ selectedValues.value = newValues;
136
+ }
137
+ };
138
+ const getEventParams = () => ({
139
+ selectedValues: selectedValues.value.slice(0),
140
+ selectedOptions: selectedOptions.value
141
+ });
142
+ const onChange = (value, columnIndex) => {
143
+ setValue(columnIndex, value);
144
+ if (columnsType.value === "cascade") {
145
+ selectedValues.value.forEach((value2, index) => {
146
+ const options = currentColumns.value[index];
147
+ if (!(0, import_utils2.isOptionExist)(options, value2, fields.value)) {
148
+ setValue(index, options.length ? options[0][fields.value.value] : void 0);
149
+ }
150
+ });
151
+ }
152
+ (0, import_vue2.nextTick)(() => {
153
+ emit("change", (0, import_utils.extend)({
154
+ columnIndex
155
+ }, getEventParams()));
156
+ });
157
+ };
158
+ const onClickOption = (currentOption, columnIndex) => emit("clickOption", (0, import_utils.extend)({
159
+ columnIndex,
160
+ currentOption
161
+ }, getEventParams()));
162
+ const confirm = () => {
163
+ children.forEach((child) => child.stopMomentum());
164
+ const params = getEventParams();
165
+ emit("confirm", params);
166
+ return params;
167
+ };
168
+ const cancel = () => {
169
+ emit("update:showPicker", false);
170
+ emit("cancel", getEventParams());
171
+ };
172
+ const updateShow = (value) => emit("update:showPicker", value);
173
+ const renderColumnItems = () => currentColumns.value.map((options, columnIndex) => (0, import_vue.createVNode)(import_RadioPickerColumn.default, {
174
+ "value": selectedValues.value[columnIndex],
175
+ "fields": fields.value,
176
+ "options": options,
177
+ "readonly": props.readonly,
178
+ "allowHtml": props.allowHtml,
179
+ "wrapHeight": wrapHeight.value,
180
+ "swipeDuration": props.swipeDuration,
181
+ "autoSearchVal": autoSearchVal.value,
182
+ "onChange": (value) => onChange(value, columnIndex),
183
+ "onClickOption": (option) => onClickOption(option, columnIndex)
184
+ }, {
185
+ option: slots.option,
186
+ searchEmpty: slots["search-empty"]
187
+ }));
188
+ const renderMask = (maskHeight) => {
189
+ if (hasOptions.value) {
190
+ const maskStyle = {
191
+ backgroundSize: `100% ${(maskHeight - wrapHeight.value) / 2}px`
192
+ };
193
+ return [(0, import_vue.createVNode)("div", {
194
+ "class": (0, import_utils2.bem)("mask"),
195
+ "style": maskStyle
196
+ }, null)];
197
+ }
198
+ };
199
+ const handleSearchInput = () => {
200
+ if (props.autoSearch) {
201
+ return (0, import_debounce.useDebounceFn)((val) => {
202
+ searchVal.value = val;
203
+ autoSearchVal.value = searchVal.value;
204
+ }, 500);
205
+ }
206
+ return (val) => {
207
+ searchVal.value = val;
208
+ };
209
+ };
210
+ const handleSearch = () => {
211
+ if (!props.autoSearch) {
212
+ autoSearchVal.value = searchVal.value;
213
+ }
214
+ };
215
+ const renderSearch = () => {
216
+ if (props.searchable) {
217
+ return (0, import_vue.createVNode)("div", {
218
+ "class": (0, import_utils2.bem)("search")
219
+ }, [(0, import_vue.createVNode)(import_search.default, {
220
+ "show-action": !props.autoSearch,
221
+ "modelValue": searchVal.value,
222
+ "placeholder": props.searchPlaceholder,
223
+ "onUpdate:modelValue": handleSearchInput(),
224
+ "onSearch": handleSearch,
225
+ "onClear": handleSearch
226
+ }, null)]);
227
+ }
228
+ };
229
+ const renderColumns = () => {
230
+ const columnsStyle = {
231
+ height: `${wrapHeight.value}px`
232
+ };
233
+ return (0, import_vue.createVNode)("div", {
234
+ "ref": columnsRef,
235
+ "class": (0, import_utils2.bem)("columns"),
236
+ "style": columnsStyle
237
+ }, [renderColumnItems(), renderMask(wrapHeight.value)]);
238
+ };
239
+ const renderToolbar = () => {
240
+ if (props.showToolbar) {
241
+ return (0, import_vue.createVNode)(import_RadioPickerToolbar.default, (0, import_vue.mergeProps)((0, import_utils.pick)(props, import_RadioPickerToolbar.pickerToolbarPropKeys), {
242
+ "onConfirm": confirm,
243
+ "onCancel": cancel
244
+ }), (0, import_utils.pick)(slots, import_RadioPickerToolbar.pickerToolbarSlots));
245
+ }
246
+ };
247
+ const renderTitleBar = () => {
248
+ if (props.showTitle) {
249
+ if (slots["title"]) {
250
+ return slots["title"]();
251
+ }
252
+ return (0, import_vue.createVNode)("div", {
253
+ "class": [(0, import_utils2.bem)("title"), import_utils.HAPTICS_FEEDBACK]
254
+ }, [props.title]);
255
+ }
256
+ };
257
+ const topDivider = () => props.showTitle ? (0, import_vue.createVNode)(import_divider.Divider, {
258
+ "style": "margin: 0"
259
+ }, null) : null;
260
+ const buttomDivider = () => props.showToolbar ? (0, import_vue.createVNode)(import_divider.Divider, {
261
+ "style": "margin: 0"
262
+ }, null) : null;
263
+ (0, import_vue2.watch)(currentColumns, (columns) => {
264
+ columns.forEach((options, index) => {
265
+ if (options.length && !(0, import_utils2.isOptionExist)(options, selectedValues.value[index], fields.value)) {
266
+ setValue(index, (0, import_utils2.getFirstEnabledOption)(options)[fields.value.value]);
267
+ }
268
+ });
269
+ }, {
270
+ immediate: true
271
+ });
272
+ let lastEmittedModelValue;
273
+ (0, import_vue2.watch)(() => props.modelValue, (newValues) => {
274
+ if (!(0, import_utils.isSameValue)(newValues, selectedValues.value) && !(0, import_utils.isSameValue)(newValues, lastEmittedModelValue)) {
275
+ selectedValues.value = newValues.slice(0);
276
+ lastEmittedModelValue = newValues.slice(0);
277
+ }
278
+ }, {
279
+ deep: true
280
+ });
281
+ (0, import_vue2.watch)(selectedValues, (newValues) => {
282
+ if (!(0, import_utils.isSameValue)(newValues, props.modelValue)) {
283
+ lastEmittedModelValue = newValues.slice(0);
284
+ emit("update:modelValue", lastEmittedModelValue);
285
+ }
286
+ }, {
287
+ immediate: true
288
+ });
289
+ (0, import_use.useEventListener)("touchmove", import_utils.preventDefault, {
290
+ target: columnsRef
291
+ });
292
+ const getSelectedOptions = () => selectedOptions.value;
293
+ (0, import_use_expose.useExpose)({
294
+ confirm,
295
+ getSelectedOptions
296
+ });
297
+ const renderPicker = () => {
298
+ var _a, _b;
299
+ return (0, import_vue.createVNode)("div", {
300
+ "class": (0, import_utils2.bem)()
301
+ }, [renderTitleBar(), props.loading ? (0, import_vue.createVNode)(import_loading.Loading, {
302
+ "class": (0, import_utils2.bem)("loading")
303
+ }, null) : null, topDivider(), renderSearch(), (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots), buttomDivider(), renderToolbar()]);
304
+ };
305
+ return () => {
306
+ if (props.popup) {
307
+ return (0, import_vue.createVNode)(import_popup.default, {
308
+ "show": showPicker.value,
309
+ "onUpdate:show": [($event) => showPicker.value = $event, updateShow],
310
+ "round": true,
311
+ "position": "bottom"
312
+ }, {
313
+ default: renderPicker
314
+ });
315
+ }
316
+ return renderPicker();
317
+ };
318
+ }
319
+ });