@nutui/nutui 3.1.12-beta.0 → 3.1.13

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 (133) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +139 -37
  3. package/dist/nutui.d.ts +12 -2
  4. package/dist/nutui.es.js +6704 -5011
  5. package/dist/nutui.umd.js +6720 -5017
  6. package/dist/packages/_es/ActionSheet.js +1 -1
  7. package/dist/packages/_es/Address.js +18 -17
  8. package/dist/packages/_es/Avatar.js +1 -1
  9. package/dist/packages/_es/BackTop.js +1 -1
  10. package/dist/packages/_es/Badge.js +1 -1
  11. package/dist/packages/_es/Barrage.js +1 -1
  12. package/dist/packages/_es/Button.js +1 -1
  13. package/dist/packages/_es/Calendar.js +1 -1
  14. package/dist/packages/_es/Card.js +105 -0
  15. package/dist/packages/_es/Cascader.js +547 -0
  16. package/dist/packages/_es/Cell.js +1 -1
  17. package/dist/packages/_es/CellGroup.js +10 -4
  18. package/dist/packages/_es/Checkbox.js +1 -1
  19. package/dist/packages/_es/CheckboxGroup.js +2 -2
  20. package/dist/packages/_es/CircleProgress.js +1 -1
  21. package/dist/packages/_es/Col.js +1 -1
  22. package/dist/packages/_es/Collapse.js +1 -1
  23. package/dist/packages/_es/CollapseItem.js +1 -1
  24. package/dist/packages/_es/CountDown.js +3 -4
  25. package/dist/packages/_es/CountUp.js +3 -1
  26. package/dist/packages/_es/DatePicker.js +2 -2
  27. package/dist/packages/_es/Dialog.js +10 -23
  28. package/dist/packages/_es/Divider.js +1 -1
  29. package/dist/packages/_es/Drag.js +1 -1
  30. package/dist/packages/_es/Elevator.js +3 -2
  31. package/dist/packages/_es/Empty.js +74 -0
  32. package/dist/packages/_es/FixedNav.js +1 -1
  33. package/dist/packages/_es/Form.js +151 -0
  34. package/dist/packages/_es/FormItem.js +110 -0
  35. package/dist/packages/_es/Grid.js +12 -0
  36. package/dist/packages/_es/GridItem.js +149 -0
  37. package/dist/packages/_es/Icon.js +1 -1
  38. package/dist/packages/_es/ImagePreview.js +148 -32
  39. package/dist/packages/_es/Indicator.js +66 -0
  40. package/dist/packages/_es/InfiniteLoading.js +1 -1
  41. package/dist/packages/_es/Input.js +1 -1
  42. package/dist/packages/_es/InputNumber.js +1 -1
  43. package/dist/packages/_es/Layout.js +1 -1
  44. package/dist/packages/_es/Menu.js +2 -2
  45. package/dist/packages/_es/MenuItem.js +1 -1
  46. package/dist/packages/_es/Navbar.js +1 -1
  47. package/dist/packages/_es/NoticeBar.js +6 -8
  48. package/dist/packages/_es/Notify.js +1 -1
  49. package/dist/packages/_es/NumberKeyboard.js +9 -7
  50. package/dist/packages/_es/OverLay.js +1 -1
  51. package/dist/packages/_es/Pagination.js +1 -1
  52. package/dist/packages/_es/Picker.js +2 -2
  53. package/dist/packages/_es/Popover.js +11 -17
  54. package/dist/packages/_es/Popup.js +1 -1
  55. package/dist/packages/_es/Price.js +1 -1
  56. package/dist/packages/_es/Progress.js +1 -1
  57. package/dist/packages/_es/Radio.js +1 -1
  58. package/dist/packages/_es/RadioGroup.js +1 -1
  59. package/dist/packages/_es/Range.js +3 -3
  60. package/dist/packages/_es/Rate.js +19 -5
  61. package/dist/packages/_es/Row.js +1 -1
  62. package/dist/packages/_es/SearchBar.js +1 -1
  63. package/dist/packages/_es/ShortPassword.js +1 -1
  64. package/dist/packages/_es/Signature.js +1 -1
  65. package/dist/packages/_es/Skeleton.js +138 -0
  66. package/dist/packages/_es/Sku.js +2 -37
  67. package/dist/packages/_es/Step.js +1 -1
  68. package/dist/packages/_es/Steps.js +1 -1
  69. package/dist/packages/_es/Swipe.js +2 -2
  70. package/dist/packages/_es/Swiper.js +11 -11
  71. package/dist/packages/_es/SwiperItem.js +3 -3
  72. package/dist/packages/_es/Switch.js +43 -13
  73. package/dist/packages/_es/TabPane.js +1 -1
  74. package/dist/packages/_es/Tabbar.js +1 -1
  75. package/dist/packages/_es/TabbarItem.js +1 -1
  76. package/dist/packages/_es/Table.js +191 -0
  77. package/dist/packages/_es/Tabs.js +6 -2
  78. package/dist/packages/_es/Tag.js +1 -1
  79. package/dist/packages/_es/TextArea.js +1 -1
  80. package/dist/packages/_es/TimeDetail.js +1 -1
  81. package/dist/packages/_es/TimePannel.js +1 -1
  82. package/dist/packages/_es/TimeSelect.js +1 -1
  83. package/dist/packages/_es/Toast.js +18 -8
  84. package/dist/packages/_es/Uploader.js +1 -1
  85. package/dist/packages/_es/Video.js +3 -3
  86. package/dist/packages/_es/common.js +136 -0
  87. package/dist/packages/_es/component.js +1 -1
  88. package/dist/packages/_es/index.js +7 -58
  89. package/dist/packages/_es/index2.js +56 -28
  90. package/dist/packages/_es/index3.js +31 -8
  91. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  92. package/dist/packages/_es/pxCheck.js +1 -1
  93. package/dist/packages/_es/raf.js +1 -1
  94. package/dist/packages/_es/util.js +47 -0
  95. package/dist/packages/button/index.scss +6 -0
  96. package/dist/packages/card/index.scss +97 -0
  97. package/dist/packages/cascader/index.scss +81 -0
  98. package/dist/packages/cellgroup/index.scss +9 -0
  99. package/dist/packages/checkbox/index.scss +1 -1
  100. package/dist/packages/dialog/index.scss +17 -0
  101. package/dist/packages/drag/index.scss +4 -0
  102. package/dist/packages/empty/index.scss +33 -0
  103. package/dist/packages/fixednav/index.scss +6 -1
  104. package/dist/packages/form/index.scss +2 -0
  105. package/dist/packages/formitem/index.scss +63 -0
  106. package/dist/packages/grid/index.scss +10 -0
  107. package/dist/packages/griditem/index.scss +92 -0
  108. package/dist/packages/icon/index.scss +2 -1
  109. package/dist/packages/indicator/index.scss +48 -0
  110. package/dist/packages/numberkeyboard/index.scss +1 -1
  111. package/dist/packages/popover/index.scss +2 -2
  112. package/dist/packages/rate/index.scss +1 -0
  113. package/dist/packages/skeleton/index.scss +57 -0
  114. package/dist/packages/switch/index.scss +1 -1
  115. package/dist/packages/table/index.scss +81 -0
  116. package/dist/packages/tabs/index.scss +16 -0
  117. package/dist/packages/textarea/index.scss +1 -0
  118. package/dist/packages/timedetail/index.scss +1 -2
  119. package/dist/packages/timeselect/index.scss +3 -0
  120. package/dist/packages/toast/index.scss +6 -0
  121. package/dist/style.css +1 -1
  122. package/dist/styles/.DS_Store +0 -0
  123. package/dist/styles/font/config.json +2 -1
  124. package/dist/styles/font/demo_index.html +26 -3
  125. package/dist/styles/font/iconfont.css +7 -3
  126. package/dist/styles/font/iconfont.js +31 -32
  127. package/dist/styles/font/iconfont.json +7 -0
  128. package/dist/styles/font/iconfont.ttf +0 -0
  129. package/dist/styles/font/iconfont.woff +0 -0
  130. package/dist/styles/font/iconfont.woff2 +0 -0
  131. package/dist/styles/themes/default.scss +44 -34
  132. package/dist/styles/variables.scss +64 -1
  133. package/package.json +3 -4
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -461,6 +461,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
461
461
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.machineNum, (val, index2) => {
462
462
  return openBlock(), createElementBlock("view", {
463
463
  class: "run-number-machine-img-li",
464
+ ref_for: true,
464
465
  ref: "run-number-machine-img-li",
465
466
  key: "mImg" + index2,
466
467
  style: normalizeStyle({
@@ -513,6 +514,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
513
514
  }, [
514
515
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.num_total_len, (val, index2) => {
515
516
  return openBlock(), createElementBlock("view", {
517
+ ref_for: true,
516
518
  ref: "numberItem",
517
519
  class: "numberItem",
518
520
  key: val,
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -26,7 +26,7 @@ import { reactive, computed, onMounted, watch, toRefs, resolveComponent, openBlo
26
26
  import picker from "./Picker.js";
27
27
  import { c as createComponent } from "./component.js";
28
28
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
- import "./index.js";
29
+ import "./index2.js";
30
30
  import "./Popup.js";
31
31
  import "./OverLay.js";
32
32
  import "./Icon.js";
@@ -22,7 +22,7 @@ var __publicField = (obj, key, value) => {
22
22
  return value;
23
23
  };
24
24
  /*!
25
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
25
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
26
26
  * (c) 2021 @jdf2e.
27
27
  * Released under the MIT License.
28
28
  */
@@ -86,25 +86,13 @@ const _sfc_main = create({
86
86
  type: String,
87
87
  default: "center"
88
88
  },
89
- onOk: {
90
- type: Function,
91
- default: null
92
- },
93
- onCancel: {
94
- type: Function,
95
- default: null
96
- },
97
- onClose: {
98
- type: Function,
99
- default: null
100
- },
101
- onClosed: {
102
- type: Function,
103
- default: null
104
- },
105
89
  closeOnPopstate: {
106
90
  type: Boolean,
107
91
  default: false
92
+ },
93
+ footerDirection: {
94
+ type: String,
95
+ default: "horizontal"
108
96
  }
109
97
  }),
110
98
  emits: ["update", "update:visible", "ok", "cancel", "open", "opened", "close", "closed"],
@@ -157,10 +145,6 @@ const _hoisted_1 = {
157
145
  class: "nut-dialog__header"
158
146
  };
159
147
  const _hoisted_2 = ["innerHTML"];
160
- const _hoisted_3 = {
161
- key: 1,
162
- class: "nut-dialog__footer"
163
- };
164
148
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
165
149
  const _component_nut_button = resolveComponent("nut-button");
166
150
  const _component_nut_popup = resolveComponent("nut-popup");
@@ -192,7 +176,10 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
192
176
  innerHTML: _ctx.content
193
177
  }, null, 8, _hoisted_2))
194
178
  ], 4),
195
- !_ctx.noFooter ? (openBlock(), createElementBlock("view", _hoisted_3, [
179
+ !_ctx.noFooter ? (openBlock(), createElementBlock("view", {
180
+ key: 1,
181
+ class: normalizeClass(["nut-dialog__footer", { [_ctx.footerDirection]: _ctx.footerDirection }])
182
+ }, [
196
183
  _ctx.$slots.footer ? renderSlot(_ctx.$slots, "footer", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
197
184
  !_ctx.noCancelBtn ? (openBlock(), createBlock(_component_nut_button, {
198
185
  key: 0,
@@ -221,7 +208,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
221
208
  _: 1
222
209
  }, 8, ["class", "disabled", "onClick"])) : createCommentVNode("", true)
223
210
  ], 64))
224
- ])) : createCommentVNode("", true)
211
+ ], 2)) : createCommentVNode("", true)
225
212
  ], 2)
226
213
  ]),
227
214
  _: 3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
22
22
  * (c) 2021 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
@@ -165,6 +165,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
165
165
  return openBlock(), createElementBlock("view", {
166
166
  class: "nut-elevator__list__item",
167
167
  key: item[_ctx.acceptKey],
168
+ ref_for: true,
168
169
  ref: _ctx.setListGroup
169
170
  }, [
170
171
  createElementVNode("view", _hoisted_1, toDisplayString(item[_ctx.acceptKey]), 1),
@@ -176,7 +177,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
176
177
  innerHTML: subitem.name
177
178
  }, null, 8, _hoisted_2);
178
179
  }), 128))
179
- ], 512);
180
+ ]);
180
181
  }), 128))
181
182
  ], 4),
182
183
  _ctx.indexList.length ? withDirectives((openBlock(), createElementBlock("view", {
@@ -0,0 +1,74 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { toRefs, computed, openBlock, createElementBlock, createElementVNode, normalizeStyle, renderSlot, Fragment, createCommentVNode, toDisplayString } from "vue";
7
+ import { c as createComponent } from "./component.js";
8
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
+ const { componentName, create } = createComponent("empty");
10
+ const defaultStatus = {
11
+ empty: "https://static-ftcms.jd.com/p/files/61a9e3183985005b3958672b.png",
12
+ error: "https://ftcms.jd.com/p/files/61a9e33ee7dcdbcc0ce62736.png",
13
+ network: "https://static-ftcms.jd.com/p/files/61a9e31de7dcdbcc0ce62734.png"
14
+ };
15
+ const _sfc_main = create({
16
+ props: {
17
+ image: {
18
+ type: String,
19
+ default: "empty"
20
+ },
21
+ imageSize: {
22
+ type: [Number, String],
23
+ default: ""
24
+ },
25
+ description: {
26
+ type: String,
27
+ default: "\u65E0\u5185\u5BB9"
28
+ }
29
+ },
30
+ setup(props) {
31
+ const { image, imageSize } = toRefs(props);
32
+ const imgStyle = computed(() => {
33
+ if (!imageSize.value) {
34
+ return "";
35
+ }
36
+ if (typeof imageSize.value === "number") {
37
+ return `width:${imageSize.value}px;height:${imageSize.value}px`;
38
+ }
39
+ return `width:${imageSize.value};height:${imageSize.value}`;
40
+ });
41
+ const isHttpUrl = image.value.startsWith("https://") || image.value.startsWith("http://") || image.value.startsWith("//");
42
+ const imageUrl = isHttpUrl ? image.value : defaultStatus[image.value];
43
+ return {
44
+ imageUrl,
45
+ imgStyle
46
+ };
47
+ }
48
+ });
49
+ const _hoisted_1 = { class: "nut-empty" };
50
+ const _hoisted_2 = ["src"];
51
+ const _hoisted_3 = {
52
+ key: 1,
53
+ class: "nut-empty-description"
54
+ };
55
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
56
+ return openBlock(), createElementBlock("view", _hoisted_1, [
57
+ createElementVNode("view", {
58
+ class: "nut-empty-image",
59
+ style: normalizeStyle(_ctx.imgStyle)
60
+ }, [
61
+ _ctx.$slots.image ? renderSlot(_ctx.$slots, "image", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
62
+ _ctx.imageUrl ? (openBlock(), createElementBlock("img", {
63
+ key: 0,
64
+ class: "img",
65
+ src: _ctx.imageUrl
66
+ }, null, 8, _hoisted_2)) : createCommentVNode("", true)
67
+ ], 64))
68
+ ], 4),
69
+ _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("view", _hoisted_3, toDisplayString(_ctx.description), 1)),
70
+ _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("", true)
71
+ ]);
72
+ }
73
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
74
+ export { index as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -0,0 +1,151 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { c as createComponent } from "./component.js";
7
+ import { i as isPromise } from "./util.js";
8
+ import { computed, reactive, provide, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, renderSlot } from "vue";
9
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
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 init = (value = props.modelValue) => {
23
+ Object.keys(value).forEach((item) => {
24
+ formErrorTip.value[item] = "";
25
+ });
26
+ };
27
+ const reset = () => {
28
+ init();
29
+ };
30
+ watch(() => props.modelValue, (value) => {
31
+ init(value);
32
+ }, { immediate: true });
33
+ const findFormItem = (vnodes) => {
34
+ let task = [];
35
+ vnodes.forEach((vnode, index2) => {
36
+ var _a, _b, _c;
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 ((_c = vnode.children) == null ? void 0 : _c.length) {
45
+ task = task.concat(findFormItem(vnode.children));
46
+ }
47
+ });
48
+ return task;
49
+ };
50
+ const tipMessage = (errorMsg) => {
51
+ if (errorMsg.message) {
52
+ emit("validate", errorMsg);
53
+ }
54
+ formErrorTip.value[errorMsg.prop] = errorMsg.message;
55
+ };
56
+ const checkRule = (item) => {
57
+ const { rules, prop } = item;
58
+ const _Promise = (errorMsg) => {
59
+ return new Promise((resolve, reject) => {
60
+ tipMessage(errorMsg);
61
+ resolve(errorMsg);
62
+ });
63
+ };
64
+ const getPropByPath = (obj, keyPath) => {
65
+ return keyPath.split(".").reduce((prev, curr) => prev[curr], obj);
66
+ };
67
+ let value = getPropByPath(props.modelValue, prop);
68
+ tipMessage({ prop, message: "" });
69
+ while (rules.length) {
70
+ const { required, validator, regex, message } = rules.shift();
71
+ const errorMsg = { prop, message };
72
+ if (required) {
73
+ if (!value) {
74
+ return _Promise(errorMsg);
75
+ }
76
+ }
77
+ if (regex && !regex.test(String(value))) {
78
+ return _Promise(errorMsg);
79
+ }
80
+ if (validator) {
81
+ const result = validator(value);
82
+ if (isPromise(result)) {
83
+ return new Promise((r, j) => {
84
+ result.then((res) => {
85
+ if (!res) {
86
+ tipMessage(errorMsg);
87
+ r(errorMsg);
88
+ } else {
89
+ r(true);
90
+ }
91
+ });
92
+ });
93
+ } else {
94
+ if (!result) {
95
+ return _Promise(errorMsg);
96
+ }
97
+ }
98
+ }
99
+ }
100
+ return Promise.resolve(true);
101
+ };
102
+ const validate = (customProp = "") => {
103
+ return new Promise((resolve, reject) => {
104
+ let task = findFormItem(slots.default());
105
+ let errors = task.map((item) => {
106
+ if (customProp) {
107
+ if (customProp == item.prop) {
108
+ return checkRule(item);
109
+ } else {
110
+ return Promise.resolve(true);
111
+ }
112
+ } else {
113
+ return checkRule(item);
114
+ }
115
+ });
116
+ Promise.all(errors).then((errorRes) => {
117
+ errorRes = errorRes.filter((item) => item != true);
118
+ const res = { valid: true, errors: [] };
119
+ if (errorRes.length) {
120
+ res.valid = false;
121
+ res.errors = errorRes;
122
+ }
123
+ resolve(res);
124
+ });
125
+ });
126
+ };
127
+ const onSubmit = () => {
128
+ validate();
129
+ return false;
130
+ };
131
+ return { validate, reset, onSubmit, formErrorTip };
132
+ }
133
+ };
134
+ const { create } = createComponent("form");
135
+ const _sfc_main = create(component);
136
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
137
+ const _component_nut_cell_group = resolveComponent("nut-cell-group");
138
+ return openBlock(), createElementBlock("form", {
139
+ class: "nut-form",
140
+ onSubmit: _cache[0] || (_cache[0] = (...args) => _ctx.onSubmit && _ctx.onSubmit(...args))
141
+ }, [
142
+ createVNode(_component_nut_cell_group, null, {
143
+ default: withCtx(() => [
144
+ renderSlot(_ctx.$slots, "default")
145
+ ]),
146
+ _: 3
147
+ })
148
+ ], 32);
149
+ }
150
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
151
+ export { index as default };
@@ -0,0 +1,110 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { p as pxCheck } from "./pxCheck.js";
7
+ import { inject, computed, resolveComponent, openBlock, createBlock, normalizeClass, withCtx, createElementBlock, normalizeStyle, 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";
10
+ const { componentName, create } = createComponent("form-item");
11
+ const _sfc_main = create({
12
+ inheritAttrs: false,
13
+ 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
+ return [];
26
+ }
27
+ },
28
+ required: {
29
+ type: Boolean,
30
+ default: false
31
+ },
32
+ showErrorMessage: {
33
+ type: Boolean,
34
+ default: true
35
+ },
36
+ showErrorLine: {
37
+ type: Boolean,
38
+ default: true
39
+ },
40
+ labelWidth: {
41
+ type: [String, Number],
42
+ default: ""
43
+ },
44
+ labelAlign: {
45
+ type: String,
46
+ default: "left"
47
+ },
48
+ errorMessageAlign: {
49
+ type: String,
50
+ default: "left"
51
+ },
52
+ bodyAlign: {
53
+ type: String,
54
+ default: "left"
55
+ }
56
+ },
57
+ components: {},
58
+ emits: [""],
59
+ setup(props, { emit }) {
60
+ const parent = inject("formErrorTip");
61
+ const labelStyle = computed(() => {
62
+ return {
63
+ width: pxCheck(props.labelWidth),
64
+ textAlign: props.labelAlign
65
+ };
66
+ });
67
+ const bodyStyle = computed(() => {
68
+ return {
69
+ textAlign: props.bodyAlign
70
+ };
71
+ });
72
+ const errorMessageStyle = computed(() => {
73
+ return {
74
+ textAlign: props.errorMessageAlign
75
+ };
76
+ });
77
+ return { parent, labelStyle, bodyStyle, errorMessageStyle };
78
+ }
79
+ });
80
+ const _hoisted_1 = { class: "nut-cell__value nut-form-item__body" };
81
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
82
+ const _component_nut_cell = resolveComponent("nut-cell");
83
+ return openBlock(), createBlock(_component_nut_cell, {
84
+ class: normalizeClass(["nut-form-item", { error: _ctx.parent[_ctx.prop], line: _ctx.showErrorLine }])
85
+ }, {
86
+ default: withCtx(() => [
87
+ _ctx.label ? (openBlock(), createElementBlock("view", {
88
+ key: 0,
89
+ class: normalizeClass(["nut-cell__title nut-form-item__label", { required: _ctx.required }]),
90
+ style: normalizeStyle(_ctx.labelStyle)
91
+ }, toDisplayString(_ctx.label), 7)) : createCommentVNode("", true),
92
+ createElementVNode("view", _hoisted_1, [
93
+ createElementVNode("view", {
94
+ class: "nut-form-item__body__slots",
95
+ style: normalizeStyle(_ctx.bodyStyle)
96
+ }, [
97
+ renderSlot(_ctx.$slots, "default")
98
+ ], 4),
99
+ _ctx.parent[_ctx.prop] && _ctx.showErrorMessage ? (openBlock(), createElementBlock("view", {
100
+ key: 0,
101
+ class: "nut-form-item__body__tips",
102
+ style: normalizeStyle(_ctx.errorMessageStyle)
103
+ }, toDisplayString(_ctx.parent[_ctx.prop]), 5)) : createCommentVNode("", true)
104
+ ])
105
+ ]),
106
+ _: 3
107
+ }, 8, ["class"]);
108
+ }
109
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
110
+ export { index as default };
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { c as createComponent } from "./component.js";
7
+ import { c as component } from "./common.js";
8
+ import "vue";
9
+ import "./pxCheck.js";
10
+ const { create } = createComponent("grid");
11
+ const _sfc_main = create(component);
12
+ export { _sfc_main as default };
@@ -0,0 +1,149 @@
1
+ /*!
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
+ * (c) 2021 @jdf2e.
4
+ * Released under the MIT License.
5
+ */
6
+ import { inject, getCurrentInstance, onUnmounted, computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, renderSlot, Fragment, createBlock, toDisplayString } from "vue";
7
+ import { useRouter } from "vue-router";
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";
12
+ function useInject(key) {
13
+ const parent = inject(key, null);
14
+ if (parent) {
15
+ const instance = getCurrentInstance();
16
+ const { add, remove, internalChildren } = parent;
17
+ add(instance);
18
+ onUnmounted(() => remove(instance));
19
+ const index2 = computed(() => internalChildren.indexOf(instance));
20
+ return {
21
+ parent,
22
+ index: index2
23
+ };
24
+ }
25
+ return {
26
+ parent: null,
27
+ index: ref(-1)
28
+ };
29
+ }
30
+ const { create, componentName } = createComponent("grid-item");
31
+ const _sfc_main = create({
32
+ props: {
33
+ text: {
34
+ type: String
35
+ },
36
+ icon: {
37
+ type: String
38
+ },
39
+ iconSize: {
40
+ type: [Number, String]
41
+ },
42
+ iconColor: {
43
+ type: String
44
+ },
45
+ to: {
46
+ type: [String, Object]
47
+ },
48
+ url: {
49
+ type: String,
50
+ default: ""
51
+ },
52
+ replace: {
53
+ type: Boolean,
54
+ default: false
55
+ }
56
+ },
57
+ emits: ["click"],
58
+ setup(props, { emit }) {
59
+ const Parent = useInject(GRID_KEY);
60
+ if (!Parent.parent)
61
+ return;
62
+ const index2 = Parent.index;
63
+ const parent = Parent.parent.props;
64
+ const rootClass = computed(() => {
65
+ const prefixCls = componentName;
66
+ return {
67
+ [prefixCls]: true
68
+ };
69
+ });
70
+ const rootStyle = computed(() => {
71
+ const style = {
72
+ flexBasis: `${100 / +parent.columnNum}%`
73
+ };
74
+ if (parent.square) {
75
+ style.paddingTop = `${100 / +parent.columnNum}%`;
76
+ } else if (parent.gutter) {
77
+ style.paddingRight = pxCheck(parent.gutter);
78
+ if (index2.value >= parent.columnNum) {
79
+ style.marginTop = pxCheck(parent.gutter);
80
+ }
81
+ }
82
+ return style;
83
+ });
84
+ const contentClass = computed(() => {
85
+ const prefixCls = `${componentName}__content`;
86
+ return {
87
+ [`${prefixCls}`]: true,
88
+ [`${prefixCls}--border`]: parent.border,
89
+ [`${prefixCls}--surround`]: parent.border && parent.gutter,
90
+ [`${prefixCls}--center`]: parent.center,
91
+ [`${prefixCls}--square`]: parent.square,
92
+ [`${prefixCls}--reverse`]: parent.reverse,
93
+ [`${prefixCls}--${parent.direction}`]: !!parent.direction,
94
+ [`${prefixCls}--clickable`]: parent.clickable || props.to || props.url
95
+ };
96
+ });
97
+ const iconProps = computed(() => {
98
+ return {
99
+ name: props.icon,
100
+ size: props.iconSize || parent.iconSize,
101
+ color: props.iconColor || parent.iconColor
102
+ };
103
+ });
104
+ const router = useRouter();
105
+ const handleClick = (event) => {
106
+ emit("click", event);
107
+ if (props.to && router) {
108
+ router[props.replace ? "replace" : "push"](props.to);
109
+ } else if (props.url) {
110
+ props.replace ? location.replace(props.url) : location.href = props.url;
111
+ }
112
+ };
113
+ return {
114
+ rootClass,
115
+ rootStyle,
116
+ contentClass,
117
+ iconProps,
118
+ handleClick
119
+ };
120
+ }
121
+ });
122
+ const _hoisted_1 = {
123
+ key: 3,
124
+ class: "nut-grid-item__text"
125
+ };
126
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
127
+ const _component_nut_icon = resolveComponent("nut-icon");
128
+ return openBlock(), createElementBlock("view", {
129
+ class: normalizeClass(_ctx.rootClass),
130
+ style: normalizeStyle(_ctx.rootStyle),
131
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
132
+ }, [
133
+ createElementVNode("view", {
134
+ class: normalizeClass(_ctx.contentClass)
135
+ }, [
136
+ _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
137
+ _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 0 }) : (openBlock(), createBlock(_component_nut_icon, {
138
+ key: 1,
139
+ name: _ctx.iconProps.name,
140
+ size: _ctx.iconProps.size,
141
+ color: _ctx.iconProps.color
142
+ }, null, 8, ["name", "size", "color"])),
143
+ _ctx.$slots.text ? renderSlot(_ctx.$slots, "text", { key: 2 }) : (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.text), 1))
144
+ ], 64))
145
+ ], 2)
146
+ ], 6);
147
+ }
148
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
149
+ export { index as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.13 Wed Dec 22 2021 20:42:09 GMT+0800 (GMT+08:00)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */