@cocreate/organizations 1.15.18 → 1.16.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ # [1.16.0](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.15.19...v1.16.0) (2023-08-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * crud attributes renamed ([c8ad6c1](https://github.com/CoCreate-app/CoCreate-organizations/commit/c8ad6c1a2045f2a24ced0dba608b06a5f89fda19))
7
+ * replace -target -selector ([9b52d00](https://github.com/CoCreate-app/CoCreate-organizations/commit/9b52d00874b7da439be63e5a787d79d7162f2095))
8
+ * updated actions callback data object ([0a98309](https://github.com/CoCreate-app/CoCreate-organizations/commit/0a983090903d966909f22e5969aaa064fb33e8f1))
9
+ * updated fetch-limit to filter-limit ([c3b4414](https://github.com/CoCreate-app/CoCreate-organizations/commit/c3b44140a5902f757b38566158936ab25a16369e))
10
+ * webpack.config and package.json make use of mode=production instead of process.env ([c35d271](https://github.com/CoCreate-app/CoCreate-organizations/commit/c35d271cc9e78fcc5c2b3cadf8b6115cf75c694f))
11
+
12
+
13
+ ### Features
14
+
15
+ * **client.js:** Add generateDB and create functions ([179b6dd](https://github.com/CoCreate-app/CoCreate-organizations/commit/179b6dd30b12b6c0a34dcb88d6942c44f9c53dd9))
16
+ * name attribute and variable renamed to key ([2af9415](https://github.com/CoCreate-app/CoCreate-organizations/commit/2af9415027d35529232f08c31da0c25535c552c2))
17
+ * renamed CRUD attributes and params ([5e616bf](https://github.com/CoCreate-app/CoCreate-organizations/commit/5e616bf1895bd711afe91272e8670007a3a63560))
18
+ * Update package.json - changed "@cocreate/form" dependency to "@cocreate/elements" ([bbfa9c4](https://github.com/CoCreate-app/CoCreate-organizations/commit/bbfa9c4b90f9722767b6fa41253bcc522df322d9))
19
+ * update template_id to render-selector attribute. update filter attributes to filter selector-attributes ([f180ae3](https://github.com/CoCreate-app/CoCreate-organizations/commit/f180ae38c037945fc8f7d6dbf6d877d503681f51))
20
+
21
+ ## [1.15.19](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.15.18...v1.15.19) (2023-06-14)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * Update dependencies versions for [@cocreate](https://github.com/cocreate) libraries ([82ea7ec](https://github.com/CoCreate-app/CoCreate-organizations/commit/82ea7ec164e05118f0130410e5bdd365b138c2c4))
27
+
1
28
  ## [1.15.18](https://github.com/CoCreate-app/CoCreate-organizations/compare/v1.15.17...v1.15.18) (2023-06-11)
2
29
 
3
30
 
@@ -4,8 +4,8 @@ module.exports = {
4
4
  "host": "",
5
5
  "sources": [
6
6
  {
7
- "collection": "files",
8
- "document": {
7
+ "array": "files",
8
+ "object": {
9
9
  "_id": "60207e303c260207bf49cab8",
10
10
  "name": "index.html",
11
11
  "path": "/docs/organizations/index.html",
@@ -14,34 +14,34 @@
14
14
  <body class="padding:20px">
15
15
  <form>
16
16
  <input
17
- collection="organizations"
17
+ array="organizations"
18
18
  class="floating-label"
19
- name="name"
20
- document_id=""
19
+ key="name"
20
+ object=""
21
21
  placeholder="org name" />
22
22
  <input
23
- collection="users"
23
+ array="users"
24
24
  class="floating-label"
25
- name="name"
26
- document_id=""
25
+ key="name"
26
+ object=""
27
27
  placeholder="user name" />
28
28
 
29
29
  <input
30
30
  type="hidden"
31
31
  id="org_id"
32
- collection="organizations"
33
- document_id=""
34
- name="_id"
32
+ array="organizations"
33
+ object=""
34
+ key="_id"
35
35
  placeholder="OrganizationId"
36
36
  readonly />
37
37
 
38
- <!-- User_id will be used to copy user document from current organizion and insert orgdb defined above-->
38
+ <!-- User_id will be used to copy user object from current organizion and insert orgdb defined above-->
39
39
  <input
40
40
  type="hidden"
41
41
  id="user_id"
42
- collection="users"
43
- document_id=""
44
- name="_id"
42
+ array="users"
43
+ object=""
44
+ key="_id"
45
45
  placeholder="UserId"
46
46
  readonly />
47
47
 
@@ -49,9 +49,9 @@
49
49
  <input
50
50
  type="hidden"
51
51
  id="key"
52
- collection="organizations"
53
- document_id=""
54
- name="key"
52
+ array="organizations"
53
+ object=""
54
+ key="key"
55
55
  placeholder="API Key"
56
56
  uuid="32"
57
57
  readonly />
package/demo/index.html CHANGED
@@ -38,9 +38,9 @@
38
38
  <input
39
39
  type="text"
40
40
  id="org-name"
41
- collection="organizations"
42
- document_id=""
43
- name="name"
41
+ array="organizations"
42
+ object=""
43
+ key="name"
44
44
  placeholder="Organization Name"
45
45
  class="floating-label" />
46
46
 
@@ -48,9 +48,9 @@
48
48
 
49
49
  <input
50
50
  type="text"
51
- collection="users"
52
- document_id=""
53
- name="name"
51
+ array="users"
52
+ object=""
53
+ key="name"
54
54
  placeholder="User Name"
55
55
  class="floating-label" />
56
56
 
@@ -58,9 +58,9 @@
58
58
  <input
59
59
  type="hidden"
60
60
  id="org_id"
61
- collection="organizations"
62
- document_id=""
63
- name="_id"
61
+ array="organizations"
62
+ object=""
63
+ key="_id"
64
64
  value=""
65
65
  placeholder="OrganizationId" />
66
66
 
@@ -68,9 +68,9 @@
68
68
  <input
69
69
  type="hidden"
70
70
  id="key"
71
- collection="organizations"
72
- document_id=""
73
- name="key"
71
+ array="organizations"
72
+ object=""
73
+ key="key"
74
74
  placeholder="API Key"
75
75
  uuid="32"
76
76
  readonly />
@@ -81,26 +81,26 @@
81
81
  <cocreate-select
82
82
  sortable
83
83
  class="floating-label"
84
- collection="organizations"
85
- name="industry"
84
+ array="organizations"
85
+ key="industry"
86
86
  placeholder="Industry"
87
87
  realtime="false"
88
88
  save="false">
89
89
  <input
90
90
  placeholder="Search"
91
- template_id="industries" />
91
+ filter-parent="[array]" />
92
92
  <ul
93
- fetch-collection="industries"
94
- template_id="industries"
93
+ array="industries"
94
+ render-selector="[template]"
95
95
  class="options overflow:auto">
96
96
  <li
97
97
  class="template option"
98
- template_id="industries"
99
- value="{{document._id}}">
98
+ template
99
+ value="{{object._id}}">
100
100
  <h4
101
- collection="industries"
102
- document_id="{{document._id}}"
103
- name="name">
101
+ array="industries"
102
+ object="{{object._id}}"
103
+ key="name">
104
104
  industry name
105
105
  </h4>
106
106
  </li>
@@ -114,9 +114,9 @@
114
114
  Register
115
115
  <a
116
116
  href="index.html"
117
- pass-collection="modules"
118
- pass-document_id=""
119
- pass-name="html"
117
+ pass-array="modules"
118
+ pass-object=""
119
+ pass-key="html"
120
120
  pass_to="render"></a>
121
121
  </button>
122
122
  </div>
@@ -58,8 +58,8 @@
58
58
  <a
59
59
  actions="pass, openModal"
60
60
  modal-src="render.html"
61
- pass-collection="modules"
62
- pass-document_id=""
61
+ pass-array="modules"
62
+ pass-object=""
63
63
  pass_to="builder"
64
64
  modal-width="100%"
65
65
  pass_id="render">
@@ -67,8 +67,8 @@
67
67
  class="display:flex height:18px fill:#505050"
68
68
  src="/assets/svg/palette.svg"></i>
69
69
  <div
70
- pass-collection="modules"
71
- pass-document_id=""
70
+ pass-array="modules"
71
+ pass-object=""
72
72
  pass_to="render"
73
73
  class="sessionBuilderUI_Id"></div>
74
74
  </a>
@@ -77,8 +77,8 @@
77
77
  <a
78
78
  <a
79
79
  actions="deleteDocument, closeModal"
80
- collection="modules"
81
- document_id=""
80
+ array="modules"
81
+ object=""
82
82
  pass_id="form-fields"
83
83
  class="btn-modal-close">
84
84
  <i
@@ -90,19 +90,19 @@
90
90
  </div>
91
91
 
92
92
  <div content_id="content">
93
- <form collection="industries" class="padding:15px" realtime="false">
93
+ <form array="industries" class="padding:15px" realtime="false">
94
94
  <h3>Indusrty Creator</h3>
95
95
  <input
96
- document_id=""
96
+ object=""
97
97
  pass_id="form-fields"
98
- name="name"
98
+ key="name"
99
99
  placeholder="Industry Name"
100
100
  class="floating-label" />
101
101
 
102
102
  <textarea
103
- document_id=""
103
+ object=""
104
104
  pass_id="form-fields"
105
- name="description"
105
+ key="description"
106
106
  placeholder="Description"
107
107
  class="floating-label"></textarea>
108
108
 
@@ -21,16 +21,16 @@
21
21
  <input
22
22
  type="text"
23
23
  class="floating-label"
24
- filter-name="name"
25
- template_id="datatable"
24
+ filter-key="name"
25
+ filter-closest="table; tbody"
26
26
  placeholder="Industry Name" />
27
27
  <span
28
28
  class="position:absolute bottom:20px right:20px float:right z-index:6">
29
29
  <!-- need a solution to update toggle value="desc|asc" and define and upadte icons... show hide works great but to much html and orderby only has 2 values -->
30
30
  <a
31
- filter-sort-name="name"
31
+ filter-sort-key="name"
32
32
  filter-sort-toggle
33
- template_id="datatable">
33
+ filter-closest="table; tbody">
34
34
  <i></i>
35
35
  </a>
36
36
  </span>
@@ -40,63 +40,63 @@
40
40
  <input
41
41
  type="text"
42
42
  class="floating-label"
43
- filter-name="_id"
44
- template_id="datatable"
43
+ filter-key="_id"
44
+ filter-closest="table; tbody"
45
45
  placeholder="Industry_id" />
46
46
  <span
47
47
  class="position:absolute bottom:20px right:20px float:right z-index:6">
48
48
  <a
49
- filter-sort-name="_id"
49
+ filter-sort-key="_id"
50
50
  value=""
51
51
  filter-sort-direction="asc"
52
52
  click-value="desc, asc"
53
53
  click-attribute="filter-sort-direction"
54
- template_id="datatable">
54
+ filter-closest="table; tbody">
55
55
  </a>
56
56
  </span>
57
57
  </td>
58
58
  </tr>
59
59
 
60
60
  <tbody
61
- fetch-collection="industries"
62
- fetch-name=""
61
+ array="industries"
62
+ key=""
63
63
  filter-value=""
64
- filter-sort-name="name"
64
+ filter-sort-key="name"
65
65
  filter-sort-direction="asc"
66
- template_id="datatable">
66
+ render-selector="[template]">
67
67
  <tr
68
- template="datatable"
68
+ template
69
69
  class="background:gainsboro:hover border-bottom:1px_solid_darkgray">
70
70
  <td class="padding:10px">
71
71
  <div class="min-width:200px">
72
72
  <div class="icon-wrapper">
73
- <span pass_id="me1234" name="icon"></span>
73
+ <span pass_id="me1234" key="icon"></span>
74
74
  </div>
75
75
  <div>
76
76
  <a
77
77
  actions="pass, openModal"
78
78
  modal-src="render.html"
79
- pass-collection="module_activity"
80
- pass-document_id="{{document._id}}"
79
+ pass-array="module_activity"
80
+ pass-object="{{object._id}}"
81
81
  pass_to="form-fields"
82
82
  modal-width="320px"
83
83
  modal-color="#229954">
84
84
  <h4
85
- collection="{{document.collection}}"
86
- pass-document_id="{{document._id}}"
87
- name="name">
85
+ array="{{object.array}}"
86
+ pass-object="{{object._id}}"
87
+ key="name">
88
88
  Name
89
89
  </h4>
90
90
  <div
91
- pass-collection="modules"
92
- pass-document_id=""
91
+ pass-array="modules"
92
+ pass-object=""
93
93
  pass_to="render"
94
94
  pass_id="render"></div>
95
95
  </a>
96
96
  <h5
97
- collection="{{document.collection}}"
98
- pass-document_id="{{document._id}}"
99
- name="description"></h5>
97
+ array="{{object.array}}"
98
+ pass-object="{{object._id}}"
99
+ key="description"></h5>
100
100
  </div>
101
101
  </div>
102
102
  </td>
@@ -104,20 +104,20 @@
104
104
  <a
105
105
  actions="pass, openModal"
106
106
  modal-src="render.html"
107
- pass-document_id=""
108
- pass-collection="module_activity"
107
+ pass-object=""
108
+ pass-array="module_activity"
109
109
  pass_to="form-fields"
110
110
  modal-width="320px"
111
111
  modal-color="#229954">
112
112
  <b
113
- collection="{{document.collection}}"
114
- pass-document_id="{{document._id}}"
115
- name="_id"
113
+ array="{{object.array}}"
114
+ pass-object="{{object._id}}"
115
+ key="_id"
116
116
  >Industry Id</b
117
117
  >
118
118
  <div
119
- pass-collection="module_activity"
120
- pass-document_id=""
119
+ pass-array="module_activity"
120
+ pass-object=""
121
121
  pass_to="render"></div>
122
122
  </a>
123
123
  </td>
@@ -129,8 +129,8 @@
129
129
  <button
130
130
  actions="pass, openModal"
131
131
  modal-src="render.html"
132
- pass-collection="modules"
133
- pass-document_id=""
132
+ pass-array="modules"
133
+ pass-object=""
134
134
  pass_to="render"
135
135
  modal-width="320px"
136
136
  modal-height="100%"
@@ -21,16 +21,16 @@
21
21
  <input
22
22
  type="text"
23
23
  class="floating-label"
24
- filter-name="name"
25
- template_id="datatable"
24
+ filter-key="name"
25
+ filter-closest="table; tbody"
26
26
  placeholder="Industry Name" />
27
27
  <span
28
28
  class="position:absolute bottom:20px right:20px float:right z-index:6">
29
29
  <!-- need a solution to update toggle value="desc|asc" and define and upadte icons... show hide works great but to much html and orderby only has 2 values -->
30
30
  <a
31
- filter-sort-name="name"
31
+ filter-sort-key="name"
32
32
  filter-sort-toggle
33
- template_id="datatable">
33
+ filter-closest="table; tbody">
34
34
  <i></i>
35
35
  </a>
36
36
  </span>
@@ -40,59 +40,60 @@
40
40
  <input
41
41
  type="text"
42
42
  class="floating-label"
43
- filter-name="_id"
44
- template_id="datatable"
43
+ filter-key="_id"
44
+ filter-closest="table; tbody"
45
45
  placeholder="Industry_id" />
46
46
  <span
47
47
  class="position:absolute bottom:20px right:20px float:right z-index:6">
48
48
  <a
49
- filter-sort-name="_id"
49
+ filter-sort-key="_id"
50
50
  value=""
51
51
  filter-sort-direction="asc"
52
52
  click-value="desc, asc"
53
53
  click-attribute="filter-sort-direction"
54
- template_id="datatable">
54
+ filter-closest="table; tbody">
55
55
  </a>
56
56
  </span>
57
57
  </td>
58
58
  </tr>
59
59
 
60
60
  <tbody
61
- fetch-collection="industry_documents"
62
- fetch-name=""
61
+ array="industry_documents"
62
+ key=""
63
63
  filter-value=""
64
64
  filter-value-type="or"
65
- fetch-limit=""
66
- filter-sort-name="name"
65
+ filter-limit=""
66
+ filter-sort-key="name"
67
67
  filter-sort-direction="asc"
68
- template_id="datatable"
68
+ render-selector="[template]"
69
69
  pass_to="me1234">
70
70
  <tr
71
- class="template background:gainsboro:hover border-bottom:1px_solid_darkgray">
71
+ template
72
+ class="background:gainsboro:hover border-bottom:1px_solid_darkgray">
72
73
  <td class="padding:10px">
73
74
  <div class="min-width:200px">
74
75
  <div class="icon-wrapper">
75
- <span pass_id="me1234" name="icon"></span>
76
+ <span pass_id="me1234" key="icon"></span>
76
77
  </div>
77
78
  <div>
78
79
  <a
79
80
  actions="pass, openModal"
80
81
  modal-src="render.html"
81
- pass-collection="module_activity"
82
- pass-document_id=""
82
+ pass-array="module_activity"
83
+ pass-object=""
83
84
  pass_to="form-fields"
84
85
  modal-width="320px"
85
86
  modal-color="#229954">
86
- <h4 pass_id="me1234" name="name">
87
+ <h4 pass_id="me1234" key="name">
87
88
  Name
88
89
  </h4>
89
90
  <div
90
- pass-collection="modules"
91
- pass-document_id=""
91
+ pass-array="modules"
92
+ pass-object=""
92
93
  pass_to="render"
93
94
  pass_id="render"></div>
94
95
  </a>
95
- <h5 name="description"></h5>
96
+ <h5 key="description"></h5>
96
97
  </div>
97
98
  </div>
98
99
  </td>
@@ -100,15 +101,15 @@
100
101
  <a
101
102
  actions="pass, openModal"
102
103
  modal-src="render.html"
103
- pass-document_id=""
104
- pass-collection="module_activity"
104
+ pass-object=""
105
+ pass-array="module_activity"
105
106
  pass_to="form-fields"
106
107
  modal-width="320px"
107
108
  modal-color="#229954">
108
- <b pass_id="me1234" name="_id">Document Id</b>
109
+ <b pass_id="me1234" key="_id">Document Id</b>
109
110
  <div
110
- pass-collection="module_activity"
111
- pass-document_id=""
111
+ pass-array="module_activity"
112
+ pass-object=""
112
113
  pass_to="render"></div>
113
114
  </a>
114
115
  </td>
@@ -120,8 +121,8 @@
120
121
  <button
121
122
  actions="pass, openModal"
122
123
  modal-src="render.html"
123
- pass-collection="modules"
124
- pass-document_id=""
124
+ pass-array="modules"
125
+ pass-object=""
125
126
  pass_to="render"
126
127
  modal-width="320px"
127
128
  modal-height="100%"
package/docs/index.html CHANGED
@@ -11,10 +11,10 @@
11
11
  sizes="32x32"
12
12
  href="https://cocreate.app/images/favicon.ico" />
13
13
  <meta
14
- name="description"
14
+ key="description"
15
15
  content="A simple HTML5 and pure javascript component. Easy configuration using HTML5 attributes or Javscript api and highly styleable." />
16
16
  <meta
17
- name="keywords"
17
+ key="keywords"
18
18
  content="helper classes, utility classes, css framework, css library, inline style classes" />
19
19
  <meta name="robots" content="index,follow" />
20
20
  <meta
@@ -29,9 +29,9 @@
29
29
  <link
30
30
  rel="stylesheet"
31
31
  href="https://ws.cocreate.app/docs.css"
32
- collection="apples"
33
- document_id="6069ff5042ef8ff5175a5c8d"
34
- name="css"
32
+ array="apples"
33
+ object="6069ff5042ef8ff5175a5c8d"
34
+ key="css"
35
35
  type="text/css" />
36
36
  <link rel="manifest" href="/manifest.webmanifest" />
37
37
  </head>
@@ -42,20 +42,20 @@
42
42
  scroll="sticky-nav,hide-nav"
43
43
  scroll-up="10"
44
44
  scroll-down="10"
45
- collection="files"
46
- document_id="60395ef42b3ac232657040fd"
47
- name="src"></nav>
45
+ array="files"
46
+ object="60395ef42b3ac232657040fd"
47
+ key="src"></nav>
48
48
  <sidenav
49
49
  id="menuL"
50
50
  class="position:fixed top:0px left:0px overflow:hidden background:whitesmoke height:100vh width:0px width:300px@xl"
51
51
  resizable
52
- resize-target="[content_id='content']"
52
+ resize-selector="[content_id='content']"
53
53
  resize-property="margin-left"
54
54
  resize-value="width">
55
55
  <menu
56
- collection="files"
57
- document_id="603717b07de7fb350ae9fec8"
58
- name="src"></menu>
56
+ array="files"
57
+ object="603717b07de7fb350ae9fec8"
58
+ key="src"></menu>
59
59
  <div resize="right"></div>
60
60
  </sidenav>
61
61
  <main
@@ -78,7 +78,7 @@
78
78
  share-width="700"
79
79
  share-media="https://cdn.cocreate.app/docs/organizations.png"
80
80
  hover="display:block!important"
81
- hover-target=".social-networks">
81
+ hover-selector=".social-networks">
82
82
  <div class="display:none social-networks">
83
83
  <a
84
84
  class="margin-right:15px"
@@ -137,11 +137,11 @@
137
137
  class="border-bottom:1px_solid_lightgrey"
138
138
  scroll
139
139
  scroll-intersect="color:dodgerblue"
140
- scroll-target="#organizations-install-section">
140
+ scroll-selector="#organizations-install-section">
141
141
  <span
142
142
  class="display:flex align-items:center width:fit-content"
143
143
  hover="display:block!important"
144
- hover-target="[href='#organizations-install']">
144
+ hover-selector="[href='#organizations-install']">
145
145
  <h2 class="padding:5px_0px">Install</h2>
146
146
  <a
147
147
  class="margin-left:10px display:none"
@@ -164,11 +164,11 @@
164
164
  class="margin-top:80px border-bottom:1px_solid_lightgrey"
165
165
  scroll
166
166
  scroll-intersect="color:dodgerblue"
167
- scroll-target="#organizations-usage-section">
167
+ scroll-selector="#organizations-usage-section">
168
168
  <span
169
169
  class="display:flex align-items:center width:fit-content"
170
170
  hover="display:block!important"
171
- hover-target="[href='#organizations-usage']">
171
+ hover-selector="[href='#organizations-usage']">
172
172
  <h2 class="padding:5px_0px">Usage</h2>
173
173
  <a
174
174
  class="margin-left:10px display:none"
@@ -189,11 +189,11 @@
189
189
  class="margin-top:80px border-bottom:1px_solid_lightgrey"
190
190
  scroll
191
191
  scroll-intersect="color:dodgerblue"
192
- scroll-target="#organizations-attributes-section">
192
+ scroll-selector="#organizations-attributes-section">
193
193
  <span
194
194
  class="display:flex align-items:center width:fit-content"
195
195
  hover="display:block!important"
196
- hover-target="[href='#organizations-attributes']">
196
+ hover-selector="[href='#organizations-attributes']">
197
197
  <h2 class="padding:5px_0px">Attributes</h2>
198
198
  <a
199
199
  class="margin-left:10px display:none"
@@ -242,11 +242,11 @@
242
242
  class="border-bottom:1px_solid_lightgrey"
243
243
  scroll
244
244
  scroll-intersect="color:dodgerblue"
245
- scroll-target="#organizations-demo-section">
245
+ scroll-selector="#organizations-demo-section">
246
246
  <span
247
247
  class="display:flex align-items:center width:fit-content"
248
248
  hover="display:block!important"
249
- hover-target="[href='#organizations-demo']">
249
+ hover-selector="[href='#organizations-demo']">
250
250
  <h2 class="padding:5px_0px">Demo</h2>
251
251
  <a
252
252
  class="margin-left:10px display:none"
@@ -270,9 +270,9 @@
270
270
  <textarea
271
271
  type="code"
272
272
  lang="html"
273
- collection="demos"
274
- document_id=""
275
- name="demo"
273
+ array="demos"
274
+ object=""
275
+ key="demo"
276
276
  save="false"
277
277
  id="demo"
278
278
  class="height:100% width:100% outline:none border:none resize:none padding:5px"></textarea>
@@ -295,7 +295,7 @@
295
295
  show="#eye-slash"
296
296
  hide="#eye, #demo-preview"
297
297
  toggle="code-height"
298
- toggle-target="#demo-code"
298
+ toggle-selector="#demo-code"
299
299
  ><i
300
300
  class="height:18px fill:#505050"
301
301
  src="/assets/svg/eye.svg"></i
@@ -307,7 +307,7 @@
307
307
  show="#eye, #demo-preview"
308
308
  hide="#eye-slash"
309
309
  toggle="code-height"
310
- toggle-target="#demo-code"
310
+ toggle-selector="#demo-code"
311
311
  ><i
312
312
  class="height:20px fill:#505050"
313
313
  src="/assets/svg/eye-slash.svg"></i
@@ -334,7 +334,7 @@
334
334
  <a
335
335
  class="margin-right:5px"
336
336
  fullscreen
337
- fullscreen-target="#playground"></a>
337
+ fullscreen-selector="#playground"></a>
338
338
  </div>
339
339
  </div>
340
340
  <!-- End SandBox -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/organizations",
3
- "version": "1.15.18",
3
+ "version": "1.16.0",
4
4
  "description": "A simple organizations component in vanilla javascript. Easily configured using HTML5 attributes and/or JavaScript API.",
5
5
  "keywords": [
6
6
  "organizations",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "scripts": {
27
27
  "start": "npx webpack --config webpack.config.js",
28
- "build": "NODE_ENV=production npx webpack --config webpack.config.js",
28
+ "build": "npx webpack --mode=production --config webpack.config.js",
29
29
  "dev": "npx webpack --config webpack.config.js --watch",
30
30
  "postinstall": "node -e \"const { execSync } = require('child_process'); try { execSync('coc --version', { stdio: 'ignore' }); } catch (error) { try { execSync('npm install -g @cocreate/cli', { stdio: 'inherit' }); console.log('Installed \"@cocreate/cli\" globally.'); } catch (error) { console.error('Failed to install \"@cocreate/cli\" globally:', error); } }\""
31
31
  },
@@ -58,10 +58,8 @@
58
58
  "webpack-log": "^3.0.1"
59
59
  },
60
60
  "dependencies": {
61
- "@cocreate/actions": "^1.8.30",
62
- "@cocreate/cli": "^1.33.8",
63
- "@cocreate/crud-client": "^1.21.22",
64
- "@cocreate/form": "^1.14.28",
65
- "@cocreate/indexeddb": "^1.10.18"
61
+ "@cocreate/actions": "^1.8.32",
62
+ "@cocreate/crud-client": "^1.21.24",
63
+ "@cocreate/elements": "^1.17.33"
66
64
  }
67
65
  }
package/src/client.js CHANGED
@@ -1,60 +1,152 @@
1
- import crud from '@cocreate/crud-client';
2
- import indexeddb from '@cocreate/indexeddb';
3
- import action from '@cocreate/actions';
4
- import form from '@cocreate/form';
1
+ import Crud from '@cocreate/crud-client';
2
+ import Action from '@cocreate/actions';
3
+ import Elements from '@cocreate/elements';
5
4
 
6
- const CoCreateOrganization = {
7
5
 
8
- createOrganization: async function (btn) {
9
- let formEl = btn.closest("form");
10
- if (!formEl) return;
6
+ async function generateDB(organization = { object: {} }, user = { object: {} }) {
7
+ const organization_id = organization.object._id || Crud.ObjectId();
8
+ const defaultKey = organization.object.key || uuid.generate();
9
+ const user_id = user.object._id || Crud.ObjectId();
11
10
 
12
- let organization = form.getData(formEl, 'organizations')
13
- let user = form.getData(formEl, 'users')
11
+ let apiKey = await Crud.send({ method: 'create.object', database: organization_id, array: 'keys', organization_id })
12
+ if (apiKey && apiKey.object && apiKey.object[0])
13
+ return
14
14
 
15
- if (!organization || !organization.document)
16
- return
17
- if (!user || !user.document)
18
- return
15
+ try {
16
+ // Create organization
17
+ organization.method = 'create.object'
18
+ organization.storage = 'indexeddb'
19
+ organization.database = organization_id
20
+ organization.array = 'organizations'
21
+ organization.object._id = organization_id
22
+ organization.object.name = organization.object.name || 'untitiled'
23
+ organization.organization_id = organization_id
24
+ Crud.send(organization);
25
+
26
+ // Create user
27
+ user.method = 'create.object'
28
+ user.storage = 'indexeddb'
29
+ user.database = organization_id
30
+ user.array = 'users'
31
+ user.object._id = user_id
32
+ user.object.firstname = user.object.firstname || 'untitiled'
33
+ user.object.lastname = user.object.lastname || 'untitiled'
34
+ user.organization_id = organization_id
35
+ Crud.send(user);
19
36
 
20
- if (!organization.document._id && !user.document._id) {
21
- let documents = await indexeddb.generateDB(organization, user)
22
- if (!documents)
23
- return
37
+ // Create default key
38
+ let key = {
39
+ method: 'create.object',
40
+ storage: 'indexeddb',
41
+ database: organization_id,
42
+ array: 'keys',
43
+ object: {
44
+ _id: Crud.ObjectId(),
45
+ type: "key",
46
+ key: defaultKey,
47
+ actions: {
48
+ signIn: true,
49
+ signUp: true
50
+ },
51
+ default: true
52
+ },
53
+ organization_id
24
54
  }
55
+ Crud.send(key);
56
+
57
+ // Create role
58
+ let role_id = Crud.ObjectId();
59
+ let role = {
60
+ method: 'create.object',
61
+ storage: 'indexeddb',
62
+ database: organization_id,
63
+ array: 'keys',
64
+ object: {
65
+ _id: role_id,
66
+ type: "role",
67
+ name: "admin",
68
+ admin: "true"
69
+ },
70
+ organization_id
71
+ };
72
+ Crud.send(role);
25
73
 
26
- form.setDocumentId(formEl, organization)
27
- form.setDocumentId(formEl, user)
74
+ // Create user key
75
+ let userKey = {
76
+ method: 'create.object',
77
+ storage: 'indexeddb',
78
+ database: organization_id,
79
+ array: 'keys',
80
+ object: {
81
+ _id: Crud.ObjectId(),
82
+ type: "user",
83
+ key: user_id,
84
+ array: 'users', // could be any array
85
+ roles: [role_id],
86
+ email: user.object.email,
87
+ password: user.object.password || btoa('0000')
88
+ },
89
+ organization_id
90
+ };
91
+ Crud.send(userKey);
28
92
 
29
- organization = organization.document[0]
30
- user = user.document[0]
93
+ return { organization: organization.object, key: key.object, user: user.object, role: role.object, userKey: userKey.object }
31
94
 
32
- let organization_id = organization._id
95
+ } catch (error) {
96
+ return false
97
+ }
98
+ }
33
99
 
34
- if (crud.socket.organization !== true) {
35
- crud.socket.organization = true
36
- crud.socket.create({ organization_id })
37
- }
100
+ async function create(btn) {
101
+ let formEl = btn.closest("form");
102
+ if (!formEl) return;
38
103
 
39
- let response = await crud.socket.send('createOrganization', {
40
- organization,
41
- user,
42
- broadcastBrowser: false,
43
- organization_id
44
- });
104
+ let organization = Elements.getFormData(formEl, 'organizations')
105
+ let user = Elements.getFormData(formEl, 'users')
45
106
 
46
- document.dispatchEvent(new CustomEvent('createdOrganization', {
47
- detail: response
48
- }));
107
+ if (!organization || !organization.object)
108
+ return
109
+ if (!user || !user.object)
110
+ return
111
+
112
+ if (!organization.object._id && !user.object._id) {
113
+ let objects = await generateDB(organization, user)
114
+ if (!objects)
115
+ return
49
116
  }
50
- };
51
117
 
52
- action.init({
118
+ Elements.setTypeValue(formEl, organization)
119
+ Elements.setTypeValue(formEl, user)
120
+
121
+ organization = organization.object[0]
122
+ user = user.object[0]
123
+
124
+ let organization_id = organization._id
125
+
126
+ if (Crud.socket.organization !== true) {
127
+ Crud.socket.organization = true
128
+ Crud.socket.create({ organization_id })
129
+ }
130
+
131
+ let response = await Crud.socket.send({
132
+ method: 'createOrganization',
133
+ organization,
134
+ user,
135
+ broadcastBrowser: false,
136
+ organization_id
137
+ });
138
+
139
+ document.dispatchEvent(new CustomEvent('createdOrganization', {
140
+ detail: response
141
+ }));
142
+ }
143
+
144
+ Action.init({
53
145
  name: "createOrganization",
54
146
  endEvent: "createdOrganization",
55
- callback: (btn) => {
56
- CoCreateOrganization.createOrganization(btn);
147
+ callback: (action) => {
148
+ CoCreateOrganization.create(action.element);
57
149
  }
58
150
  });
59
151
 
60
- export default CoCreateOrganization;
152
+ export default { generateDB, create };
package/src/server.js CHANGED
@@ -41,34 +41,35 @@ class CoCreateOrganization {
41
41
  type: "user",
42
42
  key: user._id,
43
43
  roles: ['user'],
44
- email: user.document.email,
45
- password: user.document.password || btoa('0000'),
44
+ email: user.object.email,
45
+ password: user.object.password || btoa('0000'),
46
46
  user: {
47
- collection: 'users'
47
+ array: 'users'
48
48
  }
49
49
  }
50
50
 
51
51
  const Data = {}
52
+ Data.method = 'create.object'
52
53
  Data.database = process.env.organization_id
53
54
  Data.organization_id = process.env.organization_id
54
55
 
55
56
  if (organization) {
56
- const response = await this.crud.createDocument({ ...Data, collection: 'organizations', document: organization })
57
- this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
57
+ const response = await this.crud.send({ ...Data, method: 'create.object', array: 'organizations', object: organization })
58
+ this.wsManager.broadcast(this.platformSocket, response);
58
59
  }
59
60
  if (user) {
60
- const response = await this.crud.createDocument({ ...Data, collection: 'users', document: user })
61
- this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
61
+ const response = await this.crud.send({ ...Data, method: 'create.object', array: 'users', object: user })
62
+ this.wsManager.broadcast(this.platformSocket, response);
62
63
  }
63
64
 
64
65
  if (userKey) {
65
- const response = await this.crud.createDocument({ ...Data, collection: 'keys', document: userKey })
66
- this.wsManager.broadcast(this.platformSocket, 'createDocument', response);
66
+ const response = await this.crud.send({ ...Data, method: 'create.object', array: 'keys', object: userKey })
67
+ this.wsManager.broadcast(this.platformSocket, response);
67
68
  }
68
69
 
69
- this.wsManager.send(socket, 'createOrganization', data);
70
+ this.wsManager.send(socket, data);
70
71
  } catch (error) {
71
- console.log('createDocument error', error);
72
+ console.log('createObject error', error);
72
73
  }
73
74
  }
74
75
  }
package/webpack.config.js CHANGED
@@ -1,84 +1,90 @@
1
1
  const path = require("path")
2
2
  const TerserPlugin = require("terser-webpack-plugin")
3
3
  const MiniCssExtractPlugin = require("mini-css-extract-plugin")
4
- let isProduction = process.env.NODE_ENV === "production"
5
4
  const { CleanWebpackPlugin } = require("clean-webpack-plugin")
6
5
 
7
- module.exports = {
8
- entry: {
9
- "CoCreate-organizations": "./src/index.js",
10
- },
11
- output: {
12
- path: path.resolve(__dirname, "dist"),
13
- filename: isProduction ? "[name].min.js" : "[name].js",
14
- libraryTarget: "umd",
15
- libraryExport: "default",
16
- library: ["CoCreate", "organizations"],
17
- globalObject: "this",
18
- },
6
+ module.exports = (env, argv) => {
7
+ let isProduction = false
8
+ if (argv.mode === 'production')
9
+ isProduction = true
19
10
 
20
- plugins: [
21
- new CleanWebpackPlugin(),
22
- new MiniCssExtractPlugin({
23
- filename: "[name].css",
24
- }),
25
- ],
26
- // Default mode for Webpack is production.
27
- // Depending on mode Webpack will apply different things
28
- // on final bundle. For now we don't need production's JavaScript
29
- // minifying and other thing so let's set mode to development
30
- mode: isProduction ? "production" : "development",
31
- module: {
32
- rules: [
33
- {
34
- test: /.js$/,
35
- exclude: /(node_modules)/,
36
- use: {
37
- loader: "babel-loader",
38
- options: {
39
- plugins: ["@babel/plugin-transform-modules-commonjs"],
40
- },
11
+ const config = {
12
+ entry: {
13
+ "CoCreate-organizations": "./src/index.js",
41
14
  },
42
- },
43
- {
44
- test: /.css$/i,
45
- use: [
46
- { loader: "style-loader", options: { injectType: "linkTag" } },
47
- "file-loader",
15
+ output: {
16
+ path: path.resolve(__dirname, "dist"),
17
+ filename: isProduction ? "[name].min.js" : "[name].js",
18
+ libraryTarget: "umd",
19
+ libraryExport: "default",
20
+ library: ["CoCreate", "organizations"],
21
+ globalObject: "this",
22
+ },
23
+
24
+ plugins: [
25
+ new CleanWebpackPlugin(),
26
+ new MiniCssExtractPlugin({
27
+ filename: "[name].css",
28
+ }),
48
29
  ],
49
- },
50
- ],
51
- },
30
+ // Default mode for Webpack is production.
31
+ // Depending on mode Webpack will apply different things
32
+ // on final bundle. For now we don't need production's JavaScript
33
+ // minifying and other thing so let's set mode to development
34
+ mode: isProduction ? "production" : "development",
35
+ module: {
36
+ rules: [
37
+ {
38
+ test: /.js$/,
39
+ exclude: /(node_modules)/,
40
+ use: {
41
+ loader: "babel-loader",
42
+ options: {
43
+ plugins: ["@babel/plugin-transform-modules-commonjs"],
44
+ },
45
+ },
46
+ },
47
+ {
48
+ test: /.css$/i,
49
+ use: [
50
+ { loader: "style-loader", options: { injectType: "linkTag" } },
51
+ "file-loader",
52
+ ],
53
+ },
54
+ ],
55
+ },
52
56
 
53
- // add source map
54
- ...(isProduction ? {} : { devtool: "eval-source-map" }),
57
+ // add source map
58
+ ...(isProduction ? {} : { devtool: "eval-source-map" }),
55
59
 
56
- optimization: {
57
- minimize: true,
58
- minimizer: [
59
- new TerserPlugin({
60
- extractComments: true,
61
- // cache: true,
62
- parallel: true,
63
- // sourceMap: true, // Must be set to true if using source-maps in production
64
- terserOptions: {
65
- // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
66
- // extractComments: 'all',
67
- compress: {
68
- drop_console: true,
69
- },
70
- },
71
- }),
72
- ],
73
- splitChunks: {
74
- chunks: "all",
75
- minSize: 200,
76
- // maxSize: 99999,
77
- //minChunks: 1,
60
+ optimization: {
61
+ minimize: true,
62
+ minimizer: [
63
+ new TerserPlugin({
64
+ extractComments: true,
65
+ // cache: true,
66
+ parallel: true,
67
+ // sourceMap: true, // Must be set to true if using source-maps in production
68
+ terserOptions: {
69
+ // https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions
70
+ // extractComments: 'all',
71
+ compress: {
72
+ drop_console: true,
73
+ },
74
+ },
75
+ }),
76
+ ],
77
+ splitChunks: {
78
+ chunks: "all",
79
+ minSize: 200,
80
+ // maxSize: 99999,
81
+ //minChunks: 1,
78
82
 
79
- cacheGroups: {
80
- defaultVendors: false,
81
- },
82
- },
83
- },
84
- }
83
+ cacheGroups: {
84
+ defaultVendors: false,
85
+ },
86
+ },
87
+ },
88
+ }
89
+ return config
90
+ }