⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpletype.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 2 页
字号:
/*
 * Isomorphic SmartClient
 * Version 6.5 (2008-04-30)
 * Copyright(c) 1998-2007 Isomorphic Software, Inc. All rights reserved.
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 *
 * licensing@smartclient.com
 *
 * http://smartclient.com/license
 */
 isc.builtinTypes ={    // basic types    text:{validators:{type:"isString", typeCastValidator:true}},    "boolean":{validators:{type:"isBoolean", typeCastValidator:true}},    integer:{validators:{type:"isInteger", typeCastValidator:true},             normalDisplayFormatter : function (value, field) {                if (isc.isA.Number(value)) return value.toFormattedString();                return value;             }    },    "float":{validators:{type:"isFloat", typeCastValidator:true},             normalDisplayFormatter : function (value, field) {                if (isc.isA.Number(value)) return value.toFormattedString();                return value;             }    },    date:{validators:{type:"isDate", typeCastValidator:true},             normalDisplayFormatter : function (value, field) {                if (isc.isA.Date(value)) return value.toNormalDate();                return value;             }        },    time:{validators:{type:"isTime", typeCastValidator:true},             normalDisplayFormatter : function (value, field) {                if (isc.isA.Date(value)) return isc.Time.toTime(value);                return value;             }        },    // synonyms of basic types.  NOTE: must inheritFrom rather than duplicate base type    // definitions, so that the equivalent of "instanceof" checks will detect them as    // being of the same base type    string:{inheritsFrom:"text"}, // XML Schema    "int":{inheritsFrom:"integer"}, // XML Schema    "long":{inheritsFrom:"integer"},    number:{inheritsFrom:"integer"},    decimal:{inheritsFrom:"float"}, // XML Schema    "double":{inheritsFrom:"float"}, // XML Schema    dateTime:{inheritsFrom:"date"}, // XML Schema    datetime:{inheritsFrom:"date"},    // derived types    positiveInteger:{        inheritsFrom:"integer",        validators:{type:"integerRange", min:0}    },    integerPercent:{        inheritsFrom:"integer",        validators:{type:"integerRange", min:0, max:100}    },    percent:{inheritsFrom:"integerPercent"},    sequence:{inheritsFrom:"integer"},    "enum":{validators:"isOneOf"},    "intEnum":{inheritsFrom:"integer",validators:"isOneOf"},    regexp:{inheritsFrom:"text", validators:"isRegexp"},    identifier:{inheritsFrom:"text", validators:"isIdentifier"},    URL:{inheritsFrom:"text"},    HTML:{inheritsFrom:"text"},    measure:{validators:"isMeasure"},    integerOrAuto:{validators:"integerOrAuto"},    expression:{inheritsFrom:"text"},    method:{inheritsFrom:"text"},    "function":{inheritsFrom:"text"},    alignEnum:{        inheritsFrom:"enum",        valueMap:{left:"left", center:"center", right:"right"}    },    valignEnum:{        inheritsFrom:"enum",        valueMap:{top:"top", bottom:"bottom", center:"center"}    },    sideEnum:{        inheritsFrom:"enum",        valueMap:{left:"left", right:"right", top:"top", bottom:"bottom"}    },    color:{inheritsFrom:"string", validators:"isColor"}    };(function () {         for (var typeName in isc.builtinTypes) {        isc.builtinTypes[typeName].name = typeName;    }})();//> @class SimpleType// An atomic type such as a string or number, that is generally stored, displayed and// manipulated as a single value.// <P>// SimpleTypes can be created at any time, and subsequently referred to as a // +link{dataSourceField.type,field type} in +link{DataSource,DataSources} and// +link{DataBoundComponent,DataBoundComponents}.  This allows you to define// +link{simpleType.validators,validation}, +link{simpleType.normalDisplayFormatter,formatting}// and +link{simpleType.editorType,editing} behaviors for a type to be reused across all// +link{DataBoundComponent,DataBoundComponents}.// <P>// Note that the term "simpleType" is used in the same sense as in// +externalLink{XML Schema,http://www.w3.org/TR/xmlschema-0/}, and// +link{XMLTools.loadXMLSchema()} will create new SimpleType definitions.// <P>// An +explorerExample{customSimpleType,example} is here.//// @treeLocation Client Reference/Data Binding// @visibility external// @example customSimpleType//<isc.defineClass("SimpleType").addClassMethods({    //> @attr simpleType.name (identifier : null : IR)    // Name of the type, used to refer to the type from +link{DataSourceField.name,field.name}.    // @visibility external    //<    //> @attr simpleType.inheritsFrom (identifier : null : IR)    // Name of another SimpleType from which this type should inherit.    // <P>    // Validators, if any, will be combined.  All other SimpleType properties default to the    // inherited type's value.    //    // @visibility external    // @example customSimpleType    //<    //> @attr simpleType.validators (Array of Validator : null : IR)    // Validators to apply to value of this type.    //    // @group validation    // @visibility external    //<        //> @attr simpleType.valueMap (ValueMap : null : IR)    // List of legal values for this type, like +link{DataSourceField.valueMap}.    //    // @group dataType    // @visibility external    //<    //> @attr simpleType.editorType (FormItem ClassName : null : IR)    // Classname of the FormItem that should be the default for editing values of this type (eg    // "SelectItem").    // <P>    // You can create a simple custom FormItem by adding default +link{FormItem.icons} that    // launch custom value picking dialogs (an example is in the <i>QuickStart    // Guide</i>, Chapter 9, <i>Extending SmartClient</i>).  By setting simpleType.editorType    // to the name of your custom FormItem, forms will automatically use the custom FormItem,    // as will grids performing +link{listGrid.canEdit,inline editing}.    //    // @visibility external    //<    //> @method simpleType.shortDisplayFormatter()     // Formatter for values of this type when compact display is required, for example, in a    // +link{ListGrid} or +link{TreeGrid}.    // <P>    // When this formatter is called, the SimpleType object is available as "this".      // <P>    // A formatter can make itself configurable on a per-component or per-field basis by    // checking properties on the component or field.  For example, a formatter for account IDs    // may want to omit a prefix in views where it is redundant, and could check a flag    // listGridField.omitAccountIdPrefix for this purpose.    //    // @param value (any) value to be formatted    // @param [field] (Field) field descriptor from the component calling the formatter, if    //                      applicable.  Depending on the calling component, this could be a    //                      +link{ListGridField}, +link{TreeGridField}, etc    // @param [component] (DataBoundComponent) component calling this formatter, if applicable    // @param [record] (Object) Full record, if applicable    //    // @visibility external    //<     //> @method simpleType.normalDisplayFormatter()     // Normal formatter for values of this type used in a +link{StaticTextItem} or    // +link{DetailViewer}.    // <P>    // When this formatter is called, the SimpleType object is available as "this".      // <P>    // A formatter can make itself configurable on a per-component or per-field basis by    // checking properties on the component or field.  For example, a formatter for account IDs    // may want to omit a prefix in views where it is redundant, and could check a flag    // detailViewer.omitAccountIdPrefix for this purpose.    //    // @param value (any) value to be formatted    // @param [field] (Field) field descriptor from the component calling the formatter, if    //                      applicable.  Depending on the calling component, this could be a    //                      +link{FormItem}, +link{DetailViewerField}, etc

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -