Browse Source
* commit 'ec5fa0512b2049a50872a71dfacd6d173a09523a': (22 commits) BI-117324 深色主题树节点查看已选文字看不清 auto upgrade version to 2.0.20221117172352 auto upgrade version to 2.0.20221117125408 auto upgrade version to 2.0.20221116201501 无JIRA refactor(base): 给findIndex加泛型 auto upgrade version to 2.0.20221116175433 BI-117406 fix: 动态图标无 auto upgrade version to 2.0.20221116151511 auto upgrade version to 2.0.20221116143350 无JIRA configRender.call(this auto upgrade version to 2.0.20221115175620 KERNEL-13158: zhenfei漏改了 KERNEL-13523 chore: 修复下fui-cli命令 KERNEL-13521 refactor: segment调整&行列布局的类名方法抽到layout上 KERNEL-13521 refactor: segment使用grid布局,使其默认使用最长项宽度等分 auto upgrade version to 2.0.20221114221310 auto upgrade version to 2.0.20221111195401 KERNEL-13158: 样式优化下 auto upgrade version to 2.0.20221111145656 auto upgrade version to 2.0.20221111090621 ...research/test
superman
2 years ago
24 changed files with 227 additions and 238 deletions
@ -1,44 +1,21 @@ |
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
const yargs = require('yargs/yargs'); |
||||||
|
const { hideBin } = require('yargs/helpers'); |
||||||
|
|
||||||
const workerCmd = require('./worker/cli.worker'); |
const workerCmd = require('./worker/cli.worker'); |
||||||
|
|
||||||
function getArgs (startIndex = 1) { |
const argv = yargs(hideBin(process.argv)).argv; |
||||||
const args = {}; |
|
||||||
process.argv |
|
||||||
.slice(startIndex, process.argv.length) |
|
||||||
.forEach(arg => { |
|
||||||
// long arg
|
|
||||||
if (arg.slice(0, 2) === '--') { |
|
||||||
const longArg = arg.split('='); |
|
||||||
const longArgFlag = longArg[0].slice(2, longArg[0].length); |
|
||||||
const longArgValue = longArg.length > 1 ? longArg[1] : true; |
|
||||||
args[longArgFlag] = longArgValue; |
|
||||||
// flags
|
|
||||||
} else if (arg[0] === '-') { |
|
||||||
const flags = arg.slice(1, arg.length); |
|
||||||
args[flags] = true; |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
return args; |
const cmd = argv._[0]; |
||||||
} |
|
||||||
|
|
||||||
const cmds = new Map([ |
const cmds = new Map([ |
||||||
['worker', workerCmd], |
['worker', workerCmd], |
||||||
]); |
]); |
||||||
|
|
||||||
const baseCmd = 'fui-cli'; |
if (!cmd) throw new Error('Command is undefined!'); |
||||||
|
|
||||||
const startIndex = process.argv.findIndex(argv => argv.indexOf(baseCmd) !== -1); |
|
||||||
|
|
||||||
if (startIndex === -1) { |
|
||||||
throw new Error(`Command ${baseCmd} not found in args`); |
|
||||||
} |
|
||||||
|
|
||||||
const cmd = process.argv[startIndex + 1]; |
|
||||||
|
|
||||||
if (cmds.has(cmd)) { |
if (cmds.has(cmd)) { |
||||||
cmds.get(cmd)?.exec(getArgs(startIndex + 2)); |
cmds.get(cmd)?.exec(argv); |
||||||
} else { |
} else { |
||||||
throw new Error(`Command ${cmd} not supported`); |
throw new Error(`Command ${cmd} not supported`); |
||||||
} |
} |
||||||
|
@ -1,28 +1,28 @@ |
|||||||
Demo.Func = BI.inherit(BI.Widget, { |
Demo.Func = BI.inherit(BI.Widget, { |
||||||
props: { |
props: { |
||||||
baseCls: "demo-func" |
baseCls: "demo-func", |
||||||
}, |
}, |
||||||
|
|
||||||
render: function () { |
render: function () { |
||||||
BI.createWidget({ |
BI.createWidget({ |
||||||
type: "bi.vertical", |
type: "bi.horizontal", |
||||||
element: this, |
element: this, |
||||||
vgap: 20, |
vgap: 20, |
||||||
hgap: 30, |
hgap: 30, |
||||||
items: [{ |
items: [{ |
||||||
type: "bi.segment", |
type: "bi.segment", |
||||||
items: [{ |
items: [{ |
||||||
text: "1", |
text: "较长的选项1", |
||||||
value: 1 |
value: 1, |
||||||
}, { |
}, { |
||||||
text: "2", |
text: "选项2", |
||||||
value: 2 |
value: 2, |
||||||
}, { |
}, { |
||||||
text: "3", |
text: "选项3", |
||||||
value: 3 |
value: 3, |
||||||
}] |
}], |
||||||
}] |
}], |
||||||
}); |
}); |
||||||
} |
}, |
||||||
}); |
}); |
||||||
BI.shortcut("demo.segment", Demo.Func); |
BI.shortcut("demo.segment", Demo.Func); |
Loading…
Reference in new issue