v1.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace zin;
  3. class pasteDialog extends wg
  4. {
  5. /**
  6. * @var mixed[]
  7. */
  8. protected static $defineProps = array(
  9. 'field: string', // 表单中多行录入列的字段名,必选
  10. 'title?: string', // 弹窗的标题,默认为“多行录入”
  11. 'name?: string="importLines"' // 多行文本控件名称,默认为“importLines”
  12. );
  13. public static function getPageCSS()
  14. {
  15. return file_get_contents(__DIR__ . DS . 'css' . DS . 'v1.css');
  16. }
  17. public static function getPageJS()
  18. {
  19. return file_get_contents(__DIR__ . DS . 'js' . DS . 'v1.js');
  20. }
  21. protected function build()
  22. {
  23. global $lang;
  24. $field = $this->prop('field');
  25. $title = $this->prop('title');
  26. $name = $this->prop('name');
  27. if(empty($title)) $title = $lang->pasteText;
  28. return modal
  29. (
  30. set::id('paste-dialog'),
  31. set::title($title),
  32. set::footerClass('center pt-2'),
  33. set::footerActions
  34. (
  35. array
  36. (
  37. btn
  38. (
  39. setClass('btn btn-wide primary'),
  40. on::click("window.importLines(target, '$field')"),
  41. $lang->save
  42. )
  43. )
  44. ),
  45. textarea
  46. (
  47. setID($name),
  48. setClass('mt-2'),
  49. set::name($name),
  50. set::placeholder($lang->pasteTextInfo)
  51. )
  52. );
  53. }
  54. }