@nutui/nutui 4.0.12-beta.1 → 4.0.12

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 (158) hide show
  1. package/dist/nutui.es.js +1 -1
  2. package/dist/nutui.js +1 -1
  3. package/dist/nutui.umd.js +1 -1
  4. package/dist/packages/_es/ActionSheet.js +111 -78
  5. package/dist/packages/_es/Address.js +375 -250
  6. package/dist/packages/_es/AddressList.js +354 -269
  7. package/dist/packages/_es/Animate.js +58 -41
  8. package/dist/packages/_es/Audio.js +197 -128
  9. package/dist/packages/_es/AudioOperate.js +71 -60
  10. package/dist/packages/_es/Avatar.js +89 -66
  11. package/dist/packages/_es/AvatarGroup.js +31 -23
  12. package/dist/packages/_es/Backtop.js +99 -59
  13. package/dist/packages/_es/Badge.js +47 -36
  14. package/dist/packages/_es/Barrage.js +147 -68
  15. package/dist/packages/_es/Button.js +66 -47
  16. package/dist/packages/_es/Calendar.js +157 -135
  17. package/dist/packages/_es/CalendarItem.js +6 -6
  18. package/dist/packages/_es/Card.js +56 -42
  19. package/dist/packages/_es/Cascader.js +474 -315
  20. package/dist/packages/_es/Category.js +39 -29
  21. package/dist/packages/_es/CategoryPane.js +83 -57
  22. package/dist/packages/_es/Cell.js +71 -56
  23. package/dist/packages/_es/CellGroup.js +27 -19
  24. package/dist/packages/_es/Checkbox.js +156 -109
  25. package/dist/packages/_es/CheckboxGroup.js +59 -38
  26. package/dist/packages/_es/CircleProgress.js +96 -67
  27. package/dist/packages/_es/Col.js +31 -23
  28. package/dist/packages/_es/Collapse.js +58 -33
  29. package/dist/packages/_es/CollapseItem.js +108 -78
  30. package/dist/packages/_es/Comment.js +279 -207
  31. package/dist/packages/_es/ConfigProvider.js +55 -37
  32. package/dist/packages/_es/Countdown.js +212 -100
  33. package/dist/packages/_es/Countup.js +445 -232
  34. package/dist/packages/_es/DatePicker.js +265 -162
  35. package/dist/packages/_es/Dialog.js +213 -161
  36. package/dist/packages/_es/Divider.js +57 -42
  37. package/dist/packages/_es/Drag.js +153 -70
  38. package/dist/packages/_es/Ecard.js +104 -64
  39. package/dist/packages/_es/Elevator.js +219 -143
  40. package/dist/packages/_es/Ellipsis.js +178 -95
  41. package/dist/packages/_es/Empty.js +39 -23
  42. package/dist/packages/_es/FixedNav.js +116 -93
  43. package/dist/packages/_es/Form.js +178 -107
  44. package/dist/packages/_es/FormItem.js +61 -48
  45. package/dist/packages/_es/Grid.js +6 -5
  46. package/dist/packages/_es/GridItem.js +84 -58
  47. package/dist/packages/_es/Image.js +130 -90
  48. package/dist/packages/_es/ImagePreview.js +412 -256
  49. package/dist/packages/_es/Indicator.js +34 -30
  50. package/dist/packages/_es/InfiniteLoading.js +136 -83
  51. package/dist/packages/_es/Input.js +264 -160
  52. package/dist/packages/_es/InputNumber.js +117 -81
  53. package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
  54. package/dist/packages/_es/Invoice.js +130 -104
  55. package/dist/packages/_es/Layout.js +4 -3
  56. package/dist/packages/_es/List.js +215 -117
  57. package/dist/packages/_es/Menu.js +150 -95
  58. package/dist/packages/_es/MenuItem.js +154 -109
  59. package/dist/packages/_es/Navbar.js +119 -103
  60. package/dist/packages/_es/Noticebar.js +312 -197
  61. package/dist/packages/_es/Notify.js +166 -110
  62. package/dist/packages/_es/NumberKeyboard.js +202 -127
  63. package/dist/packages/_es/Overlay.js +80 -52
  64. package/dist/packages/_es/Pagination.js +100 -70
  65. package/dist/packages/_es/Picker.js +437 -275
  66. package/dist/packages/_es/Popover.js +225 -122
  67. package/dist/packages/_es/Popup.js +4 -4
  68. package/dist/packages/_es/Price.js +82 -44
  69. package/dist/packages/_es/Progress.js +79 -63
  70. package/dist/packages/_es/PullRefresh.js +173 -95
  71. package/dist/packages/_es/Radio.js +4 -4
  72. package/dist/packages/_es/RadioGroup.js +3 -3
  73. package/dist/packages/_es/Range.js +347 -204
  74. package/dist/packages/_es/Rate.js +141 -92
  75. package/dist/packages/_es/Row.js +27 -21
  76. package/dist/packages/_es/Searchbar.js +174 -123
  77. package/dist/packages/_es/ShortPassword.js +93 -69
  78. package/dist/packages/_es/SideNavbar.js +80 -49
  79. package/dist/packages/_es/SideNavbarItem.js +32 -22
  80. package/dist/packages/_es/Signature.js +146 -83
  81. package/dist/packages/_es/Skeleton.js +130 -110
  82. package/dist/packages/_es/Sku.js +343 -250
  83. package/dist/packages/_es/Step.js +86 -59
  84. package/dist/packages/_es/Steps.js +31 -26
  85. package/dist/packages/_es/Sticky.js +4 -4
  86. package/dist/packages/_es/SubSideNavbar.js +74 -52
  87. package/dist/packages/_es/Swipe.js +155 -83
  88. package/dist/packages/_es/Swiper.js +311 -174
  89. package/dist/packages/_es/SwiperItem.js +44 -28
  90. package/dist/packages/_es/Switch.js +68 -55
  91. package/dist/packages/_es/TabPane.js +41 -30
  92. package/dist/packages/_es/Tabbar.js +52 -41
  93. package/dist/packages/_es/TabbarItem.js +82 -61
  94. package/dist/packages/_es/Table.js +165 -109
  95. package/dist/packages/_es/Tabs.js +388 -240
  96. package/dist/packages/_es/Tag.js +61 -44
  97. package/dist/packages/_es/Textarea.js +124 -80
  98. package/dist/packages/_es/TimeDetail.js +76 -49
  99. package/dist/packages/_es/TimePannel.js +48 -34
  100. package/dist/packages/_es/TimeSelect.js +68 -47
  101. package/dist/packages/_es/Toast.js +218 -144
  102. package/dist/packages/_es/Tour.js +192 -138
  103. package/dist/packages/_es/TrendArrow.js +77 -57
  104. package/dist/packages/_es/Uploader.js +359 -234
  105. package/dist/packages/_es/Video.js +316 -191
  106. package/dist/packages/_es/Watermark.js +117 -84
  107. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
  108. package/dist/packages/_es/common-b9a5e726.js +145 -0
  109. package/dist/packages/_es/component-81a4c1d0.js +145 -0
  110. package/dist/packages/_es/index-29892cda.js +33 -0
  111. package/dist/packages/_es/index-43c34ac6.js +30 -0
  112. package/dist/packages/_es/index-54d03fc1.js +8 -0
  113. package/dist/packages/_es/index-79c5dc33.js +10 -0
  114. package/dist/packages/_es/index-7a7385e4.js +67 -0
  115. package/dist/packages/_es/index-87422be8.js +942 -0
  116. package/dist/packages/_es/index-da0a7662.js +259 -0
  117. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
  120. package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
  121. package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
  122. package/dist/packages/_es/raf-729dad54.js +25 -0
  123. package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
  124. package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
  125. package/dist/packages/locale/lang/en-US.js +39 -36
  126. package/dist/packages/locale/lang/id-ID.js +39 -36
  127. package/dist/packages/locale/lang/index.js +44 -22
  128. package/dist/packages/locale/lang/zh-CN.js +38 -35
  129. package/dist/packages/locale/lang/zh-TW.js +38 -35
  130. package/dist/resolver/index.js +26 -1
  131. package/dist/resolver/index.mjs +17 -14
  132. package/dist/smartips/web-types.json +1 -1
  133. package/dist/style.css +1 -1
  134. package/dist/styles/themes/default.scss +50 -50
  135. package/dist/styles/themes/jdb.scss +50 -50
  136. package/dist/styles/themes/jddkh.scss +50 -50
  137. package/dist/styles/themes/jdt.scss +50 -50
  138. package/dist/types/index.d.ts +1 -1
  139. package/package.json +2 -2
  140. package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
  141. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
  142. package/dist/packages/_es/common-d218746f.js +0 -116
  143. package/dist/packages/_es/component-234624bc.js +0 -89
  144. package/dist/packages/_es/index-14dfadc4.js +0 -561
  145. package/dist/packages/_es/index-192a3ef6.js +0 -29
  146. package/dist/packages/_es/index-360c5092.js +0 -210
  147. package/dist/packages/_es/index-496e6e05.js +0 -24
  148. package/dist/packages/_es/index-50eed3d9.js +0 -7
  149. package/dist/packages/_es/index-53ec2d4d.js +0 -34
  150. package/dist/packages/_es/index-fadb0974.js +0 -8
  151. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
  152. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
  153. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
  154. package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
  155. package/dist/packages/_es/pxCheck-38173291.js +0 -4
  156. package/dist/packages/_es/raf-a74f1a06.js +0 -16
  157. package/dist/packages/_es/renderIcon-47498b32.js +0 -5
  158. package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
@@ -1,125 +1,196 @@
1
- var $ = Object.getOwnPropertySymbols;
2
- var F = Object.prototype.hasOwnProperty, I = Object.prototype.propertyIsEnumerable;
3
- var x = (l, i) => {
4
- var m = {};
5
- for (var o in l)
6
- F.call(l, o) && i.indexOf(o) < 0 && (m[o] = l[o]);
7
- if (l != null && $)
8
- for (var o of $(l))
9
- i.indexOf(o) < 0 && I.call(l, o) && (m[o] = l[o]);
10
- return m;
1
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
2
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
4
+ var __objRest = (source, exclude) => {
5
+ var target = {};
6
+ for (var prop in source)
7
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
8
+ target[prop] = source[prop];
9
+ if (source != null && __getOwnPropSymbols)
10
+ for (var prop of __getOwnPropSymbols(source)) {
11
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
12
+ target[prop] = source[prop];
13
+ }
14
+ return target;
11
15
  };
12
- import { g as T, h as A, f as N, c as W } from "./component-234624bc.js";
13
- import { computed as q, reactive as G, provide as U, watch as z, resolveComponent as D, openBlock as H, createElementBlock as J, withModifiers as K, createVNode as L, withCtx as Q, renderSlot as X } from "vue";
14
- import C from "./CellGroup.js";
15
- import { _ as Y } from "./_plugin-vue_export-helper-dad06003.js";
16
+ import { g as isObject, h as getPropByPath, f as isPromise, c as createComponent } from "./component-81a4c1d0.js";
17
+ import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, withModifiers, createVNode, withCtx, renderSlot } from "vue";
18
+ import CellGroup from "./CellGroup.js";
19
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
16
20
  import "../locale/lang";
17
- const Z = (l) => ({
18
- props: {
19
- modelValue: {
20
- type: Object,
21
- default: {}
22
- },
23
- rules: {
24
- type: Object,
25
- default: {}
26
- }
27
- },
28
- components: l,
29
- emits: ["validate"],
30
- setup(i, { emit: m, slots: o }) {
31
- const f = q(() => G({}));
32
- U("formErrorTip", f);
33
- const _ = () => {
34
- Object.keys(f.value).forEach((s) => {
35
- f.value[s] = "";
36
- });
37
- }, g = () => {
38
- _();
39
- };
40
- z(
41
- () => i.modelValue,
42
- () => {
43
- _();
21
+ const component = (components) => {
22
+ return {
23
+ props: {
24
+ modelValue: {
25
+ type: Object,
26
+ default: {}
44
27
  },
45
- { immediate: !0 }
46
- );
47
- const y = (s) => {
48
- let n = [];
49
- return s.forEach((e) => {
50
- var c, t, a, u;
51
- let r = e.type;
52
- r = r.name || r, r == "nut-form-item" || r != null && r.toString().endsWith("form-item") ? n.push({
53
- prop: (c = e.props) == null ? void 0 : c.prop,
54
- rules: ((t = e.props) == null ? void 0 : t.rules) || []
55
- }) : Array.isArray(e.children) && ((a = e.children) != null && a.length) ? n = n.concat(y(e.children)) : T(e.children) && Object.keys(e.children) && (u = e.children) != null && u.default && (e.children = e.children.default(), n = n.concat(y(e.children)));
56
- }), n;
57
- }, P = (s) => {
58
- s.message && m("validate", s), f.value[s.prop] = s.message;
59
- }, j = (s) => {
60
- const { rules: n, prop: e } = s, r = (b) => new Promise((h, d) => {
61
- try {
62
- P(b), h(b);
63
- } catch (k) {
64
- d(k);
65
- }
66
- });
67
- e || console.warn("[NutUI] <FormItem> 使用 rules 校验规则时 , 必须设置 prop 参数");
68
- const c = A(i.modelValue, e || "");
69
- P({ prop: e, message: "" });
70
- const t = i.rules || {}, a = [...(t == null ? void 0 : t[e]) || [], ...n];
71
- for (; a.length; ) {
72
- const u = a.shift(), { validator: h } = u, d = x(u, ["validator"]), { required: k, regex: O, message: S } = d, p = { prop: e, message: S };
73
- if (k && !c && c !== 0 || O && !O.test(String(c)))
74
- return r(p);
75
- if (h) {
76
- const w = h(c, d);
77
- if (N(w))
78
- return new Promise((V, B) => {
79
- w.then((E) => {
80
- E ? V(!0) : (P(p), V(p));
81
- }).catch((E) => B(E));
28
+ rules: {
29
+ type: Object,
30
+ default: {}
31
+ }
32
+ },
33
+ components,
34
+ emits: ["validate"],
35
+ setup(props, { emit, slots }) {
36
+ const formErrorTip = computed(() => reactive({}));
37
+ provide("formErrorTip", formErrorTip);
38
+ const clearErrorTips = () => {
39
+ Object.keys(formErrorTip.value).forEach((item) => {
40
+ formErrorTip.value[item] = "";
41
+ });
42
+ };
43
+ const reset = () => {
44
+ clearErrorTips();
45
+ };
46
+ watch(
47
+ () => props.modelValue,
48
+ () => {
49
+ clearErrorTips();
50
+ },
51
+ { immediate: true }
52
+ );
53
+ const findFormItem = (vnodes) => {
54
+ let task = [];
55
+ vnodes.forEach((vnode) => {
56
+ var _a, _b, _c, _d;
57
+ let type = vnode.type;
58
+ type = type.name || type;
59
+ if (type == "nut-form-item" || (type == null ? void 0 : type.toString().endsWith("form-item"))) {
60
+ task.push({
61
+ prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
62
+ rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
82
63
  });
83
- if (!w)
84
- return r(p);
64
+ } else if (Array.isArray(vnode.children) && ((_c = vnode.children) == null ? void 0 : _c.length)) {
65
+ task = task.concat(findFormItem(vnode.children));
66
+ } else if (isObject(vnode.children) && Object.keys(vnode.children)) {
67
+ if ((_d = vnode.children) == null ? void 0 : _d.default) {
68
+ vnode.children = vnode.children.default();
69
+ task = task.concat(findFormItem(vnode.children));
70
+ }
71
+ }
72
+ });
73
+ return task;
74
+ };
75
+ const tipMessage = (errorMsg) => {
76
+ if (errorMsg.message) {
77
+ emit("validate", errorMsg);
85
78
  }
86
- }
87
- return Promise.resolve(!0);
88
- }, v = (s = "") => new Promise((n, e) => {
89
- try {
90
- const c = y(o.default()).map((t) => s ? s == t.prop ? j(t) : Promise.resolve(!0) : j(t));
91
- Promise.all(c).then((t) => {
92
- t = t.filter((u) => u != !0);
93
- const a = { valid: !0, errors: [] };
94
- t.length && (a.valid = !1, a.errors = t), n(a);
79
+ formErrorTip.value[errorMsg.prop] = errorMsg.message;
80
+ };
81
+ const checkRule = (item) => {
82
+ const { rules, prop } = item;
83
+ const _Promise = (errorMsg) => {
84
+ return new Promise((resolve, reject) => {
85
+ try {
86
+ tipMessage(errorMsg);
87
+ resolve(errorMsg);
88
+ } catch (error) {
89
+ reject(error);
90
+ }
91
+ });
92
+ };
93
+ if (!prop) {
94
+ console.warn("[NutUI] <FormItem> 使用 rules 校验规则时 , 必须设置 prop 参数");
95
+ }
96
+ const value = getPropByPath(props.modelValue, prop || "");
97
+ tipMessage({ prop, message: "" });
98
+ const formRules = props.rules || {};
99
+ const _rules = [...(formRules == null ? void 0 : formRules[prop]) || [], ...rules];
100
+ while (_rules.length) {
101
+ const rule = _rules.shift();
102
+ const _a = rule, { validator } = _a, ruleWithoutValidator = __objRest(_a, ["validator"]);
103
+ const { required, regex, message } = ruleWithoutValidator;
104
+ const errorMsg = { prop, message };
105
+ if (required) {
106
+ if (!value && value !== 0) {
107
+ return _Promise(errorMsg);
108
+ }
109
+ }
110
+ if (regex && !regex.test(String(value))) {
111
+ return _Promise(errorMsg);
112
+ }
113
+ if (validator) {
114
+ const result = validator(value, ruleWithoutValidator);
115
+ if (isPromise(result)) {
116
+ return new Promise((r, j) => {
117
+ result.then((res) => {
118
+ if (!res) {
119
+ tipMessage(errorMsg);
120
+ r(errorMsg);
121
+ } else {
122
+ r(true);
123
+ }
124
+ }).catch((e) => j(e));
125
+ });
126
+ } else {
127
+ if (!result) {
128
+ return _Promise(errorMsg);
129
+ }
130
+ }
131
+ }
132
+ }
133
+ return Promise.resolve(true);
134
+ };
135
+ const validate = (customProp = "") => {
136
+ return new Promise((resolve, reject) => {
137
+ try {
138
+ const task = findFormItem(slots.default());
139
+ const errors = task.map((item) => {
140
+ if (customProp) {
141
+ if (customProp == item.prop) {
142
+ return checkRule(item);
143
+ } else {
144
+ return Promise.resolve(true);
145
+ }
146
+ } else {
147
+ return checkRule(item);
148
+ }
149
+ });
150
+ Promise.all(errors).then((errorRes) => {
151
+ errorRes = errorRes.filter((item) => item != true);
152
+ const res = { valid: true, errors: [] };
153
+ if (errorRes.length) {
154
+ res.valid = false;
155
+ res.errors = errorRes;
156
+ }
157
+ resolve(res);
158
+ });
159
+ } catch (error) {
160
+ reject(error);
161
+ }
95
162
  });
96
- } catch (r) {
97
- e(r);
98
- }
99
- });
100
- return { validate: v, reset: g, submit: () => (v(), !1), formErrorTip: f };
101
- }
102
- }), { create: M } = W("form"), R = M(
103
- Z({
104
- [C.name]: C
163
+ };
164
+ const submit = () => {
165
+ validate();
166
+ return false;
167
+ };
168
+ return { validate, reset, submit, formErrorTip };
169
+ }
170
+ };
171
+ };
172
+ const { create } = createComponent("form");
173
+ const _sfc_main = create(
174
+ component({
175
+ [CellGroup.name]: CellGroup
105
176
  })
106
177
  );
107
- function ee(l, i, m, o, f, _) {
108
- const g = D("nut-cell-group");
109
- return H(), J("form", {
178
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
179
+ const _component_nut_cell_group = resolveComponent("nut-cell-group");
180
+ return openBlock(), createElementBlock("form", {
110
181
  class: "nut-form",
111
182
  action: "#",
112
- onSubmit: i[0] || (i[0] = K(() => !1, ["prevent"]))
183
+ onSubmit: _cache[0] || (_cache[0] = withModifiers(() => false, ["prevent"]))
113
184
  }, [
114
- L(g, null, {
115
- default: Q(() => [
116
- X(l.$slots, "default")
185
+ createVNode(_component_nut_cell_group, null, {
186
+ default: withCtx(() => [
187
+ renderSlot(_ctx.$slots, "default")
117
188
  ]),
118
189
  _: 3
119
190
  })
120
191
  ], 32);
121
192
  }
122
- const ce = /* @__PURE__ */ Y(R, [["render", ee]]);
193
+ const Form = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
123
194
  export {
124
- ce as default
195
+ Form as default
125
196
  };
@@ -1,13 +1,14 @@
1
- import { p as S } from "./pxCheck-38173291.js";
2
- import { inject as h, provide as _, computed as l, resolveComponent as A, openBlock as o, createBlock as w, normalizeClass as m, normalizeStyle as t, withCtx as $, createElementBlock as p, renderSlot as u, createTextVNode as v, toDisplayString as d, createCommentVNode as y, createElementVNode as f } from "vue";
3
- import { c as C } from "./component-234624bc.js";
4
- import c from "./Cell.js";
5
- import { _ as E } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
2
+ import { inject, provide, computed, resolveComponent, openBlock, createBlock, normalizeClass, normalizeStyle, withCtx, createElementBlock, renderSlot, createTextVNode, toDisplayString, createCommentVNode, createElementVNode } from "vue";
3
+ import { c as createComponent } from "./component-81a4c1d0.js";
4
+ import Cell from "./Cell.js";
5
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
6
6
  import "../locale/lang";
7
- import "./index-50eed3d9.js";
7
+ import "./index-54d03fc1.js";
8
8
  import "@nutui/icons-vue";
9
- const { componentName: I, create: k } = C("form-item"), B = k({
10
- inheritAttrs: !1,
9
+ const { componentName, create } = createComponent("form-item");
10
+ const _sfc_main = create({
11
+ inheritAttrs: false,
11
12
  props: {
12
13
  prop: {
13
14
  type: String,
@@ -19,19 +20,21 @@ const { componentName: I, create: k } = C("form-item"), B = k({
19
20
  },
20
21
  rules: {
21
22
  type: Array,
22
- default: () => []
23
+ default: () => {
24
+ return [];
25
+ }
23
26
  },
24
27
  required: {
25
28
  type: Boolean,
26
- default: !1
29
+ default: false
27
30
  },
28
31
  showErrorMessage: {
29
32
  type: Boolean,
30
- default: !0
33
+ default: true
31
34
  },
32
35
  showErrorLine: {
33
36
  type: Boolean,
34
- default: !0
37
+ default: true
35
38
  },
36
39
  labelWidth: {
37
40
  type: [String, Number],
@@ -51,59 +54,69 @@ const { componentName: I, create: k } = C("form-item"), B = k({
51
54
  }
52
55
  },
53
56
  components: {
54
- [c.name]: c
57
+ [Cell.name]: Cell
55
58
  },
56
59
  emits: [""],
57
- setup(e, { emit: g, slots: n }) {
58
- const s = h("formErrorTip");
59
- _("form", {
60
- props: e
60
+ setup(props, { emit, slots }) {
61
+ const parent = inject("formErrorTip");
62
+ provide("form", {
63
+ props
61
64
  });
62
- const a = l(() => ({
63
- width: S(e.labelWidth),
64
- textAlign: e.labelAlign
65
- })), i = l(() => ({
66
- textAlign: e.bodyAlign
67
- })), r = l(() => ({
68
- textAlign: e.errorMessageAlign
69
- }));
70
- return { parent: s, labelStyle: a, bodyStyle: i, errorMessageStyle: r, getSlots: (b) => n[b] };
65
+ const labelStyle = computed(() => {
66
+ return {
67
+ width: pxCheck(props.labelWidth),
68
+ textAlign: props.labelAlign
69
+ };
70
+ });
71
+ const bodyStyle = computed(() => {
72
+ return {
73
+ textAlign: props.bodyAlign
74
+ };
75
+ });
76
+ const errorMessageStyle = computed(() => {
77
+ return {
78
+ textAlign: props.errorMessageAlign
79
+ };
80
+ });
81
+ const getSlots = (name) => slots[name];
82
+ return { parent, labelStyle, bodyStyle, errorMessageStyle, getSlots };
71
83
  }
72
- }), M = { class: "nut-cell__value nut-form-item__body" };
73
- function N(e, g, n, s, a, i) {
74
- const r = A("nut-cell");
75
- return o(), w(r, {
76
- class: m(["nut-form-item", [{ error: e.parent[e.prop], line: e.showErrorLine }, e.$attrs.class]]),
77
- style: t(e.$attrs.style)
84
+ });
85
+ const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
86
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
87
+ const _component_nut_cell = resolveComponent("nut-cell");
88
+ return openBlock(), createBlock(_component_nut_cell, {
89
+ class: normalizeClass(["nut-form-item", [{ error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }, _ctx.$attrs.class]]),
90
+ style: normalizeStyle(_ctx.$attrs.style)
78
91
  }, {
79
- default: $(() => [
80
- e.label || e.getSlots("label") ? (o(), p("view", {
92
+ default: withCtx(() => [
93
+ _ctx.label || _ctx.getSlots("label") ? (openBlock(), createElementBlock("view", {
81
94
  key: 0,
82
- class: m(["nut-cell__title nut-form-item__label", { required: e.required }]),
83
- style: t(e.labelStyle)
95
+ class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
96
+ style: normalizeStyle(_ctx.labelStyle)
84
97
  }, [
85
- u(e.$slots, "label", {}, () => [
86
- v(d(e.label), 1)
98
+ renderSlot(_ctx.$slots, "label", {}, () => [
99
+ createTextVNode(toDisplayString(_ctx.label), 1)
87
100
  ])
88
- ], 6)) : y("", !0),
89
- f("view", M, [
90
- f("view", {
101
+ ], 6)) : createCommentVNode("", true),
102
+ createElementVNode("view", _hoisted_1, [
103
+ createElementVNode("view", {
91
104
  class: "nut-form-item__body__slots",
92
- style: t(e.bodyStyle)
105
+ style: normalizeStyle(_ctx.bodyStyle)
93
106
  }, [
94
- u(e.$slots, "default")
107
+ renderSlot(_ctx.$slots, "default")
95
108
  ], 4),
96
- e.parent[e.prop] && e.showErrorMessage ? (o(), p("view", {
109
+ _ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
97
110
  key: 0,
98
111
  class: "nut-form-item__body__tips",
99
- style: t(e.errorMessageStyle)
100
- }, d(e.parent[e.prop]), 5)) : y("", !0)
112
+ style: normalizeStyle(_ctx.errorMessageStyle)
113
+ }, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
101
114
  ])
102
115
  ]),
103
116
  _: 3
104
117
  }, 8, ["class", "style"]);
105
118
  }
106
- const G = /* @__PURE__ */ E(B, [["render", N]]);
119
+ const FormItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
107
120
  export {
108
- G as default
121
+ FormItem as default
109
122
  };
@@ -1,9 +1,10 @@
1
- import { c as o } from "./component-234624bc.js";
1
+ import { c as createComponent } from "./component-81a4c1d0.js";
2
2
  import "vue";
3
- import { c as t } from "./common-d218746f.js";
3
+ import { c as component } from "./common-b9a5e726.js";
4
4
  import "../locale/lang";
5
- import "./pxCheck-38173291.js";
6
- const { create: r } = o("grid"), i = r(t);
5
+ import "./pxCheck-c6b9f6b7.js";
6
+ const { create } = createComponent("grid");
7
+ const _sfc_main = create(component);
7
8
  export {
8
- i as default
9
+ _sfc_main as default
9
10
  };
@@ -1,27 +1,30 @@
1
- import { inject as k, getCurrentInstance as y, onUnmounted as x, computed as a, ref as h, openBlock as u, createElementBlock as d, normalizeClass as m, normalizeStyle as S, createElementVNode as p, renderSlot as f, Fragment as v, createTextVNode as b, toDisplayString as N } from "vue";
2
- import { u as _ } from "./index-50eed3d9.js";
3
- import { c as B } from "./component-234624bc.js";
4
- import { p as $ } from "./pxCheck-38173291.js";
5
- import { G as j } from "./common-d218746f.js";
6
- import { _ as q } from "./_plugin-vue_export-helper-dad06003.js";
1
+ import { inject, getCurrentInstance, onUnmounted, computed, ref, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, Fragment, createTextVNode, toDisplayString } from "vue";
2
+ import { u as useRouter } from "./index-54d03fc1.js";
3
+ import { c as createComponent } from "./component-81a4c1d0.js";
4
+ import { p as pxCheck } from "./pxCheck-c6b9f6b7.js";
5
+ import { G as GRID_KEY } from "./common-b9a5e726.js";
6
+ import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
7
7
  import "../locale/lang";
8
- function w(e) {
9
- const n = k(e, null);
10
- if (n) {
11
- const o = y(), { add: s, remove: t, internalChildren: i } = n;
12
- s(o), x(() => t(o));
13
- const l = a(() => i.indexOf(o));
8
+ function useInject(key) {
9
+ const parent = inject(key, null);
10
+ if (parent) {
11
+ const instance = getCurrentInstance();
12
+ const { add, remove, internalChildren } = parent;
13
+ add(instance);
14
+ onUnmounted(() => remove(instance));
15
+ const index2 = computed(() => internalChildren.indexOf(instance));
14
16
  return {
15
- parent: n,
16
- index: l
17
+ parent,
18
+ index: index2
17
19
  };
18
20
  }
19
21
  return {
20
22
  parent: null,
21
- index: h(-1)
23
+ index: ref(-1)
22
24
  };
23
25
  }
24
- const { create: E, componentName: C } = B("grid-item"), I = E({
26
+ const { create, componentName } = createComponent("grid-item");
27
+ const _sfc_main = create({
25
28
  props: {
26
29
  text: {
27
30
  type: String
@@ -36,63 +39,86 @@ const { create: E, componentName: C } = B("grid-item"), I = E({
36
39
  },
37
40
  replace: {
38
41
  type: Boolean,
39
- default: !1
42
+ default: false
40
43
  }
41
44
  },
42
45
  emits: ["click"],
43
- setup(e, { emit: n }) {
44
- const o = w(j);
45
- if (!o.parent)
46
+ setup(props, { emit }) {
47
+ const Parent = useInject(GRID_KEY);
48
+ if (!Parent.parent)
46
49
  return {};
47
- const s = o.index, t = o.parent.props, i = a(() => ({
48
- [C]: !0
49
- })), l = a(() => {
50
- const r = {
51
- flexBasis: `${100 / +t.columnNum}%`
50
+ const index2 = Parent.index;
51
+ const parent = Parent.parent.props;
52
+ const rootClass = computed(() => {
53
+ const prefixCls = componentName;
54
+ return {
55
+ [prefixCls]: true
56
+ };
57
+ });
58
+ const rootStyle = computed(() => {
59
+ const style = {
60
+ flexBasis: `${100 / +parent.columnNum}%`
52
61
  };
53
- return t.square ? r.paddingTop = `${100 / +t.columnNum}%` : t.gutter && (r.paddingRight = $(t.gutter), s.value >= t.columnNum && (r.marginTop = $(t.gutter))), r;
54
- }), g = a(() => {
55
- const r = `${C}__content`;
62
+ if (parent.square) {
63
+ style.paddingTop = `${100 / +parent.columnNum}%`;
64
+ } else if (parent.gutter) {
65
+ style.paddingRight = pxCheck(parent.gutter);
66
+ if (index2.value >= parent.columnNum) {
67
+ style.marginTop = pxCheck(parent.gutter);
68
+ }
69
+ }
70
+ return style;
71
+ });
72
+ const contentClass = computed(() => {
73
+ const prefixCls = `${componentName}__content`;
56
74
  return {
57
- [`${r}`]: !0,
58
- [`${r}--border`]: t.border,
59
- [`${r}--surround`]: t.border && t.gutter,
60
- [`${r}--center`]: t.center,
61
- [`${r}--square`]: t.square,
62
- [`${r}--reverse`]: t.reverse,
63
- [`${r}--${t.direction}`]: !!t.direction,
64
- [`${r}--clickable`]: t.clickable || e.to || e.url
75
+ [`${prefixCls}`]: true,
76
+ [`${prefixCls}--border`]: parent.border,
77
+ [`${prefixCls}--surround`]: parent.border && parent.gutter,
78
+ [`${prefixCls}--center`]: parent.center,
79
+ [`${prefixCls}--square`]: parent.square,
80
+ [`${prefixCls}--reverse`]: parent.reverse,
81
+ [`${prefixCls}--${parent.direction}`]: !!parent.direction,
82
+ [`${prefixCls}--clickable`]: parent.clickable || props.to || props.url
65
83
  };
66
- }), c = _();
67
- return {
68
- rootClass: i,
69
- rootStyle: l,
70
- contentClass: g,
71
- handleClick: (r) => {
72
- n("click", r), e.to && c ? c[e.replace ? "replace" : "push"](e.to) : e.url && (e.replace ? location.replace(e.url) : location.href = e.url);
84
+ });
85
+ const router = useRouter();
86
+ const handleClick = (event) => {
87
+ emit("click", event);
88
+ if (props.to && router) {
89
+ router[props.replace ? "replace" : "push"](props.to);
90
+ } else if (props.url) {
91
+ props.replace ? location.replace(props.url) : location.href = props.url;
73
92
  }
74
93
  };
94
+ return {
95
+ rootClass,
96
+ rootStyle,
97
+ contentClass,
98
+ handleClick
99
+ };
75
100
  }
76
- }), R = { class: "nut-grid-item__text" };
77
- function T(e, n, o, s, t, i) {
78
- return u(), d("view", {
79
- class: m(e.rootClass),
80
- style: S(e.rootStyle),
81
- onClick: n[0] || (n[0] = (...l) => e.handleClick && e.handleClick(...l))
101
+ });
102
+ const _hoisted_1 = { class: "nut-grid-item__text" };
103
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
104
+ return openBlock(), createElementBlock("view", {
105
+ class: normalizeClass(_ctx.rootClass),
106
+ style: normalizeStyle(_ctx.rootStyle),
107
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
82
108
  }, [
83
- p("view", {
84
- class: m(e.contentClass)
109
+ createElementVNode("view", {
110
+ class: normalizeClass(_ctx.contentClass)
85
111
  }, [
86
- f(e.$slots, "default"),
87
- p("view", R, [
88
- e.text ? (u(), d(v, { key: 0 }, [
89
- b(N(e.text), 1)
90
- ], 64)) : f(e.$slots, "text", { key: 1 })
112
+ renderSlot(_ctx.$slots, "default"),
113
+ createElementVNode("view", _hoisted_1, [
114
+ _ctx.text ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
115
+ createTextVNode(toDisplayString(_ctx.text), 1)
116
+ ], 64)) : renderSlot(_ctx.$slots, "text", { key: 1 })
91
117
  ])
92
118
  ], 2)
93
119
  ], 6);
94
120
  }
95
- const U = /* @__PURE__ */ q(I, [["render", T]]);
121
+ const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
96
122
  export {
97
- U as default
123
+ index as default
98
124
  };