efront 3.5.11 → 3.5.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  ./aapi/ authorization:
2
2
  login: options /::login-:a
3
3
  run: options /:::run
4
- share: options /::share-:opt
4
+ share: options /::share-:opt?:path
5
5
  folder: options /::file-:opt:::path?:to
@@ -5,6 +5,6 @@
5
5
  </form>
6
6
  </div>
7
7
  <div foot>
8
- <button white @click="close()">取消</button>
8
+ <btn white @click="close()">取消</btn>
9
9
  <button @click="save()"> 保存 </button>
10
10
  </div>
@@ -6,8 +6,10 @@ function main({ fields, item }) {
6
6
  close() {
7
7
  return remove(page);
8
8
  },
9
- save() {
10
- return data.from("share", { opt: item ? 'update' : 'create', data: this.data }).loading_promise;
9
+ async save() {
10
+ await data.from("share", { opt: 'create', path: this.data.path }).loading_promise;
11
+ dispatch(page, 'submited');
12
+ remove(page);
11
13
  },
12
14
  data: Object.assign({}, item)
13
15
  });
@@ -1,36 +1,56 @@
1
1
  var fields = refilm`
2
2
  路径/path
3
- 挂载点/name
4
3
  `;
5
- var options = [
6
- {
7
- name: "删除",
8
- do(e) {
9
- data.from('share', { opt: 'delete', item: e });
10
- }
11
- },
12
- {
13
- name: "修改",
14
- do(e) {
15
- popup('/share/edit', { fields, item: e });
16
- }
17
- }
18
- ];
19
- console.log(fields)
20
4
  function main() {
5
+ var options = [
6
+ {
7
+ name(e) {
8
+ return this.confirm === e ? "确认取消" : "取消"
9
+ },
10
+ type: 'danger',
11
+ confirm: false,
12
+ timer: 0,
13
+ async do(e) {
14
+ if (this.confirm !== e) {
15
+ this.confirm = e;
16
+ clearTimeout(this.timer);
17
+ this.timer = setTimeout(() => render.refresh(this.confirm = null), 2000);
18
+ return;
19
+ }
20
+ await data.from('share', { opt: 'delete', path: e.path }).loading_promise;
21
+ page.$scope.load();
22
+ }
23
+ }
24
+ ];
21
25
  var page = div();
22
26
  page.innerHTML = list;
23
- var a = data.from("share", { opt: 'list' }, a => {
24
- if (a) return a.map(b => ({ path: b }));
25
- });
26
27
  renderWithDefaults(page, {
27
- data: a,
28
+ data: [],
29
+ load() {
30
+ this.data = data.from("share", { opt: 'list' }, a => {
31
+ if (a) return a.map(b => ({ path: b }));
32
+ });
33
+ },
28
34
  fields: fields.concat({
29
35
  name: "操作",
36
+ width: 200,
30
37
  type: 'button',
31
38
  options,
32
39
  }),
33
40
  });
34
- console.log(a)
41
+ page.$scope.load();
42
+ contextmenu(page, [
43
+ {
44
+ name: "添加",
45
+ do(e) {
46
+ zimoli.prepare("/share/edit", function () {
47
+ var p = popup("/share/edit", { fields });
48
+ on('submited')(p, function () {
49
+ page.$scope.load();
50
+ })
51
+ })
52
+ }
53
+ },
54
+ ])
35
55
  return page;
36
56
  }
@@ -0,0 +1,7 @@
1
+ >table {
2
+ width: 100%;
3
+ }
4
+
5
+ & {
6
+ height: 100%;
7
+ }
@@ -8,8 +8,8 @@
8
8
  <tr>
9
9
  <td -repeat="f in fields">
10
10
  <span -if="f.key" -text="d[f.key]"></span>
11
- <a on-click="o.do(d)" -if="f.options" -repeat="o in f.options">
12
- <span -text=o.name></span>
11
+ <a on-click="o.do(d)" -if="f.options" _type="o.type" -repeat="o in f.options">
12
+ <span -text="o.name instanceof Function?o.name(d):o.name"></span>
13
13
  </a>
14
14
  </td>
15
15
  </tr>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.5.11",
3
+ "version": "3.5.12",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {