Esempio n. 1
0
ComponentNames.forEach(name => {
  var componentName = uppercamelcase(name)

  includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
    name: componentName,
    package: name
  }))


  if ([
      // directives
      'InfiniteScroll',
      'Lazyload',

      // services
      'MessageBox',
      'Toast',
      'Indicator'
    ].indexOf(componentName) === -1) {
    installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
      name: componentName,
      component: name
    }))
  }

  listTemplate.push(`  ${componentName}`)
})
  tables.each(function () {
    var tr = this.children[0];

    function getArray(obj) {
      return $(obj).text().trim().split(/[\s,]+/);
    }

    var a = tr.children[1];
    var b = tr.children[3];
    var c = tr.children[5];
    var inPorts, name, outPorts;
    if (!isNaN(getArray(a)[0])) {
      inPorts = a;
      name = $(b).text().trim();
      outPorts = c;
    } else {
      name = $(a).text().trim();
      outPorts = b;
    }
    var nameCamel = upperCamelCase(name);

    console.log(getArray(inPorts).join(), nameCamel, getArray(outPorts).join());

    var data = template(name, nameCamel, getArray(inPorts), getArray(outPorts));

    fs.writeFileSync('../../lib/components/' + nameCamel + '.ts', data);

  });
    const useComponents = componentDeps.map((mod) => {
      let basePackage = '';
      let className = '';
      if (mod.startsWith('@icedesign/base')) {
        basePackage = '@icedesign/base';
        const subCom = /@icedesign\/base\/lib\/(.*)/.exec(mod)[1];
        className = uppercamelcase(subCom);
      } else {
        basePackage = mod;
        const subCom = /@icedesign\/(.*)/.exec(mod)[1];
        className = uppercamelcase(subCom);
      }

      return {
        basePackage,
        className,
      };
    });
Esempio n. 4
0
 ]).spread((verb, idiom) => {
     
     // track this generation via app insights
     let client = appInsights.getClient();
     client.trackEvent("wordnik-verb", {verb: verb, idiom: idiom});
     
     // concatenate the verb and the idiom using pascal casing
     return upperCamelCase(verb, idiom);
 });
Esempio n. 5
0
 ]).spread((adj, idiom) => {
     
     // track this generation via app insights
     let client = appInsights.getClient();
     client.trackEvent("wordnik-adjective", {adjective: adj, idiom: idiom});
     
     // concatenate the adj and the idiom using pascal casing
     return upperCamelCase(adj, idiom);
 });
Esempio n. 6
0
export default function(opts = {}) {
  const { file ,pagename} = opts;
  const cwd = opts.cwd || process.cwd();

  console.log(`generate component ${file}`);

  let cssTargetPath;
  let jsTargetPath;
  const fileName = basename(file);
  const componentName = uppercamelcase(fileName);
  if (pagename) {
    assert(
      !directoryExists(join(cwd, 'src', 'pages',pagename, componentName)),
      `directory src/pages/${pagename}/${componentName} exists`,
    );
    jsTargetPath = join(cwd, 'src', 'pages',pagename,'components', componentName, 'index.js');
    cssTargetPath = join(cwd, 'src', 'pages',pagename,'components', componentName, 'index.less');
  } else {
    assert(
      !directoryExists(join(cwd, 'src', 'components', componentName)),
      `directory src/page/${file} exists`,
    );
    jsTargetPath = join(cwd, 'src', 'components', componentName,`index.js`);
    cssTargetPath = join(cwd, 'src', 'components',componentName ,`index.less`);
  }

  assert(!fileExists(jsTargetPath), `file src/.../${componentName} exists`);
  assert(!fileExists(cssTargetPath), `file src/.../${componentName} exists`);

  const jsTpl = readFileSync(
    join(__dirname, '../../template/component/Example.js'),
    'utf-8',
  );
  const cssTpl = readFileSync(
    join(__dirname, '../../template/component/Example.less'),
    'utf-8',
  );

  
  const jsContent = ejs.render(
    jsTpl,
    {
      componentName,
    },
    {
      _with: false,
      localsName: 'oni',
    },
  );


  outputFileSync(jsTargetPath, stripEmptyLine(jsContent), 'utf-8');
  outputFileSync(cssTargetPath, stripEmptyLine(cssTpl), 'utf-8');
}
Esempio n. 7
0
ComponentNames.forEach(name => {
  var componentName = uppercamelcase(name)

  includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
    name: componentName,
    package: name
  }))

  installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
    name: componentName,
    component: name
  }))

  listTemplate.push(`  ${componentName}`)
})
Esempio n. 8
0
ComponentNames.forEach(name => {
  var componentName = uppercamelcase(name);

  includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
    name: componentName,
    package: name
  }));

  if (['Loading', 'MessageBox', 'Notification', 'Message'].indexOf(componentName) === -1) {
    installTemplate.push(render(INSTALL_COMPONENT_TEMPLATE, {
      name: componentName,
      component: name
    }));
  }

  if (componentName !== 'Loading') listTemplate.push(`  ${componentName}`);
});
Esempio n. 9
0
ComponentNames.forEach(name => {
  var componentName = uppercamelcase(name)

  includeComponentTemplate.push(render(IMPORT_TEMPLATE, {
    name: componentName,
    package: name
  }))


  if (['InfiniteScroll', 'Lazyload'].indexOf(componentName) === -1) {
    installTemplate.push(render(ISNTALL_COMPONENT_TEMPLATE, {
      name: componentName,
      component: name
    }))
  }

  listTemplate.push(`  ${componentName}`)
})
Esempio n. 10
0
 return function () {
   if (!this.isListening) {
     return false;
   }
   const isName = 'is' + upperCamelCase(name);
   let muting;
   [...this[_muters].values()].forEach(muter => {
     if (muting === undefined) {
       muting = muter[isName];
     } else {
       if (muting !== muter[isName]) {
         throw new Error(
           `Muters referenced by advanced Muter have inconsistent ${
             name} states`);
       }
     }
   });
   return muting;
 };
Esempio n. 11
0
      .then((answers) => {
        this.patternType = answers.type;
        this.patternName = answers.patternName;
        this.pascalCasePatternName = pascalcase(answers.patternName);

        switch (answers.type) {
          case 'Atom':
            this.patternPath = '00-atoms';
            break;
          case 'Molecule':
            this.patternPath = '01-molecules';
            break;
          case 'Organism':
            this.patternPath = '02-organisms';
            break;
          default:
            this.patternPath = '';
            break;
        }
      });
Esempio n. 12
0
console.log();
process.on('exit', () => {
  console.log();
});

if (!process.argv[2]) {
  console.error('[组件名]必填.');
  process.exit(1);
}

const path = require('path');
const fileSave = require('file-save');
const uppercamelcase = require('uppercamelcase');
const componentname = process.argv[2];
const chineseName = process.argv[3] || componentname;
const ComponentName = uppercamelcase(componentname);
const PackagePath = path.resolve(__dirname, '../../packages', componentname);
const Files = [
  {
    filename: 'index.js',
    content: `import ${ComponentName} from './src/main';

/* istanbul ignore next */
${ComponentName}.install = function(Vue) {
  Vue.component(${ComponentName}.name, ${ComponentName});
};

export default ${ComponentName};`
  },
  {
    filename: 'cooking.conf.js',
Esempio n. 13
0
 const intallList = exportList.filter(name => !~uninstallComponents.indexOf(uppercamelize(name)));
Esempio n. 14
0
 const exportList = Components.map(name => `${uppercamelize(name)}`);
Esempio n. 15
0
 const importList = Components.map(name => `import ${uppercamelize(name)} from './${name}';`);
Esempio n. 16
0
modules.forEach(item => {
  const name = uppercamelcase(item.name.replace(/mt-/, ''));
  components[name] = item;
});
Esempio n. 17
0
    if (!this.$amapComponent) return;

    this.$amapComponent.setMap && this.$amapComponent.setMap(null);
    this.$amapComponent.close && this.$amapComponent.close();
    this.$amapComponent.editor && this.$amapComponent.editor.close();
    this.unwatchFns.forEach(item => item());
    this.unwatchFns = [];
  },

  methods: {
    getHandlerFun(prop) {
      if (this.handlers && this.handlers[prop]) {
        return this.handlers[prop];
      }

      return this.$amapComponent[`set${upperCamelCase(prop)}`] || this.$amapComponent.setOptions;
    },

    convertProps() {
      const props = {};
      if (this.$amap) props.map = this.$amap;
      const { $options: { propsData = {} }, propsRedirect } = this;
      return Object.keys(propsData).reduce((res, _key) => {
        let key = _key;
        let propsValue = this.convertSignalProp(key, propsData[key]);
        if (propsValue === undefined) return res;
        if (propsRedirect && propsRedirect[_key]) key = propsRedirect[key];
        props[key] = propsValue;
        return res;
      }, props);
    },
function toName ( str ) {
  return uppercamelcase( String(str).replace(/error$/i, ''), 'error' );
}
Esempio n. 19
0
 Object.keys(this._props).forEach(k => {
   let fn = this.$amapComponent[`set${upperCamelCase(k)}`];
   if (fn) {
     console.log(k);
   }
 });