eoss 0.1.0-alpha.39 → 0.1.0-alpha.40

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 (233) hide show
  1. package/lib/0.js +1 -1
  2. package/lib/1.js +1 -1
  3. package/lib/10.js +1 -1
  4. package/lib/11.js +1 -1
  5. package/lib/12.js +1 -1
  6. package/lib/13.js +1 -1
  7. package/lib/14.js +1 -1
  8. package/lib/15.js +1 -1
  9. package/lib/16.js +1 -1
  10. package/lib/17.js +1 -1
  11. package/lib/18.js +1 -1
  12. package/lib/19.js +1 -1
  13. package/lib/20.js +1 -1
  14. package/lib/21.js +1 -1
  15. package/lib/22.js +1 -1
  16. package/lib/23.js +1 -1
  17. package/lib/24.js +1 -1
  18. package/lib/25.js +1 -1
  19. package/lib/26.js +1 -1
  20. package/lib/27.js +1 -1
  21. package/lib/28.js +1 -1
  22. package/lib/29.js +1 -1
  23. package/lib/3.js +1 -1
  24. package/lib/30.js +1 -1
  25. package/lib/31.js +1 -1
  26. package/lib/32.js +1 -1
  27. package/lib/33.js +1 -1
  28. package/lib/34.js +1 -1
  29. package/lib/35.js +1 -1
  30. package/lib/36.js +1 -1
  31. package/lib/37.js +1 -1
  32. package/lib/38.js +1 -1
  33. package/lib/39.js +1 -1
  34. package/lib/4.js +1 -1
  35. package/lib/40.js +1 -1
  36. package/lib/41.js +1 -1
  37. package/lib/42.js +1 -1
  38. package/lib/43.js +1 -1
  39. package/lib/44.js +1 -1
  40. package/lib/45.js +1 -1
  41. package/lib/46.js +1 -1
  42. package/lib/47.js +1 -1
  43. package/lib/48.js +1 -1
  44. package/lib/49.js +1 -1
  45. package/lib/5.js +1 -1
  46. package/lib/50.js +1 -1
  47. package/lib/51.js +1 -1
  48. package/lib/52.js +1 -1
  49. package/lib/53.js +1 -1
  50. package/lib/54.js +1 -1
  51. package/lib/55.js +1 -1
  52. package/lib/56.js +1 -1
  53. package/lib/57.js +1 -1
  54. package/lib/58.js +1 -1
  55. package/lib/59.js +1 -1
  56. package/lib/6.js +1 -1
  57. package/lib/60.js +1 -1
  58. package/lib/61.js +1 -1
  59. package/lib/62.js +1 -1
  60. package/lib/63.js +1 -1
  61. package/lib/64.js +1 -1
  62. package/lib/65.js +1 -1
  63. package/lib/66.js +1 -1
  64. package/lib/67.js +1 -1
  65. package/lib/68.js +1 -1
  66. package/lib/69.js +1 -1
  67. package/lib/7.js +1 -1
  68. package/lib/70.js +1 -1
  69. package/lib/71.js +1 -1
  70. package/lib/72.js +1 -1
  71. package/lib/73.js +1 -1
  72. package/lib/74.js +1 -1
  73. package/lib/75.js +1 -1
  74. package/lib/76.js +1 -1
  75. package/lib/77.js +1 -1
  76. package/lib/78.js +1 -1
  77. package/lib/79.js +1 -1
  78. package/lib/8.js +1 -1
  79. package/lib/80.js +1 -1
  80. package/lib/81.js +1 -1
  81. package/lib/9.js +1 -1
  82. package/lib/account-login.js +837 -862
  83. package/lib/alert.js +2 -2
  84. package/lib/aside.js +2 -2
  85. package/lib/audit-trajectory.js +4 -4
  86. package/lib/autocomplete.js +1813 -1988
  87. package/lib/avatar.js +2 -2
  88. package/lib/backtop.js +2 -2
  89. package/lib/badge.js +2 -2
  90. package/lib/breadcrumb-item.js +4 -4
  91. package/lib/breadcrumb.js +4 -4
  92. package/lib/button-group.js +4 -4
  93. package/lib/button.js +2 -2
  94. package/lib/ca-login.js +837 -862
  95. package/lib/calendar.js +839 -864
  96. package/lib/card.js +2 -2
  97. package/lib/carousel-item.js +846 -871
  98. package/lib/carousel.js +839 -864
  99. package/lib/cascader-panel.js +852 -877
  100. package/lib/cascader.js +2048 -2223
  101. package/lib/checkbox-button.js +4 -4
  102. package/lib/checkbox-group.js +859 -884
  103. package/lib/checkbox.js +4 -4
  104. package/lib/col.js +2 -2
  105. package/lib/collapse-item.js +1040 -1065
  106. package/lib/collapse.js +1040 -1065
  107. package/lib/color-picker.js +972 -1122
  108. package/lib/container.js +2 -2
  109. package/lib/cron.js +12 -12
  110. package/lib/data-table.js +843 -868
  111. package/lib/date-picker.js +10520 -10695
  112. package/lib/descriptions-item.js +4 -4
  113. package/lib/descriptions.js +4 -4
  114. package/lib/dialog.js +837 -862
  115. package/lib/divider.js +2 -2
  116. package/lib/drawer.js +2 -2
  117. package/lib/dropdown-item.js +4 -4
  118. package/lib/dropdown-menu.js +974 -1124
  119. package/lib/dropdown.js +841 -866
  120. package/lib/email-login.js +837 -862
  121. package/lib/empty.js +2 -2
  122. package/lib/eoss.common.js +4023 -2668
  123. package/lib/flip.js +2 -2
  124. package/lib/flow-group.js +853 -878
  125. package/lib/flow.js +868 -893
  126. package/lib/flows.js +854 -879
  127. package/lib/footer.js +2 -2
  128. package/lib/form-item.js +860 -885
  129. package/lib/form.js +933 -950
  130. package/lib/guide.js +2 -2
  131. package/lib/header.js +2 -2
  132. package/lib/icon.js +837 -862
  133. package/lib/icons.js +2 -2
  134. package/lib/image-viewer.js +837 -862
  135. package/lib/image.js +4 -4
  136. package/lib/index.js +1 -1
  137. package/lib/infinite-scroll.js +2 -2
  138. package/lib/input-number.js +6 -6
  139. package/lib/input.js +839 -864
  140. package/lib/link.js +2 -2
  141. package/lib/loading.js +2 -2
  142. package/lib/login.js +867 -891
  143. package/lib/lowcode-view.js +1843 -1185
  144. package/lib/lowcode.js +3050 -1569
  145. package/lib/main.js +970 -988
  146. package/lib/marquee.js +837 -862
  147. package/lib/menu-item-group.js +15 -15
  148. package/lib/menu-item.js +6 -6
  149. package/lib/menu.js +2227 -2368
  150. package/lib/message-box.js +843 -868
  151. package/lib/message.js +839 -864
  152. package/lib/notification.js +861 -886
  153. package/lib/option-group.js +4 -4
  154. package/lib/option.js +839 -864
  155. package/lib/page-header.js +2 -2
  156. package/lib/pagination.js +839 -864
  157. package/lib/phone-login.js +847 -866
  158. package/lib/popconfirm.js +4 -4
  159. package/lib/popover.js +1831 -2006
  160. package/lib/process-config.js +839 -864
  161. package/lib/process-module.js +846 -871
  162. package/lib/process-rule.js +905 -930
  163. package/lib/progress.js +2 -2
  164. package/lib/qr-code.js +4 -4
  165. package/lib/qrcode-login.js +839 -864
  166. package/lib/radio-button.js +4 -4
  167. package/lib/radio-group.js +850 -875
  168. package/lib/radio.js +4 -4
  169. package/lib/rate.js +837 -862
  170. package/lib/retrial-auth.js +837 -862
  171. package/lib/row.js +2 -2
  172. package/lib/scrollbar.js +839 -864
  173. package/lib/select.js +2139 -2314
  174. package/lib/selector-panel.js +940 -965
  175. package/lib/selector.js +852 -877
  176. package/lib/slider.js +4 -4
  177. package/lib/step.js +32 -32
  178. package/lib/steps.js +874 -899
  179. package/lib/submenu.js +1269 -1385
  180. package/lib/switch.js +839 -864
  181. package/lib/tab-pane.js +4 -4
  182. package/lib/table-column.js +840 -865
  183. package/lib/table.js +1825 -2000
  184. package/lib/tabs.js +846 -871
  185. package/lib/tag.js +2 -2
  186. package/lib/theme-chalk/fonts/iconfont.ttf +0 -0
  187. package/lib/theme-chalk/fonts/iconfont.woff +0 -0
  188. package/lib/theme-chalk/index.css +1 -1
  189. package/lib/theme-chalk/lowcode.css +1 -1
  190. package/lib/time-picker.js +6471 -6646
  191. package/lib/time-select.js +5039 -5214
  192. package/lib/timeline-item.js +2 -2
  193. package/lib/timeline.js +2 -2
  194. package/lib/tips.js +837 -862
  195. package/lib/toolbar.js +4 -4
  196. package/lib/tooltip.js +1813 -1988
  197. package/lib/transfer.js +837 -862
  198. package/lib/tree-group.js +853 -878
  199. package/lib/tree.js +1026 -1051
  200. package/lib/update-history.js +4 -4
  201. package/lib/upload.js +859 -884
  202. package/lib/wujie.js +841 -866
  203. package/package.json +1 -1
  204. package/packages/flow-group/src/main.vue +2 -2
  205. package/packages/form/src/form-item-render.vue +1 -0
  206. package/packages/form/src/form-item.vue +12 -6
  207. package/packages/form/src/form.vue +5 -5
  208. package/packages/login/src/login.vue +1 -0
  209. package/packages/lowcode/src/attribute/function.vue +28 -9
  210. package/packages/lowcode/src/attribute/props.vue +202 -0
  211. package/packages/lowcode/src/attribute/styles.vue +79 -5
  212. package/packages/lowcode/src/attribute.vue +61 -4
  213. package/packages/lowcode/src/canvas.vue +159 -2
  214. package/packages/lowcode/src/form-render.vue +305 -0
  215. package/packages/lowcode/src/lowcode.vue +33 -13
  216. package/packages/lowcode/src/modules.vue +53 -37
  217. package/packages/lowcode/src/render.vue +80 -25
  218. package/packages/lowcode/src/util/components.js +100 -0
  219. package/packages/lowcode/src/util/props-util.js +67 -0
  220. package/packages/lowcode/src/util/source-generator.js +69 -9
  221. package/packages/lowcode/src/util/source-parser.js +64 -10
  222. package/packages/lowcode-view/src/render.vue +48 -18
  223. package/packages/main/src/components/userinfo.vue +0 -1
  224. package/packages/menu/src/menu-item-group.vue +1 -1
  225. package/packages/menu/src/mixins.js +8 -4
  226. package/packages/menu/src/submenu.vue +35 -5
  227. package/packages/phone-login/src/phone-login.vue +5 -2
  228. package/packages/theme-chalk/dist/fonts/iconfont.ttf +0 -0
  229. package/packages/theme-chalk/dist/fonts/iconfont.woff +0 -0
  230. package/packages/theme-chalk/src/fonts/iconfont.ttf +0 -0
  231. package/packages/theme-chalk/src/fonts/iconfont.woff +0 -0
  232. package/packages/theme-chalk/src/lowcode.scss +21 -2
  233. package/src/index.js +336 -336
@@ -82,7 +82,7 @@ module.exports =
82
82
  /******/
83
83
  /******/
84
84
  /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = 190);
85
+ /******/ return __webpack_require__(__webpack_require__.s = 197);
86
86
  /******/ })
87
87
  /************************************************************************/
88
88
  /******/ ({
@@ -4467,6 +4467,13 @@ var getTableData = function getTableData(_ref9) {
4467
4467
 
4468
4468
  /***/ }),
4469
4469
 
4470
+ /***/ 100:
4471
+ /***/ (function(module, exports) {
4472
+
4473
+ module.exports = require("eoss/lib/card");
4474
+
4475
+ /***/ }),
4476
+
4470
4477
  /***/ 12:
4471
4478
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4472
4479
 
@@ -4668,246 +4675,778 @@ var getRgb = function getRgb($color) {
4668
4675
 
4669
4676
  /***/ }),
4670
4677
 
4671
- /***/ 13:
4672
- /***/ (function(module, exports) {
4673
-
4674
- module.exports = require("eoss/lib/button");
4675
-
4676
- /***/ }),
4677
-
4678
- /***/ 16:
4679
- /***/ (function(module, exports) {
4680
-
4681
- module.exports = require("eoss/lib/loading");
4682
-
4683
- /***/ }),
4684
-
4685
- /***/ 17:
4686
- /***/ (function(module, exports) {
4687
-
4688
- module.exports = require("lodash/get");
4689
-
4690
- /***/ }),
4691
-
4692
- /***/ 18:
4693
- /***/ (function(module, exports) {
4694
-
4695
- module.exports = require("lodash/set");
4696
-
4697
- /***/ }),
4698
-
4699
- /***/ 19:
4700
- /***/ (function(module, exports) {
4701
-
4702
- module.exports = require("lodash/cloneDeep");
4703
-
4704
- /***/ }),
4705
-
4706
- /***/ 190:
4678
+ /***/ 128:
4707
4679
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
4708
4680
 
4709
4681
  "use strict";
4710
- // ESM COMPAT FLAG
4711
- __webpack_require__.r(__webpack_exports__);
4712
4682
 
4713
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/view.vue?vue&type=template&id=68107199&
4683
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode/src/form-render.vue?vue&type=template&id=28fc6454&
4714
4684
  var render = function () {
4715
4685
  var _vm = this
4716
4686
  var _h = _vm.$createElement
4717
4687
  var _c = _vm._self._c || _h
4718
4688
  return _c(
4719
- "es-scrollbar",
4720
- { ref: "canvasComponent", staticClass: "es-lowcode-view" },
4689
+ "es-form-item",
4690
+ {
4691
+ staticClass: "es-lowcode__canvas--component",
4692
+ class: { "is-active": _vm.newNode.id === _vm.active },
4693
+ style: _vm.newNode.style,
4694
+ attrs: {
4695
+ "data-id": _vm.newNode.id,
4696
+ label: _vm.formItem.label,
4697
+ prop: _vm.formItem.prop,
4698
+ },
4699
+ nativeOn: {
4700
+ click: function ($event) {
4701
+ $event.stopPropagation()
4702
+ return _vm.handleClick.apply(null, arguments)
4703
+ },
4704
+ },
4705
+ },
4721
4706
  [
4722
- _vm.isCanEdit
4723
- ? _c(
4724
- "div",
4707
+ _c(
4708
+ _vm.newNode.name,
4709
+ _vm._g(
4710
+ _vm._b(
4725
4711
  {
4726
4712
  directives: [
4727
4713
  {
4728
- name: "guide",
4729
- rawName: "v-guide",
4730
- value: _vm.guideConfig,
4731
- expression: "guideConfig",
4714
+ name: "show",
4715
+ rawName: "v-show",
4716
+ value:
4717
+ _vm.newNode.directives["show"] !== undefined
4718
+ ? _vm.newNode.directives["show"]
4719
+ : true,
4720
+ expression:
4721
+ "\n newNode.directives['show'] !== undefined\n ? newNode.directives['show']\n : true\n ",
4732
4722
  },
4733
4723
  ],
4734
- staticClass: "es-lowcode-view__edit-switch",
4735
- class: { "is-edit": _vm.edit },
4724
+ key: _vm.instanceKey,
4725
+ tag: "component",
4726
+ style: _vm.controlStyle,
4736
4727
  },
4737
- [
4738
- !_vm.edit
4739
- ? [
4740
- _c(
4741
- "div",
4742
- {
4743
- staticClass: "es-lowcode-view__edit-switch--trigger",
4744
- on: {
4745
- click: _vm.handleEdit,
4746
- mouseenter: _vm.dismissGuide,
4728
+ "component",
4729
+ _vm.cleanProps,
4730
+ false
4731
+ ),
4732
+ _vm.newNode.events
4733
+ )
4734
+ ),
4735
+ _vm.newNode.id === _vm.active
4736
+ ? [
4737
+ _c(
4738
+ "div",
4739
+ { staticClass: "es-lowcode__handles" },
4740
+ [
4741
+ _vm.isRemove()
4742
+ ? _c("es-button", {
4743
+ attrs: {
4744
+ type: "text",
4745
+ size: "mini",
4746
+ icon: "es-icon-shanchu",
4747
+ },
4748
+ on: {
4749
+ click: function ($event) {
4750
+ $event.stopPropagation()
4751
+ return _vm.handleRemove.apply(null, arguments)
4747
4752
  },
4748
4753
  },
4749
- [
4750
- _c("span", {
4751
- staticClass: "es-lowcode-view__edit-switch--strip",
4752
- }),
4753
- _c(
4754
- "span",
4755
- {
4756
- staticClass:
4757
- "es-lowcode-view__edit-switch--content",
4758
- },
4759
- [
4760
- _c("es-button", {
4761
- attrs: {
4762
- type: "primary",
4763
- icon: "es-icon-tuodong",
4764
- circle: "",
4765
- size: "medium",
4766
- },
4767
- }),
4768
- _c(
4769
- "span",
4770
- {
4771
- staticClass:
4772
- "es-lowcode-view__edit-switch--label",
4773
- },
4774
- [_vm._v("编辑布局")]
4775
- ),
4776
- ],
4777
- 1
4778
- ),
4779
- ]
4780
- ),
4781
- ]
4782
- : [
4783
- _c(
4784
- "div",
4785
- {
4786
- staticClass: "es-lowcode-view__edit-switch--btn",
4787
- on: { click: _vm.handleCancel },
4754
+ })
4755
+ : _vm._e(),
4756
+ ],
4757
+ 1
4758
+ ),
4759
+ _vm.canResizeWidth
4760
+ ? [
4761
+ _c(
4762
+ "div",
4763
+ {
4764
+ staticClass:
4765
+ "es-lowcode__resize-handle is-left es-icon-stretch",
4766
+ on: {
4767
+ pointerdown: function ($event) {
4768
+ return _vm.handleResizeStart($event, "left")
4769
+ },
4770
+ dragstart: function ($event) {
4771
+ return $event.preventDefault()
4772
+ },
4788
4773
  },
4789
- [
4790
- _c("es-button", {
4791
- attrs: {
4792
- type: "default",
4793
- icon: "es-icon-circle-guanbi",
4794
- circle: "",
4795
- size: "medium",
4796
- },
4797
- }),
4798
- _c(
4799
- "span",
4800
- {
4801
- staticClass: "es-lowcode-view__edit-switch--label",
4802
- },
4803
- [_vm._v("取消")]
4804
- ),
4805
- ],
4806
- 1
4807
- ),
4808
- _c(
4809
- "div",
4810
- {
4811
- staticClass:
4812
- "es-lowcode-view__edit-switch--btn is-confirm",
4813
- on: { click: _vm.handleConfirm },
4774
+ },
4775
+ [
4776
+ _c(
4777
+ "span",
4778
+ {
4779
+ directives: [
4780
+ {
4781
+ name: "show",
4782
+ rawName: "v-show",
4783
+ value: _vm.direction === "left",
4784
+ expression: "direction === 'left'",
4785
+ },
4786
+ ],
4787
+ staticClass: "es-lowcode__resize-size",
4788
+ },
4789
+ [_vm._v(_vm._s(_vm.width))]
4790
+ ),
4791
+ ]
4792
+ ),
4793
+ _c(
4794
+ "div",
4795
+ {
4796
+ staticClass:
4797
+ "es-lowcode__resize-handle is-right es-icon-stretch",
4798
+ on: {
4799
+ pointerdown: function ($event) {
4800
+ return _vm.handleResizeStart($event, "right")
4801
+ },
4802
+ dragstart: function ($event) {
4803
+ return $event.preventDefault()
4804
+ },
4814
4805
  },
4815
- [
4816
- _c("es-button", {
4817
- attrs: {
4818
- type: "primary",
4819
- icon: "es-icon-gou",
4820
- circle: "",
4821
- size: "medium",
4822
- },
4823
- }),
4824
- _c(
4825
- "span",
4826
- {
4827
- staticClass: "es-lowcode-view__edit-switch--label",
4828
- },
4829
- [_vm._v("完成")]
4830
- ),
4831
- ],
4832
- 1
4833
- ),
4834
- ],
4835
- ],
4836
- 2
4837
- )
4838
- : _vm._e(),
4839
- _c(
4840
- "div",
4841
- {
4842
- ref: "waterfallContainer",
4843
- staticClass: "es-lowcode-view__waterfall",
4844
- style: _vm.containerStyle,
4845
- },
4846
- [
4847
- _vm._l(_vm.pages, function (item) {
4848
- return _c("render", {
4849
- key: item.id,
4850
- class: { "es-lowcode-view__waterfall-item": _vm.edit },
4851
- attrs: {
4852
- node: item,
4853
- drag: _vm.edit,
4854
- "display-mode": _vm.pageStyle.display || "masonry",
4855
- },
4856
- on: { change: _vm.handleResize, remove: _vm.handleRemove },
4857
- })
4858
- }),
4859
- _vm.edit
4860
- ? _c(
4861
- "div",
4862
- {
4863
- staticClass: "es-lowcode-view__waterfall-add",
4864
- style:
4865
- _vm.pageStyle.display === "masonry" ? _vm.addStyle : {},
4866
- on: {
4867
- click: function ($event) {
4868
- _vm.visible = true
4869
4806
  },
4870
- },
4871
- },
4872
- [
4873
- _c("es-icon", {
4874
- attrs: { contents: "es-icon-jia", size: "24" },
4875
- }),
4876
- _c("span", [_vm._v("添加模块")]),
4877
- ],
4878
- 1
4879
- )
4880
- : _vm._e(),
4881
- ],
4882
- 2
4883
- ),
4884
- _c(
4885
- "es-dialog",
4886
- {
4887
- attrs: { visible: _vm.visible, title: "添加模块", size: "max" },
4888
- on: {
4889
- "update:visible": function ($event) {
4890
- _vm.visible = $event
4891
- },
4892
- close: _vm.handleClose,
4893
- },
4894
- },
4895
- [
4896
- _vm.visible
4897
- ? _c("modules", {
4898
- attrs: {
4899
- modules: _vm.pagesMap,
4900
- filters: _vm.pages,
4901
- url: _vm.listsUrl,
4902
- styles: _vm.containerStyle,
4903
- pageStyle: _vm.pageStyle,
4904
- },
4905
- on: { add: _vm.handleAdd },
4906
- })
4907
- : _vm._e(),
4908
- ],
4909
- 1
4910
- ),
4807
+ [
4808
+ _c(
4809
+ "span",
4810
+ {
4811
+ directives: [
4812
+ {
4813
+ name: "show",
4814
+ rawName: "v-show",
4815
+ value: _vm.direction === "right",
4816
+ expression: "direction === 'right'",
4817
+ },
4818
+ ],
4819
+ staticClass: "es-lowcode__resize-size",
4820
+ },
4821
+ [_vm._v(_vm._s(_vm.width))]
4822
+ ),
4823
+ ]
4824
+ ),
4825
+ ]
4826
+ : _vm._e(),
4827
+ ]
4828
+ : _vm._e(),
4829
+ ],
4830
+ 2
4831
+ )
4832
+ }
4833
+ var staticRenderFns = []
4834
+ render._withStripped = true
4835
+
4836
+
4837
+ // CONCATENATED MODULE: ./packages/lowcode/src/form-render.vue?vue&type=template&id=28fc6454&
4838
+
4839
+ // EXTERNAL MODULE: external "eoss/lib/button"
4840
+ var button_ = __webpack_require__(13);
4841
+ var button_default = /*#__PURE__*/__webpack_require__.n(button_);
4842
+
4843
+ // EXTERNAL MODULE: ./src/utils/bus.js
4844
+ var bus = __webpack_require__(47);
4845
+
4846
+ // EXTERNAL MODULE: ./packages/lowcode/src/util/props-util.js
4847
+ var props_util = __webpack_require__(83);
4848
+
4849
+ // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode/src/form-render.vue?vue&type=script&lang=js&
4850
+ var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
4851
+
4852
+ //
4853
+ //
4854
+ //
4855
+ //
4856
+ //
4857
+ //
4858
+ //
4859
+ //
4860
+ //
4861
+ //
4862
+ //
4863
+ //
4864
+ //
4865
+ //
4866
+ //
4867
+ //
4868
+ //
4869
+ //
4870
+ //
4871
+ //
4872
+ //
4873
+ //
4874
+ //
4875
+ //
4876
+ //
4877
+ //
4878
+ //
4879
+ //
4880
+ //
4881
+ //
4882
+ //
4883
+ //
4884
+ //
4885
+ //
4886
+ //
4887
+ //
4888
+ //
4889
+ //
4890
+ //
4891
+ //
4892
+ //
4893
+ //
4894
+ //
4895
+ //
4896
+ //
4897
+ //
4898
+ //
4899
+ //
4900
+ //
4901
+ //
4902
+ //
4903
+ //
4904
+ //
4905
+ //
4906
+ //
4907
+ //
4908
+ //
4909
+ //
4910
+ //
4911
+ //
4912
+ //
4913
+ //
4914
+
4915
+
4916
+
4917
+
4918
+
4919
+ /* harmony default export */ var form_rendervue_type_script_lang_js_ = ({
4920
+ name: 'FormRender',
4921
+ // lowcode.vue provide 了自身实例,notRemoves(禁止删除名单)从其读取
4922
+ inject: {
4923
+ lowcode: {
4924
+ default: null
4925
+ }
4926
+ },
4927
+ components: {
4928
+ EsButton: button_default.a
4929
+ },
4930
+ props: {
4931
+ node: {
4932
+ type: Object,
4933
+ default: null
4934
+ },
4935
+ page: {
4936
+ type: Object,
4937
+ default: null
4938
+ },
4939
+ active: {
4940
+ type: String,
4941
+ default: ''
4942
+ },
4943
+ // 声明仅为吸收父级统一绑定的 :drag(手柄显隐由 active 控制,预览端无 active 自然不显示)
4944
+ drag: {
4945
+ type: Boolean,
4946
+ default: true
4947
+ }
4948
+ },
4949
+ data: function data() {
4950
+ var newNode = JSON.parse(JSON.stringify(this.node)) || {};
4951
+ // directives 在页面结构上已定义,这里兼容子节点未携带的情况
4952
+ newNode.directives = newNode.directives || {};
4953
+ newNode.style = newNode.style || {};
4954
+ return {
4955
+ newNode: newNode,
4956
+ resizingComponent: null,
4957
+ initialMouseX: 0,
4958
+ initialWidth: 0,
4959
+ isResizing: false,
4960
+ direction: ''
4961
+ };
4962
+ },
4963
+
4964
+ watch: {
4965
+ node: {
4966
+ handler: function handler(newVal) {
4967
+ var node = JSON.parse(JSON.stringify(newVal)) || {};
4968
+ node.directives = node.directives || {};
4969
+ node.style = node.style || {};
4970
+ this.newNode = node;
4971
+ },
4972
+
4973
+ deep: true
4974
+ }
4975
+ },
4976
+ computed: {
4977
+ /**
4978
+ * 表单元信息(label/字段键):canvas 拖入时写入 node.formItem,
4979
+ * 解析源码时由 es-form-item 包裹层拆包还原
4980
+ */
4981
+ formItem: function formItem() {
4982
+ return this.newNode && this.newNode.formItem || {};
4983
+ },
4984
+
4985
+ /**
4986
+ * 所属 es-form 节点:在页面树中反查包含当前字段的父节点
4987
+ */
4988
+ parentForm: function parentForm() {
4989
+ var _this = this;
4990
+
4991
+ var find = function find(nodes) {
4992
+ if (!nodes) return null;
4993
+ for (var _iterator = nodes, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
4994
+ var _ref;
4995
+
4996
+ if (_isArray) {
4997
+ if (_i >= _iterator.length) break;
4998
+ _ref = _iterator[_i++];
4999
+ } else {
5000
+ _i = _iterator.next();
5001
+ if (_i.done) break;
5002
+ _ref = _i.value;
5003
+ }
5004
+
5005
+ var node = _ref;
5006
+
5007
+ var children = node.children || [];
5008
+ if (children.some(function (c) {
5009
+ return c.id === _this.newNode.id;
5010
+ })) return node;
5011
+ var found = find(children);
5012
+ if (found) return found;
5013
+ }
5014
+ return null;
5015
+ };
5016
+ return this.page ? find([this.page]) : null;
5017
+ },
5018
+
5019
+ /**
5020
+ * 是否允许宽度拖拽:单列(columns 缺省或 <=1)表单不显示宽度手柄,
5021
+ * 多列时字段可拖宽占多列
5022
+ */
5023
+ canResizeWidth: function canResizeWidth() {
5024
+ var columns = Object(props_util["a" /* getPropRaw */])(this.parentForm && this.parentForm.props, 'columns');
5025
+ return (parseInt(columns, 10) || 1) > 1;
5026
+ },
5027
+
5028
+ /**
5029
+ * 手柄旁 span 展示的宽度:拖拽写入 style.width 后自动跟随,
5030
+ * 无显式宽度(columns 列宽百分比布局)时从 DOM 取实际宽度
5031
+ */
5032
+ width: function width() {
5033
+ var w = parseInt(this.newNode.style && this.newNode.style.width, 10);
5034
+ if (!isNaN(w)) return w;
5035
+ return this.$el && this.$el.offsetWidth || 0;
5036
+ },
5037
+
5038
+ /**
5039
+ * 控件样式:表单字段默认撑满 form-item 内容区(宽度由 es-form-item 根的 style.width 控制)
5040
+ */
5041
+ controlStyle: function controlStyle() {
5042
+ var style = _extends({}, this.newNode && this.newNode.style || {});
5043
+ delete style.width;
5044
+ delete style.height;
5045
+ return _extends({ width: '100%' }, style);
5046
+ },
5047
+
5048
+ /**
5049
+ * 页面 data 变量:供 props 中 {{var}} 引用解析
5050
+ */
5051
+ pageData: function pageData() {
5052
+ return this.page && this.page.data || {};
5053
+ },
5054
+
5055
+ /**
5056
+ * 过滤掉 Vue 指令(v-xxx)的 props,避免它们作为普通属性传递给组件
5057
+ */
5058
+ cleanProps: function cleanProps() {
5059
+ if (!this.newNode) return {};
5060
+ var result = {};
5061
+ // 合并 HTML 属性
5062
+ if (this.newNode.attrs) {
5063
+ Object.assign(result, this.newNode.attrs);
5064
+ }
5065
+ // 合并组件 props:定义数组经 propsToObject 转取值对象(含 {{var}} 解析)
5066
+ Object.assign(result, Object(props_util["b" /* propsToObject */])(this.newNode.props, this.pageData));
5067
+ return result;
5068
+ },
5069
+
5070
+ /**
5071
+ * 组件实例 key:节点 id + props 签名。
5072
+ * 业务组件在 created 里按 props 拉数据、不 watch prop 变化,
5073
+ * 源码视图改完 props 后必须换 key 强制重挂载,画布才会刷新
5074
+ */
5075
+ instanceKey: function instanceKey() {
5076
+ var sig = '';
5077
+ try {
5078
+ sig = JSON.stringify(this.cleanProps);
5079
+ } catch (e) {
5080
+ sig = '';
5081
+ }
5082
+ return (this.newNode ? this.newNode.id : '') + ':' + sig;
5083
+ }
5084
+ },
5085
+ methods: {
5086
+ /**
5087
+ * 是否展示删除按钮:节点 canRemove 未显式禁止,
5088
+ * 且 id 不在 lowcode 的 notRemoves(禁止删除名单)中
5089
+ */
5090
+ isRemove: function isRemove() {
5091
+ if (this.newNode.canRemove === false) return false;
5092
+ var notRemoves = this.lowcode && this.lowcode.notRemoves || [];
5093
+ return !notRemoves.includes(this.newNode.id);
5094
+ },
5095
+
5096
+ /**
5097
+ * 处理字段点击事件(选中);拖拽中不响应,避免误选
5098
+ */
5099
+ handleClick: function handleClick(event) {
5100
+ if (this.isResizing) {
5101
+ return;
5102
+ }
5103
+ this.$emit('click', this.newNode, event);
5104
+ },
5105
+
5106
+ /**
5107
+ * 宽度拖拽开始(仅 left/right,字段不提供高度拖拽)
5108
+ * @param event 指针事件对象
5109
+ * @param direction 拖拽方向 left/right
5110
+ */
5111
+ handleResizeStart: function handleResizeStart(event, direction) {
5112
+ event.preventDefault();
5113
+ event.stopPropagation(); // 阻止事件冒泡,防止触发字段选中
5114
+ this.direction = direction;
5115
+ // 只响应鼠标左键或触摸
5116
+ if (event.pointerType === 'mouse' && event.button !== 0) return;
5117
+ this.resizingComponent = _extends({}, this.newNode, { direction: direction });
5118
+ this.initialMouseX = event.clientX;
5119
+ this.initialWidth = this.width || 0;
5120
+ document.addEventListener('pointermove', this.handleResizeMove);
5121
+ document.addEventListener('pointerup', this.handleResizeEnd);
5122
+ },
5123
+
5124
+ /**
5125
+ * 宽度拖拽移动:实时写入 style.width(作用于 es-form-item 根),
5126
+ * 上限钉到所属表单内容区宽度,下限保 40px 防止拖没
5127
+ * @param event 指针事件对象
5128
+ */
5129
+ handleResizeMove: function handleResizeMove(event) {
5130
+ event.preventDefault();
5131
+ event.stopPropagation();
5132
+ this.isResizing = true;
5133
+ if (!this.resizingComponent) return;
5134
+ var deltaX = event.clientX - this.initialMouseX;
5135
+ var newWidth = this.direction === 'right' ? this.initialWidth + deltaX : this.initialWidth - deltaX;
5136
+ var formContent = this.$el && this.$el.parentElement ? this.$el.parentElement : null;
5137
+ var maxWidth = formContent ? formContent.clientWidth : 0;
5138
+ newWidth = Math.max(40, newWidth);
5139
+ if (maxWidth > 0) {
5140
+ newWidth = Math.min(newWidth, maxWidth);
5141
+ }
5142
+ this.$set(this.newNode.style, 'width', newWidth + 'px');
5143
+ },
5144
+
5145
+ /**
5146
+ * 宽度拖拽结束:经 bus updateNode 持久化到页面 JSON(lowcode.vue 按 id
5147
+ * 写回页面树并存档历史),嵌套字段不走 canvas 顶层 index 式 handleChange
5148
+ * @param event 指针事件对象
5149
+ */
5150
+ handleResizeEnd: function handleResizeEnd(event) {
5151
+ var _this2 = this;
5152
+
5153
+ event.preventDefault();
5154
+ event.stopPropagation();
5155
+ bus["a" /* default */].$emit('updateNode', this.newNode);
5156
+ this.resizingComponent = null;
5157
+ document.removeEventListener('pointermove', this.handleResizeMove);
5158
+ document.removeEventListener('pointerup', this.handleResizeEnd);
5159
+ // 释放鼠标时浏览器会在指针位置派发 click,若此时鼠标不在被拖元素上,
5160
+ // 会误选中底下的其它元素;在捕获阶段吞掉紧随其后的这一次 click
5161
+ var swallowClick = function swallowClick(e) {
5162
+ e.stopPropagation();
5163
+ e.preventDefault();
5164
+ document.removeEventListener('click', swallowClick, true);
5165
+ };
5166
+ document.addEventListener('click', swallowClick, true);
5167
+ // 延迟重置调整状态,避免触发点击事件
5168
+ setTimeout(function () {
5169
+ _this2.isResizing = false;
5170
+ document.removeEventListener('click', swallowClick, true);
5171
+ }, 200);
5172
+ },
5173
+
5174
+ /**
5175
+ * 处理字段删除事件
5176
+ */
5177
+ handleRemove: function handleRemove() {
5178
+ this.$emit('remove', this.newNode);
5179
+ }
5180
+ }
5181
+ });
5182
+ // CONCATENATED MODULE: ./packages/lowcode/src/form-render.vue?vue&type=script&lang=js&
5183
+ /* harmony default export */ var src_form_rendervue_type_script_lang_js_ = (form_rendervue_type_script_lang_js_);
5184
+ // EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
5185
+ var componentNormalizer = __webpack_require__(4);
5186
+
5187
+ // CONCATENATED MODULE: ./packages/lowcode/src/form-render.vue
5188
+
5189
+
5190
+
5191
+
5192
+
5193
+ /* normalize component */
5194
+
5195
+ var component = Object(componentNormalizer["a" /* default */])(
5196
+ src_form_rendervue_type_script_lang_js_,
5197
+ render,
5198
+ staticRenderFns,
5199
+ false,
5200
+ null,
5201
+ null,
5202
+ null
5203
+
5204
+ )
5205
+
5206
+ /* harmony default export */ var form_render = __webpack_exports__["a"] = (component.exports);
5207
+
5208
+ /***/ }),
5209
+
5210
+ /***/ 13:
5211
+ /***/ (function(module, exports) {
5212
+
5213
+ module.exports = require("eoss/lib/button");
5214
+
5215
+ /***/ }),
5216
+
5217
+ /***/ 16:
5218
+ /***/ (function(module, exports) {
5219
+
5220
+ module.exports = require("eoss/lib/loading");
5221
+
5222
+ /***/ }),
5223
+
5224
+ /***/ 17:
5225
+ /***/ (function(module, exports) {
5226
+
5227
+ module.exports = require("lodash/get");
5228
+
5229
+ /***/ }),
5230
+
5231
+ /***/ 18:
5232
+ /***/ (function(module, exports) {
5233
+
5234
+ module.exports = require("lodash/set");
5235
+
5236
+ /***/ }),
5237
+
5238
+ /***/ 19:
5239
+ /***/ (function(module, exports) {
5240
+
5241
+ module.exports = require("lodash/cloneDeep");
5242
+
5243
+ /***/ }),
5244
+
5245
+ /***/ 197:
5246
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
5247
+
5248
+ "use strict";
5249
+ // ESM COMPAT FLAG
5250
+ __webpack_require__.r(__webpack_exports__);
5251
+
5252
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/view.vue?vue&type=template&id=68107199&
5253
+ var render = function () {
5254
+ var _vm = this
5255
+ var _h = _vm.$createElement
5256
+ var _c = _vm._self._c || _h
5257
+ return _c(
5258
+ "es-scrollbar",
5259
+ { ref: "canvasComponent", staticClass: "es-lowcode-view" },
5260
+ [
5261
+ _vm.isCanEdit
5262
+ ? _c(
5263
+ "div",
5264
+ {
5265
+ directives: [
5266
+ {
5267
+ name: "guide",
5268
+ rawName: "v-guide",
5269
+ value: _vm.guideConfig,
5270
+ expression: "guideConfig",
5271
+ },
5272
+ ],
5273
+ staticClass: "es-lowcode-view__edit-switch",
5274
+ class: { "is-edit": _vm.edit },
5275
+ },
5276
+ [
5277
+ !_vm.edit
5278
+ ? [
5279
+ _c(
5280
+ "div",
5281
+ {
5282
+ staticClass: "es-lowcode-view__edit-switch--trigger",
5283
+ on: {
5284
+ click: _vm.handleEdit,
5285
+ mouseenter: _vm.dismissGuide,
5286
+ },
5287
+ },
5288
+ [
5289
+ _c("span", {
5290
+ staticClass: "es-lowcode-view__edit-switch--strip",
5291
+ }),
5292
+ _c(
5293
+ "span",
5294
+ {
5295
+ staticClass:
5296
+ "es-lowcode-view__edit-switch--content",
5297
+ },
5298
+ [
5299
+ _c("es-button", {
5300
+ attrs: {
5301
+ type: "primary",
5302
+ icon: "es-icon-tuodong",
5303
+ circle: "",
5304
+ size: "medium",
5305
+ },
5306
+ }),
5307
+ _c(
5308
+ "span",
5309
+ {
5310
+ staticClass:
5311
+ "es-lowcode-view__edit-switch--label",
5312
+ },
5313
+ [_vm._v("编辑布局")]
5314
+ ),
5315
+ ],
5316
+ 1
5317
+ ),
5318
+ ]
5319
+ ),
5320
+ ]
5321
+ : [
5322
+ _c(
5323
+ "div",
5324
+ {
5325
+ staticClass: "es-lowcode-view__edit-switch--btn",
5326
+ on: { click: _vm.handleCancel },
5327
+ },
5328
+ [
5329
+ _c("es-button", {
5330
+ attrs: {
5331
+ type: "default",
5332
+ icon: "es-icon-circle-guanbi",
5333
+ circle: "",
5334
+ size: "medium",
5335
+ },
5336
+ }),
5337
+ _c(
5338
+ "span",
5339
+ {
5340
+ staticClass: "es-lowcode-view__edit-switch--label",
5341
+ },
5342
+ [_vm._v("取消")]
5343
+ ),
5344
+ ],
5345
+ 1
5346
+ ),
5347
+ _c(
5348
+ "div",
5349
+ {
5350
+ staticClass:
5351
+ "es-lowcode-view__edit-switch--btn is-confirm",
5352
+ on: { click: _vm.handleConfirm },
5353
+ },
5354
+ [
5355
+ _c("es-button", {
5356
+ attrs: {
5357
+ type: "primary",
5358
+ icon: "es-icon-gou",
5359
+ circle: "",
5360
+ size: "medium",
5361
+ },
5362
+ }),
5363
+ _c(
5364
+ "span",
5365
+ {
5366
+ staticClass: "es-lowcode-view__edit-switch--label",
5367
+ },
5368
+ [_vm._v("完成")]
5369
+ ),
5370
+ ],
5371
+ 1
5372
+ ),
5373
+ ],
5374
+ ],
5375
+ 2
5376
+ )
5377
+ : _vm._e(),
5378
+ _c(
5379
+ "div",
5380
+ {
5381
+ ref: "waterfallContainer",
5382
+ staticClass: "es-lowcode-view__waterfall",
5383
+ style: _vm.containerStyle,
5384
+ },
5385
+ [
5386
+ _vm._l(_vm.pages, function (item) {
5387
+ return _c("render", {
5388
+ key: item.id,
5389
+ class: { "es-lowcode-view__waterfall-item": _vm.edit },
5390
+ attrs: {
5391
+ node: item,
5392
+ drag: _vm.edit,
5393
+ "display-mode": _vm.pageStyle.display || "masonry",
5394
+ },
5395
+ on: { change: _vm.handleResize, remove: _vm.handleRemove },
5396
+ })
5397
+ }),
5398
+ _vm.edit
5399
+ ? _c(
5400
+ "div",
5401
+ {
5402
+ staticClass: "es-lowcode-view__waterfall-add",
5403
+ style:
5404
+ _vm.pageStyle.display === "masonry" ? _vm.addStyle : {},
5405
+ on: {
5406
+ click: function ($event) {
5407
+ _vm.visible = true
5408
+ },
5409
+ },
5410
+ },
5411
+ [
5412
+ _c("es-icon", {
5413
+ attrs: { contents: "es-icon-jia", size: "24" },
5414
+ }),
5415
+ _c("span", [_vm._v("添加模块")]),
5416
+ ],
5417
+ 1
5418
+ )
5419
+ : _vm._e(),
5420
+ ],
5421
+ 2
5422
+ ),
5423
+ _c(
5424
+ "es-dialog",
5425
+ {
5426
+ attrs: { visible: _vm.visible, title: "添加模块", size: "max" },
5427
+ on: {
5428
+ "update:visible": function ($event) {
5429
+ _vm.visible = $event
5430
+ },
5431
+ close: _vm.handleClose,
5432
+ },
5433
+ },
5434
+ [
5435
+ _vm.visible
5436
+ ? _c("modules", {
5437
+ attrs: {
5438
+ modules: _vm.pagesMap,
5439
+ filters: _vm.pages,
5440
+ url: _vm.listsUrl,
5441
+ styles: _vm.containerStyle,
5442
+ pageStyle: _vm.pageStyle,
5443
+ },
5444
+ on: { add: _vm.handleAdd },
5445
+ })
5446
+ : _vm._e(),
5447
+ ],
5448
+ 1
5449
+ ),
4911
5450
  ],
4912
5451
  1
4913
5452
  )
@@ -4919,11 +5458,11 @@ render._withStripped = true
4919
5458
  // CONCATENATED MODULE: ./packages/lowcode-view/src/view.vue?vue&type=template&id=68107199&
4920
5459
 
4921
5460
  // EXTERNAL MODULE: external "sortablejs"
4922
- var external_sortablejs_ = __webpack_require__(56);
5461
+ var external_sortablejs_ = __webpack_require__(55);
4923
5462
  var external_sortablejs_default = /*#__PURE__*/__webpack_require__.n(external_sortablejs_);
4924
5463
 
4925
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/render.vue?vue&type=template&id=45a220b2&
4926
- var rendervue_type_template_id_45a220b2_render = function () {
5464
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/render.vue?vue&type=template&id=6ff9a775&
5465
+ var rendervue_type_template_id_6ff9a775_render = function () {
4927
5466
  var _vm = this
4928
5467
  var _h = _vm.$createElement
4929
5468
  var _c = _vm._self._c || _h
@@ -4968,14 +5507,16 @@ var rendervue_type_template_id_45a220b2_render = function () {
4968
5507
  _vm.newNode.events
4969
5508
  ),
4970
5509
  [
4971
- _vm.newNode.children && _vm.newNode.children.length > 0
4972
- ? _vm._l(_vm.newNode.children, function (child, index) {
4973
- return _c("Render", {
4974
- key: child.id,
4975
- attrs: { node: child, page: _vm.page, drag: false },
4976
- })
4977
- })
4978
- : [_vm._v(_vm._s(_vm.resolvedText || _vm.newNode.description))],
5510
+ _vm._l(_vm.newNode.children, function (child) {
5511
+ return _c(_vm.childRender(child), {
5512
+ key: child.id,
5513
+ tag: "component",
5514
+ attrs: { node: child, page: _vm.page, drag: false },
5515
+ })
5516
+ }),
5517
+ _vm._l(_vm.slotTexts, function (t) {
5518
+ return [_vm._v(_vm._s(t))]
5519
+ }),
4979
5520
  ],
4980
5521
  2
4981
5522
  ),
@@ -5129,11 +5670,11 @@ var rendervue_type_template_id_45a220b2_render = function () {
5129
5670
  2
5130
5671
  )
5131
5672
  }
5132
- var rendervue_type_template_id_45a220b2_staticRenderFns = []
5133
- rendervue_type_template_id_45a220b2_render._withStripped = true
5673
+ var rendervue_type_template_id_6ff9a775_staticRenderFns = []
5674
+ rendervue_type_template_id_6ff9a775_render._withStripped = true
5134
5675
 
5135
5676
 
5136
- // CONCATENATED MODULE: ./packages/lowcode-view/src/render.vue?vue&type=template&id=45a220b2&
5677
+ // CONCATENATED MODULE: ./packages/lowcode-view/src/render.vue?vue&type=template&id=6ff9a775&
5137
5678
 
5138
5679
  // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/Iframe.vue?vue&type=template&id=3a1f5bf7&
5139
5680
  var Iframevue_type_template_id_3a1f5bf7_render = function () {
@@ -5187,7 +5728,7 @@ Iframevue_type_template_id_3a1f5bf7_render._withStripped = true
5187
5728
  // CONCATENATED MODULE: ./packages/lowcode-view/src/Iframe.vue?vue&type=template&id=3a1f5bf7&
5188
5729
 
5189
5730
  // EXTERNAL MODULE: external "eoss/lib/card"
5190
- var card_ = __webpack_require__(98);
5731
+ var card_ = __webpack_require__(100);
5191
5732
  var card_default = /*#__PURE__*/__webpack_require__.n(card_);
5192
5733
 
5193
5734
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/Iframe.vue?vue&type=script&lang=js&
@@ -5273,6 +5814,12 @@ var component = Object(componentNormalizer["a" /* default */])(
5273
5814
  )
5274
5815
 
5275
5816
  /* harmony default export */ var Iframe = (component.exports);
5817
+ // EXTERNAL MODULE: ./packages/lowcode/src/util/props-util.js
5818
+ var props_util = __webpack_require__(83);
5819
+
5820
+ // EXTERNAL MODULE: ./packages/lowcode/src/form-render.vue + 4 modules
5821
+ var form_render = __webpack_require__(128);
5822
+
5276
5823
  // EXTERNAL MODULE: external "eoss/lib/button"
5277
5824
  var button_ = __webpack_require__(13);
5278
5825
  var button_default = /*#__PURE__*/__webpack_require__.n(button_);
@@ -5362,12 +5909,18 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
5362
5909
  //
5363
5910
  //
5364
5911
  //
5912
+ //
5913
+ //
5914
+ //
5915
+
5916
+
5917
+
5365
5918
 
5366
5919
 
5367
5920
 
5368
5921
  /* harmony default export */ var rendervue_type_script_lang_js_ = ({
5369
5922
  name: 'Render',
5370
- components: { Frame: Iframe, EsButton: button_default.a },
5923
+ components: { Frame: Iframe, FormRender: form_render["a" /* default */], EsButton: button_default.a },
5371
5924
  props: {
5372
5925
  node: {
5373
5926
  type: Object,
@@ -5481,33 +6034,57 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
5481
6034
  return textExpr;
5482
6035
  },
5483
6036
 
6037
+ /**
6038
+ * 页面 data 变量:供 props 中 {{var}} 引用解析
6039
+ */
6040
+ pageData: function pageData() {
6041
+ return this.page && this.page.data || {};
6042
+ },
6043
+
5484
6044
  /**
5485
6045
  * 过滤掉 Vue 指令(v-xxx)的 props,避免它们作为普通属性传递给组件
5486
6046
  * 指令统一存在 directives 字段,这里仅兼容历史数据中混入 props 的 v- 键
5487
6047
  */
5488
6048
  cleanProps: function cleanProps() {
5489
- var _this = this;
5490
-
5491
6049
  if (!this.newNode) return {};
5492
6050
  var result = {};
5493
6051
  // 合并 HTML 属性
5494
6052
  if (this.newNode.attrs) {
5495
6053
  Object.assign(result, this.newNode.attrs);
5496
6054
  }
5497
- // 合并组件 props(跳过 Vue 指令)
5498
- if (this.newNode.props) {
5499
- Object.keys(this.newNode.props).forEach(function (key) {
5500
- if (key.startsWith('v-')) return;
5501
- result[key] = _this.newNode.props[key];
5502
- });
5503
- }
6055
+ // 合并组件 props:定义数组经 propsToObject 转取值对象(含 {{var}} 解析)
6056
+ Object.assign(result, Object(props_util["b" /* propsToObject */])(this.newNode.props, this.pageData));
5504
6057
  return result;
6058
+ },
6059
+
6060
+ /**
6061
+ * 插槽文本:仅当无 children 时产出,
6062
+ * 保证 EsForm 等组件在无字段时默认插槽为空、fallback 生效
6063
+ */
6064
+ slotTexts: function slotTexts() {
6065
+ var node = this.newNode;
6066
+ if (!node) {
6067
+ return [];
6068
+ }
6069
+ var hasChildren = Array.isArray(node.children) && node.children.length > 0;
6070
+ if (hasChildren) {
6071
+ return [];
6072
+ }
6073
+ return [this.resolvedText || node.description || ''];
5505
6074
  }
5506
6075
  },
5507
6076
  mounted: function mounted() {},
5508
6077
  beforeDestroy: function beforeDestroy() {},
5509
6078
 
5510
6079
  methods: {
6080
+ /**
6081
+ * 子节点渲染器:表单控件子节点(带 formItem 标记)由 form-render 渲染,
6082
+ * 其余走通用 Render(与编辑器 render.vue 同一判定)
6083
+ */
6084
+ childRender: function childRender(child) {
6085
+ return child && child.formItem ? 'FormRender' : 'Render';
6086
+ },
6087
+
5511
6088
  /**
5512
6089
  * 处理组件大小调整开始事件
5513
6090
  * @param event 指针事件对象
@@ -5619,7 +6196,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
5619
6196
  * @param event 鼠标事件对象
5620
6197
  */
5621
6198
  handleResizeEnd: function handleResizeEnd(event) {
5622
- var _this2 = this;
6199
+ var _this = this;
5623
6200
 
5624
6201
  event.preventDefault();
5625
6202
  event.stopPropagation(); // 阻止事件冒泡,防止触发父级点击事件
@@ -5637,7 +6214,7 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
5637
6214
  document.addEventListener('click', swallowClick, true);
5638
6215
  // 延迟重置调整状态,避免触发点击事件
5639
6216
  setTimeout(function () {
5640
- _this2.isResizing = false;
6217
+ _this.isResizing = false;
5641
6218
  document.removeEventListener('click', swallowClick, true);
5642
6219
  }, 200);
5643
6220
  },
@@ -5662,8 +6239,8 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
5662
6239
 
5663
6240
  var render_component = Object(componentNormalizer["a" /* default */])(
5664
6241
  src_rendervue_type_script_lang_js_,
5665
- rendervue_type_template_id_45a220b2_render,
5666
- rendervue_type_template_id_45a220b2_staticRenderFns,
6242
+ rendervue_type_template_id_6ff9a775_render,
6243
+ rendervue_type_template_id_6ff9a775_staticRenderFns,
5667
6244
  false,
5668
6245
  null,
5669
6246
  null,
@@ -5783,7 +6360,7 @@ var checkbox_group_ = __webpack_require__(40);
5783
6360
  var checkbox_group_default = /*#__PURE__*/__webpack_require__.n(checkbox_group_);
5784
6361
 
5785
6362
  // EXTERNAL MODULE: external "eoss/lib/empty"
5786
- var empty_ = __webpack_require__(86);
6363
+ var empty_ = __webpack_require__(88);
5787
6364
  var empty_default = /*#__PURE__*/__webpack_require__.n(empty_);
5788
6365
 
5789
6366
  // EXTERNAL MODULE: external "eoss/lib/scrollbar"
@@ -5791,7 +6368,7 @@ var scrollbar_ = __webpack_require__(34);
5791
6368
  var scrollbar_default = /*#__PURE__*/__webpack_require__.n(scrollbar_);
5792
6369
 
5793
6370
  // EXTERNAL MODULE: external "eoss/lib/pagination"
5794
- var pagination_ = __webpack_require__(85);
6371
+ var pagination_ = __webpack_require__(87);
5795
6372
  var pagination_default = /*#__PURE__*/__webpack_require__.n(pagination_);
5796
6373
 
5797
6374
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/lowcode-view/src/Modules.vue?vue&type=script&lang=js&
@@ -7518,7 +8095,39 @@ module.exports = require("sm-crypto");
7518
8095
 
7519
8096
  /***/ }),
7520
8097
 
7521
- /***/ 56:
8098
+ /***/ 47:
8099
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
8100
+
8101
+ "use strict";
8102
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
8103
+ /* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
8104
+ /**
8105
+ * 组件之间的消息总线,用作组件间消息传递
8106
+ */
8107
+
8108
+
8109
+ /**
8110
+ * Vue 实例
8111
+ *
8112
+ * @example
8113
+ * A组件:
8114
+ * import bus from 'eoss/src/utils/bus.js'
8115
+ * // 触发事件
8116
+ * bus.$emit('message', data)
8117
+ *
8118
+ * B组件:
8119
+ * import bus from 'eoss/src/utils/bus.js'
8120
+ *
8121
+ * // 侦听事件
8122
+ * bus.$on('message', data => {
8123
+ * // 收到A组件发送过来的消息
8124
+ * })
8125
+ */
8126
+ /* harmony default export */ __webpack_exports__["a"] = (new vue__WEBPACK_IMPORTED_MODULE_0___default.a({}));
8127
+
8128
+ /***/ }),
8129
+
8130
+ /***/ 55:
7522
8131
  /***/ (function(module, exports) {
7523
8132
 
7524
8133
  module.exports = require("sortablejs");
@@ -8096,811 +8705,788 @@ var auditTrajectory = '/baseOperationRecords/listJson';
8096
8705
  // 暂停定时任务
8097
8706
  var changeInTime = '/baseIssueRules/changeInTime';
8098
8707
 
8099
- /***/ }),
8708
+ /***/ }),
8709
+
8710
+ /***/ 7:
8711
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
8712
+
8713
+ "use strict";
8714
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return fecha; });
8715
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return getSettings; });
8716
+ /* unused harmony export toDate */
8717
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return isDate; });
8718
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return isDateObject; });
8719
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return formatDate; });
8720
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return parseDate; });
8721
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getDayCountOfMonth; });
8722
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getDayCountOfYear; });
8723
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return getFirstDayOfMonth; });
8724
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return prevDate; });
8725
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return nextDate; });
8726
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return getStartDateOfMonth; });
8727
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return getWeekNumber; });
8728
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return getRangeHours; });
8729
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return getPrevMonthLastDays; });
8730
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return getMonthDays; });
8731
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return getRangeMinutes; });
8732
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return range; });
8733
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return modifyDate; });
8734
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return modifyTime; });
8735
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return modifyWithTimeString; });
8736
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return clearTime; });
8737
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return clearMilliseconds; });
8738
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return limitTimeRange; });
8739
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return timeWithinRange; });
8740
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changeYearMonthAndClampDate; });
8741
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return prevMonth; });
8742
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return nextMonth; });
8743
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return prevYear; });
8744
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return nextYear; });
8745
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return extractDateFormat; });
8746
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return extractTimeFormat; });
8747
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return validateRangeInOneMonth; });
8748
+ /* unused harmony export calculateNetworkDays */
8749
+ /* unused harmony export dateAddDays */
8750
+ /* unused harmony export dateDiff */
8751
+ /* unused harmony export dayOfMonth */
8752
+ /* unused harmony export getCurrentDate */
8753
+ /* unused harmony export getCurrentDateTime */
8754
+ /* unused harmony export getHour */
8755
+ /* unused harmony export getMinute */
8756
+ /* unused harmony export getMonth */
8757
+ /* unused harmony export getSecond */
8758
+ /* unused harmony export getWeekday */
8759
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
8760
+
8761
+
8762
+ /**
8763
+ * Parse or format dates
8764
+ * @class fecha
8765
+ */
8766
+ var fecha = {};
8767
+ var token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
8768
+ var twoDigits = '\\d\\d?';
8769
+ var threeDigits = '\\d{3}';
8770
+ var fourDigits = '\\d{4}';
8771
+ var word = '[^\\s]+';
8772
+ var literal = /\[([^]*?)\]/gm;
8773
+ var noop = function noop() {};
8774
+
8775
+ function regexEscape(str) {
8776
+ return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
8777
+ }
8778
+
8779
+ function shorten(arr, sLen) {
8780
+ var newArr = [];
8781
+ for (var i = 0, len = arr.length; i < len; i++) {
8782
+ newArr.push(arr[i].substr(0, sLen));
8783
+ }
8784
+ return newArr;
8785
+ }
8786
+
8787
+ function monthUpdate() {
8788
+ return function (d, v) {
8789
+ var index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
8790
+ if (~index) {
8791
+ d.month = index;
8792
+ }
8793
+ };
8794
+ }
8795
+
8796
+ function pad(val, len) {
8797
+ val = String(val);
8798
+ len = len || 2;
8799
+ while (val.length < len) {
8800
+ val = '0' + val;
8801
+ }
8802
+ return val;
8803
+ }
8804
+
8805
+ // 直接使用中文日期名称常量
8806
+ var dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
8807
+ var monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
8808
+ var monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
8809
+ var dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
8810
+ var amPm = ['上午', '下午'];
8811
+ var DoFn = function DoFn(D) {
8812
+ return D + '日';
8813
+ };
8814
+
8815
+ var formatFlags = {
8816
+ D: function D(dateObj) {
8817
+ return dateObj.getDay();
8818
+ },
8819
+ DD: function DD(dateObj) {
8820
+ return pad(dateObj.getDay());
8821
+ },
8822
+ Do: function Do(dateObj) {
8823
+ return DoFn(dateObj.getDate());
8824
+ },
8825
+ d: function d(dateObj) {
8826
+ return dateObj.getDate();
8827
+ },
8828
+ dd: function dd(dateObj) {
8829
+ return pad(dateObj.getDate());
8830
+ },
8831
+ ddd: function ddd(dateObj) {
8832
+ return dayNamesShort[dateObj.getDay()];
8833
+ },
8834
+ dddd: function dddd(dateObj) {
8835
+ return dayNames[dateObj.getDay()];
8836
+ },
8837
+ M: function M(dateObj) {
8838
+ return dateObj.getMonth() + 1;
8839
+ },
8840
+ MM: function MM(dateObj) {
8841
+ return pad(dateObj.getMonth() + 1);
8842
+ },
8843
+ MMM: function MMM(dateObj) {
8844
+ return monthNamesShort[dateObj.getMonth()];
8845
+ },
8846
+ MMMM: function MMMM(dateObj) {
8847
+ return monthNames[dateObj.getMonth()];
8848
+ },
8849
+ yy: function yy(dateObj) {
8850
+ return pad(String(dateObj.getFullYear()), 4).substr(2);
8851
+ },
8852
+ yyyy: function yyyy(dateObj) {
8853
+ return pad(dateObj.getFullYear(), 4);
8854
+ },
8855
+ h: function h(dateObj) {
8856
+ return dateObj.getHours() % 12 || 12;
8857
+ },
8858
+ hh: function hh(dateObj) {
8859
+ return pad(dateObj.getHours() % 12 || 12);
8860
+ },
8861
+ H: function H(dateObj) {
8862
+ return dateObj.getHours();
8863
+ },
8864
+ HH: function HH(dateObj) {
8865
+ return pad(dateObj.getHours());
8866
+ },
8867
+ m: function m(dateObj) {
8868
+ return dateObj.getMinutes();
8869
+ },
8870
+ mm: function mm(dateObj) {
8871
+ return pad(dateObj.getMinutes());
8872
+ },
8873
+ s: function s(dateObj) {
8874
+ return dateObj.getSeconds();
8875
+ },
8876
+ ss: function ss(dateObj) {
8877
+ return pad(dateObj.getSeconds());
8878
+ },
8879
+ S: function S(dateObj) {
8880
+ return Math.round(dateObj.getMilliseconds() / 100);
8881
+ },
8882
+ SS: function SS(dateObj) {
8883
+ return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
8884
+ },
8885
+ SSS: function SSS(dateObj) {
8886
+ return pad(dateObj.getMilliseconds(), 3);
8887
+ },
8888
+ a: function a(dateObj) {
8889
+ return dateObj.getHours() < 12 ? '上午' : '下午';
8890
+ },
8891
+ A: function A(dateObj) {
8892
+ return dateObj.getHours() < 12 ? '上午' : '下午';
8893
+ },
8894
+ ZZ: function ZZ(dateObj) {
8895
+ var o = dateObj.getTimezoneOffset();
8896
+ return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
8897
+ }
8898
+ };
8899
+
8900
+ var parseFlags = {
8901
+ d: [twoDigits, function (d, v) {
8902
+ d.day = v;
8903
+ }],
8904
+ Do: [twoDigits + word, function (d, v) {
8905
+ d.day = parseInt(v, 10);
8906
+ }],
8907
+ M: [twoDigits, function (d, v) {
8908
+ d.month = v - 1;
8909
+ }],
8910
+ yy: [twoDigits, function (d, v) {
8911
+ var da = new Date(),
8912
+ cent = +('' + da.getFullYear()).substr(0, 2);
8913
+ d.year = '' + (v > 68 ? cent - 1 : cent) + v;
8914
+ }],
8915
+ h: [twoDigits, function (d, v) {
8916
+ d.hour = v;
8917
+ }],
8918
+ m: [twoDigits, function (d, v) {
8919
+ d.minute = v;
8920
+ }],
8921
+ s: [twoDigits, function (d, v) {
8922
+ d.second = v;
8923
+ }],
8924
+ yyyy: [fourDigits, function (d, v) {
8925
+ d.year = v;
8926
+ }],
8927
+ S: ['\\d', function (d, v) {
8928
+ d.millisecond = v * 100;
8929
+ }],
8930
+ SS: ['\\d{2}', function (d, v) {
8931
+ d.millisecond = v * 10;
8932
+ }],
8933
+ SSS: [threeDigits, function (d, v) {
8934
+ d.millisecond = v;
8935
+ }],
8936
+ D: [twoDigits, noop],
8937
+ ddd: [word, noop],
8938
+ MMM: [word, monthUpdate('monthNamesShort')],
8939
+ MMMM: [word, monthUpdate('monthNames')],
8940
+ a: [word, function (d, v) {
8941
+ var val = v.toLowerCase();
8942
+ if (val === '上午') {
8943
+ d.isPm = false;
8944
+ } else if (val === '下午') {
8945
+ d.isPm = true;
8946
+ }
8947
+ }],
8948
+ ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
8949
+ var parts = (v + '').match(/([+-]|\d\d)/gi),
8950
+ minutes = void 0;
8951
+
8952
+ if (parts) {
8953
+ minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
8954
+ d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
8955
+ }
8956
+ }]
8957
+ };
8958
+ parseFlags.dd = parseFlags.d;
8959
+ parseFlags.dddd = parseFlags.ddd;
8960
+ parseFlags.DD = parseFlags.D;
8961
+ parseFlags.mm = parseFlags.m;
8962
+ parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
8963
+ parseFlags.MM = parseFlags.M;
8964
+ parseFlags.ss = parseFlags.s;
8965
+ parseFlags.A = parseFlags.a;
8966
+
8967
+ // Some common format strings
8968
+ fecha.masks = {
8969
+ default: 'ddd MMM dd yyyy HH:mm:ss',
8970
+ shortDate: 'M/D/yy',
8971
+ mediumDate: 'MMM d, yyyy',
8972
+ longDate: 'MMMM d, yyyy',
8973
+ fullDate: 'dddd, MMMM d, yyyy',
8974
+ shortTime: 'HH:mm',
8975
+ mediumTime: 'HH:mm:ss',
8976
+ longTime: 'HH:mm:ss.SSS'
8977
+ };
8978
+
8979
+ /***
8980
+ * Format a date
8981
+ * @method format
8982
+ * @param {Date|number} dateObj
8983
+ * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
8984
+ */
8985
+ fecha.format = function (dateObj, mask) {
8986
+ if (typeof dateObj === 'number') {
8987
+ dateObj = new Date(dateObj);
8988
+ }
8989
+
8990
+ if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
8991
+ throw new Error('Invalid Date in fecha.format');
8992
+ }
8993
+
8994
+ mask = fecha.masks[mask] || mask || fecha.masks['default'];
8995
+
8996
+ var literals = [];
8997
+
8998
+ // Make literals inactive by replacing them with ??
8999
+ mask = mask.replace(literal, function ($0, $1) {
9000
+ literals.push($1);
9001
+ return '@@@';
9002
+ });
9003
+ // Apply formatting rules
9004
+ mask = mask.replace(token, function ($0) {
9005
+ return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
9006
+ });
9007
+ // Inline literal values back into the formatted value
9008
+ return mask.replace(/@@@/g, function () {
9009
+ return literals.shift();
9010
+ });
9011
+ };
9012
+
9013
+ /**
9014
+ * Parse a date string into an object, changes - into /
9015
+ * @method parse
9016
+ * @param {string} dateStr Date string
9017
+ * @param {string} format Date parse format
9018
+ * @returns {Date|boolean}
9019
+ */
9020
+ fecha.parse = function (dateStr, format) {
9021
+ if (typeof format !== 'string') {
9022
+ throw new Error('Invalid format in fecha.parse');
9023
+ }
9024
+
9025
+ format = fecha.masks[format] || format;
9026
+
9027
+ // Avoid regular expression denial of service, fail early for really long strings
9028
+ // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
9029
+ if (dateStr.length > 1000) {
9030
+ return null;
9031
+ }
9032
+
9033
+ var dateInfo = {};
9034
+ var parseInfo = [];
9035
+ var literals = [];
9036
+ format = format.replace(literal, function ($0, $1) {
9037
+ literals.push($1);
9038
+ return '@@@';
9039
+ });
9040
+ var newFormat = regexEscape(format).replace(token, function ($0) {
9041
+ if (parseFlags[$0]) {
9042
+ var info = parseFlags[$0];
9043
+ parseInfo.push(info[1]);
9044
+ return '(' + info[0] + ')';
9045
+ }
9046
+
9047
+ return $0;
9048
+ });
9049
+ newFormat = newFormat.replace(/@@@/g, function () {
9050
+ return literals.shift();
9051
+ });
9052
+ var matches = dateStr.match(new RegExp(newFormat, 'i'));
9053
+ if (!matches) {
9054
+ return null;
9055
+ }
9056
+
9057
+ for (var i = 1; i < matches.length; i++) {
9058
+ parseInfo[i - 1](dateInfo, matches[i]);
9059
+ }
9060
+
9061
+ var today = new Date();
9062
+ if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
9063
+ dateInfo.hour = +dateInfo.hour + 12;
9064
+ } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
9065
+ dateInfo.hour = 0;
9066
+ }
9067
+
9068
+ var date = void 0;
9069
+ if (dateInfo.timezoneOffset != null) {
9070
+ dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
9071
+ date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
9072
+ } else {
9073
+ date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1, dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
9074
+ }
9075
+ return date;
9076
+ };
9077
+
9078
+ // 导出fecha对象
9079
+
9080
+
9081
+ // 以下是从date-util.js合并的函数
9082
+ var newArray = function newArray(start, end) {
9083
+ var result = [];
9084
+ for (var i = start; i <= end; i++) {
9085
+ result.push(i);
9086
+ }
9087
+ return result;
9088
+ };
9089
+
9090
+ var getSettings = function getSettings() {
9091
+ return {
9092
+ dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
9093
+ dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
9094
+ monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
9095
+ monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
9096
+ amPm: ['上午', '下午']
9097
+ };
9098
+ };
9099
+
9100
+ var toDate = function toDate(date) {
9101
+ return isDate(date) ? new Date(date) : null;
9102
+ };
9103
+
9104
+ var isDate = function isDate(date) {
9105
+ if (date === null || date === undefined) return false;
9106
+ if (isNaN(new Date(date).getTime())) return false;
9107
+ if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
9108
+ return true;
9109
+ };
9110
+
9111
+ var isDateObject = function isDateObject(val) {
9112
+ return val instanceof Date;
9113
+ };
9114
+
9115
+ var formatDate = function formatDate(date) {
9116
+ var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'yyyy-MM-dd';
9117
+
9118
+ // 处理多种输入类型
9119
+ if (!date) return '';
9120
+
9121
+ // 如果是时间戳,转成日期对象
9122
+ if (typeof date === 'number') {
9123
+ date = new Date(date);
9124
+ }
9125
+ // 如果是字符串,转成日期对象
9126
+ if (typeof date === 'string') {
9127
+ date = new Date(date);
9128
+ }
9129
+
9130
+ // 调用toDate进一步验证和转换
9131
+ date = toDate(date);
9132
+ if (!date) return '';
9133
+
9134
+ // 兼容大写和小写的格式标记
9135
+ // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
9136
+ var lowercaseFormat = format.replace(/YYYY/g, 'yyyy').replace(/D/g, 'd');
9137
+
9138
+ // 使用fecha库进行格式化,支持中文配置
9139
+ var str = fecha.format(date, lowercaseFormat, getSettings());
9140
+ return str;
9141
+ };
9142
+
9143
+ var parseDate = function parseDate(string, format) {
9144
+ return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
9145
+ };
9146
+
9147
+ var getDayCountOfMonth = function getDayCountOfMonth(year, month) {
9148
+ if (month === 3 || month === 5 || month === 8 || month === 10) {
9149
+ return 30;
9150
+ }
9151
+
9152
+ if (month === 1) {
9153
+ if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
9154
+ return 29;
9155
+ } else {
9156
+ return 28;
9157
+ }
9158
+ }
9159
+
9160
+ return 31;
9161
+ };
9162
+
9163
+ var getDayCountOfYear = function getDayCountOfYear(year) {
9164
+ var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0;
9165
+ return isLeapYear ? 366 : 365;
9166
+ };
9167
+
9168
+ var getFirstDayOfMonth = function getFirstDayOfMonth(date) {
9169
+ var temp = new Date(date.getTime());
9170
+ temp.setDate(1);
9171
+ return temp.getDay();
9172
+ };
9173
+
9174
+ // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
9175
+ // {prev, next} Date should work for Daylight Saving Time
9176
+ // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
9177
+ var prevDate = function prevDate(date) {
9178
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9179
+
9180
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
9181
+ };
9182
+
9183
+ var nextDate = function nextDate(date) {
9184
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9185
+
9186
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
9187
+ };
9188
+
9189
+ var getStartDateOfMonth = function getStartDateOfMonth(year, month) {
9190
+ var result = new Date(year, month, 1);
9191
+ var day = result.getDay();
9192
+
9193
+ if (day === 0) {
9194
+ return prevDate(result, 7);
9195
+ } else {
9196
+ return prevDate(result, day);
9197
+ }
9198
+ };
9199
+
9200
+ var getWeekNumber = function getWeekNumber(date) {
9201
+ // 支持多种输入类型
9202
+ if (!date || !isDate(date)) {
9203
+ date = new Date();
9204
+ }
9205
+ if (typeof date === 'string') {
9206
+ date = new Date(date);
9207
+ }
9208
+
9209
+ // 验证日期有效性
9210
+ if (!isDate(date)) return null;
8100
9211
 
8101
- /***/ 7:
8102
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
9212
+ var d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
9213
+ // 设置为最近的星期四:当前日期 + 4 - 当前星期数
9214
+ // 将星期日的星期数设为7
9215
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
9216
+ // 获取当年的第一天
9217
+ var yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
9218
+ // 计算到最近的星期四的完整周数
9219
+ var weekNo = Math.ceil(((d - yearStart) / 86400000 + 1) / 7);
9220
+ // 返回周数
9221
+ return weekNo;
9222
+ };
9223
+
9224
+ var getRangeHours = function getRangeHours(ranges) {
9225
+ var hours = [];
9226
+ var disabledHours = [];
9227
+
9228
+ (ranges || []).forEach(function (range) {
9229
+ var value = range.map(function (date) {
9230
+ return date.getHours();
9231
+ });
9232
+
9233
+ disabledHours = disabledHours.concat(newArray(value[0], value[1]));
9234
+ });
9235
+
9236
+ if (disabledHours.length) {
9237
+ for (var i = 0; i < 24; i++) {
9238
+ hours[i] = disabledHours.indexOf(i) === -1;
9239
+ }
9240
+ } else {
9241
+ for (var _i = 0; _i < 24; _i++) {
9242
+ hours[_i] = false;
9243
+ }
9244
+ }
9245
+
9246
+ return hours;
9247
+ };
9248
+
9249
+ var getPrevMonthLastDays = function getPrevMonthLastDays(date, amount) {
9250
+ if (amount <= 0) return [];
9251
+ var temp = new Date(date.getTime());
9252
+ temp.setDate(0);
9253
+ var lastDay = temp.getDate();
9254
+ return range(amount).map(function (_, index) {
9255
+ return lastDay - (amount - index - 1);
9256
+ });
9257
+ };
9258
+
9259
+ var getMonthDays = function getMonthDays(date) {
9260
+ var temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
9261
+ var days = temp.getDate();
9262
+ return range(days).map(function (_, index) {
9263
+ return index + 1;
9264
+ });
9265
+ };
9266
+
9267
+ function setRangeData(arr, start, end, value) {
9268
+ for (var i = start; i < end; i++) {
9269
+ arr[i] = value;
9270
+ }
9271
+ }
9272
+
9273
+ var getRangeMinutes = function getRangeMinutes(ranges, hour) {
9274
+ var minutes = new Array(60);
9275
+
9276
+ if (ranges.length > 0) {
9277
+ ranges.forEach(function (range) {
9278
+ var start = range[0];
9279
+ var end = range[1];
9280
+ var startHour = start.getHours();
9281
+ var startMinute = start.getMinutes();
9282
+ var endHour = end.getHours();
9283
+ var endMinute = end.getMinutes();
9284
+ if (startHour === hour && endHour !== hour) {
9285
+ setRangeData(minutes, startMinute, 60, true);
9286
+ } else if (startHour === hour && endHour === hour) {
9287
+ setRangeData(minutes, startMinute, endMinute + 1, true);
9288
+ } else if (startHour !== hour && endHour === hour) {
9289
+ setRangeData(minutes, 0, endMinute + 1, true);
9290
+ } else if (startHour < hour && endHour > hour) {
9291
+ setRangeData(minutes, 0, 60, true);
9292
+ }
9293
+ });
9294
+ } else {
9295
+ setRangeData(minutes, 0, 60, true);
9296
+ }
9297
+ return minutes;
9298
+ };
9299
+
9300
+ var range = function range(n) {
9301
+ // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
9302
+ return Array.apply(null, { length: n }).map(function (_, n) {
9303
+ return n;
9304
+ });
9305
+ };
9306
+
9307
+ var modifyDate = function modifyDate(date, y, m, d) {
9308
+ return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
9309
+ };
9310
+
9311
+ var modifyTime = function modifyTime(date, h, m, s) {
9312
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
9313
+ };
9314
+
9315
+ var modifyWithTimeString = function modifyWithTimeString(date, time) {
9316
+ if (date == null || !time) {
9317
+ return date;
9318
+ }
9319
+ time = parseDate(time, 'HH:mm:ss');
9320
+ return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
9321
+ };
9322
+
9323
+ var clearTime = function clearTime(date) {
9324
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate());
9325
+ };
9326
+
9327
+ var clearMilliseconds = function clearMilliseconds(date) {
9328
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
9329
+ };
9330
+
9331
+ var limitTimeRange = function limitTimeRange(date, ranges) {
9332
+ var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss';
9333
+
9334
+ // TODO: refactory a more elegant solution
9335
+ if (ranges.length === 0) return date;
9336
+ var normalizeDate = function normalizeDate(date) {
9337
+ return fecha.parse(fecha.format(date, format), format);
9338
+ };
9339
+ var ndate = normalizeDate(date);
9340
+ var nranges = ranges.map(function (range) {
9341
+ return range.map(normalizeDate);
9342
+ });
9343
+ if (nranges.some(function (nrange) {
9344
+ return ndate >= nrange[0] && ndate <= nrange[1];
9345
+ })) return date;
9346
+
9347
+ var minDate = nranges[0][0];
9348
+ var maxDate = nranges[0][0];
9349
+
9350
+ nranges.forEach(function (nrange) {
9351
+ minDate = new Date(Math.min(nrange[0], minDate));
9352
+ maxDate = new Date(Math.max(nrange[1], minDate));
9353
+ });
9354
+
9355
+ var ret = ndate < minDate ? minDate : maxDate;
9356
+ // preserve Year/Month/Date
9357
+ return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate());
9358
+ };
9359
+
9360
+ var timeWithinRange = function timeWithinRange(date, selectableRange, format) {
9361
+ var limitedDate = limitTimeRange(date, selectableRange, format);
9362
+ return limitedDate.getTime() === date.getTime();
9363
+ };
9364
+
9365
+ var changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) {
9366
+ // clamp date to the number of days in `year`, `month`
9367
+ // eg: (2010-1-31, 2010, 2) => 2010-2-28
9368
+ var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
9369
+ return modifyDate(date, year, month, monthDate);
9370
+ };
9371
+
9372
+ var prevMonth = function prevMonth(date) {
9373
+ var year = date.getFullYear();
9374
+ var month = date.getMonth();
9375
+ return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1);
9376
+ };
9377
+
9378
+ var nextMonth = function nextMonth(date) {
9379
+ var year = date.getFullYear();
9380
+ var month = date.getMonth();
9381
+ return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1);
9382
+ };
9383
+
9384
+ var prevYear = function prevYear(date) {
9385
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9386
+
9387
+ var year = date.getFullYear();
9388
+ var month = date.getMonth();
9389
+ return changeYearMonthAndClampDate(date, year - amount, month);
9390
+ };
9391
+
9392
+ var nextYear = function nextYear(date) {
9393
+ var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
9394
+
9395
+ var year = date.getFullYear();
9396
+ var month = date.getMonth();
9397
+ return changeYearMonthAndClampDate(date, year + amount, month);
9398
+ };
9399
+
9400
+ var extractDateFormat = function extractDateFormat(format) {
9401
+ return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim();
9402
+ };
9403
+
9404
+ var extractTimeFormat = function extractTimeFormat(format) {
9405
+ return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim();
9406
+ };
9407
+
9408
+ var validateRangeInOneMonth = function validateRangeInOneMonth(start, end) {
9409
+ return start.getMonth() === end.getMonth() && start.getFullYear() === end.getFullYear();
9410
+ };
8103
9411
 
8104
- "use strict";
8105
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return fecha; });
8106
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return getSettings; });
8107
- /* unused harmony export toDate */
8108
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return isDate; });
8109
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return isDateObject; });
8110
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return formatDate; });
8111
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return parseDate; });
8112
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getDayCountOfMonth; });
8113
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getDayCountOfYear; });
8114
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return getFirstDayOfMonth; });
8115
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return prevDate; });
8116
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return nextDate; });
8117
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return getStartDateOfMonth; });
8118
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return getWeekNumber; });
8119
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return getRangeHours; });
8120
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return getPrevMonthLastDays; });
8121
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return getMonthDays; });
8122
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return getRangeMinutes; });
8123
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return range; });
8124
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return modifyDate; });
8125
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return modifyTime; });
8126
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return modifyWithTimeString; });
8127
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return clearTime; });
8128
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return clearMilliseconds; });
8129
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return limitTimeRange; });
8130
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return timeWithinRange; });
8131
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return changeYearMonthAndClampDate; });
8132
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return prevMonth; });
8133
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return nextMonth; });
8134
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return prevYear; });
8135
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return nextYear; });
8136
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return extractDateFormat; });
8137
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return extractTimeFormat; });
8138
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return validateRangeInOneMonth; });
8139
- /* unused harmony export calculateNetworkDays */
8140
- /* unused harmony export dateAddDays */
8141
- /* unused harmony export dateDiff */
8142
- /* unused harmony export dayOfMonth */
8143
- /* unused harmony export getCurrentDate */
8144
- /* unused harmony export getCurrentDateTime */
8145
- /* unused harmony export getHour */
8146
- /* unused harmony export getMinute */
8147
- /* unused harmony export getMonth */
8148
- /* unused harmony export getSecond */
8149
- /* unused harmony export getWeekday */
8150
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return timeCycle; });
8151
- /* Modified from https://github.com/taylorhakes/fecha
8152
- *
8153
- * The MIT License (MIT)
8154
- *
8155
- * Copyright (c) 2015 Taylor Hakes
8156
- *
8157
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8158
- * of this software and associated documentation files (the "Software"), to deal
8159
- * in the Software without restriction, including without limitation the rights
8160
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8161
- * copies of the Software, and to permit persons to whom the Software is
8162
- * furnished to do so, subject to the following conditions:
8163
- *
8164
- * The above copyright notice and this permission notice shall be included in all
8165
- * copies or substantial portions of the Software.
8166
- *
8167
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8168
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8169
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8170
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8171
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8172
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
8173
- * SOFTWARE.
8174
- */
8175
-
8176
- /*eslint-disable*/
8177
- // 把 YYYY-MM-DD 改成了 yyyy-MM-dd
8178
-
8179
-
8180
- /**
8181
- * Parse or format dates
8182
- * @class fecha
8183
- */
8184
- const fecha = {};
8185
- const token = /d{1,4}|M{1,4}|yy(?:yy)?|S{1,3}|Do|ZZ|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g;
8186
- const twoDigits = '\\d\\d?';
8187
- const threeDigits = '\\d{3}';
8188
- const fourDigits = '\\d{4}';
8189
- const word = '[^\\s]+';
8190
- const literal = /\[([^]*?)\]/gm;
8191
- const noop = function () {};
8192
-
8193
- function regexEscape(str) {
8194
- return str.replace(/[|\\{()[^$+*?.-]/g, '\\$&');
8195
- }
8196
-
8197
- function shorten(arr, sLen) {
8198
- const newArr = [];
8199
- for (let i = 0, len = arr.length; i < len; i++) {
8200
- newArr.push(arr[i].substr(0, sLen));
8201
- }
8202
- return newArr;
8203
- }
8204
-
8205
- function monthUpdate() {
8206
- return function (d, v) {
8207
- const index = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'].indexOf(v.toLowerCase());
8208
- if (~index) {
8209
- d.month = index;
8210
- }
8211
- };
8212
- }
8213
-
8214
- function pad(val, len) {
8215
- val = String(val);
8216
- len = len || 2;
8217
- while (val.length < len) {
8218
- val = '0' + val;
8219
- }
8220
- return val;
8221
- }
8222
-
8223
- // 直接使用中文日期名称常量
8224
- const dayNames = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];
8225
- const monthNames = ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'];
8226
- const monthNamesShort = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二'];
8227
- const dayNamesShort = ['日', '一', '二', '三', '四', '五', '六'];
8228
- const amPm = ['上午', '下午'];
8229
- const DoFn = function DoFn(D) {
8230
- return D + '日';
8231
- };
8232
-
8233
- const formatFlags = {
8234
- D: function(dateObj) {
8235
- return dateObj.getDay();
8236
- },
8237
- DD: function(dateObj) {
8238
- return pad(dateObj.getDay());
8239
- },
8240
- Do: function(dateObj) {
8241
- return DoFn(dateObj.getDate());
8242
- },
8243
- d: function(dateObj) {
8244
- return dateObj.getDate();
8245
- },
8246
- dd: function(dateObj) {
8247
- return pad(dateObj.getDate());
8248
- },
8249
- ddd: function(dateObj) {
8250
- return dayNamesShort[dateObj.getDay()];
8251
- },
8252
- dddd: function(dateObj) {
8253
- return dayNames[dateObj.getDay()];
8254
- },
8255
- M: function(dateObj) {
8256
- return dateObj.getMonth() + 1;
8257
- },
8258
- MM: function(dateObj) {
8259
- return pad(dateObj.getMonth() + 1);
8260
- },
8261
- MMM: function(dateObj) {
8262
- return monthNamesShort[dateObj.getMonth()];
8263
- },
8264
- MMMM: function(dateObj) {
8265
- return monthNames[dateObj.getMonth()];
8266
- },
8267
- yy: function(dateObj) {
8268
- return pad(String(dateObj.getFullYear()), 4).substr(2);
8269
- },
8270
- yyyy: function(dateObj) {
8271
- return pad(dateObj.getFullYear(), 4);
8272
- },
8273
- h: function(dateObj) {
8274
- return dateObj.getHours() % 12 || 12;
8275
- },
8276
- hh: function(dateObj) {
8277
- return pad(dateObj.getHours() % 12 || 12);
8278
- },
8279
- H: function(dateObj) {
8280
- return dateObj.getHours();
8281
- },
8282
- HH: function(dateObj) {
8283
- return pad(dateObj.getHours());
8284
- },
8285
- m: function(dateObj) {
8286
- return dateObj.getMinutes();
8287
- },
8288
- mm: function(dateObj) {
8289
- return pad(dateObj.getMinutes());
8290
- },
8291
- s: function(dateObj) {
8292
- return dateObj.getSeconds();
8293
- },
8294
- ss: function(dateObj) {
8295
- return pad(dateObj.getSeconds());
8296
- },
8297
- S: function(dateObj) {
8298
- return Math.round(dateObj.getMilliseconds() / 100);
8299
- },
8300
- SS: function(dateObj) {
8301
- return pad(Math.round(dateObj.getMilliseconds() / 10), 2);
8302
- },
8303
- SSS: function(dateObj) {
8304
- return pad(dateObj.getMilliseconds(), 3);
8305
- },
8306
- a: function(dateObj) {
8307
- return dateObj.getHours() < 12 ? '上午' : '下午';
8308
- },
8309
- A: function(dateObj) {
8310
- return dateObj.getHours() < 12 ? '上午' : '下午';
8311
- },
8312
- ZZ: function(dateObj) {
8313
- const o = dateObj.getTimezoneOffset();
8314
- return (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4);
8315
- }
8316
- };
8317
-
8318
- const parseFlags = {
8319
- d: [twoDigits, function (d, v) {
8320
- d.day = v;
8321
- }],
8322
- Do: [twoDigits + word, function (d, v) {
8323
- d.day = parseInt(v, 10);
8324
- }],
8325
- M: [twoDigits, function (d, v) {
8326
- d.month = v - 1;
8327
- }],
8328
- yy: [twoDigits, function (d, v) {
8329
- const da = new Date(), cent = +('' + da.getFullYear()).substr(0, 2);
8330
- d.year = '' + (v > 68 ? cent - 1 : cent) + v;
8331
- }],
8332
- h: [twoDigits, function (d, v) {
8333
- d.hour = v;
8334
- }],
8335
- m: [twoDigits, function (d, v) {
8336
- d.minute = v;
8337
- }],
8338
- s: [twoDigits, function (d, v) {
8339
- d.second = v;
8340
- }],
8341
- yyyy: [fourDigits, function (d, v) {
8342
- d.year = v;
8343
- }],
8344
- S: ['\\d', function (d, v) {
8345
- d.millisecond = v * 100;
8346
- }],
8347
- SS: ['\\d{2}', function (d, v) {
8348
- d.millisecond = v * 10;
8349
- }],
8350
- SSS: [threeDigits, function (d, v) {
8351
- d.millisecond = v;
8352
- }],
8353
- D: [twoDigits, noop],
8354
- ddd: [word, noop],
8355
- MMM: [word, monthUpdate('monthNamesShort')],
8356
- MMMM: [word, monthUpdate('monthNames')],
8357
- a: [word, function (d, v) {
8358
- const val = v.toLowerCase();
8359
- if (val === '上午') {
8360
- d.isPm = false;
8361
- } else if (val === '下午') {
8362
- d.isPm = true;
8363
- }
8364
- }],
8365
- ZZ: ['[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z', function (d, v) {
8366
- let parts = (v + '').match(/([+-]|\d\d)/gi), minutes;
8367
-
8368
- if (parts) {
8369
- minutes = +(parts[1] * 60) + parseInt(parts[2], 10);
8370
- d.timezoneOffset = parts[0] === '+' ? minutes : -minutes;
8371
- }
8372
- }]
8373
- };
8374
- parseFlags.dd = parseFlags.d;
8375
- parseFlags.dddd = parseFlags.ddd;
8376
- parseFlags.DD = parseFlags.D;
8377
- parseFlags.mm = parseFlags.m;
8378
- parseFlags.hh = parseFlags.H = parseFlags.HH = parseFlags.h;
8379
- parseFlags.MM = parseFlags.M;
8380
- parseFlags.ss = parseFlags.s;
8381
- parseFlags.A = parseFlags.a;
8382
-
8383
-
8384
- // Some common format strings
8385
- fecha.masks = {
8386
- default: 'ddd MMM dd yyyy HH:mm:ss',
8387
- shortDate: 'M/D/yy',
8388
- mediumDate: 'MMM d, yyyy',
8389
- longDate: 'MMMM d, yyyy',
8390
- fullDate: 'dddd, MMMM d, yyyy',
8391
- shortTime: 'HH:mm',
8392
- mediumTime: 'HH:mm:ss',
8393
- longTime: 'HH:mm:ss.SSS'
8394
- };
8395
-
8396
- /***
8397
- * Format a date
8398
- * @method format
8399
- * @param {Date|number} dateObj
8400
- * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate'
8401
- */
8402
- fecha.format = function (dateObj, mask) {
8403
- if (typeof dateObj === 'number') {
8404
- dateObj = new Date(dateObj);
8405
- }
8406
-
8407
- if (Object.prototype.toString.call(dateObj) !== '[object Date]' || isNaN(dateObj.getTime())) {
8408
- throw new Error('Invalid Date in fecha.format');
8409
- }
8410
-
8411
- mask = fecha.masks[mask] || mask || fecha.masks['default'];
8412
-
8413
- const literals = [];
8414
-
8415
- // Make literals inactive by replacing them with ??
8416
- mask = mask.replace(literal, function($0, $1) {
8417
- literals.push($1);
8418
- return '@@@';
8419
- });
8420
- // Apply formatting rules
8421
- mask = mask.replace(token, function ($0) {
8422
- return $0 in formatFlags ? formatFlags[$0](dateObj) : $0.slice(1, $0.length - 1);
8423
- });
8424
- // Inline literal values back into the formatted value
8425
- return mask.replace(/@@@/g, function() {
8426
- return literals.shift();
8427
- });
8428
- };
8429
-
8430
- /**
8431
- * Parse a date string into an object, changes - into /
8432
- * @method parse
8433
- * @param {string} dateStr Date string
8434
- * @param {string} format Date parse format
8435
- * @returns {Date|boolean}
8436
- */
8437
- fecha.parse = function (dateStr, format) {
8438
- if (typeof format !== 'string') {
8439
- throw new Error('Invalid format in fecha.parse');
8440
- }
8441
-
8442
- format = fecha.masks[format] || format;
8443
-
8444
- // Avoid regular expression denial of service, fail early for really long strings
8445
- // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
8446
- if (dateStr.length > 1000) {
8447
- return null;
8448
- }
8449
-
8450
- const dateInfo = {};
8451
- const parseInfo = [];
8452
- const literals = [];
8453
- format = format.replace(literal, function($0, $1) {
8454
- literals.push($1);
8455
- return '@@@';
8456
- });
8457
- let newFormat = regexEscape(format).replace(token, function ($0) {
8458
- if (parseFlags[$0]) {
8459
- const info = parseFlags[$0];
8460
- parseInfo.push(info[1]);
8461
- return '(' + info[0] + ')';
8462
- }
8463
-
8464
- return $0;
8465
- });
8466
- newFormat = newFormat.replace(/@@@/g, function() {
8467
- return literals.shift();
8468
- });
8469
- const matches = dateStr.match(new RegExp(newFormat, 'i'));
8470
- if (!matches) {
8471
- return null;
8472
- }
8473
-
8474
- for (let i = 1; i < matches.length; i++) {
8475
- parseInfo[i - 1](dateInfo, matches[i]);
8476
- }
8477
-
8478
- const today = new Date();
8479
- if (dateInfo.isPm === true && dateInfo.hour != null && +dateInfo.hour !== 12) {
8480
- dateInfo.hour = +dateInfo.hour + 12;
8481
- } else if (dateInfo.isPm === false && +dateInfo.hour === 12) {
8482
- dateInfo.hour = 0;
8483
- }
8484
-
8485
- let date;
8486
- if (dateInfo.timezoneOffset != null) {
8487
- dateInfo.minute = +(dateInfo.minute || 0) - +dateInfo.timezoneOffset;
8488
- date = new Date(Date.UTC(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
8489
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0));
8490
- } else {
8491
- date = new Date(dateInfo.year || today.getFullYear(), dateInfo.month || 0, dateInfo.day || 1,
8492
- dateInfo.hour || 0, dateInfo.minute || 0, dateInfo.second || 0, dateInfo.millisecond || 0);
8493
- }
8494
- return date;
8495
- };
8496
-
8497
- // 导出fecha对象
8498
-
8499
-
8500
- // 以下是从date-util.js合并的函数
8501
- const newArray = function(start, end) {
8502
- let result = [];
8503
- for (let i = start; i <= end; i++) {
8504
- result.push(i);
8505
- }
8506
- return result;
8507
- };
8508
-
8509
- const getSettings = () => {
8510
- return {
8511
- dayNamesShort: ['日', '一', '二', '三', '四', '五', '六'],
8512
- dayNames: ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'],
8513
- monthNamesShort: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
8514
- monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
8515
- amPm: ['上午', '下午']
8516
- };
8517
- };
8518
-
8519
- const toDate = function(date) {
8520
- return isDate(date) ? new Date(date) : null;
8521
- };
8522
-
8523
- const isDate = function(date) {
8524
- if (date === null || date === undefined) return false;
8525
- if (isNaN(new Date(date).getTime())) return false;
8526
- if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()`
8527
- return true;
8528
- };
8529
-
8530
- const isDateObject = function(val) {
8531
- return val instanceof Date;
8532
- };
8533
-
8534
- const formatDate = function (date, format = 'yyyy-MM-dd') {
8535
- // 处理多种输入类型
8536
- if (!date) return '';
8537
-
8538
- // 如果是时间戳,转成日期对象
8539
- if (typeof date === 'number') {
8540
- date = new Date(date);
8541
- }
8542
- // 如果是字符串,转成日期对象
8543
- if (typeof date === 'string') {
8544
- date = new Date(date);
8545
- }
8546
-
8547
- // 调用toDate进一步验证和转换
8548
- date = toDate(date);
8549
- if (!date) return '';
8550
-
8551
- // 兼容大写和小写的格式标记
8552
- // 将大写的YYYY/MM/DD/HH/mm/ss转换为小写的yyyy/mm/dd/hh/mm/ss
8553
- const lowercaseFormat = format
8554
- .replace(/YYYY/g, 'yyyy')
8555
- .replace(/D/g, 'd')
8556
-
8557
- // 使用fecha库进行格式化,支持中文配置
8558
- const str = fecha.format(date, lowercaseFormat, getSettings());
8559
- return str;
8560
- };
8561
-
8562
- const parseDate = function(string, format) {
8563
- return fecha.parse(string, format || 'yyyy-MM-dd', getSettings());
8564
- };
8565
-
8566
- const getDayCountOfMonth = function(year, month) {
8567
- if (month === 3 || month === 5 || month === 8 || month === 10) {
8568
- return 30;
8569
- }
8570
-
8571
- if (month === 1) {
8572
- if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) {
8573
- return 29;
8574
- } else {
8575
- return 28;
8576
- }
8577
- }
8578
-
8579
- return 31;
8580
- };
8581
-
8582
- const getDayCountOfYear = function(year) {
8583
- const isLeapYear = year % 400 === 0 || (year % 100 !== 0 && year % 4 === 0);
8584
- return isLeapYear ? 366 : 365;
8585
- };
8586
-
8587
- const getFirstDayOfMonth = function(date) {
8588
- const temp = new Date(date.getTime());
8589
- temp.setDate(1);
8590
- return temp.getDay();
8591
- };
8592
-
8593
- // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript
8594
- // {prev, next} Date should work for Daylight Saving Time
8595
- // Adding 24 * 60 * 60 * 1000 does not work in the above scenario
8596
- const prevDate = function(date, amount = 1) {
8597
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount);
8598
- };
8599
-
8600
- const nextDate = function(date, amount = 1) {
8601
- return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount);
8602
- };
8603
-
8604
- const getStartDateOfMonth = function(year, month) {
8605
- const result = new Date(year, month, 1);
8606
- const day = result.getDay();
8607
-
8608
- if (day === 0) {
8609
- return prevDate(result, 7);
8610
- } else {
8611
- return prevDate(result, day);
8612
- }
8613
- };
8614
-
8615
- const getWeekNumber = function(date) {
8616
- // 支持多种输入类型
8617
- if (!date||!isDate(date)) {
8618
- date = new Date();
8619
- }
8620
- if (typeof date === 'string') {
8621
- date = new Date(date);
8622
- }
8623
-
8624
- // 验证日期有效性
8625
- if (!isDate(date)) return null;
8626
-
8627
- const d = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
8628
- // 设置为最近的星期四:当前日期 + 4 - 当前星期数
8629
- // 将星期日的星期数设为7
8630
- d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
8631
- // 获取当年的第一天
8632
- const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
8633
- // 计算到最近的星期四的完整周数
8634
- const weekNo = Math.ceil((((d - yearStart) / 86400000) + 1) / 7);
8635
- // 返回周数
8636
- return weekNo;
8637
- };
8638
-
8639
- const getRangeHours = function(ranges) {
8640
- const hours = [];
8641
- let disabledHours = [];
8642
-
8643
- (ranges || []).forEach(range => {
8644
- const value = range.map(date => date.getHours());
8645
-
8646
- disabledHours = disabledHours.concat(newArray(value[0], value[1]));
8647
- });
8648
-
8649
- if (disabledHours.length) {
8650
- for (let i = 0; i < 24; i++) {
8651
- hours[i] = disabledHours.indexOf(i) === -1;
8652
- }
8653
- } else {
8654
- for (let i = 0; i < 24; i++) {
8655
- hours[i] = false;
8656
- }
8657
- }
8658
-
8659
- return hours;
8660
- };
8661
-
8662
- const getPrevMonthLastDays = (date, amount) => {
8663
- if (amount <= 0) return [];
8664
- const temp = new Date(date.getTime());
8665
- temp.setDate(0);
8666
- const lastDay = temp.getDate();
8667
- return range(amount).map((_, index) => lastDay - (amount - index - 1));
8668
- };
8669
-
8670
- const getMonthDays = (date) => {
8671
- const temp = new Date(date.getFullYear(), date.getMonth() + 1, 0);
8672
- const days = temp.getDate();
8673
- return range(days).map((_, index) => index + 1);
8674
- };
8675
-
8676
- function setRangeData(arr, start, end, value) {
8677
- for (let i = start; i < end; i++) {
8678
- arr[i] = value;
8679
- }
8680
- }
8681
-
8682
- const getRangeMinutes = function(ranges, hour) {
8683
- const minutes = new Array(60);
8684
-
8685
- if (ranges.length > 0) {
8686
- ranges.forEach(range => {
8687
- const start = range[0];
8688
- const end = range[1];
8689
- const startHour = start.getHours();
8690
- const startMinute = start.getMinutes();
8691
- const endHour = end.getHours();
8692
- const endMinute = end.getMinutes();
8693
- if (startHour === hour && endHour !== hour) {
8694
- setRangeData(minutes, startMinute, 60, true);
8695
- } else if (startHour === hour && endHour === hour) {
8696
- setRangeData(minutes, startMinute, endMinute + 1, true);
8697
- } else if (startHour !== hour && endHour === hour) {
8698
- setRangeData(minutes, 0, endMinute + 1, true);
8699
- } else if (startHour < hour && endHour > hour) {
8700
- setRangeData(minutes, 0, 60, true);
8701
- }
8702
- });
8703
- } else {
8704
- setRangeData(minutes, 0, 60, true);
8705
- }
8706
- return minutes;
8707
- };
8708
-
8709
- const range = function(n) {
8710
- // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n
8711
- return Array.apply(null, {length: n}).map((_, n) => n);
8712
- };
8713
-
8714
- const modifyDate = function(date, y, m, d) {
8715
- return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds());
8716
- };
8717
-
8718
- const modifyTime = function(date, h, m, s) {
8719
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds());
8720
- };
8721
-
8722
- const modifyWithTimeString = (date, time) => {
8723
- if (date == null || !time) {
8724
- return date;
8725
- }
8726
- time = parseDate(time, 'HH:mm:ss');
8727
- return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds());
8728
- };
8729
-
8730
- const clearTime = function(date) {
8731
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
8732
- };
8733
-
8734
- const clearMilliseconds = function(date) {
8735
- return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0);
8736
- };
8737
-
8738
- const limitTimeRange = function(date, ranges, format = 'HH:mm:ss') {
8739
- // TODO: refactory a more elegant solution
8740
- if (ranges.length === 0) return date;
8741
- const normalizeDate = date => fecha.parse(fecha.format(date, format), format);
8742
- const ndate = normalizeDate(date);
8743
- const nranges = ranges.map(range => range.map(normalizeDate));
8744
- if (nranges.some(nrange => ndate >= nrange[0] && ndate <= nrange[1])) return date;
8745
-
8746
- let minDate = nranges[0][0];
8747
- let maxDate = nranges[0][0];
8748
-
8749
- nranges.forEach(nrange => {
8750
- minDate = new Date(Math.min(nrange[0], minDate));
8751
- maxDate = new Date(Math.max(nrange[1], minDate));
8752
- });
8753
-
8754
- const ret = ndate < minDate ? minDate : maxDate;
8755
- // preserve Year/Month/Date
8756
- return modifyDate(
8757
- ret,
8758
- date.getFullYear(),
8759
- date.getMonth(),
8760
- date.getDate()
8761
- );
8762
- };
8763
-
8764
- const timeWithinRange = function(date, selectableRange, format) {
8765
- const limitedDate = limitTimeRange(date, selectableRange, format);
8766
- return limitedDate.getTime() === date.getTime();
8767
- };
8768
-
8769
- const changeYearMonthAndClampDate = function(date, year, month) {
8770
- // clamp date to the number of days in `year`, `month`
8771
- // eg: (2010-1-31, 2010, 2) => 2010-2-28
8772
- const monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month));
8773
- return modifyDate(date, year, month, monthDate);
8774
- };
8775
-
8776
- const prevMonth = function(date) {
8777
- const year = date.getFullYear();
8778
- const month = date.getMonth();
8779
- return month === 0
8780
- ? changeYearMonthAndClampDate(date, year - 1, 11)
8781
- : changeYearMonthAndClampDate(date, year, month - 1);
8782
- };
8783
-
8784
- const nextMonth = function(date) {
8785
- const year = date.getFullYear();
8786
- const month = date.getMonth();
8787
- return month === 11
8788
- ? changeYearMonthAndClampDate(date, year + 1, 0)
8789
- : changeYearMonthAndClampDate(date, year, month + 1);
8790
- };
8791
-
8792
- const prevYear = function(date, amount = 1) {
8793
- const year = date.getFullYear();
8794
- const month = date.getMonth();
8795
- return changeYearMonthAndClampDate(date, year - amount, month);
8796
- };
8797
-
8798
- const nextYear = function(date, amount = 1) {
8799
- const year = date.getFullYear();
8800
- const month = date.getMonth();
8801
- return changeYearMonthAndClampDate(date, year + amount, month);
8802
- };
8803
-
8804
- const extractDateFormat = function(format) {
8805
- return format
8806
- .replace(/\W?m{1,2}|\W?ZZ/g, '')
8807
- .replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '')
8808
- .trim();
8809
- };
8810
-
8811
- const extractTimeFormat = function(format) {
8812
- return format
8813
- .replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '')
8814
- .trim();
8815
- };
8816
-
8817
- const validateRangeInOneMonth = function(start, end) {
8818
- return (start.getMonth() === end.getMonth()) && (start.getFullYear() === end.getFullYear());
8819
- };
8820
-
8821
9412
  /**
8822
9413
  * 计算两个日期之间的工作日数量(不包括周末和节假日)
8823
9414
  * @param {string} start_date - 开始日期字符串,格式为 "YYYY-MM-DD"
8824
9415
  * @param {string} end_date - 结束日期字符串,格式为 "YYYY-MM-DD"
8825
9416
  * @param {Array<string>} holidays - 假期日期字符串数组,格式为 "YYYY-MM-DD"
8826
9417
  * @returns {number} 工作日数量
8827
- */
8828
- const calculateNetworkDays = function (start_date, end_date, holidays = []) {
8829
- if (typeof start_date !== 'string' || typeof end_date !== 'string') {
8830
- throw new Error(
8831
- "Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'."
8832
- );
8833
- }
8834
-
8835
- const startDateObj = new Date(start_date);
8836
- const endDateObj = new Date(end_date);
8837
-
8838
- if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
8839
- throw new Error(
8840
- "Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'."
8841
- );
8842
- }
8843
-
8844
- if (startDateObj > endDateObj) {
8845
- throw new Error('Start date should be earlier than or equal to end date.');
8846
- }
8847
-
8848
- let workdays = 0;
8849
-
8850
- // Iterate through each day in the date range
8851
- for (
8852
- let currentDate = new Date(startDateObj);
8853
- currentDate <= endDateObj;
8854
- currentDate.setDate(currentDate.getDate() + 1)
8855
- ) {
8856
- // Check if the current day is a weekend (Saturday or Sunday)
8857
- const isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
8858
-
8859
- // Check if the current day is a holiday
8860
- const isHoliday = holidays.some((holiday) => {
8861
- const holidayDate = new Date(holiday);
8862
- return currentDate.toDateString() === holidayDate.toDateString();
8863
- });
8864
-
8865
- // If it's a workday (not a weekend or holiday), increment the workdays count
8866
- if (!isWeekend && !isHoliday) {
8867
- workdays++;
8868
- }
8869
- }
8870
-
8871
- return workdays;
8872
- };
8873
-
9418
+ */
9419
+ var calculateNetworkDays = function calculateNetworkDays(start_date, end_date) {
9420
+ var holidays = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
9421
+
9422
+ if (typeof start_date !== 'string' || typeof end_date !== 'string') {
9423
+ throw new Error("Invalid input. Please provide valid date strings in the format 'YYYY-MM-DD'.");
9424
+ }
9425
+
9426
+ var startDateObj = new Date(start_date);
9427
+ var endDateObj = new Date(end_date);
9428
+
9429
+ if (isNaN(startDateObj.getTime()) || isNaN(endDateObj.getTime())) {
9430
+ throw new Error("Invalid date format. Please provide valid date strings in the format 'YYYY-MM-DD'.");
9431
+ }
9432
+
9433
+ if (startDateObj > endDateObj) {
9434
+ throw new Error('Start date should be earlier than or equal to end date.');
9435
+ }
9436
+
9437
+ var workdays = 0;
9438
+
9439
+ // Iterate through each day in the date range
9440
+
9441
+ var _loop = function _loop(currentDate) {
9442
+ // Check if the current day is a weekend (Saturday or Sunday)
9443
+ var isWeekend = currentDate.getDay() === 0 || currentDate.getDay() === 6;
9444
+
9445
+ // Check if the current day is a holiday
9446
+ var isHoliday = holidays.some(function (holiday) {
9447
+ var holidayDate = new Date(holiday);
9448
+ return currentDate.toDateString() === holidayDate.toDateString();
9449
+ });
9450
+
9451
+ // If it's a workday (not a weekend or holiday), increment the workdays count
9452
+ if (!isWeekend && !isHoliday) {
9453
+ workdays++;
9454
+ }
9455
+ };
9456
+
9457
+ for (var currentDate = new Date(startDateObj); currentDate <= endDateObj; currentDate.setDate(currentDate.getDate() + 1)) {
9458
+ _loop(currentDate);
9459
+ }
9460
+
9461
+ return workdays;
9462
+ };
9463
+
8874
9464
  /**
8875
9465
  * 日期加减天数
8876
9466
  * @param {string} start_date - 起始日期字符串,格式为 "YYYY-MM-DD"
8877
9467
  * @param {number} days - 要加上或减去的天数,正数表示加,负数表示减
8878
9468
  * @returns {string} 结果日期,格式为 "YYYY-MM-DD"
8879
- */
8880
- const dateAddDays = function (start_date, days) {
8881
- if (typeof start_date !== 'string' || !Number.isInteger(days)) {
8882
- throw new Error(
8883
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days."
8884
- );
8885
- }
8886
-
8887
- const startDateObj = new Date(start_date);
8888
- if (isNaN(startDateObj.getTime())) {
8889
- throw new Error(
8890
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
8891
- );
8892
- }
8893
-
8894
- const resultDateObj = new Date(startDateObj);
8895
- resultDateObj.setDate(resultDateObj.getDate() + days);
8896
-
8897
- const resultYear = resultDateObj.getFullYear();
8898
- const resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
8899
- const resultDay = String(resultDateObj.getDate()).padStart(2, '0');
8900
-
8901
- return `${resultYear}-${resultMonth}-${resultDay}`;
8902
- };
8903
-
9469
+ */
9470
+ var dateAddDays = function dateAddDays(start_date, days) {
9471
+ if (typeof start_date !== 'string' || !Number.isInteger(days)) {
9472
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD' and a valid integer for the number of days.");
9473
+ }
9474
+
9475
+ var startDateObj = new Date(start_date);
9476
+ if (isNaN(startDateObj.getTime())) {
9477
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
9478
+ }
9479
+
9480
+ var resultDateObj = new Date(startDateObj);
9481
+ resultDateObj.setDate(resultDateObj.getDate() + days);
9482
+
9483
+ var resultYear = resultDateObj.getFullYear();
9484
+ var resultMonth = String(resultDateObj.getMonth() + 1).padStart(2, '0');
9485
+ var resultDay = String(resultDateObj.getDate()).padStart(2, '0');
9486
+
9487
+ return resultYear + '-' + resultMonth + '-' + resultDay;
9488
+ };
9489
+
8904
9490
  /**
8905
9491
  * 计算两个日期之间的差值
8906
9492
  * @date 2023年12月14日
@@ -8908,182 +9494,180 @@ const dateAddDays = function (start_date, days) {
8908
9494
  * @param {String} end_date - 结束日期字符串
8909
9495
  * @param {String} unit - 单位:year/month/day
8910
9496
  * @returns {Number} 差值
8911
- */
8912
- const dateDiff = function (start_date, end_date, unit = 'day') {
8913
- // Assuming date strings are in "YYYY-MM-DD" format
8914
- var startDate = new Date(start_date);
8915
- var endDate = new Date(end_date);
8916
-
8917
- // If the date is invalid, return 0
8918
- if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
8919
- return 0;
8920
- }
8921
-
8922
- if (unit === 'year') {
8923
- return endDate.getFullYear() - startDate.getFullYear();
8924
- } else if (unit === 'month') {
8925
- return (
8926
- (endDate.getFullYear() - startDate.getFullYear()) * 12 +
8927
- (endDate.getMonth() - startDate.getMonth())
8928
- );
8929
- } else {
8930
- // Default to day
8931
- var timeDifference = endDate - startDate;
8932
- // Calculate days (86400000 milliseconds per day)
8933
- return Math.floor(timeDifference / 86400000);
8934
- }
8935
- };
8936
-
9497
+ */
9498
+ var dateDiff = function dateDiff(start_date, end_date) {
9499
+ var unit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
9500
+
9501
+ // Assuming date strings are in "YYYY-MM-DD" format
9502
+ var startDate = new Date(start_date);
9503
+ var endDate = new Date(end_date);
9504
+
9505
+ // If the date is invalid, return 0
9506
+ if (isNaN(startDate.getTime()) || isNaN(endDate.getTime())) {
9507
+ return 0;
9508
+ }
9509
+
9510
+ if (unit === 'year') {
9511
+ return endDate.getFullYear() - startDate.getFullYear();
9512
+ } else if (unit === 'month') {
9513
+ return (endDate.getFullYear() - startDate.getFullYear()) * 12 + (endDate.getMonth() - startDate.getMonth());
9514
+ } else {
9515
+ // Default to day
9516
+ var timeDifference = endDate - startDate;
9517
+ // Calculate days (86400000 milliseconds per day)
9518
+ return Math.floor(timeDifference / 86400000);
9519
+ }
9520
+ };
9521
+
8937
9522
  /**
8938
9523
  * 获取月份中的日期
8939
9524
  * @param {string} date - 日期字符串,格式为 "YYYY-MM-DD"
8940
9525
  * @returns {number} 月份中的日期(1-31)
8941
- */
8942
- const dayOfMonth = function (date) {
8943
- if (typeof date !== 'string') {
8944
- throw new Error(
8945
- "Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'."
8946
- );
8947
- }
8948
-
8949
- const dateObj = new Date(date);
8950
- if (isNaN(dateObj.getTime())) {
8951
- throw new Error(
8952
- "Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'."
8953
- );
8954
- }
8955
-
8956
- return dateObj.getDate();
8957
- };
8958
-
9526
+ */
9527
+ var dayOfMonth = function dayOfMonth(date) {
9528
+ if (typeof date !== 'string') {
9529
+ throw new Error("Invalid input. Please provide a valid date string in the format 'YYYY-MM-DD'.");
9530
+ }
9531
+
9532
+ var dateObj = new Date(date);
9533
+ if (isNaN(dateObj.getTime())) {
9534
+ throw new Error("Invalid date format. Please provide a valid date string in the format 'YYYY-MM-DD'.");
9535
+ }
9536
+
9537
+ return dateObj.getDate();
9538
+ };
9539
+
8959
9540
  /**
8960
9541
  * 获取当前日期
8961
9542
  * @date 2022年5月7日
8962
9543
  * @param {string} format - 日期格式,默认为'YYYY-MM-DD'
8963
9544
  * @returns {string} 当前日期的格式化字符串
8964
- */
8965
- const getCurrentDate = function (format = 'YYYY-MM-DD') {
8966
- return formatDate(new Date(), format);
8967
- };
8968
-
9545
+ */
9546
+ var getCurrentDate = function getCurrentDate() {
9547
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD';
9548
+
9549
+ return formatDate(new Date(), format);
9550
+ };
9551
+
8969
9552
  /**
8970
9553
  * 获取当前日期时间
8971
9554
  * @date 2022年5月7日
8972
9555
  * @param {string} format - 日期时间格式,默认为'YYYY-MM-DD HH:mm:ss'
8973
9556
  * @returns {string} 当前日期时间的格式化字符串
8974
- */
8975
- const getCurrentDateTime = function (format = 'YYYY-MM-DD HH:mm:ss') {
8976
- return formatDate(new Date(), format);
8977
- };
8978
-
9557
+ */
9558
+ var getCurrentDateTime = function getCurrentDateTime() {
9559
+ var format = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'YYYY-MM-DD HH:mm:ss';
9560
+
9561
+ return formatDate(new Date(), format);
9562
+ };
9563
+
8979
9564
  /**
8980
9565
  * 获取小时
8981
9566
  * @date 2022年5月7日
8982
9567
  * @param {Date|string} [date] - 日期对象或日期字符串
8983
9568
  * @returns {number} 小时数(0-23)
8984
- */
8985
- const getHour = function (date) {
8986
- if (!date) {
8987
- return new Date().getHours();
8988
- }
8989
- if (typeof date === 'string') {
8990
- date = new Date(date);
8991
- }
8992
- return date.getHours();
8993
- };
8994
-
9569
+ */
9570
+ var getHour = function getHour(date) {
9571
+ if (!date) {
9572
+ return new Date().getHours();
9573
+ }
9574
+ if (typeof date === 'string') {
9575
+ date = new Date(date);
9576
+ }
9577
+ return date.getHours();
9578
+ };
9579
+
8995
9580
  /**
8996
9581
  * 获取分钟
8997
9582
  * @date 2022年5月7日
8998
9583
  * @param {Date|string} [date] - 日期对象或日期字符串
8999
9584
  * @returns {number} 分钟数(0-59)
9000
- */
9001
- const getMinute = function (date) {
9002
- if (!date) {
9003
- return new Date().getMinutes();
9004
- }
9005
- if (typeof date === 'string') {
9006
- date = new Date(date);
9007
- }
9008
- return date.getMinutes();
9009
- };
9010
-
9585
+ */
9586
+ var getMinute = function getMinute(date) {
9587
+ if (!date) {
9588
+ return new Date().getMinutes();
9589
+ }
9590
+ if (typeof date === 'string') {
9591
+ date = new Date(date);
9592
+ }
9593
+ return date.getMinutes();
9594
+ };
9595
+
9011
9596
  /**
9012
9597
  * 获取月份
9013
9598
  * @date 2022年5月7日
9014
9599
  * @param {Date|string} [date] - 日期对象或日期字符串
9015
9600
  * @returns {number} 月份数(1-12)
9016
- */
9017
- const getMonth = function (date) {
9018
- if (!date) {
9019
- return new Date().getMonth() + 1;
9020
- }
9021
- if (typeof date === 'string') {
9022
- date = new Date(date);
9023
- }
9024
- return date.getMonth() + 1;
9025
- };
9026
-
9601
+ */
9602
+ var getMonth = function getMonth(date) {
9603
+ if (!date) {
9604
+ return new Date().getMonth() + 1;
9605
+ }
9606
+ if (typeof date === 'string') {
9607
+ date = new Date(date);
9608
+ }
9609
+ return date.getMonth() + 1;
9610
+ };
9611
+
9027
9612
  /**
9028
9613
  * 获取秒
9029
9614
  * @date 2022年5月7日
9030
9615
  * @param {Date|string} [date] - 日期对象或日期字符串
9031
9616
  * @returns {number} 秒数(0-59)
9032
- */
9033
- const getSecond = function (date) {
9034
- if (!date) {
9035
- return new Date().getSeconds();
9036
- }
9037
- if (typeof date === 'string') {
9038
- date = new Date(date);
9039
- }
9040
- return date.getSeconds();
9041
- };
9042
-
9617
+ */
9618
+ var getSecond = function getSecond(date) {
9619
+ if (!date) {
9620
+ return new Date().getSeconds();
9621
+ }
9622
+ if (typeof date === 'string') {
9623
+ date = new Date(date);
9624
+ }
9625
+ return date.getSeconds();
9626
+ };
9627
+
9043
9628
  /**
9044
9629
  * 获取星期几
9045
9630
  * @date 2022年5月7日
9046
9631
  * @param {Date|string} [date] - 日期对象或日期字符串
9047
9632
  * @returns {number} 星期几(0-6,0表示星期日)
9048
- */
9049
- const getWeekday = function (date) {
9050
- if (!date) {
9051
- return new Date().getDay();
9052
- }
9053
- if (typeof date === 'string') {
9054
- date = new Date(date);
9055
- }
9056
- return date.getDay();
9057
- };
9058
-
9059
-
9633
+ */
9634
+ var getWeekday = function getWeekday(date) {
9635
+ if (!date) {
9636
+ return new Date().getDay();
9637
+ }
9638
+ if (typeof date === 'string') {
9639
+ date = new Date(date);
9640
+ }
9641
+ return date.getDay();
9642
+ };
9643
+
9060
9644
  /**
9061
9645
  * @desc 获取上午/下午/晚上
9062
9646
  * @author huangbo
9063
9647
  * @date 2022年5月7日
9064
9648
  * @param {String} [time] - 时间
9065
- **/
9066
- const timeCycle = function (time) {
9067
- let hour = 0;
9068
- if (!time) {
9069
- hour = new Date().getHours();
9070
- } else if (typeof time === 'string') {
9071
- // 从时间字符串中提取小时
9072
- const match = time.match(/^(\d{1,2})/);
9073
- if (match) {
9074
- hour = parseInt(match[1], 10);
9075
- }
9076
- } else if (typeof time === 'number') {
9077
- hour = time;
9078
- }
9079
- // 判断时间段
9080
- if (hour >= 5 && hour < 12) {
9081
- return '上午';
9082
- } else if (hour >= 12 && hour < 18) {
9083
- return '下午';
9084
- } else {
9085
- return '晚上';
9086
- }
9649
+ **/
9650
+ var timeCycle = function timeCycle(time) {
9651
+ var hour = 0;
9652
+ if (!time) {
9653
+ hour = new Date().getHours();
9654
+ } else if (typeof time === 'string') {
9655
+ // 从时间字符串中提取小时
9656
+ var match = time.match(/^(\d{1,2})/);
9657
+ if (match) {
9658
+ hour = parseInt(match[1], 10);
9659
+ }
9660
+ } else if (typeof time === 'number') {
9661
+ hour = time;
9662
+ }
9663
+ // 判断时间段
9664
+ if (hour >= 5 && hour < 12) {
9665
+ return '上午';
9666
+ } else if (hour >= 12 && hour < 18) {
9667
+ return '下午';
9668
+ } else {
9669
+ return '晚上';
9670
+ }
9087
9671
  };
9088
9672
 
9089
9673
  /***/ }),
@@ -9095,31 +9679,105 @@ module.exports = require("eoss/lib/message-box");
9095
9679
 
9096
9680
  /***/ }),
9097
9681
 
9098
- /***/ 85:
9099
- /***/ (function(module, exports) {
9682
+ /***/ 83:
9683
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
9100
9684
 
9101
- module.exports = require("eoss/lib/pagination");
9685
+ "use strict";
9686
+ /* unused harmony export resolvePropValue */
9687
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getPropRaw; });
9688
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return propsToObject; });
9689
+ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
9690
+
9691
+ /**
9692
+ * 节点 props 定义数组与取值转换工具
9693
+ *
9694
+ * 节点 props 存定义数组:[{ name, type, default?, options?, value? }],
9695
+ * value 仅在用户改动后写入条目;字符串取值支持 {{变量名}} 语法
9696
+ * 引用页面 data 中定义的变量(整体匹配按变量绑定,局部匹配按插值)
9697
+ */
9698
+
9699
+ /** 整体匹配 {{expr}} */
9700
+ var FULL_VAR = /^\{\{([\s\S]+)\}\}$/;
9701
+ /** 局部匹配 {{expr}} */
9702
+ var PART_VAR = /\{\{([\s\S]+?)\}\}/g;
9703
+
9704
+ /** 按点路径从 data 中取变量值 */
9705
+ function lookup(data, expr) {
9706
+ if (!data || (typeof data === 'undefined' ? 'undefined' : _typeof(data)) !== 'object') return undefined;
9707
+ return expr.split('.').reduce(function (cur, key) {
9708
+ if (cur === undefined || cur === null) return undefined;
9709
+ return cur[key];
9710
+ }, data);
9711
+ }
9712
+
9713
+ /** 解析字符串取值中的 {{变量}} 引用;非字符串原样返回 */
9714
+ function resolvePropValue(raw, data) {
9715
+ if (typeof raw !== 'string' || raw.indexOf('{{') === -1) return raw;
9716
+ var full = FULL_VAR.exec(raw);
9717
+ if (full) return lookup(data, full[1].trim());
9718
+ return raw.replace(PART_VAR, function (all, expr) {
9719
+ var val = lookup(data, expr.trim());
9720
+ return val === undefined || val === null ? '' : val;
9721
+ });
9722
+ }
9723
+
9724
+ /** 按名读取条目原始取值(value 优先、其次 default);兼容历史对象形态 */
9725
+ function getPropRaw(props, name) {
9726
+ if (!props) return undefined;
9727
+ if (!Array.isArray(props)) return props[name];
9728
+ var item = props.find(function (p) {
9729
+ return p && p.name === name;
9730
+ });
9731
+ if (!item) return undefined;
9732
+ return item.value !== undefined ? item.value : item.default;
9733
+ }
9734
+
9735
+ /**
9736
+ * 定义数组 → 组件 v-bind 用的取值对象;
9737
+ * 兼容历史对象形态 props(原样透传,跳过 v- 键)
9738
+ */
9739
+ function propsToObject(props, data) {
9740
+ if (!props) return {};
9741
+ if (!Array.isArray(props)) {
9742
+ var _result = {};
9743
+ Object.keys(props).forEach(function (key) {
9744
+ if (key.startsWith('v-')) return;
9745
+ _result[key] = props[key];
9746
+ });
9747
+ return _result;
9748
+ }
9749
+ var result = {};
9750
+ props.forEach(function (item) {
9751
+ if (!item || !item.name) return;
9752
+ var raw = item.value !== undefined ? item.value : item.default;
9753
+ if (raw === undefined) return;
9754
+ var val = resolvePropValue(raw, data);
9755
+ if (val === undefined) return;
9756
+ result[item.name] = val;
9757
+ });
9758
+ return result;
9759
+ }
9102
9760
 
9103
9761
  /***/ }),
9104
9762
 
9105
- /***/ 86:
9763
+ /***/ 87:
9106
9764
  /***/ (function(module, exports) {
9107
9765
 
9108
- module.exports = require("eoss/lib/empty");
9766
+ module.exports = require("eoss/lib/pagination");
9109
9767
 
9110
9768
  /***/ }),
9111
9769
 
9112
- /***/ 9:
9770
+ /***/ 88:
9113
9771
  /***/ (function(module, exports) {
9114
9772
 
9115
- module.exports = require("eoss/lib/message");
9773
+ module.exports = require("eoss/lib/empty");
9116
9774
 
9117
9775
  /***/ }),
9118
9776
 
9119
- /***/ 98:
9777
+ /***/ 9:
9120
9778
  /***/ (function(module, exports) {
9121
9779
 
9122
- module.exports = require("eoss/lib/card");
9780
+ module.exports = require("eoss/lib/message");
9123
9781
 
9124
9782
  /***/ })
9125
9783