mpBuilder-compiled.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. (function (global, factory) {
  2. define && define.amd && define(factory);
  3. // global.$r = factory();
  4. })(this, function () {
  5. var r = function r(h) {
  6. this.h = h;
  7. };
  8. var t = function t() {
  9. this.data = this._initData();
  10. };
  11. r.prototype = {
  12. form: function form(data, VNodeFn) {
  13. return this.make('i-form', data, VNodeFn);
  14. },
  15. formItem: function formItem(data, VNodeFn) {
  16. return this.make('form-Item', data, VNodeFn);
  17. },
  18. input: function input(data, VNodeFn) {
  19. return this.make('i-input', data, VNodeFn);
  20. },
  21. inputNumber: function inputNumber(data, VNodeFn) {
  22. return this.make('Input-Number', data, VNodeFn);
  23. },
  24. radioGroup: function radioGroup(data, VNodeFn) {
  25. return this.make('Radio-Group', data, VNodeFn);
  26. },
  27. radio: function radio(data, VNodeFn) {
  28. return this.make('Radio', data, VNodeFn);
  29. },
  30. checkboxGroup: function checkboxGroup(data, VNodeFn) {
  31. return this.make('Checkbox-Group', data, VNodeFn);
  32. },
  33. checkbox: function checkbox(data, VNodeFn) {
  34. return this.make('Checkbox', data, VNodeFn);
  35. },
  36. select: function select(data, VNodeFn) {
  37. return this.make('i-select', data, VNodeFn);
  38. },
  39. option: function option(data, VNodeFn) {
  40. return this.make('i-option', data, VNodeFn);
  41. },
  42. datePicker: function datePicker(data, VNodeFn) {
  43. return this.make('Date-Picker', data, VNodeFn);
  44. },
  45. timePicker: function timePicker(data, VNodeFn) {
  46. return this.make('Time-Picker', data, VNodeFn);
  47. },
  48. colorPicker: function colorPicker(data, VNodeFn) {
  49. return this.make('Color-Picker', data, VNodeFn);
  50. },
  51. upload: function upload(data, VNodeFn) {
  52. return this.make('Upload', data, VNodeFn);
  53. },
  54. span: function span(data, VNodeFn) {
  55. if (typeof data == 'string') data = { domProps: { innerHTML: data } };
  56. return this.make('span', data, VNodeFn);
  57. },
  58. icon: function icon(data, VNodeFn) {
  59. return this.make('Icon', data, VNodeFn);
  60. },
  61. button: function button(data, VNodeFn) {
  62. return this.make('i-button', data, VNodeFn);
  63. },
  64. make: function make(nodeName, data, VNodeFn) {
  65. return this.h(nodeName, data, this.getVNode(VNodeFn));
  66. },
  67. more: function more() {
  68. var vNodeList = [];
  69. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  70. args[_key] = arguments[_key];
  71. }
  72. args.map(function (arg) {
  73. vNodeList.push(arg);
  74. });
  75. return vNodeList;
  76. },
  77. getVNode: function getVNode(VNode) {
  78. return typeof VNode == 'function' ? VNode() : VNode;
  79. },
  80. $t: function $t() {
  81. return t;
  82. }
  83. };
  84. t.prototype = {
  85. _initData: function _initData() {
  86. return {
  87. class: {},
  88. style: {},
  89. attrs: {},
  90. props: {},
  91. domProps: {},
  92. on: {},
  93. nativeOn: {},
  94. directives: [],
  95. scopedSlots: {},
  96. slot: undefined,
  97. key: undefined,
  98. ref: undefined
  99. };
  100. },
  101. class: function _class(opt, status) {
  102. status !== undefined ? this.data.class[opt] = status : this.data.class = opt;
  103. return this;
  104. },
  105. style: function style(opt, status) {
  106. status !== undefined ? this.data.style[opt] = status : this.data.style = opt;
  107. return this;
  108. },
  109. attrs: function attrs(opt, value) {
  110. value !== undefined ? this.data.attrs[opt] = value : this.data.attrs = opt;
  111. return this;
  112. },
  113. props: function props(opt, value) {
  114. value !== undefined ? this.data.props[opt] = value : this.data.props = opt;
  115. return this;
  116. },
  117. domProps: function domProps(opt, value) {
  118. value !== undefined ? this.data.domProps[opt] = value : this.data.domProps = opt;
  119. return this;
  120. },
  121. on: function on(opt, call) {
  122. call !== undefined ? this.data.on[opt] = call : this.data.on = opt;
  123. return this;
  124. },
  125. nativeOn: function nativeOn(opt, call) {
  126. call !== undefined ? this.data.nativeOn[opt] = call : this.data.nativeOn = opt;
  127. return this;
  128. },
  129. directives: function directives(opt) {
  130. this.data.directives.push(opt);
  131. return this;
  132. },
  133. scopedSlots: function scopedSlots(opt, call) {
  134. call !== undefined ? this.data.scopedSlots[opt] = call : this.data.scopedSlots = opt;
  135. return this;
  136. },
  137. slot: function slot(value) {
  138. this.data.slot = value;
  139. return this;
  140. },
  141. key: function key(value) {
  142. this.data.key = value;
  143. return this;
  144. },
  145. ref: function ref(value) {
  146. this.data.ref = value;
  147. return this;
  148. },
  149. init: function init() {
  150. this.data = this._initData();
  151. },
  152. get: function get() {
  153. var data = this.data;
  154. this.init();
  155. return data;
  156. }
  157. };
  158. return r;
  159. });
  160. //# sourceMappingURL=mpBuilder-compiled.js.map