Bladeren bron

连续收货 isContinue

luoyifan 3 jaren geleden
bovenliggende
commit
bfe9bc0fa3
1 gewijzigde bestanden met toevoegingen van 276 en 254 verwijderingen
  1. 276 254
      dist/yvan-ext-mobile.js

+ 276 - 254
dist/yvan-ext-mobile.js

@@ -38281,11 +38281,12 @@ define(['exports'], function (exports) { 'use strict';
       picker: {
           xtype: 'datepicker',
           slotOrder: ['year', 'month', 'day'],
-          yearFrom: 1900,
-          yearTo: 2099,
+          yearFrom: 1990,
+          yearTo: 2050,
       },
-      maxDate: moment('2099-12-31').toDate(),
-      minDate: moment('1900-01-01').toDate(),
+      clearable: true,
+      maxDate: moment('2050-12-31').toDate(),
+      minDate: moment('1990-01-01').toDate(),
       // picker: 'floated',
       labelWidth: labelWidth,
   };
@@ -38370,94 +38371,179 @@ define(['exports'], function (exports) { 'use strict';
           flex: 1
       },
   };
-  //# sourceMappingURL=Defaults.js.map
-
-  function initDate () {
-      var cc = Ext.field.Date.prototype.constructor;
-      var _a = Ext.field.Date.prototype, initialize = _a.initialize, getValue = _a.getValue, valueToRaw = _a.valueToRaw;
-      Ext.field.Date.override({
-          dateFormat: 'Y-m-d',
-          altFormats: 'Y-m-d',
-          constructor: function (config) {
-              var newConfig = lodash.defaultsDeep({
-              // 强制属性
-              }, date, config);
-              cc.call(this, newConfig);
-          },
-          getValue: function () {
-              var ov = getValue.call(this);
-              var nv = Ext.util.Format.date(ov, 'Y-m-d');
-              // console.log('cc:', nv, ov)
-              return nv;
-          },
-          initialize: function () {
-              this.on({
-                  expand: function (sender, opts) {
-                      var value = sender.getRawValue();
-                      if (value) {
-                          //@ts-ignore
-                          var dt_1 = moment(value).toDate();
-                          var picker_1 = sender.getPicker();
-                          picker_1.setValue(dt_1);
-                          // 延迟200毫秒后再设定一次值,动画会造成 bug
-                          setTimeout(function () {
-                              picker_1.setValue(dt_1);
-                          }, 200);
-                      }
-                  },
-              });
-              initialize.call(this);
-          },
-      });
-  }
-  //# sourceMappingURL=datefield.js.map
 
   /**
-   * 构建所有组件的公共属性
-   * @param config 原始config
-   * @param dragType 组件模式
-   *      不填,代表不能在设计时被拖拽
-   *      row-container 是一个rows容器
-   *      col-container 是一个cols容器
-   *      col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
-   *      row-item rows中的一行,比如 tree / grid / panel 等等
+   * 创建一个 Ajax 客户端
    */
-  function baseConfig(config, dragType) {
-      if (config && config.designMode && dragType) {
-          var cc = '';
-          switch (dragType) {
-              case "cols-container":
-                  cc = 'design_cols_container';
+  function createAjax(createOption) {
+      if (createOption.baseUrl) {
+          axios$1.defaults.baseURL = createOption.baseUrl;
+          axios$1.defaults.timeout = createOption.timeout;
+          axios$1.defaults.timeoutErrorMessage = '网络超时';
+      }
+      return function (option) {
+          //@ts-ignore
+          option.method = (option.method || 'get').toLocaleLowerCase();
+          //@ts-ignore
+          var ax = __assign({}, option);
+          switch (option.method) {
+              case 'get':
+                  ax.method = 'GET';
+                  ax.params = option.param;
+                  ax.headers = __assign({}, option.headers);
                   break;
-              case "col-item":
-                  cc = 'design_col_item';
+              case 'post':
+                  ax.method = 'POST';
+                  ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
+                  ax.params = option.param;
+                  ax.data = lib.stringify(option.data);
                   break;
-              case "rows-container":
-                  cc = 'design_rows_container';
+              case 'put':
+              case 'patch':
+              case 'delete':
+                  ax.method = option.method;
+                  ax.headers = option.headers;
+                  ax.params = option.param;
+                  ax.data = lib.stringify(option.data);
                   break;
-              case "row-item":
-                  cc = 'design_row_item';
+              case 'download':
+                  downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
+                  return new Promise(function (resolver, reject) {
+                  });
+              case "invoke":
+                  ax.url = serverInvokeUrlTransform(option.url, option);
+                  ax.method = 'POST';
+                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
+                  if (typeof option.args === 'object') {
+                      ax.data = JSON.stringify({
+                          args: option.args,
+                      });
+                  }
+                  else {
+                      ax.data = JSON.stringify({
+                          args: [
+                              __assign(__assign({}, option.data), option.param)
+                          ],
+                          filterModel: option.filterModel,
+                          sortModel: option.sortModel
+                      });
+                  }
                   break;
+              case 'post-json':
+                  ax.method = 'POST';
+                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
+                  ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
+                  break;
+              case 'post-raw':
+                  ax.method = 'POST';
+                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
+                  ax.data = option.data;
+                  break;
+              case 'post-file':
+                  //TODO 刘壮. 上传文件
+                  var forms = new FormData();
+                  ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
+                  lodash.forOwn(option.data, function (value, key) {
+                      if (key === 'files') {
+                          var i_1 = 0;
+                          lodash.each(value, function (f) {
+                              // @ts-ignore
+                              forms.append('file' + (++i_1), f);
+                          });
+                      }
+                      else {
+                          forms.append(key, value);
+                      }
+                  });
+                  ax.data = forms;
+                  ax.method = 'POST';
+                  break;
+              case "sql":
+                  ax.url = sqlUrlTransform(option.url);
+                  ax.method = 'POST';
+                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
+                  ax.data = JSON.stringify({
+                      args: [option.data],
+                      db: option.db,
+                      filterModel: option.filterModel,
+                      sortModel: option.sortModel
+                  });
+                  break;
+              default:
+                  throw new Error('not implements');
           }
-          if (typeof config.cls === 'string') {
-              lodash.extend(config, {
-                  cls: [config.cls, 'yvan_design', cc]
-              });
-          }
-          else if (lodash.isArray(config.cls)) {
-              lodash.extend(config, {
-                  cls: __spread(config.cls, ['yvan_design', cc])
-              });
-          }
-          else {
-              lodash.extend(config, {
-                  cls: ['yvan_design', cc]
+          return new Promise(function (resolver, reject) {
+              axios$1(ax).then(function (resolverRaw) {
+                  var apiResult = {
+                      rawData: resolverRaw.data,
+                      status: resolverRaw.status,
+                      success: (resolverRaw.data && resolverRaw.data.success),
+                      data: resolverRaw.data.data,
+                      pagination: resolverRaw.data.pagination,
+                      msg: (resolverRaw.data.msg),
+                      errors: resolverRaw.data.errors,
+                      headers: resolverRaw.headers
+                  };
+                  resolver(apiResult);
+              }).catch(function (reason) {
+                  reject(reason);
               });
-          }
+          });
+      };
+  }
+  function downLoad(downLoadUrl, filename, data, header, isJson) {
+      if (isJson === void 0) { isJson = false; }
+      var YvanUI = lodash.get(window, 'YvanUI');
+      YvanUI.loading();
+      var createObjectURL = function (object) {
+          return (window.URL) ? window.URL.createObjectURL(object) : lodash.get(window, 'webkitURL').createObjectURL(object);
+      };
+      // const formData = new FormData();
+      // _.forOwn(data, (v, k) => {
+      //     formData.append(k, v);
+      // });
+      var formData = '';
+      var xhr = new XMLHttpRequest();
+      xhr.open('POST', downLoadUrl);
+      xhr.responseType = 'blob';
+      // xhr.setRequestHeader('Authorization', $.cookie('auth'))
+      if (isJson) {
+          formData = data ? JSON.stringify(data) : '';
+          xhr.setRequestHeader('Content-Type', 'application/json');
       }
-      return config;
+      else {
+          formData = data ? lib.stringify(data) : '';
+          xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
+      }
+      //
+      if (header) {
+          lodash.forOwn(header, function (v, k) {
+              xhr.setRequestHeader(k, v);
+          });
+      }
+      xhr.onload = function (e) {
+          if (this.status === 200) {
+              var blob = this.response;
+              if (lodash.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
+                  navigator.msSaveBlob(blob, filename);
+                  YvanUI.clearLoading();
+              }
+              else {
+                  var a = document.createElement('a');
+                  var url = createObjectURL(blob);
+                  a.href = url;
+                  a.download = filename;
+                  document.append(a);
+                  a.click();
+                  a.remove();
+                  window.URL.revokeObjectURL(url);
+                  YvanUI.clearLoading();
+              }
+          }
+      };
+      xhr.send(formData);
   }
-  //# sourceMappingURL=base.js.map
+  //# sourceMappingURL=ajax.js.map
 
   function prompt(message, multiLine, value) {
       if (value === void 0) { value = ''; }
@@ -39774,6 +39860,115 @@ define(['exports'], function (exports) { 'use strict';
     getGridEditRows: getGridEditRows
   });
 
+  function initDate () {
+      var cc = Ext.field.Date.prototype.constructor;
+      var _a = Ext.field.Date.prototype, initialize = _a.initialize, getValue = _a.getValue, valueToRaw = _a.valueToRaw, onPickerChange = _a.onPickerChange;
+      Ext.field.Date.override({
+          dateFormat: 'Y-m-d',
+          altFormats: 'Y-m-d',
+          constructor: function (config) {
+              var newConfig = lodash.defaultsDeep({
+              // 强制属性
+              }, date, config);
+              cc.call(this, newConfig);
+          },
+          getValue: function () {
+              var ov = getValue.call(this);
+              var nv = Ext.util.Format.date(ov, 'Y-m-d');
+              return nv;
+          },
+          onPickerChange: function (sender, value) {
+              var _a, _b, _c;
+              onPickerChange.call(this, sender, value);
+              value = Ext.util.Format.date(value, 'Y-m-d');
+              var scope = lookupScope(this);
+              // console.log('cc:', nv, ov)
+              if (scope) {
+                  var bind = '';
+                  if (typeof ((_a = this.config.bind) === null || _a === void 0 ? void 0 : _a.value) === 'string') {
+                      bind = (_b = this.config.bind) === null || _b === void 0 ? void 0 : _b.value;
+                  }
+                  else if (typeof this.config.bind === 'string') {
+                      bind = this.config.bind;
+                  }
+                  if (bind && lodash.startsWith(bind, '{') && lodash.endsWith(bind, '}')) {
+                      bind = bind.substr(1, bind.length - 2);
+                      if (bind) {
+                          scope.viewModel.set(bind, value);
+                          (_c = sender.ownerCmp) === null || _c === void 0 ? void 0 : _c.fireEvent('change2', sender, value);
+                      }
+                  }
+              }
+          },
+          initialize: function () {
+              this.on({
+                  expand: function (sender, opts) {
+                      var value = sender.getRawValue();
+                      if (value) {
+                          //@ts-ignore
+                          var dt_1 = moment(value).toDate();
+                          var picker_1 = sender.getPicker();
+                          picker_1.setValue(dt_1);
+                          // 延迟200毫秒后再设定一次值,动画会造成 bug
+                          setTimeout(function () {
+                              picker_1.setValue(dt_1);
+                          }, 200);
+                      }
+                  },
+              });
+              initialize.call(this);
+          },
+      });
+  }
+  //# sourceMappingURL=datefield.js.map
+
+  /**
+   * 构建所有组件的公共属性
+   * @param config 原始config
+   * @param dragType 组件模式
+   *      不填,代表不能在设计时被拖拽
+   *      row-container 是一个rows容器
+   *      col-container 是一个cols容器
+   *      col-item cols中的一个格子(非容器),比如 textfield / combofield 等等
+   *      row-item rows中的一行,比如 tree / grid / panel 等等
+   */
+  function baseConfig(config, dragType) {
+      if (config && config.designMode && dragType) {
+          var cc = '';
+          switch (dragType) {
+              case "cols-container":
+                  cc = 'design_cols_container';
+                  break;
+              case "col-item":
+                  cc = 'design_col_item';
+                  break;
+              case "rows-container":
+                  cc = 'design_rows_container';
+                  break;
+              case "row-item":
+                  cc = 'design_row_item';
+                  break;
+          }
+          if (typeof config.cls === 'string') {
+              lodash.extend(config, {
+                  cls: [config.cls, 'yvan_design', cc]
+              });
+          }
+          else if (lodash.isArray(config.cls)) {
+              lodash.extend(config, {
+                  cls: __spread(config.cls, ['yvan_design', cc])
+              });
+          }
+          else {
+              lodash.extend(config, {
+                  cls: ['yvan_design', cc]
+              });
+          }
+      }
+      return config;
+  }
+  //# sourceMappingURL=base.js.map
+
   /**
    * 构建一个 grid 支持的 dataSource
    */
@@ -41134,179 +41329,6 @@ define(['exports'], function (exports) { 'use strict';
   }
   //# sourceMappingURL=init.js.map
 
-  /**
-   * 创建一个 Ajax 客户端
-   */
-  function createAjax(createOption) {
-      if (createOption.baseUrl) {
-          axios$1.defaults.baseURL = createOption.baseUrl;
-          axios$1.defaults.timeout = createOption.timeout;
-          axios$1.defaults.timeoutErrorMessage = '网络超时';
-      }
-      return function (option) {
-          //@ts-ignore
-          option.method = (option.method || 'get').toLocaleLowerCase();
-          //@ts-ignore
-          var ax = __assign({}, option);
-          switch (option.method) {
-              case 'get':
-                  ax.method = 'GET';
-                  ax.params = option.param;
-                  ax.headers = __assign({}, option.headers);
-                  break;
-              case 'post':
-                  ax.method = 'POST';
-                  ax.headers = __assign({ 'Content-Type': 'application/x-www-form-urlencoded' }, option.headers);
-                  ax.params = option.param;
-                  ax.data = lib.stringify(option.data);
-                  break;
-              case 'put':
-              case 'patch':
-              case 'delete':
-                  ax.method = option.method;
-                  ax.headers = option.headers;
-                  ax.params = option.param;
-                  ax.data = lib.stringify(option.data);
-                  break;
-              case 'download':
-                  downLoad(createOption.baseUrl + option.url, option.fileName || 'file', option.data, option.headers);
-                  return new Promise(function (resolver, reject) {
-                  });
-              case "invoke":
-                  ax.url = serverInvokeUrlTransform(option.url, option);
-                  ax.method = 'POST';
-                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
-                  if (typeof option.args === 'object') {
-                      ax.data = JSON.stringify({
-                          args: option.args,
-                      });
-                  }
-                  else {
-                      ax.data = JSON.stringify({
-                          args: [
-                              __assign(__assign({}, option.data), option.param)
-                          ],
-                          filterModel: option.filterModel,
-                          sortModel: option.sortModel
-                      });
-                  }
-                  break;
-              case 'post-json':
-                  ax.method = 'POST';
-                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
-                  ax.data = JSON.stringify(__assign(__assign({}, option.data), { filterModel: option.filterModel, sortModel: option.sortModel }));
-                  break;
-              case 'post-raw':
-                  ax.method = 'POST';
-                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
-                  ax.data = option.data;
-                  break;
-              case 'post-file':
-                  //TODO 刘壮. 上传文件
-                  var forms = new FormData();
-                  ax.headers = __assign({ 'Content-Type': 'multipart/form-data' }, option.headers);
-                  lodash.forOwn(option.data, function (value, key) {
-                      if (key === 'files') {
-                          var i_1 = 0;
-                          lodash.each(value, function (f) {
-                              // @ts-ignore
-                              forms.append('file' + (++i_1), f);
-                          });
-                      }
-                      else {
-                          forms.append(key, value);
-                      }
-                  });
-                  ax.data = forms;
-                  ax.method = 'POST';
-                  break;
-              case "sql":
-                  ax.url = sqlUrlTransform(option.url);
-                  ax.method = 'POST';
-                  ax.headers = __assign({ 'Content-Type': 'application/json' }, option.headers);
-                  ax.data = JSON.stringify({
-                      args: [option.data],
-                      db: option.db,
-                      filterModel: option.filterModel,
-                      sortModel: option.sortModel
-                  });
-                  break;
-              default:
-                  throw new Error('not implements');
-          }
-          return new Promise(function (resolver, reject) {
-              axios$1(ax).then(function (resolverRaw) {
-                  var apiResult = {
-                      rawData: resolverRaw.data,
-                      status: resolverRaw.status,
-                      success: (resolverRaw.data && resolverRaw.data.success),
-                      data: resolverRaw.data.data,
-                      pagination: resolverRaw.data.pagination,
-                      msg: (resolverRaw.data.msg),
-                      errors: resolverRaw.data.errors,
-                      headers: resolverRaw.headers
-                  };
-                  resolver(apiResult);
-              }).catch(function (reason) {
-                  reject(reason);
-              });
-          });
-      };
-  }
-  function downLoad(downLoadUrl, filename, data, header, isJson) {
-      if (isJson === void 0) { isJson = false; }
-      var YvanUI = lodash.get(window, 'YvanUI');
-      YvanUI.loading();
-      var createObjectURL = function (object) {
-          return (window.URL) ? window.URL.createObjectURL(object) : lodash.get(window, 'webkitURL').createObjectURL(object);
-      };
-      // const formData = new FormData();
-      // _.forOwn(data, (v, k) => {
-      //     formData.append(k, v);
-      // });
-      var formData = '';
-      var xhr = new XMLHttpRequest();
-      xhr.open('POST', downLoadUrl);
-      xhr.responseType = 'blob';
-      // xhr.setRequestHeader('Authorization', $.cookie('auth'))
-      if (isJson) {
-          formData = data ? JSON.stringify(data) : '';
-          xhr.setRequestHeader('Content-Type', 'application/json');
-      }
-      else {
-          formData = data ? lib.stringify(data) : '';
-          xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
-      }
-      //
-      if (header) {
-          lodash.forOwn(header, function (v, k) {
-              xhr.setRequestHeader(k, v);
-          });
-      }
-      xhr.onload = function (e) {
-          if (this.status === 200) {
-              var blob = this.response;
-              if (lodash.hasIn(window, 'navigator.msSaveOrOpenBlob')) {
-                  navigator.msSaveBlob(blob, filename);
-                  YvanUI.clearLoading();
-              }
-              else {
-                  var a = document.createElement('a');
-                  var url = createObjectURL(blob);
-                  a.href = url;
-                  a.download = filename;
-                  document.append(a);
-                  a.click();
-                  a.remove();
-                  window.URL.revokeObjectURL(url);
-                  YvanUI.clearLoading();
-              }
-          }
-      };
-      xhr.send(formData);
-  }
-  //# sourceMappingURL=ajax.js.map
-
   exports.Lib = Lib;
   exports.LibParam = LibParam;
   exports.Scope = Scope;