@nutui/nutui 3.1.22-beta.0 → 3.1.22-beta.3

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 (176) hide show
  1. package/dist/nutui.es.js +4019 -19251
  2. package/dist/nutui.umd.js +4012 -19344
  3. package/dist/packages/_es/ActionSheet.js +26 -157
  4. package/dist/packages/_es/Address.js +119 -542
  5. package/dist/packages/_es/AddressList.js +113 -613
  6. package/dist/packages/_es/Audio.js +62 -264
  7. package/dist/packages/_es/AudioOperate.js +18 -107
  8. package/dist/packages/_es/Avatar.js +42 -165
  9. package/dist/packages/_es/AvatarGroup.js +14 -73
  10. package/dist/packages/_es/BackTop.js +43 -156
  11. package/dist/packages/_es/Badge.js +14 -86
  12. package/dist/packages/_es/Barrage.js +41 -120
  13. package/dist/packages/_es/Button.js +23 -128
  14. package/dist/packages/_es/Calendar.js +24 -237
  15. package/dist/packages/_es/CalendarItem.js +1 -1
  16. package/dist/packages/_es/Card.js +10 -107
  17. package/dist/packages/_es/Cascader.js +156 -500
  18. package/dist/packages/_es/Category.js +15 -58
  19. package/dist/packages/_es/CategoryPane.js +11 -111
  20. package/dist/packages/_es/Cell.js +21 -100
  21. package/dist/packages/_es/CellGroup.js +9 -44
  22. package/dist/packages/_es/Checkbox.js +31 -113
  23. package/dist/packages/_es/CheckboxGroup.js +29 -58
  24. package/dist/packages/_es/CircleProgress.js +28 -151
  25. package/dist/packages/_es/Col.js +14 -56
  26. package/dist/packages/_es/Collapse.js +24 -85
  27. package/dist/packages/_es/CollapseItem.js +70 -261
  28. package/dist/packages/_es/Comment.js +64 -434
  29. package/dist/packages/_es/CountDown.js +61 -242
  30. package/dist/packages/_es/CountUp.js +149 -546
  31. package/dist/packages/_es/DatePicker.js +107 -322
  32. package/dist/packages/_es/Dialog.js +69 -261
  33. package/dist/packages/_es/Divider.js +18 -68
  34. package/dist/packages/_es/Drag.js +56 -197
  35. package/dist/packages/_es/Ecard.js +24 -159
  36. package/dist/packages/_es/Elevator.js +63 -198
  37. package/dist/packages/_es/Empty.js +12 -71
  38. package/dist/packages/_es/FixedNav.js +15 -122
  39. package/dist/packages/_es/Form.js +64 -151
  40. package/dist/packages/_es/FormItem.js +15 -110
  41. package/dist/packages/_es/Grid.js +5 -6
  42. package/dist/packages/_es/GridItem.js +33 -144
  43. package/dist/packages/_es/Icon.js +15 -40
  44. package/dist/packages/_es/ImagePreview.js +74 -298
  45. package/dist/packages/_es/Indicator.js +15 -62
  46. package/dist/packages/_es/InfiniteLoading.js +66 -258
  47. package/dist/packages/_es/Input.js +51 -413
  48. package/dist/packages/_es/InputNumber.js +41 -160
  49. package/dist/packages/_es/Layout.js +4 -5
  50. package/dist/packages/_es/List.js +23 -110
  51. package/dist/packages/_es/Menu.js +30 -118
  52. package/dist/packages/_es/MenuItem.js +34 -162
  53. package/dist/packages/_es/Navbar.js +30 -192
  54. package/dist/packages/_es/NoticeBar.js +83 -387
  55. package/dist/packages/_es/Notify.js +81 -236
  56. package/dist/packages/_es/NumberKeyboard.js +41 -272
  57. package/dist/packages/_es/OldPicker.js +140 -464
  58. package/dist/packages/_es/OverLay.js +32 -105
  59. package/dist/packages/_es/Pagination.js +39 -157
  60. package/dist/packages/_es/Picker.js +138 -459
  61. package/dist/packages/_es/Popover.js +327 -965
  62. package/dist/packages/_es/Popup.js +64 -303
  63. package/dist/packages/_es/Price.js +16 -118
  64. package/dist/packages/_es/Progress.js +14 -146
  65. package/dist/packages/_es/PullRefresh.js +92 -346
  66. package/dist/packages/_es/Radio.js +22 -90
  67. package/dist/packages/_es/RadioGroup.js +8 -37
  68. package/dist/packages/_es/Range.js +92 -417
  69. package/dist/packages/_es/Rate.js +16 -139
  70. package/dist/packages/_es/Row.js +22 -64
  71. package/dist/packages/_es/SearchBar.js +46 -247
  72. package/dist/packages/_es/ShortPassword.js +35 -225
  73. package/dist/packages/_es/SideNavBar.js +33 -89
  74. package/dist/packages/_es/SideNavBarItem.js +11 -46
  75. package/dist/packages/_es/Signature.js +46 -165
  76. package/dist/packages/_es/Skeleton.js +20 -136
  77. package/dist/packages/_es/Sku.js +93 -499
  78. package/dist/packages/_es/Step.js +25 -119
  79. package/dist/packages/_es/Steps.js +18 -53
  80. package/dist/packages/_es/Sticky.js +53 -138
  81. package/dist/packages/_es/SubSideNavBar.js +26 -90
  82. package/dist/packages/_es/Swipe.js +46 -183
  83. package/dist/packages/_es/Swiper.js +121 -433
  84. package/dist/packages/_es/SwiperItem.js +22 -53
  85. package/dist/packages/_es/Switch.js +21 -116
  86. package/dist/packages/_es/TabPane.js +12 -39
  87. package/dist/packages/_es/Tabbar.js +17 -72
  88. package/dist/packages/_es/TabbarItem.js +29 -151
  89. package/dist/packages/_es/Table.js +27 -186
  90. package/dist/packages/_es/Tabs.js +51 -209
  91. package/dist/packages/_es/Tag.js +20 -97
  92. package/dist/packages/_es/TextArea.js +42 -160
  93. package/dist/packages/_es/TimeDetail.js +23 -84
  94. package/dist/packages/_es/TimePannel.js +19 -52
  95. package/dist/packages/_es/TimeSelect.js +15 -103
  96. package/dist/packages/_es/Toast.js +80 -319
  97. package/dist/packages/_es/Uploader.js +112 -460
  98. package/dist/packages/_es/Video.js +83 -340
  99. package/dist/packages/_es/common.js +38 -128
  100. package/dist/packages/_es/component.js +35 -76
  101. package/dist/packages/_es/index.js +5 -6
  102. package/dist/packages/_es/index2.js +9 -30
  103. package/dist/packages/_es/index3.js +6 -8
  104. package/dist/packages/_es/index4.js +13 -58
  105. package/dist/packages/_es/index5.js +120 -675
  106. package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
  107. package/dist/packages/_es/pxCheck.js +3 -5
  108. package/dist/packages/_es/raf.js +8 -15
  109. package/dist/packages/button/index.scss +2 -1
  110. package/dist/packages/cell/index.scss +11 -0
  111. package/dist/packages/checkbox/index.scss +6 -0
  112. package/dist/packages/dialog/index.scss +1 -0
  113. package/dist/packages/elevator/index.scss +21 -0
  114. package/dist/packages/input/index.scss +13 -1
  115. package/dist/packages/locale/lang/baseLang.d.ts +1 -0
  116. package/dist/packages/locale/lang/baseLang.js +3 -3
  117. package/dist/packages/locale/lang/en-US.d.ts +8 -0
  118. package/dist/packages/locale/lang/en-US.js +5 -97
  119. package/dist/packages/locale/lang/id-ID.d.ts +8 -0
  120. package/dist/packages/locale/lang/id-ID.js +5 -97
  121. package/dist/packages/locale/lang/index.js +16 -38
  122. package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
  123. package/dist/packages/locale/lang/zh-CN.js +5 -97
  124. package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
  125. package/dist/packages/locale/lang/zh-TW.js +5 -97
  126. package/dist/packages/radio/index.scss +1 -0
  127. package/dist/packages/switch/index.scss +3 -3
  128. package/dist/packages/tabpane/index.scss +1 -0
  129. package/dist/smartips/attributes.json +62 -10
  130. package/dist/smartips/tags.json +17 -4
  131. package/dist/style.css +1 -1
  132. package/dist/styles/themes/default.scss +49 -49
  133. package/dist/styles/themes/jdb.scss +49 -49
  134. package/dist/styles/themes/jdt.scss +49 -49
  135. package/dist/styles/variables-jdb.scss +10 -1
  136. package/dist/styles/variables-jdt.scss +10 -1
  137. package/dist/styles/variables.scss +10 -1
  138. package/dist/types/__VUE/address/index.vue.d.ts +5 -5
  139. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
  140. package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
  141. package/dist/types/__VUE/avatar/index.vue.d.ts +4 -4
  142. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  143. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  144. package/dist/types/__VUE/button/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/cascader/index.vue.d.ts +1 -1
  146. package/dist/types/__VUE/cell/index.vue.d.ts +11 -4
  147. package/dist/types/__VUE/checkbox/common.d.ts +59 -0
  148. package/dist/types/__VUE/checkbox/index.vue.d.ts +18 -5
  149. package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
  150. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  151. package/dist/types/__VUE/dialog/index.d.ts +9 -2
  152. package/dist/types/__VUE/dialog/index.vue.d.ts +23 -8
  153. package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
  154. package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
  155. package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
  156. package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
  157. package/dist/types/__VUE/grid/index.vue.d.ts +4 -4
  158. package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
  159. package/dist/types/__VUE/input/index.vue.d.ts +2 -2
  160. package/dist/types/__VUE/noticebar/index.vue.d.ts +1 -1
  161. package/dist/types/__VUE/oldpicker/index.vue.d.ts +2 -2
  162. package/dist/types/__VUE/picker/index.vue.d.ts +2 -2
  163. package/dist/types/__VUE/popover/index.vue.d.ts +2 -2
  164. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  165. package/dist/types/__VUE/rate/index.vue.d.ts +2 -2
  166. package/dist/types/__VUE/row/index.vue.d.ts +2 -2
  167. package/dist/types/__VUE/shortpassword/index.vue.d.ts +2 -2
  168. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  169. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  170. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  171. package/dist/types/__VUE/timeselect/index.vue.d.ts +9 -2
  172. package/dist/types/__VUE/toast/index.vue.d.ts +3 -3
  173. package/dist/types/__VUE/uploader/index.vue.d.ts +2 -2
  174. package/dist/types/__VUE/video/index.vue.d.ts +1 -1
  175. package/dist/types/index.d.ts +1 -1
  176. package/package.json +2 -1
@@ -1,158 +1,71 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { i as isObject, g as getPropByPath, a as isPromise, c as createComponent } from "./component.js";
7
- import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, withModifiers, createVNode, withCtx, renderSlot } from "vue";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { i as e, g as r, a as t, c as o } from "./component.js";
7
+ import { computed as l, reactive as s, provide as n, watch as a, resolveComponent as i, openBlock as m, createElementBlock as p, withModifiers as u, createVNode as c, withCtx as d, renderSlot as f } from "vue";
8
+ import { _ as h } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- const component = {
11
- props: {
12
- modelValue: {
13
- type: Object,
14
- default: {}
15
- }
16
- },
17
- components: {},
18
- emits: ["validate"],
19
- setup(props, { emit, slots }) {
20
- const formErrorTip = computed(() => reactive({}));
21
- provide("formErrorTip", formErrorTip);
22
- const clearErrorTips = (value = props.modelValue) => {
23
- Object.keys(formErrorTip.value).forEach((item) => {
24
- formErrorTip.value[item] = "";
25
- });
26
- };
27
- const reset = () => {
28
- clearErrorTips();
29
- };
30
- watch(() => props.modelValue, (value) => {
31
- clearErrorTips(value);
32
- }, { immediate: true });
33
- const findFormItem = (vnodes) => {
34
- let task = [];
35
- vnodes.forEach((vnode, index2) => {
36
- var _a, _b, _c, _d;
37
- let type = vnode.type;
38
- type = type.name || type;
39
- if (type == "nut-form-item") {
40
- task.push({
41
- prop: (_a = vnode.props) == null ? void 0 : _a["prop"],
42
- rules: ((_b = vnode.props) == null ? void 0 : _b["rules"]) || []
43
- });
44
- } else if (Array.isArray(vnode.children) && ((_c = vnode.children) == null ? void 0 : _c.length)) {
45
- task = task.concat(findFormItem(vnode.children));
46
- } else if (isObject(vnode.children) && Object.keys(vnode.children)) {
47
- if ((_d = vnode.children) == null ? void 0 : _d.default) {
48
- vnode.children = vnode.children.default();
49
- task = task.concat(findFormItem(vnode.children));
50
- }
51
- }
52
- });
53
- return task;
54
- };
55
- const tipMessage = (errorMsg) => {
56
- if (errorMsg.message) {
57
- emit("validate", errorMsg);
58
- }
59
- formErrorTip.value[errorMsg.prop] = errorMsg.message;
60
- };
61
- const checkRule = (item) => {
62
- const { rules, prop } = item;
63
- const _Promise = (errorMsg) => {
64
- return new Promise((resolve, reject) => {
65
- tipMessage(errorMsg);
66
- resolve(errorMsg);
67
- });
68
- };
69
- if (!prop) {
70
- console.warn("[NutUI] <FormItem> \u4F7F\u7528 rules \u6821\u9A8C\u89C4\u5219\u65F6 , \u5FC5\u987B\u8BBE\u7F6E prop \u53C2\u6570");
71
- }
72
- let value = getPropByPath(props.modelValue, prop || "");
73
- tipMessage({ prop, message: "" });
74
- let _rules = [...rules];
75
- while (_rules.length) {
76
- const { required, validator, regex, message } = _rules.shift();
77
- const errorMsg = { prop, message };
78
- if (required) {
79
- if (!value) {
80
- return _Promise(errorMsg);
81
- }
82
- }
83
- if (regex && !regex.test(String(value))) {
84
- return _Promise(errorMsg);
85
- }
86
- if (validator) {
87
- const result = validator(value);
88
- if (isPromise(result)) {
89
- return new Promise((r, j) => {
90
- result.then((res) => {
91
- if (!res) {
92
- tipMessage(errorMsg);
93
- r(errorMsg);
94
- } else {
95
- r(true);
96
- }
97
- });
10
+ const v = { props: { modelValue: { type: Object, default: {} } }, components: {}, emits: ["validate"], setup(o2, { emit: i2, slots: m2 }) {
11
+ const p2 = l(() => s({}));
12
+ n("formErrorTip", p2);
13
+ const u2 = (e2 = o2.modelValue) => {
14
+ Object.keys(p2.value).forEach((e3) => {
15
+ p2.value[e3] = "";
16
+ });
17
+ };
18
+ a(() => o2.modelValue, (e2) => {
19
+ u2();
20
+ }, { immediate: true });
21
+ const c2 = (r2) => {
22
+ let t2 = [];
23
+ return r2.forEach((r3, o3) => {
24
+ var _a, _b, _c, _d;
25
+ let l2 = r3.type;
26
+ l2 = l2.name || l2, l2 == "nut-form-item" ? t2.push({ prop: (_a = r3.props) == null ? void 0 : _a.prop, rules: ((_b = r3.props) == null ? void 0 : _b.rules) || [] }) : Array.isArray(r3.children) && ((_c = r3.children) == null ? void 0 : _c.length) ? t2 = t2.concat(c2(r3.children)) : e(r3.children) && Object.keys(r3.children) && ((_d = r3.children) == null ? void 0 : _d.default) && (r3.children = r3.children.default(), t2 = t2.concat(c2(r3.children)));
27
+ }), t2;
28
+ }, d2 = (e2) => {
29
+ e2.message && i2("validate", e2), p2.value[e2.prop] = e2.message;
30
+ }, f2 = (e2) => {
31
+ const { rules: l2, prop: s2 } = e2, n2 = (e3) => new Promise((r2, t2) => {
32
+ d2(e3), r2(e3);
33
+ });
34
+ let a2 = r(o2.modelValue, s2 || "");
35
+ d2({ prop: s2, message: "" });
36
+ let i3 = [...l2];
37
+ for (; i3.length; ) {
38
+ const { required: e3, validator: r2, regex: o3, message: l3 } = i3.shift(), m3 = { prop: s2, message: l3 };
39
+ if (e3 && !a2)
40
+ return n2(m3);
41
+ if (o3 && !o3.test(String(a2)))
42
+ return n2(m3);
43
+ if (r2) {
44
+ const e4 = r2(a2);
45
+ if (t(e4))
46
+ return new Promise((r3, t2) => {
47
+ e4.then((e5) => {
48
+ e5 ? r3(true) : (d2(m3), r3(m3));
98
49
  });
99
- } else {
100
- if (!result) {
101
- return _Promise(errorMsg);
102
- }
103
- }
104
- }
50
+ });
51
+ if (!e4)
52
+ return n2(m3);
105
53
  }
106
- return Promise.resolve(true);
107
- };
108
- const validate = (customProp = "") => {
109
- return new Promise((resolve, reject) => {
110
- let task = findFormItem(slots.default());
111
- let errors = task.map((item) => {
112
- if (customProp) {
113
- if (customProp == item.prop) {
114
- return checkRule(item);
115
- } else {
116
- return Promise.resolve(true);
117
- }
118
- } else {
119
- return checkRule(item);
120
- }
121
- });
122
- Promise.all(errors).then((errorRes) => {
123
- errorRes = errorRes.filter((item) => item != true);
124
- const res = { valid: true, errors: [] };
125
- if (errorRes.length) {
126
- res.valid = false;
127
- res.errors = errorRes;
128
- }
129
- resolve(res);
130
- });
131
- });
132
- };
133
- const onSubmit = () => {
134
- validate();
135
- return false;
136
- };
137
- return { validate, reset, onSubmit, formErrorTip };
138
- }
139
- };
140
- const { create } = createComponent("form");
141
- const _sfc_main = create(component);
142
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
143
- const _component_nut_cell_group = resolveComponent("nut-cell-group");
144
- return openBlock(), createElementBlock("form", {
145
- class: "nut-form",
146
- action: "#",
147
- onSubmit: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onSubmit && _ctx.onSubmit(...args), ["prevent"]))
148
- }, [
149
- createVNode(_component_nut_cell_group, null, {
150
- default: withCtx(() => [
151
- renderSlot(_ctx.$slots, "default")
152
- ]),
153
- _: 3
154
- })
155
- ], 32);
156
- }
157
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
158
- export { index as default };
54
+ }
55
+ return Promise.resolve(true);
56
+ }, h2 = (e2 = "") => new Promise((r2, t2) => {
57
+ let o3 = c2(m2.default()).map((r3) => e2 ? e2 == r3.prop ? f2(r3) : Promise.resolve(true) : f2(r3));
58
+ Promise.all(o3).then((e3) => {
59
+ const t3 = { valid: true, errors: [] };
60
+ (e3 = e3.filter((e4) => e4 != 1)).length && (t3.valid = false, t3.errors = e3), r2(t3);
61
+ });
62
+ });
63
+ return { validate: h2, reset: () => {
64
+ u2();
65
+ }, onSubmit: () => (h2(), false), formErrorTip: p2 };
66
+ } }, { create: g } = o("form");
67
+ var y = h(g(v), [["render", function(e2, r2, t2, o2, l2, s2) {
68
+ const n2 = i("nut-cell-group");
69
+ return m(), p("form", { class: "nut-form", action: "#", onSubmit: r2[0] || (r2[0] = u(() => false, ["prevent"])) }, [c(n2, null, { default: d(() => [f(e2.$slots, "default")]), _: 3 })], 32);
70
+ }]]);
71
+ export { y as default };
@@ -1,115 +1,20 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { p as pxCheck } from "./pxCheck.js";
7
- import { inject, provide, computed, resolveComponent, openBlock, createBlock, normalizeClass, normalizeStyle, withCtx, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, renderSlot } from "vue";
8
- import { c as createComponent } from "./component.js";
9
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { p as e } from "./pxCheck.js";
7
+ import { inject as t, provide as r, computed as l, resolveComponent as o, openBlock as s, createBlock as a, normalizeClass as n, normalizeStyle as i, withCtx as p, createElementBlock as u, renderSlot as y, createTextVNode as m, toDisplayString as d, createCommentVNode as f, createElementVNode as g } from "vue";
8
+ import { c } from "./component.js";
9
+ import { _ as b } from "./plugin-vue_export-helper.js";
10
10
  import "../locale/lang";
11
- const { componentName, create } = createComponent("form-item");
12
- const _sfc_main = create({
13
- inheritAttrs: false,
14
- props: {
15
- prop: {
16
- type: String,
17
- default: ""
18
- },
19
- label: {
20
- type: String,
21
- default: ""
22
- },
23
- rules: {
24
- type: Array,
25
- default: () => {
26
- return [];
27
- }
28
- },
29
- required: {
30
- type: Boolean,
31
- default: false
32
- },
33
- showErrorMessage: {
34
- type: Boolean,
35
- default: true
36
- },
37
- showErrorLine: {
38
- type: Boolean,
39
- default: true
40
- },
41
- labelWidth: {
42
- type: [String, Number],
43
- default: ""
44
- },
45
- labelAlign: {
46
- type: String,
47
- default: ""
48
- },
49
- errorMessageAlign: {
50
- type: String,
51
- default: ""
52
- },
53
- bodyAlign: {
54
- type: String,
55
- default: ""
56
- }
57
- },
58
- components: {},
59
- emits: [""],
60
- setup(props, { emit }) {
61
- const parent = inject("formErrorTip");
62
- provide("form", {
63
- props
64
- });
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
- return { parent, labelStyle, bodyStyle, errorMessageStyle };
82
- }
83
- });
84
- const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
85
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
86
- const _component_nut_cell = resolveComponent("nut-cell");
87
- return openBlock(), createBlock(_component_nut_cell, {
88
- class: normalizeClass(["nut-form-item", [{ error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }, _ctx.$attrs.class]]),
89
- style: normalizeStyle(_ctx.$attrs.style)
90
- }, {
91
- default: withCtx(() => [
92
- _ctx.label ? (openBlock(), createElementBlock("view", {
93
- key: 0,
94
- class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
95
- style: normalizeStyle(_ctx.labelStyle)
96
- }, toDisplayString(_ctx.label), 7)) : createCommentVNode("", true),
97
- createElementVNode("view", _hoisted_1, [
98
- createElementVNode("view", {
99
- class: "nut-form-item__body__slots",
100
- style: normalizeStyle(_ctx.bodyStyle)
101
- }, [
102
- renderSlot(_ctx.$slots, "default")
103
- ], 4),
104
- _ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
105
- key: 0,
106
- class: "nut-form-item__body__tips",
107
- style: normalizeStyle(_ctx.errorMessageStyle)
108
- }, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
109
- ])
110
- ]),
111
- _: 3
112
- }, 8, ["class", "style"]);
113
- }
114
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
115
- export { index as default };
11
+ const { componentName: _, create: S } = c("form-item"), A = S({ inheritAttrs: false, props: { prop: { type: String, default: "" }, label: { type: String, default: "" }, rules: { type: Array, default: () => [] }, required: { type: Boolean, default: false }, showErrorMessage: { type: Boolean, default: true }, showErrorLine: { type: Boolean, default: true }, labelWidth: { type: [String, Number], default: "" }, labelAlign: { type: String, default: "" }, errorMessageAlign: { type: String, default: "" }, bodyAlign: { type: String, default: "" } }, components: {}, emits: [""], setup(o2, { emit: s2 }) {
12
+ const a2 = t("formErrorTip");
13
+ r("form", { props: o2 });
14
+ return { parent: a2, labelStyle: l(() => ({ width: e(o2.labelWidth), textAlign: o2.labelAlign })), bodyStyle: l(() => ({ textAlign: o2.bodyAlign })), errorMessageStyle: l(() => ({ textAlign: o2.errorMessageAlign })) };
15
+ } }), h = { class: "nut-cell__value nut-form-item__body" };
16
+ var w = b(A, [["render", function(e2, t2, r2, l2, c2, b2) {
17
+ const _2 = o("nut-cell");
18
+ return s(), a(_2, { class: n(["nut-form-item", [{ error: e2.parent[e2.prop], line: e2.showErrorLine }, e2.$attrs.class]]), style: i(e2.$attrs.style) }, { default: p(() => [e2.label ? (s(), u("view", { key: 0, class: n(["nut-cell__title nut-form-item__label", { required: e2.required }]), style: i(e2.labelStyle) }, [y(e2.$slots, "label", {}, () => [m(d(e2.label), 1)])], 6)) : f("", true), g("view", h, [g("view", { class: "nut-form-item__body__slots", style: i(e2.bodyStyle) }, [y(e2.$slots, "default")], 4), e2.parent[e2.prop] && e2.showErrorMessage ? (s(), u("view", { key: 0, class: "nut-form-item__body__tips", style: i(e2.errorMessageStyle) }, d(e2.parent[e2.prop]), 5)) : f("", true)])]), _: 3 }, 8, ["class", "style"]);
19
+ }]]);
20
+ export { w as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { c as createComponent } from "./component.js";
7
- import { c as component } from "./common.js";
6
+ import { c as o } from "./component.js";
7
+ import { c as m } from "./common.js";
8
8
  import "vue";
9
9
  import "../locale/lang";
10
10
  import "./pxCheck.js";
11
- const { create } = createComponent("grid");
12
- const _sfc_main = create(component);
13
- export { _sfc_main as default };
11
+ const { create: r } = o("grid"), t = r(m);
12
+ export { t as default };
@@ -1,150 +1,39 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { inject, getCurrentInstance, onUnmounted, computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, Fragment, createBlock, toDisplayString } from "vue";
7
- import { u as useRouter } from "./index.js";
8
- import { c as createComponent } from "./component.js";
9
- import { p as pxCheck } from "./pxCheck.js";
10
- import { G as GRID_KEY } from "./common.js";
11
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { inject as e, getCurrentInstance as t, onUnmounted as o, computed as r, ref as n, resolveComponent as i, openBlock as l, createElementBlock as c, normalizeClass as s, normalizeStyle as a, createElementVNode as u, renderSlot as p, Fragment as m, createBlock as d, toDisplayString as f } from "vue";
7
+ import { u as g } from "./index.js";
8
+ import { c as y } from "./component.js";
9
+ import { p as $ } from "./pxCheck.js";
10
+ import { G as k } from "./common.js";
11
+ import { _ as x } from "./plugin-vue_export-helper.js";
12
12
  import "../locale/lang";
13
- function useInject(key) {
14
- const parent = inject(key, null);
15
- if (parent) {
16
- const instance = getCurrentInstance();
17
- const { add, remove, internalChildren } = parent;
18
- add(instance);
19
- onUnmounted(() => remove(instance));
20
- const index2 = computed(() => internalChildren.indexOf(instance));
21
- return {
22
- parent,
23
- index: index2
24
- };
25
- }
26
- return {
27
- parent: null,
28
- index: ref(-1)
29
- };
30
- }
31
- const { create, componentName } = createComponent("grid-item");
32
- const _sfc_main = create({
33
- props: {
34
- text: {
35
- type: String
36
- },
37
- icon: {
38
- type: String
39
- },
40
- iconSize: {
41
- type: [Number, String]
42
- },
43
- iconColor: {
44
- type: String
45
- },
46
- to: {
47
- type: [String, Object]
48
- },
49
- url: {
50
- type: String,
51
- default: ""
52
- },
53
- replace: {
54
- type: Boolean,
55
- default: false
13
+ const { create: C, componentName: S } = y("grid-item"), v = C({ props: { text: { type: String }, icon: { type: String }, iconSize: { type: [Number, String] }, iconColor: { type: String }, to: { type: [String, Object] }, url: { type: String, default: "" }, replace: { type: Boolean, default: false } }, emits: ["click"], setup(i2, { emit: l2 }) {
14
+ const c2 = function(i3) {
15
+ const l3 = e(i3, null);
16
+ if (l3) {
17
+ const e2 = t(), { add: n2, remove: i4, internalChildren: c3 } = l3;
18
+ return n2(e2), o(() => i4(e2)), { parent: l3, index: r(() => c3.indexOf(e2)) };
56
19
  }
57
- },
58
- emits: ["click"],
59
- setup(props, { emit }) {
60
- const Parent = useInject(GRID_KEY);
61
- if (!Parent.parent)
62
- return;
63
- const index2 = Parent.index;
64
- const parent = Parent.parent.props;
65
- const rootClass = computed(() => {
66
- const prefixCls = componentName;
67
- return {
68
- [prefixCls]: true
69
- };
70
- });
71
- const rootStyle = computed(() => {
72
- const style = {
73
- flexBasis: `${100 / +parent.columnNum}%`
74
- };
75
- if (parent.square) {
76
- style.paddingTop = `${100 / +parent.columnNum}%`;
77
- } else if (parent.gutter) {
78
- style.paddingRight = pxCheck(parent.gutter);
79
- if (index2.value >= parent.columnNum) {
80
- style.marginTop = pxCheck(parent.gutter);
81
- }
82
- }
83
- return style;
84
- });
85
- const contentClass = computed(() => {
86
- const prefixCls = `${componentName}__content`;
87
- return {
88
- [`${prefixCls}`]: true,
89
- [`${prefixCls}--border`]: parent.border,
90
- [`${prefixCls}--surround`]: parent.border && parent.gutter,
91
- [`${prefixCls}--center`]: parent.center,
92
- [`${prefixCls}--square`]: parent.square,
93
- [`${prefixCls}--reverse`]: parent.reverse,
94
- [`${prefixCls}--${parent.direction}`]: !!parent.direction,
95
- [`${prefixCls}--clickable`]: parent.clickable || props.to || props.url
96
- };
97
- });
98
- const iconProps = computed(() => {
99
- return {
100
- name: props.icon,
101
- size: props.iconSize || parent.iconSize,
102
- color: props.iconColor || parent.iconColor
103
- };
104
- });
105
- const router = useRouter();
106
- const handleClick = (event) => {
107
- emit("click", event);
108
- if (props.to && router) {
109
- router[props.replace ? "replace" : "push"](props.to);
110
- } else if (props.url) {
111
- props.replace ? location.replace(props.url) : location.href = props.url;
112
- }
113
- };
114
- return {
115
- rootClass,
116
- rootStyle,
117
- contentClass,
118
- iconProps,
119
- handleClick
120
- };
121
- }
122
- });
123
- const _hoisted_1 = {
124
- key: 3,
125
- class: "nut-grid-item__text"
126
- };
127
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
128
- const _component_nut_icon = resolveComponent("nut-icon");
129
- return openBlock(), createElementBlock("view", {
130
- class: normalizeClass(_ctx.rootClass),
131
- style: normalizeStyle(_ctx.rootStyle),
132
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
133
- }, [
134
- createElementVNode("view", {
135
- class: normalizeClass(_ctx.contentClass)
136
- }, [
137
- _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
138
- _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 0 }) : (openBlock(), createBlock(_component_nut_icon, {
139
- key: 1,
140
- name: _ctx.iconProps.name,
141
- size: _ctx.iconProps.size,
142
- color: _ctx.iconProps.color
143
- }, null, 8, ["name", "size", "color"])),
144
- _ctx.$slots.text ? renderSlot(_ctx.$slots, "text", { key: 2 }) : (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.text), 1))
145
- ], 64))
146
- ], 2)
147
- ], 6);
148
- }
149
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
150
- export { index as default };
20
+ return { parent: null, index: n(-1) };
21
+ }(k);
22
+ if (!c2.parent)
23
+ return;
24
+ const s2 = c2.index, a2 = c2.parent.props, u2 = r(() => ({ [S]: true })), p2 = r(() => {
25
+ const e2 = { flexBasis: 100 / +a2.columnNum + "%" };
26
+ return a2.square ? e2.paddingTop = 100 / +a2.columnNum + "%" : a2.gutter && (e2.paddingRight = $(a2.gutter), s2.value >= a2.columnNum && (e2.marginTop = $(a2.gutter))), e2;
27
+ }), m2 = r(() => {
28
+ const e2 = `${S}__content`;
29
+ return { [`${e2}`]: true, [`${e2}--border`]: a2.border, [`${e2}--surround`]: a2.border && a2.gutter, [`${e2}--center`]: a2.center, [`${e2}--square`]: a2.square, [`${e2}--reverse`]: a2.reverse, [`${e2}--${a2.direction}`]: !!a2.direction, [`${e2}--clickable`]: a2.clickable || i2.to || i2.url };
30
+ }), d2 = r(() => ({ name: i2.icon, size: i2.iconSize || a2.iconSize, color: i2.iconColor || a2.iconColor })), f2 = g();
31
+ return { rootClass: u2, rootStyle: p2, contentClass: m2, iconProps: d2, handleClick: (e2) => {
32
+ l2("click", e2), i2.to && f2 ? f2[i2.replace ? "replace" : "push"](i2.to) : i2.url && (i2.replace ? location.replace(i2.url) : location.href = i2.url);
33
+ } };
34
+ } }), h = { key: 3, class: "nut-grid-item__text" };
35
+ var b = x(v, [["render", function(e2, t2, o2, r2, n2, g2) {
36
+ const y2 = i("nut-icon");
37
+ return l(), c("view", { class: s(e2.rootClass), style: a(e2.rootStyle), onClick: t2[0] || (t2[0] = (...t3) => e2.handleClick && e2.handleClick(...t3)) }, [u("view", { class: s(e2.contentClass) }, [e2.$slots.default ? p(e2.$slots, "default", { key: 0 }) : (l(), c(m, { key: 1 }, [e2.$slots.icon ? p(e2.$slots, "icon", { key: 0 }) : (l(), d(y2, { key: 1, name: e2.iconProps.name, size: e2.iconProps.size, color: e2.iconProps.color }, null, 8, ["name", "size", "color"])), e2.$slots.text ? p(e2.$slots, "text", { key: 2 }) : (l(), c("view", h, f(e2.text), 1))], 64))], 2)], 6);
38
+ }]]);
39
+ export { b as default };
@@ -1,45 +1,20 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.22-beta.0 Tue May 31 2022 21:47:10 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.3 Wed Jun 15 2022 20:12:30 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { h } from "vue";
7
- import { c as createComponent } from "./component.js";
8
- import { p as pxCheck } from "./pxCheck.js";
6
+ import { h as t } from "vue";
7
+ import { c as e } from "./component.js";
8
+ import { p as i } from "./pxCheck.js";
9
9
  import "../locale/lang";
10
- const { componentName, create } = createComponent("icon");
11
- const _sfc_main = create({
12
- props: {
13
- name: { type: String, default: "" },
14
- size: { type: [String, Number], default: "" },
15
- classPrefix: { type: String, default: "nut-icon" },
16
- fontClassName: { type: String, default: "nutui-iconfont" },
17
- color: { type: String, default: "" },
18
- tag: { type: String, default: "i" }
19
- },
20
- emits: ["click"],
21
- setup(props, { emit, slots }) {
22
- const handleClick = (event) => {
23
- emit("click", event);
24
- };
25
- const isImage = () => {
26
- return props.name ? props.name.indexOf("/") !== -1 : false;
27
- };
28
- return () => {
29
- var _a;
30
- const _isImage = isImage();
31
- return h(_isImage ? "img" : props.tag, {
32
- class: _isImage ? `${componentName}__img` : `${props.fontClassName} ${componentName} ${props.classPrefix}-${props.name}`,
33
- style: {
34
- color: props.color,
35
- fontSize: pxCheck(props.size),
36
- width: pxCheck(props.size),
37
- height: pxCheck(props.size)
38
- },
39
- onClick: handleClick,
40
- src: _isImage ? props.name : ""
41
- }, (_a = slots.default) == null ? void 0 : _a.call(slots));
42
- };
43
- }
44
- });
45
- export { _sfc_main as default };
10
+ const { componentName: n, create: o } = e("icon"), a = o({ props: { name: { type: String, default: "" }, size: { type: [String, Number], default: "" }, classPrefix: { type: String, default: "nut-icon" }, fontClassName: { type: String, default: "nutui-iconfont" }, color: { type: String, default: "" }, tag: { type: String, default: "i" } }, emits: ["click"], setup(e2, { emit: o2, slots: a2 }) {
11
+ const s = (t2) => {
12
+ o2("click", t2);
13
+ };
14
+ return () => {
15
+ var _a;
16
+ const o3 = !!e2.name && e2.name.indexOf("/") !== -1;
17
+ return t(o3 ? "img" : e2.tag, { class: o3 ? `${n}__img` : `${e2.fontClassName} ${n} ${e2.classPrefix}-${e2.name}`, style: { color: e2.color, fontSize: i(e2.size), width: i(e2.size), height: i(e2.size) }, onClick: s, src: o3 ? e2.name : "" }, (_a = a2.default) == null ? void 0 : _a.call(a2));
18
+ };
19
+ } });
20
+ export { a as default };