zsmj
2 years ago
18 changed files with 206 additions and 229 deletions
@ -1,44 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
const yargs = require('yargs/yargs'); |
||||
const { hideBin } = require('yargs/helpers'); |
||||
|
||||
const workerCmd = require('./worker/cli.worker'); |
||||
|
||||
function getArgs (startIndex = 1) { |
||||
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; |
||||
} |
||||
}); |
||||
const argv = yargs(hideBin(process.argv)).argv; |
||||
|
||||
return args; |
||||
} |
||||
const cmd = argv._[0]; |
||||
|
||||
const cmds = new Map([ |
||||
['worker', workerCmd], |
||||
]); |
||||
|
||||
const baseCmd = 'fui-cli'; |
||||
|
||||
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 (!cmd) throw new Error('Command is undefined!'); |
||||
|
||||
if (cmds.has(cmd)) { |
||||
cmds.get(cmd)?.exec(getArgs(startIndex + 2)); |
||||
cmds.get(cmd)?.exec(argv); |
||||
} else { |
||||
throw new Error(`Command ${cmd} not supported`); |
||||
} |
||||
|
@ -1,28 +1,28 @@
|
||||
Demo.Func = BI.inherit(BI.Widget, { |
||||
props: { |
||||
baseCls: "demo-func" |
||||
baseCls: "demo-func", |
||||
}, |
||||
|
||||
render: function () { |
||||
BI.createWidget({ |
||||
type: "bi.vertical", |
||||
type: "bi.horizontal", |
||||
element: this, |
||||
vgap: 20, |
||||
hgap: 30, |
||||
items: [{ |
||||
type: "bi.segment", |
||||
items: [{ |
||||
text: "1", |
||||
value: 1 |
||||
text: "较长的选项1", |
||||
value: 1, |
||||
}, { |
||||
text: "2", |
||||
value: 2 |
||||
text: "选项2", |
||||
value: 2, |
||||
}, { |
||||
text: "3", |
||||
value: 3 |
||||
}] |
||||
}] |
||||
text: "选项3", |
||||
value: 3, |
||||
}], |
||||
}], |
||||
}); |
||||
} |
||||
}, |
||||
}); |
||||
BI.shortcut("demo.segment", Demo.Func); |
||||
BI.shortcut("demo.segment", Demo.Func); |
||||
|
@ -0,0 +1,5 @@
|
||||
@import "../../index.less"; |
||||
|
||||
.bi-calendar-date-item.not-current-month-day { |
||||
color: @color-bi-text-disabled-button !important; |
||||
} |
Loading…
Reference in new issue