@nutui/nutui 4.3.0 → 4.3.2

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 (128) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +5980 -6124
  4. package/dist/nutui.umd.js +1 -1
  5. package/dist/packages/actionsheet/ActionSheet.js +1 -3
  6. package/dist/packages/address/Address.js +1 -4
  7. package/dist/packages/addresslist/AddressList.js +0 -4
  8. package/dist/packages/animate/Animate.js +51 -44
  9. package/dist/packages/audio/Audio.js +0 -3
  10. package/dist/packages/audiooperate/AudioOperate.js +0 -4
  11. package/dist/packages/avatar/Avatar.js +0 -1
  12. package/dist/packages/avatarcropper/AvatarCropper.js +0 -1
  13. package/dist/packages/calendar/Calendar.js +1 -7
  14. package/dist/packages/calendarcard/CalendarCard.js +0 -2
  15. package/dist/packages/calendaritem/CalendarItem.js +0 -2
  16. package/dist/packages/card/Card.js +2 -3
  17. package/dist/packages/cascader/Cascader.js +1 -10
  18. package/dist/packages/checkbox/Checkbox.js +4 -2
  19. package/dist/packages/col/Col.js +41 -30
  20. package/dist/packages/collapse/Collapse.js +40 -28
  21. package/dist/packages/collapseitem/CollapseItem.js +112 -125
  22. package/dist/packages/comment/Comment.js +0 -5
  23. package/dist/packages/common-FZL3qC99.js +16 -0
  24. package/dist/packages/countdown/Countdown.js +3 -4
  25. package/dist/packages/datepicker/DatePicker.js +0 -4
  26. package/dist/packages/dialog/Dialog.js +1 -5
  27. package/dist/packages/ecard/Ecard.js +0 -4
  28. package/dist/packages/empty/Empty.js +0 -2
  29. package/dist/packages/fixednav/FixedNav.js +0 -2
  30. package/dist/packages/form/Form.js +163 -157
  31. package/dist/packages/formitem/FormItem.js +77 -108
  32. package/dist/packages/grid/Grid.js +0 -1
  33. package/dist/packages/imagepreview/ImagePreview.js +1 -5
  34. package/dist/packages/{index-wY4t0zYt.js → index-BqB5dTeo.js} +29 -17
  35. package/dist/packages/{index.vue_vue_type_script_lang-MJYVRFbp.js → index.vue_vue_type_script_lang-n0HbjvfF.js} +6 -4
  36. package/dist/packages/infiniteloading/InfiniteLoading.js +0 -1
  37. package/dist/packages/input/Input.js +10 -7
  38. package/dist/packages/inputnumber/InputNumber.js +11 -8
  39. package/dist/packages/invoice/Invoice.js +10 -21
  40. package/dist/packages/layout/Layout.js +3 -0
  41. package/dist/packages/locale/lang/index.js +0 -1
  42. package/dist/packages/menuitem/MenuItem.js +1 -3
  43. package/dist/packages/notify/Notify.js +1 -4
  44. package/dist/packages/numberkeyboard/NumberKeyboard.js +1 -5
  45. package/dist/packages/pagination/Pagination.js +0 -2
  46. package/dist/packages/picker/Picker.js +10 -5
  47. package/dist/packages/popover/Popover.js +1 -4
  48. package/dist/packages/popup/Popup.js +1 -5
  49. package/dist/packages/price/Price.js +69 -77
  50. package/dist/packages/pullrefresh/PullRefresh.js +0 -1
  51. package/dist/packages/radio/Radio.js +1 -6
  52. package/dist/packages/radiogroup/RadioGroup.js +0 -3
  53. package/dist/packages/range/Range.js +10 -7
  54. package/dist/packages/rate/Rate.js +6 -3
  55. package/dist/packages/row/Row.js +43 -39
  56. package/dist/packages/searchbar/Searchbar.js +5 -4
  57. package/dist/packages/shortpassword/ShortPassword.js +1 -4
  58. package/dist/packages/signature/Signature.js +0 -4
  59. package/dist/packages/sku/Sku.js +8 -12
  60. package/dist/packages/switch/Switch.js +12 -2
  61. package/dist/packages/switch/index.css +1 -1
  62. package/dist/packages/switch/index.scss +1 -1
  63. package/dist/packages/table/Table.js +0 -2
  64. package/dist/packages/tabs/Tabs.js +0 -1
  65. package/dist/packages/textarea/Textarea.js +7 -6
  66. package/dist/packages/timepannel/TimePannel.js +2 -2
  67. package/dist/packages/timeselect/TimeSelect.js +1 -5
  68. package/dist/packages/toast/Toast.js +3 -3
  69. package/dist/packages/tour/Tour.js +0 -4
  70. package/dist/packages/uploader/Uploader.js +7 -5
  71. package/dist/packages/video/Video.js +0 -2
  72. package/dist/smartips/web-types.json +21 -3
  73. package/dist/style.css +1 -1
  74. package/dist/types/__VUE/address/index.vue.d.ts +43 -3
  75. package/dist/types/__VUE/animate/animate.vue.d.ts +75 -0
  76. package/dist/types/__VUE/animate/index.d.ts +6 -0
  77. package/dist/types/__VUE/col/col.vue.d.ts +53 -0
  78. package/dist/types/__VUE/col/index.d.ts +5 -0
  79. package/dist/types/__VUE/collapse/collapse.vue.d.ts +60 -0
  80. package/dist/types/__VUE/collapse/index.d.ts +6 -0
  81. package/dist/types/__VUE/collapse/types.d.ts +3 -2
  82. package/dist/types/__VUE/collapseitem/collapse-item.vue.d.ts +201 -0
  83. package/dist/types/__VUE/collapseitem/index.d.ts +5 -0
  84. package/dist/types/__VUE/countdown/index.vue.d.ts +23 -1
  85. package/dist/types/__VUE/fixednav/index.vue.d.ts +2 -2
  86. package/dist/types/__VUE/form/common.d.ts +4 -30
  87. package/dist/types/__VUE/form/form.vue.d.ts +80 -0
  88. package/dist/types/__VUE/form/index.d.ts +6 -0
  89. package/dist/types/__VUE/form/types.d.ts +12 -5
  90. package/dist/types/__VUE/formitem/form-item.vue.d.ts +97 -0
  91. package/dist/types/__VUE/formitem/index.d.ts +5 -0
  92. package/dist/types/__VUE/input/index.vue.d.ts +1 -0
  93. package/dist/types/__VUE/inputnumber/index.vue.d.ts +1 -0
  94. package/dist/types/__VUE/layout/index.d.ts +4 -0
  95. package/dist/types/__VUE/layout/layout.vue.d.ts +10 -0
  96. package/dist/types/__VUE/picker/index.vue.d.ts +1 -0
  97. package/dist/types/__VUE/picker/types.d.ts +1 -0
  98. package/dist/types/__VUE/picker/usePicker.d.ts +1 -0
  99. package/dist/types/__VUE/price/index.d.ts +6 -0
  100. package/dist/types/__VUE/price/price.vue.d.ts +83 -0
  101. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  102. package/dist/types/__VUE/rate/index.vue.d.ts +1 -0
  103. package/dist/types/__VUE/row/index.d.ts +5 -0
  104. package/dist/types/__VUE/row/row.vue.d.ts +71 -0
  105. package/dist/types/__VUE/searchbar/index.vue.d.ts +1 -0
  106. package/dist/types/__VUE/skeleton/index.vue.d.ts +3 -3
  107. package/dist/types/__VUE/sku/components/SkuStepper.vue.d.ts +1 -1
  108. package/dist/types/__VUE/sku/index.vue.d.ts +1 -1
  109. package/dist/types/__VUE/switch/index.vue.d.ts +9 -0
  110. package/dist/types/__VUE/table/index.vue.d.ts +4 -4
  111. package/dist/types/__VUE/tabs/index.vue.d.ts +4 -4
  112. package/dist/types/__VUE/textarea/index.vue.d.ts +1 -0
  113. package/dist/types/__VUE/toast/index.vue.d.ts +21 -1
  114. package/dist/types/index.d.ts +19 -10
  115. package/dist/types/utils/index.d.ts +1 -0
  116. package/package.json +1 -1
  117. package/dist/packages/types-Ynmct7na.js +0 -4
  118. package/dist/types/__VUE/animate/index.vue.d.ts +0 -71
  119. package/dist/types/__VUE/col/index.vue.d.ts +0 -42
  120. package/dist/types/__VUE/collapse/index.vue.d.ts +0 -39
  121. package/dist/types/__VUE/collapseitem/index.vue.d.ts +0 -212
  122. package/dist/types/__VUE/form/index.vue.d.ts +0 -58
  123. package/dist/types/__VUE/formitem/index.vue.d.ts +0 -134
  124. package/dist/types/__VUE/formitem/types.d.ts +0 -11
  125. package/dist/types/__VUE/layout/index.vue.d.ts +0 -12
  126. package/dist/types/__VUE/price/index.vue.d.ts +0 -97
  127. package/dist/types/__VUE/row/index.vue.d.ts +0 -62
  128. /package/dist/types/__VUE/animate/{type.d.ts → types.d.ts} +0 -0
@@ -1,6 +1,22 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
1
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
3
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
4
20
  var __objRest = (source, exclude) => {
5
21
  var target = {};
6
22
  for (var prop in source)
@@ -33,178 +49,168 @@ var __async = (__this, __arguments, generator) => {
33
49
  step((generator = generator.apply(__this, __arguments)).next());
34
50
  });
35
51
  };
36
- import { c as createComponent } from "../component-TCzwHGVq.js";
37
- import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, withModifiers, createVNode, withCtx, renderSlot } from "vue";
38
- import { g as getPropByPath, f as isPromise } from "../util-4Jkyw4BJ.js";
39
- import { F as FORM_KEY } from "../types-Ynmct7na.js";
52
+ import { defineComponent, computed, reactive, provide, watch, openBlock, createElementBlock, withModifiers, createVNode, withCtx, renderSlot } from "vue";
40
53
  import { u as useChildren } from "../useChildren-GU_NVfD8.js";
54
+ import { g as getPropByPath, f as isPromise } from "../util-4Jkyw4BJ.js";
41
55
  import NutCellGroup from "../cellgroup/CellGroup.js";
42
- import { _ as _export_sfc } from "../_plugin-vue_export-helper-yVxbj29m.js";
43
- const component = (components) => {
44
- return {
45
- props: {
46
- modelValue: {
47
- type: Object,
48
- default: () => ({})
49
- },
50
- rules: {
51
- type: Object,
52
- default: () => ({})
53
- },
54
- labelPosition: {
55
- type: String,
56
- default: "left"
56
+ import { F as FORM_KEY, a as FORM_DISABLED_KEY } from "../common-FZL3qC99.js";
57
+ import { w as withInstall } from "../with-install-p59gYYU_.js";
58
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
59
+ name: "NutForm"
60
+ }), {
61
+ __name: "form",
62
+ props: {
63
+ modelValue: { default: () => ({}) },
64
+ rules: { default: () => ({}) },
65
+ disabled: { type: Boolean, default: false },
66
+ labelPosition: { default: "left" },
67
+ starPosition: { default: "left" }
68
+ },
69
+ emits: ["validate"],
70
+ setup(__props, { expose: __expose, emit: __emit }) {
71
+ const props = __props;
72
+ const emit = __emit;
73
+ const { children, linkChildren } = useChildren(FORM_KEY);
74
+ linkChildren({ props });
75
+ const { linkChildren: linkChildren2 } = useChildren(FORM_DISABLED_KEY);
76
+ linkChildren2({ props });
77
+ const formErrorTip = computed(() => reactive({}));
78
+ provide("formErrorTip", formErrorTip);
79
+ const clearErrorTips = () => {
80
+ Object.keys(formErrorTip.value).forEach((item) => {
81
+ formErrorTip.value[item] = "";
82
+ });
83
+ };
84
+ const reset = () => {
85
+ clearErrorTips();
86
+ };
87
+ watch(
88
+ () => props.modelValue,
89
+ () => {
90
+ clearErrorTips();
57
91
  },
58
- starPosition: {
59
- type: String,
60
- default: "left"
61
- }
62
- },
63
- components,
64
- emits: ["validate"],
65
- setup(props, { emit }) {
66
- const { children, linkChildren } = useChildren(FORM_KEY);
67
- linkChildren({ props });
68
- const formErrorTip = computed(() => reactive({}));
69
- provide("formErrorTip", formErrorTip);
70
- const clearErrorTips = () => {
71
- Object.keys(formErrorTip.value).forEach((item) => {
72
- formErrorTip.value[item] = "";
92
+ { immediate: true }
93
+ );
94
+ const getTaskFromChildren = () => {
95
+ const task = [];
96
+ children.forEach((item) => {
97
+ task.push({
98
+ prop: item == null ? void 0 : item["prop"],
99
+ rules: (item == null ? void 0 : item["rules"]) || []
73
100
  });
74
- };
75
- const reset = () => {
76
- clearErrorTips();
77
- };
78
- watch(
79
- () => props.modelValue,
80
- () => {
81
- clearErrorTips();
82
- },
83
- { immediate: true }
84
- );
85
- const getTaskFromChildren = () => {
86
- const task = [];
87
- children.forEach((item) => {
88
- task.push({
89
- prop: item == null ? void 0 : item["prop"],
90
- rules: (item == null ? void 0 : item["rules"]) || []
91
- });
101
+ });
102
+ return task;
103
+ };
104
+ const tipMessage = (errorMsg) => {
105
+ if (errorMsg.message) {
106
+ emit("validate", errorMsg);
107
+ }
108
+ formErrorTip.value[errorMsg.prop] = errorMsg.message;
109
+ };
110
+ const checkRule = (item) => __async(this, null, function* () {
111
+ const { rules = [], prop } = item;
112
+ const _Promise = (errorMsg) => {
113
+ return new Promise((resolve, reject) => {
114
+ try {
115
+ tipMessage(errorMsg);
116
+ resolve(errorMsg);
117
+ } catch (error) {
118
+ reject(error);
119
+ }
92
120
  });
93
- return task;
94
121
  };
95
- const tipMessage = (errorMsg) => {
96
- if (errorMsg.message) {
97
- emit("validate", errorMsg);
122
+ if (!prop) {
123
+ console.warn("[NutUI] <FormItem> 使用 rules 校验规则时 , 必须设置 prop 参数");
124
+ }
125
+ const value = getPropByPath(props.modelValue, prop || "");
126
+ tipMessage({ prop, message: "" });
127
+ const formRules = props.rules || {};
128
+ const _rules = [...(formRules == null ? void 0 : formRules[prop]) || [], ...rules];
129
+ while (_rules.length) {
130
+ const rule = _rules.shift();
131
+ const _a = rule, { validator } = _a, ruleWithoutValidator = __objRest(_a, ["validator"]);
132
+ const { required, regex, message } = ruleWithoutValidator;
133
+ const errorMsg = { prop, message: message || "" };
134
+ if (required) {
135
+ if (!value && value !== 0) {
136
+ return _Promise(errorMsg);
137
+ }
98
138
  }
99
- formErrorTip.value[errorMsg.prop] = errorMsg.message;
100
- };
101
- const checkRule = (item) => __async(this, null, function* () {
102
- const { rules, prop } = item;
103
- const _Promise = (errorMsg) => {
104
- return new Promise((resolve, reject) => {
139
+ if (regex && !regex.test(String(value))) {
140
+ return _Promise(errorMsg);
141
+ }
142
+ if (validator) {
143
+ const result = validator(value, ruleWithoutValidator);
144
+ if (isPromise(result)) {
105
145
  try {
106
- tipMessage(errorMsg);
107
- resolve(errorMsg);
146
+ const value2 = yield result;
147
+ if (value2 === false) {
148
+ return _Promise(errorMsg);
149
+ }
108
150
  } catch (error) {
109
- reject(error);
151
+ const validateErrorMsg = { prop, message: error };
152
+ return _Promise(validateErrorMsg);
110
153
  }
111
- });
112
- };
113
- if (!prop) {
114
- console.warn("[NutUI] <FormItem> 使用 rules 校验规则时 , 必须设置 prop 参数");
115
- }
116
- const value = getPropByPath(props.modelValue, prop || "");
117
- tipMessage({ prop, message: "" });
118
- const formRules = props.rules || {};
119
- const _rules = [...(formRules == null ? void 0 : formRules[prop]) || [], ...rules];
120
- while (_rules.length) {
121
- const rule = _rules.shift();
122
- const _a = rule, { validator } = _a, ruleWithoutValidator = __objRest(_a, ["validator"]);
123
- const { required, regex, message } = ruleWithoutValidator;
124
- const errorMsg = { prop, message: message || "" };
125
- if (required) {
126
- if (!value && value !== 0) {
154
+ } else {
155
+ if (!result) {
127
156
  return _Promise(errorMsg);
128
157
  }
129
158
  }
130
- if (regex && !regex.test(String(value))) {
131
- return _Promise(errorMsg);
132
- }
133
- if (validator) {
134
- const result = validator(value, ruleWithoutValidator);
135
- if (isPromise(result)) {
136
- try {
137
- const value2 = yield result;
138
- if (value2 === false) {
139
- return _Promise(errorMsg);
140
- }
141
- } catch (error) {
142
- const validateErrorMsg = { prop, message: error };
143
- return _Promise(validateErrorMsg);
144
- }
145
- } else {
146
- if (!result) {
147
- return _Promise(errorMsg);
148
- }
159
+ }
160
+ }
161
+ return Promise.resolve(true);
162
+ });
163
+ const validate = (customProp = "") => {
164
+ return new Promise((resolve, reject) => {
165
+ try {
166
+ const task = getTaskFromChildren();
167
+ const errors = task.map((item) => {
168
+ if (customProp && customProp !== item.prop) {
169
+ return Promise.resolve(true);
149
170
  }
150
- }
171
+ return checkRule(item);
172
+ });
173
+ Promise.all(errors).then((errorRes) => {
174
+ errorRes = errorRes.filter((item) => item !== true);
175
+ const res = { valid: true, errors: [] };
176
+ if (errorRes.length) {
177
+ res.valid = false;
178
+ res.errors = errorRes;
179
+ }
180
+ resolve(res);
181
+ });
182
+ } catch (error) {
183
+ reject(error);
151
184
  }
152
- return Promise.resolve(true);
153
185
  });
154
- const validate = (customProp = "") => {
155
- return new Promise((resolve, reject) => {
156
- try {
157
- const task = getTaskFromChildren();
158
- const errors = task.map((item) => {
159
- if (customProp && customProp !== item.prop) {
160
- return Promise.resolve(true);
161
- }
162
- return checkRule(item);
163
- });
164
- Promise.all(errors).then((errorRes) => {
165
- errorRes = errorRes.filter((item) => item !== true);
166
- const res = { valid: true, errors: [] };
167
- if (errorRes.length) {
168
- res.valid = false;
169
- res.errors = errorRes;
170
- }
171
- resolve(res);
172
- });
173
- } catch (error) {
174
- reject(error);
175
- }
176
- });
177
- };
178
- const submit = () => {
179
- validate();
180
- return false;
181
- };
182
- return { validate, reset, submit, formErrorTip };
183
- }
184
- };
185
- };
186
- const { create } = createComponent("form");
187
- const _sfc_main = create(
188
- component({
189
- NutCellGroup
190
- })
191
- );
192
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
193
- const _component_nut_cell_group = resolveComponent("nut-cell-group");
194
- return openBlock(), createElementBlock("form", {
195
- class: "nut-form",
196
- action: "#",
197
- onSubmit: withModifiers(() => false, ["prevent"])
198
- }, [
199
- createVNode(_component_nut_cell_group, null, {
200
- default: withCtx(() => [
201
- renderSlot(_ctx.$slots, "default")
202
- ]),
203
- _: 3
204
- })
205
- ], 32);
206
- }
207
- const NutForm = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
186
+ };
187
+ const submit = () => {
188
+ validate();
189
+ return false;
190
+ };
191
+ __expose({
192
+ submit,
193
+ reset,
194
+ validate
195
+ });
196
+ return (_ctx, _cache) => {
197
+ return openBlock(), createElementBlock("form", {
198
+ class: "nut-form",
199
+ action: "#",
200
+ onSubmit: withModifiers(() => false, ["prevent"])
201
+ }, [
202
+ createVNode(NutCellGroup, null, {
203
+ default: withCtx(() => [
204
+ renderSlot(_ctx.$slots, "default")
205
+ ]),
206
+ _: 3
207
+ })
208
+ ], 32);
209
+ };
210
+ }
211
+ }));
212
+ withInstall(_sfc_main);
208
213
  export {
209
- NutForm as default
214
+ _sfc_main as Form,
215
+ _sfc_main as default
210
216
  };
@@ -1,69 +1,50 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { defineComponent, computed, inject, openBlock, createBlock, normalizeClass, unref, normalizeStyle, withCtx, createElementBlock, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode } from "vue";
1
21
  import { p as pxCheck } from "../pxCheck-OnXlN1NC.js";
2
- import { computed, inject, resolveComponent, openBlock, createBlock, normalizeClass, normalizeStyle, withCtx, createElementBlock, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode } from "vue";
3
- import { c as createComponent } from "../component-TCzwHGVq.js";
4
22
  import NutCell from "../cell/Cell.js";
5
- import { F as FORM_KEY } from "../types-Ynmct7na.js";
23
+ import { F as FORM_KEY } from "../common-FZL3qC99.js";
6
24
  import { u as useParent } from "../useParent-KIxqkovs.js";
7
- import { _ as _export_sfc } from "../_plugin-vue_export-helper-yVxbj29m.js";
8
- import "../index-Ii9XdkPy.js";
9
- import "@nutui/icons-vue";
10
- const { create } = createComponent("form-item");
11
- const _sfc_main = create({
12
- inheritAttrs: false,
25
+ import { w as withInstall } from "../with-install-p59gYYU_.js";
26
+ const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
27
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
28
+ name: "NutFormItem",
29
+ inheritAttrs: false
30
+ }), {
31
+ __name: "form-item",
13
32
  props: {
14
- prop: {
15
- type: String,
16
- default: ""
17
- },
18
- label: {
19
- type: String,
20
- default: ""
21
- },
22
- rules: {
23
- type: Array,
24
- default: () => []
25
- },
26
- required: {
27
- type: Boolean,
28
- default: false
29
- },
30
- showErrorMessage: {
31
- type: Boolean,
32
- default: true
33
- },
34
- showErrorLine: {
35
- type: Boolean,
36
- default: true
37
- },
38
- labelWidth: {
39
- type: [String, Number],
40
- default: ""
41
- },
42
- labelAlign: {
43
- type: String,
44
- default: ""
45
- },
46
- errorMessageAlign: {
47
- type: String,
48
- default: ""
49
- },
50
- bodyAlign: {
51
- type: String,
52
- default: ""
53
- },
54
- labelPosition: {
55
- type: String,
56
- default: ""
57
- },
58
- starPosition: {
59
- type: String,
60
- default: ""
61
- }
62
- },
63
- components: {
64
- NutCell
33
+ prop: { default: "" },
34
+ label: { default: "" },
35
+ rules: { default: () => [] },
36
+ required: { type: Boolean, default: false },
37
+ showErrorMessage: { type: Boolean, default: true },
38
+ showErrorLine: { type: Boolean, default: true },
39
+ labelWidth: {},
40
+ labelAlign: {},
41
+ errorMessageAlign: {},
42
+ bodyAlign: {},
43
+ labelPosition: {},
44
+ starPosition: {}
65
45
  },
66
- setup(props, { slots }) {
46
+ setup(__props) {
47
+ const props = __props;
67
48
  const { parent: parentObj } = useParent(FORM_KEY);
68
49
  const isRequired = computed(() => {
69
50
  var _a;
@@ -103,54 +84,42 @@ const _sfc_main = create({
103
84
  textAlign: props.errorMessageAlign
104
85
  };
105
86
  });
106
- const getSlots = (name) => slots[name];
107
- return {
108
- parent,
109
- labelStyle,
110
- bodyStyle,
111
- errorMessageStyle,
112
- getSlots,
113
- isRequired,
114
- labelPositionClass,
115
- starPositionClass
87
+ return (_ctx, _cache) => {
88
+ return openBlock(), createBlock(NutCell, {
89
+ class: normalizeClass(["nut-form-item", [{ error: unref(parent)[_ctx.prop], line: _ctx.showErrorLine }, _ctx.$attrs.class, labelPositionClass.value]]),
90
+ style: normalizeStyle(_ctx.$attrs.style)
91
+ }, {
92
+ default: withCtx(() => [
93
+ _ctx.label || _ctx.$slots.label ? (openBlock(), createElementBlock("view", {
94
+ key: 0,
95
+ class: normalizeClass(["nut-cell__title nut-form-item__label", { required: isRequired.value, [starPositionClass.value]: starPositionClass.value }]),
96
+ style: normalizeStyle(labelStyle.value)
97
+ }, [
98
+ renderSlot(_ctx.$slots, "label", {}, () => [
99
+ createTextVNode(toDisplayString(_ctx.label), 1)
100
+ ])
101
+ ], 6)) : createCommentVNode("", true),
102
+ createElementVNode("view", _hoisted_1, [
103
+ createElementVNode("view", {
104
+ class: "nut-form-item__body__slots",
105
+ style: normalizeStyle(bodyStyle.value)
106
+ }, [
107
+ renderSlot(_ctx.$slots, "default")
108
+ ], 4),
109
+ unref(parent)[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
110
+ key: 0,
111
+ class: "nut-form-item__body__tips",
112
+ style: normalizeStyle(errorMessageStyle.value)
113
+ }, toDisplayString(unref(parent)[_ctx.prop]), 5)) : createCommentVNode("", true)
114
+ ])
115
+ ]),
116
+ _: 3
117
+ }, 8, ["class", "style"]);
116
118
  };
117
119
  }
118
- });
119
- const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
120
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
121
- const _component_nut_cell = resolveComponent("nut-cell");
122
- return openBlock(), createBlock(_component_nut_cell, {
123
- class: normalizeClass(["nut-form-item", [{ error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }, _ctx.$attrs.class, _ctx.labelPositionClass]]),
124
- style: normalizeStyle(_ctx.$attrs.style)
125
- }, {
126
- default: withCtx(() => [
127
- _ctx.label || _ctx.getSlots("label") ? (openBlock(), createElementBlock("view", {
128
- key: 0,
129
- class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.isRequired, [_ctx.starPositionClass]: _ctx.starPositionClass }]),
130
- style: normalizeStyle(_ctx.labelStyle)
131
- }, [
132
- renderSlot(_ctx.$slots, "label", {}, () => [
133
- createTextVNode(toDisplayString(_ctx.label), 1)
134
- ])
135
- ], 6)) : createCommentVNode("", true),
136
- createElementVNode("view", _hoisted_1, [
137
- createElementVNode("view", {
138
- class: "nut-form-item__body__slots",
139
- style: normalizeStyle(_ctx.bodyStyle)
140
- }, [
141
- renderSlot(_ctx.$slots, "default")
142
- ], 4),
143
- _ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
144
- key: 0,
145
- class: "nut-form-item__body__tips",
146
- style: normalizeStyle(_ctx.errorMessageStyle)
147
- }, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
148
- ])
149
- ]),
150
- _: 3
151
- }, 8, ["class", "style"]);
152
- }
153
- const NutFormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
120
+ }));
121
+ withInstall(_sfc_main);
154
122
  export {
155
- NutFormItem as default
123
+ _sfc_main as FormItem,
124
+ _sfc_main as default
156
125
  };
@@ -1,7 +1,6 @@
1
1
  import { c as createComponent } from "../component-TCzwHGVq.js";
2
2
  import "vue";
3
3
  import { c as component } from "../common-4inKawxR.js";
4
- import "../pxCheck-OnXlN1NC.js";
5
4
  const { create } = createComponent("grid");
6
5
  const _sfc_main = create(component);
7
6
  export {
@@ -31,15 +31,11 @@ import NutVideo from "../video/Video.js";
31
31
  import NutSwiperItem from "../swiperitem/SwiperItem.js";
32
32
  import { _ as _export_sfc } from "../_plugin-vue_export-helper-yVxbj29m.js";
33
33
  import { CircleClose } from "@nutui/icons-vue";
34
- import { N as NutPopup } from "../index-wY4t0zYt.js";
34
+ import { N as NutPopup } from "../index-BqB5dTeo.js";
35
35
  import NutSwiper from "../swiper/Swiper.js";
36
36
  import { f as funInterceptor } from "../Interceptor-WYVtGbGC.js";
37
37
  import { C as CreateComponent } from "../mountComponent-uInXoTMp.js";
38
38
  import NutOverlay from "../overlay/Overlay.js";
39
- import "../index-s3RgMhc7.js";
40
- import "@nutui/nutui/dist/packages/locale/lang";
41
- import "../types-9wCQwtH3.js";
42
- import "../raf-MQjoO-Ag.js";
43
39
  const baseProps = {
44
40
  show: { type: Boolean, default: false },
45
41
  initNo: { type: Number, default: 0 },
@@ -111,6 +111,7 @@ const _sfc_main = create({
111
111
  props: popupProps,
112
112
  emits: ["clickPop", "clickCloseIcon", "open", "close", "opened", "closed", "clickOverlay", "update:visible"],
113
113
  setup(props, { emit }) {
114
+ let opened;
114
115
  const state = reactive({
115
116
  zIndex: props.zIndex,
116
117
  showSlot: true,
@@ -136,23 +137,29 @@ const _sfc_main = create({
136
137
  return props.transition ? props.transition : `nut-popup-slide-${props.position}`;
137
138
  });
138
139
  const open = () => {
139
- if (props.zIndex !== initIndex) {
140
- _zIndex = Number(props.zIndex);
140
+ if (!opened) {
141
+ opened = true;
142
+ if (props.zIndex !== initIndex) {
143
+ _zIndex = Number(props.zIndex);
144
+ }
145
+ emit("update:visible", true);
146
+ state.zIndex = ++_zIndex;
147
+ if (props.destroyOnClose) {
148
+ state.showSlot = true;
149
+ }
150
+ emit("open");
141
151
  }
142
- emit("update:visible", true);
143
- state.zIndex = ++_zIndex;
144
- if (props.destroyOnClose) {
145
- state.showSlot = true;
146
- }
147
- emit("open");
148
152
  };
149
153
  const close = () => {
150
- emit("update:visible", false);
151
- emit("close");
152
- if (props.destroyOnClose) {
153
- setTimeout(() => {
154
- state.showSlot = false;
155
- }, +props.duration * 1e3);
154
+ if (opened) {
155
+ opened = false;
156
+ emit("update:visible", false);
157
+ emit("close");
158
+ if (props.destroyOnClose) {
159
+ setTimeout(() => {
160
+ state.showSlot = false;
161
+ }, +props.duration * 1e3);
162
+ }
156
163
  }
157
164
  };
158
165
  const onClick = (e) => {
@@ -161,12 +168,12 @@ const _sfc_main = create({
161
168
  const onClickCloseIcon = (e) => {
162
169
  e.stopPropagation();
163
170
  emit("clickCloseIcon", e);
164
- emit("update:visible", false);
171
+ close();
165
172
  };
166
173
  const onClickOverlay = (e) => {
167
174
  emit("clickOverlay", e);
168
175
  if (props.closeOnClickOverlay) {
169
- emit("update:visible", false);
176
+ close();
170
177
  }
171
178
  };
172
179
  const onOpened = (el) => {
@@ -178,7 +185,12 @@ const _sfc_main = create({
178
185
  watch(
179
186
  () => props.visible,
180
187
  () => {
181
- props.visible ? open() : close();
188
+ if (props.visible && !opened) {
189
+ open();
190
+ }
191
+ if (!props.visible && opened) {
192
+ close();
193
+ }
182
194
  }
183
195
  );
184
196
  watchEffect(() => {