| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332 |
- module.exports =
- /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = function(exports) {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 12);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ 0:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _basic = __webpack_require__(1);
- function mapKeys(source, target, map) {
- Object.keys(map).forEach(function (key) {
- if (source[key]) {
- target[map[key]] = source[key];
- }
- });
- }
- function NutComponent(NutOptions) {
- var options = {};
- mapKeys(NutOptions, options, {
- data: 'data',
- props: 'properties',
- mixins: 'behaviors',
- methods: 'methods',
- beforeCreate: 'created',
- created: 'attached',
- mounted: 'ready',
- destroyed: 'detached',
- classes: 'externalClasses',
- observers: 'observers'
- });
- // add default externalClasses
- options.externalClasses = options.externalClasses || [];
- options.externalClasses.push('custom-class');
- // add default behaviors
- options.behaviors = options.behaviors || [];
- options.behaviors.push(_basic.basic);
- // add relations
- var relation = NutOptions.relation;
- if (relation) {
- options.relations = relation.relations;
- options.behaviors.push(relation.mixin);
- }
- // map field to form-field behavior
- if (NutOptions.field) {
- options.behaviors.push('wx://form-field');
- }
- // 添加默认 选项
- options.options = {
- multipleSlots: true,
- addGlobalClass: true
- };
- Component(options);
- }
- module.exports = { NutComponent: NutComponent };
- /***/ }),
- /***/ 1:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- var basic = exports.basic = Behavior({
- methods: {
- $emit: function $emit(name, detail, options) {
- this.triggerEvent(name, detail, options);
- },
- set: function set(data) {
- this.setData(data);
- return new Promise(function (resolve) {
- return wx.nextTick(resolve);
- });
- }
- }
- });
- /***/ }),
- /***/ 12:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- var _component = __webpack_require__(0);
- var _utils = __webpack_require__(3);
- (0, _component.NutComponent)({
- classes: ['enter-class', 'enter-active-class', 'enter-to-class', 'leave-class', 'leave-active-class', 'leave-to-class'],
- props: {
- show: {
- type: Boolean,
- value: false,
- observer: 'observeShow'
- },
- // 动画类型 fade fade-up
- name: {
- type: String,
- value: 'fade'
- },
- duration: {
- type: null,
- value: 300
- },
- customStyle: String
- },
- data: {
- classes: [],
- inited: false,
- display: false,
- currentDurtion: 300
- },
- ready: function ready() {
- if (this.data.show === true) {
- this.observeShow(true, false);
- }
- },
- methods: {
- // 监听 show
- observeShow: function observeShow(value, old) {
- if (value === old) {
- return;
- }
- value ? this.enter() : this.leave();
- },
- // 进入
- enter: function enter() {
- var _this = this;
- var _data = this.data,
- name = _data.name,
- duration = _data.duration;
- var currentDuration = (0, _utils.isObj)(duration) ? duration.enter : duration;
- this.$emit('before-enter');
- (0, _utils.requestAnimationFrame)(function () {
- _this.setData({
- inited: true,
- display: true,
- classes: ['nut-' + name + '-enter', 'nut-' + name + '-enter-active', 'enter-class', 'enter-active-class'],
- currentDuration: currentDuration
- });
- (0, _utils.requestAnimationFrame)(function () {
- _this.setData({
- classes: ['nut-' + name + '-enter-active', 'nut-' + name + '-enter-to', 'enter-active-class', 'enter-to-class']
- });
- });
- });
- },
- // 离开
- leave: function leave() {
- var _this2 = this;
- var _data2 = this.data,
- name = _data2.name,
- duration = _data2.duration;
- var currentDuration = (0, _utils.isObj)(duration) ? duration.leave : duration;
- (0, _utils.requestAnimationFrame)(function () {
- _this2.setData({
- classes: ['nut-' + name + '-leave', 'nut-' + name + '-leave-active', 'leave-class', 'leave-active-class'],
- currentDuration: currentDuration
- });
- (0, _utils.requestAnimationFrame)(function () {
- setTimeout(function () {
- _this2.onTransitionEnd();
- }, currentDuration);
- _this2.setData({
- classes: ['nut-' + name + '-leave-to', 'nut-' + name + '-leave-active', 'leave-active-class', 'leave-to-class']
- });
- });
- });
- },
- // 动画结束
- onTransitionEnd: function onTransitionEnd() {
- var _data3 = this.data,
- show = _data3.show,
- display = _data3.display;
- if (!show && display) {
- this.setData({
- display: false
- });
- }
- }
- }
- });
- /***/ }),
- /***/ 3:
- /***/ (function(module, exports, __webpack_require__) {
- "use strict";
- exports.__esModule = true;
- 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; };
- exports.getSystemInfoSync = getSystemInfoSync;
- exports.requestAnimationFrame = requestAnimationFrame;
- exports.isObj = isObj;
- function getSystemInfoSync() {
- var systemInfo = null;
- if (systemInfo == null) {
- systemInfo = wx.getSystemInfoSync();
- }
- return systemInfo;
- }
- // 模拟 浏览器 requestAnimationFrame
- function requestAnimationFrame(cb) {
- var systemInfo = getSystemInfoSync();
- if (systemInfo.platform === 'devtools') {
- return setTimeout(function () {
- cb();
- }, 1000 / 30);
- }
- return wx.createSelectorQuery().selectViewport().boundingClientRect().exec(function () {
- cb();
- });
- }
- function isObj(x) {
- var type = typeof x === 'undefined' ? 'undefined' : _typeof(x);
- return x !== null && (type === 'object' || type === 'function');
- }
- /***/ })
- /******/ });
- //# sourceMappingURL=index.js.map
|